repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
rchl/core | tests/components/omnilogic/test_config_flow.py | <reponame>rchl/core
"""Test the Omnilogic config flow."""
from omnilogic import LoginException, OmniLogicException
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.omnilogic.const import DOMAIN
from tests.async_mock import patch
from tests.common import MockConfigEntry
D... |
rchl/core | homeassistant/components/homekit_controller/sensor.py | <gh_stars>1-10
"""Support for Homekit sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANC... |
rchl/core | homeassistant/components/motion_blinds/__init__.py | """The motion_blinds component."""
from asyncio import TimeoutError as AsyncioTimeoutError
from datetime import timedelta
import logging
from socket import timeout
from homeassistant import config_entries, core
from homeassistant.const import CONF_API_KEY, CONF_HOST
from homeassistant.exceptions import ConfigEntryNotR... |
rchl/core | tests/components/risco/test_binary_sensor.py | """Tests for the Risco binary sensors."""
from homeassistant.components.risco import CannotConnectError, UnauthorizedError
from homeassistant.components.risco.const import DOMAIN
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.entity_component import async_update_entity
from .util import... |
rchl/core | homeassistant/helpers/selector.py | <reponame>rchl/core
"""Selectors for Home Assistant."""
from typing import Any, Callable, Dict, cast
import voluptuous as vol
from homeassistant.const import CONF_MODE, CONF_UNIT_OF_MEASUREMENT
from homeassistant.util import decorator
SELECTORS = decorator.Registry()
def validate_selector(config: Any) -> Dict:
... |
rchl/core | homeassistant/helpers/placeholder.py | """Placeholder helpers."""
from typing import Any, Dict, Set
from homeassistant.util.yaml import Placeholder
class UndefinedSubstitution(Exception):
"""Error raised when we find a substitution that is not defined."""
def __init__(self, placeholder: str) -> None:
"""Initialize the undefined substitut... |
rchl/core | tests/components/pilight/test_init.py | """The tests for the pilight component."""
from datetime import timedelta
import logging
import socket
from voluptuous import MultipleInvalid
from homeassistant.components import pilight
from homeassistant.setup import async_setup_component
from homeassistant.util import dt as dt_util
from tests.async_mock import pa... |
rchl/core | tests/components/griddy/test_config_flow.py | <reponame>rchl/core
"""Test the Griddy Power config flow."""
import asyncio
from homeassistant import config_entries, setup
from homeassistant.components.griddy.const import DOMAIN
from tests.async_mock import MagicMock, patch
async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_co... |
rchl/core | homeassistant/components/motion_blinds/const.py | <reponame>rchl/core
"""Constants for the Motion Blinds component."""
DOMAIN = "motion_blinds"
MANUFACTURER = "Motion, Coulisse B.V."
KEY_GATEWAY = "gateway"
KEY_COORDINATOR = "coordinator"
|
rchl/core | homeassistant/components/devolo_home_control/config_flow.py | """Config flow to configure the devolo home control integration."""
import logging
from devolo_home_control_api.mydevolo import Mydevolo
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from .const i... |
rchl/core | tests/components/asuswrt/test_sensor.py | <filename>tests/components/asuswrt/test_sensor.py
"""The tests for the AsusWrt sensor platform."""
from aioasuswrt.asuswrt import Device
from homeassistant.components import sensor
from homeassistant.components.asuswrt import (
CONF_DNSMASQ,
CONF_INTERFACE,
CONF_MODE,
CONF_PORT,
CONF_PROTOCOL,
... |
rchl/core | tests/components/ozw/test_config_flow.py | <gh_stars>1-10
"""Test the Z-Wave over MQTT config flow."""
import pytest
from homeassistant import config_entries, setup
from homeassistant.components.hassio.handler import HassioAPIError
from homeassistant.components.ozw.config_flow import TITLE
from homeassistant.components.ozw.const import DOMAIN
from tests.async... |
rchl/core | homeassistant/components/recollect_waste/const.py | <gh_stars>1-10
"""Define Recollect Waste constants."""
import logging
DOMAIN = "recollect_waste"
LOGGER = logging.getLogger(__package__)
CONF_PLACE_ID = "place_id"
CONF_SERVICE_ID = "service_id"
DATA_COORDINATOR = "coordinator"
|
rchl/core | tests/components/onewire/test_binary_sensor.py | """Tests for 1-Wire devices connected on OWServer."""
import copy
from pyownet.protocol import Error as ProtocolError
import pytest
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.onewire.binary_sensor import DEVICE_BINARY_SENSORS
from homeassistant.cons... |
rchl/core | tests/components/metoffice/test_config_flow.py | """Test the National Weather Service (NWS) config flow."""
import json
from homeassistant import config_entries, setup
from homeassistant.components.metoffice.const import DOMAIN
from .const import (
METOFFICE_CONFIG_WAVERTREE,
TEST_API_KEY,
TEST_LATITUDE_WAVERTREE,
TEST_LONGITUDE_WAVERTREE,
TEST_... |
rchl/core | homeassistant/components/homekit_controller/climate.py | """Support for Homekit climate devices."""
import logging
from aiohomekit.model.characteristics import (
ActivationStateValues,
CharacteristicsTypes,
CurrentHeaterCoolerStateValues,
HeatingCoolingCurrentValues,
HeatingCoolingTargetValues,
SwingModeValues,
TargetHeaterCoolerStateValues,
)
fr... |
rchl/core | tests/components/color_extractor/test_service.py | <gh_stars>1-10
"""Tests for color_extractor component service calls."""
import base64
import io
import aiohttp
import pytest
from voluptuous.error import MultipleInvalid
from homeassistant.components.color_extractor import (
ATTR_PATH,
ATTR_URL,
DOMAIN,
SERVICE_TURN_ON,
)
from homeassistant.components... |
rchl/core | tests/components/cloud/test_tts.py | """Tests for cloud tts."""
from homeassistant.components.cloud import tts
def test_schema():
"""Test schema."""
assert "nl-NL" in tts.SUPPORT_LANGUAGES
processed = tts.PLATFORM_SCHEMA({"platform": "cloud", "language": "nl-NL"})
assert processed["gender"] == "female"
# Should not raise
proces... |
rchl/core | homeassistant/components/tile/__init__.py | <reponame>rchl/core
"""The Tile component."""
import asyncio
from datetime import timedelta
from pytile import async_login
from pytile.errors import SessionExpiredError, TileError
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.... |
dreoporto/xandly5 | xandly5/ai_ml_model/catalog.py | <gh_stars>1-10
import numpy as np
import csv
from typing import List, Optional
from tensorflow import keras
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
class Catalog:
"""
represents a catalog (aka corpus) of works, used in both ... |
dreoporto/xandly5 | xandly5/web/lyrics_api.py | <reponame>dreoporto/xandly5
from flask import Flask, request, make_response, jsonify, render_template
from flask_marshmallow import Marshmallow, fields
from marshmallow import post_load
from flask_restful import Resource, Api
from xandly5.service.lyrics_generator import LyricsGenerator
from xandly5.types.lyrics_model_... |
dreoporto/xandly5 | xandly5/service/tests/test_lyrics_generator_structured.py | <filename>xandly5/service/tests/test_lyrics_generator_structured.py
import hashlib
import re
import unittest
from typing import List
from ptmlib.time import Stopwatch
from xandly5.service.lyrics_generator import LyricsGenerator
from xandly5.types.lyrics_model_enum import LyricsModelEnum
from xandly5.types.lyrics_sect... |
dreoporto/xandly5 | xandly5/ai_ml_model/poe_poem_model.py | <filename>xandly5/ai_ml_model/poe_poem_model.py
import lyrics_model as lm
def main():
lm.tensorflow_diagnostics()
lyrics_model = lm.LyricsModel('poe_poem_config.json')
lyrics_model.generate_model()
if __name__ == '__main__':
main()
|
dreoporto/xandly5 | xandly5/types/lyrics_model_meta.py | <reponame>dreoporto/xandly5
from typing import Optional
from tensorflow import keras
from xandly5.ai_ml_model.catalog import Catalog
class LyricsModelMeta:
"""
stores the model and related data:
- model_file - h5 model file name
- lyrics_file - lyrics text file name
- model - keras/t... |
dreoporto/xandly5 | xandly5/ai_ml_model/lyrics_model.py | <filename>xandly5/ai_ml_model/lyrics_model.py<gh_stars>1-10
import json
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
from ptmlib.time import Stopwatch
from ptmlib import charts as pch
from catalog import Catalog
from lyrics_formatter import LyricsFormatter
... |
dreoporto/xandly5 | xandly5/service/lyrics_generator.py | import json
import os
import re
from typing import Dict, List
from tensorflow import keras
from xandly5.ai_ml_model.catalog import Catalog
from xandly5.ai_ml_model.lyrics_formatter import LyricsFormatter
from xandly5.types.lyrics_model_enum import LyricsModelEnum
from xandly5.types.lyrics_model_meta import LyricsMode... |
dreoporto/xandly5 | xandly5/types/lyrics_section.py | <filename>xandly5/types/lyrics_section.py
from typing import Optional
import uuid
from xandly5.types.section_type_enum import SectionTypeEnum
class LyricsSection:
def __init__(self, section_type: SectionTypeEnum, word_count: int, word_group_count: int, seed_text: str,
section_id: Optional[str] ... |
dreoporto/xandly5 | xandly5/ai_ml_model/lyrics_files/sonnet_to_data.py |
"""
CONVERTS RAW TEXT OF SHAKESPEARE'S SONNETS TO A TAB-SEPARATED DATA FILE
ALSO GENERATES A FILE WITH LYRICS ONLY, FOR NLP USAGE
TEXT SONNET NUMBER LINE
From fairest creatures we desire increase, 1 1
That thereby beauty's rose might never die, 1 2
"""
import re
import string
def convert_text_to_data():
sonne... |
dreoporto/xandly5 | xandly5/ai_ml_model/lyrics_formatter.py |
class LyricsFormatter:
@staticmethod
def format_lyrics(lyric_text: str, word_group_count: int = 4):
"""
format lyrics into a more human-readable layout
:param lyric_text: text to be formatted
:param word_group_count: number of words to group by for formatting
:return:... |
dreoporto/xandly5 | xandly5/types/lyrics_model_enum.py | <reponame>dreoporto/xandly5
from enum import IntEnum
class LyricsModelEnum(IntEnum):
SONNETS = 1
POE_POEM = 2
|
dreoporto/xandly5 | xandly5/ai_ml_model/shakespeare_sonnet_model.py | <filename>xandly5/ai_ml_model/shakespeare_sonnet_model.py<gh_stars>1-10
import lyrics_model as lm
from tensorflow import keras
class ShakespeareSonnetModel(lm.LyricsModel):
def __init__(self, config_file: str):
super().__init__(config_file)
def _get_compiled_model(self) -> keras.Sequential:
... |
dreoporto/xandly5 | xandly5/types/section_type_enum.py | <reponame>dreoporto/xandly5<filename>xandly5/types/section_type_enum.py
from enum import IntEnum
class SectionTypeEnum(IntEnum):
VERSE = 1
CHORUS = 2
BRIDGE = 3
INTRO = 4
PRE_CHORUS = 5
OUTRO = 6
|
dreoporto/xandly5 | xandly5/service/tests/test_lyrics_generator.py | <filename>xandly5/service/tests/test_lyrics_generator.py<gh_stars>1-10
import hashlib
import random
import string
import unittest
from ptmlib.time import Stopwatch
from xandly5.service.lyrics_generator import LyricsGenerator
from xandly5.types.lyrics_model_enum import LyricsModelEnum
from xandly5.types.validation_err... |
Azzy001/Login-Register_Tk | source/menu.py | from tkinter import *
window = Tk()
def open_menu_window():
pass
# Window configs
window.title("Azzy001 : Menu Window")
window.geometry("440x520")
window.resizable(0, 0)
window.attributes("-topmost", True)
window.mainloop() |
Azzy001/Login-Register_Tk | source/register.py | <filename>source/register.py
from tkinter import *
import sqlite3
from tkinter import messagebox
import random
window = Tk()
# connecting to sqlite3
connection = sqlite3.connect("login_register_system/registered_users_db")
c = connection.cursor()
# creating table "users" if it does not exist in user_db
c.exe... |
Azzy001/Login-Register_Tk | source/login.py | from tkinter import *
import sqlite3
from tkinter import messagebox
window = Tk()
connection = sqlite3.connect("login_register_system/registered_users_db")
c = connection.cursor()
def open_login_window():
'''This function will allow the user to return to this window from another window'''
pass
... |
Azzy001/Login-Register_Tk | source/main.py | from tkinter import *
window = Tk()
def open_registration():
window.destroy()
from register import open_registration_window
def open_login():
window.destroy()
from login import open_login_window
def return_to_main():
'''This function will allow the user to return to this w... |
plus2047/disentangling-factors-of-variation-using-adversarial-training | networks.py | <reponame>plus2047/disentangling-factors-of-variation-using-adversarial-training
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class Encoder(nn.Module):
def __init__(self, style_dim, class_dim):
super(Encoder, self).__init__()
self.conv_mod... |
plus2047/disentangling-factors-of-variation-using-adversarial-training | data_loader.py | import random
from utils import transform_config
from torchvision import datasets
from torch.utils.data import Dataset
class MNIST_Paired(Dataset):
def __init__(self, root='mnist', download=True, train=True, transform=transform_config):
self.mnist = datasets.MNIST(root=root, download=download, train=trai... |
plus2047/disentangling-factors-of-variation-using-adversarial-training | training.py | import os
import numpy as np
from itertools import cycle
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets
from torch.autograd import Variable
from tensorboardX import SummaryWriter
from utils import weights_init
import matplotlib.pyplot as plt
from data_loader import MNI... |
jumper385/TimeChart | docs/graph_first_paint.py | # start, prepare data, data ready, finish, FMP
FP_DATA = {
'Chart.JS': [
[32.4, 45.1, 297.6, 1042.4, 1054.8],
[33.6, 43.4, 285.1, 1041.6, 1064.5],
[30.9, 40.9, 292.7, 1036.2, 1056.8],
],
'TimeChart': [
[29.9, 57.2, 255.2, 288.3, 853.2],
[36.2, 43.9, 236.9, 271.5, 837.... |
jumper385/TimeChart | docs/pp.py | <filename>docs/pp.py
import sys
while True:
out = []
for idx, line in enumerate(sys.stdin):
if idx % 4 == 0:
out.append(line[:-4])
if idx == 15:
break
print(f'[{", ".join(out)}, ],')
|
ronaldaraujo/anelim | old/main.py | import sys
import logging
import locale
import json
import random
import string
import faker
import argparse
import psycopg2
import pymssql
from random import randint
from cStringIO import StringIO
from time import gmtime, strftime
from os import system
from datetime import datetime
class StringBuilder(object):
_... |
AlanSean/UnityGame3D | Assets/WX-WASM-SDK/Editor/Brotli.py | <gh_stars>100-1000
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import os
import sys
import brotli
def main():
global quiet
prettier = False
print("Start!")
# Brotli
with open(sys.argv[1], 'rb') as codeBin:
codeBr = brotli.compress(codeBin.read())
fout = open(sys.argv[2], "wb")
... |
crossbario/idma-examples | gettingstarted/python/ex4/buyer.py | # coding=utf8
# connect to WAMP router, join a XBR realm (with WAMP-cryptosign authentication), and
# subscribe to (XBR encrypted) events buying data encryption keys
import sys
import pyqrcode
import argparse
import binascii
from uuid import UUID
from pprint import pformat
import eth_keys
import web3
import txaio
t... |
crossbario/idma-examples | gettingstarted/python/ex2/producer.py | # coding=utf8
# connect to WAMP router, join a realm (no authentication), publish (non-XBR, plain WAMP) events to topic
# and register a procedure (non-XBR, plain WAMP)
|
crossbario/idma-examples | gettingstarted/python/ex3/connect.py | <reponame>crossbario/idma-examples<filename>gettingstarted/python/ex3/connect.py
# coding=utf8
# connect to WAMP router, join a XBR realm (with WAMP-cryptosign authentication), print session details and
# get (if any) active buyer/seller channels and exit
import sys
import pyqrcode
import argparse
import binascii
fr... |
crossbario/idma-examples | gettingstarted/python/ex2/consumer.py | # coding=utf8
# connect to WAMP router, join a realm (no authentication), subscribe to (non-XBR, plain WAMP) events
# published in producer, call a procedure (non-XBR, plain WAMP) registered in producer
|
crossbario/idma-examples | gettingstarted/python/ex3/__init__.py | <filename>gettingstarted/python/ex3/__init__.py
# module marker
|
crossbario/idma-examples | gettingstarted/python/ex5/seller.py | # coding=utf8
# connect to WAMP router, join a XBR realm (with WAMP-cryptosign authentication) and
# register a procedure (XBR encrypted) selling data encryption keys
|
crossbario/idma-examples | gettingstarted/python/ex5/buyer.py | <filename>gettingstarted/python/ex5/buyer.py
# coding=utf8
# connect to WAMP router, join a XBR realm (with WAMP-cryptosign authentication), and
# call a procedure (XBR encrypted) registered in producer buying data encryption keys
|
crossbario/idma-examples | gettingstarted/python/ex1/connect.py | # coding=utf8
# connect to WAMP router, join a realm (no authentication), print session details and exit
|
crossbario/idma-examples | gettingstarted/python/_work/seller.py | <reponame>crossbario/idma-examples
# coding=utf8
import txaio
txaio.use_twisted()
from txaio import time_ns, make_logger
import argparse
import treq
import sys
import binascii
import argparse
import eth_keys
import web3
import uuid
import txaio
txaio.use_twisted()
from twisted.internet import reactor
from twiste... |
crossbario/idma-examples | gettingstarted/python/ex4/seller.py | # coding=utf8
# connect to WAMP router, join a XBR realm (with WAMP-cryptosign authentication), and publish (XBR encrypted) events
# to a topic selling data encryption keys
import sys
import pyqrcode
import argparse
import binascii
import uuid
import eth_keys
import web3
import txaio
txaio.use_twisted()
from twist... |
STAC-IITMandi/Gravis3D | gravis3d/generator.py | <reponame>STAC-IITMandi/Gravis3D
from body import Body
from numpy.random import normal
from vpython import *
class Nbodies:
"""
A class to implement all bodies.
"""
def __init__(self, N = None):
self.N = N or 10
x,y,z = normal(0,1e11,N), normal(0,1e11,N), normal(0,1e11,N)
vx,vy,... |
STAC-IITMandi/Gravis3D | gravis3d/body.py | from vpython import color,vector, mag2, mag, sphere
from numpy import pi
from constants import G,k,dt
class Body():
'''
A class representing all the bodies
in the simulation.
'''
def __init__(self, radius = None, pos = None, velocity = None, colour = None,density = None):
self.radius = radi... |
STAC-IITMandi/Gravis3D | gravis3d/__init__.py | <filename>gravis3d/__init__.py
from body import *
from generator import *
from play import *
from constants import * |
STAC-IITMandi/Gravis3D | gravis3d/constants.py | <gh_stars>1-10
G = 6.674*1e-11 #gravitational constant
dt = 0.01 #for human eyes to percieve motion
k = 10e-22 #for reducing force
R = 1000 #Rate
no_of_bodies = 10 #your total bodies
wait = 7 #wait time to start motion
|
datopian/assembler | datapackage_pipelines_assembler/processors/sample.py | <filename>datapackage_pipelines_assembler/processors/sample.py<gh_stars>1-10
import logging
from datapackage_pipelines.utilities.extended_json import LazyJsonLine
from datapackage_pipelines.utilities.extended_json import json
from datapackage_pipelines.wrapper import spew, ingest
parameters, datapackage, res_iter = ... |
datopian/assembler | datapackage_pipelines_assembler/processors/validate_resource.py | <filename>datapackage_pipelines_assembler/processors/validate_resource.py
import hashlib
import json
from datapackage import Package
from goodtables import validate
from datapackage_pipelines.wrapper import spew, ingest
from datapackage_pipelines.utilities.resources import PROP_STREAMED_FROM
parameters, datapackage, ... |
datopian/assembler | datapackage_pipelines_assembler/processors/remove_hash.py | <reponame>datopian/assembler
from os import path
from datapackage_pipelines.wrapper import process
def modify_datapackage(dp, parameters, stats):
for resource in dp['resources']:
fpath = resource['path']
dir_name = path.dirname(fpath)
file_name = path.basename(fpath)
head, tail = ... |
datopian/assembler | tests/test_flow.py | import json
import jwt
import os
import requests
import time
import unittest
import yaml
from urllib.parse import urljoin
import boto3
from elasticsearch import Elasticsearch
ES_SERVER = os.environ['DPP_ELASTICSEARCH'] = 'http://localhost:9200'
ES_SERVER = os.environ['EVENTS_ELASTICSEARCH_HOST'] = 'http://localhost:9... |
datopian/assembler | datapackage_pipelines_assembler/processors/update_resource.py | from datapackage_pipelines.wrapper import process
def modify_datapackage(dp, parameters, stats):
for resource in dp['resources']:
if resource['name'] == parameters['name']:
resource.update(parameters['update'])
return dp
process(modify_datapackage=modify_datapackage)
|
datopian/assembler | datapackage_pipelines_assembler/processors/extract_readme.py | from tempfile import mkdtemp
from os import path
from datapackage_pipelines.wrapper import spew, ingest
from datapackage_pipelines.utilities.resources import PROP_STREAMED_FROM
parameters, datapackage, res_iter = ingest()
readme_name = path.join(mkdtemp(), 'README.md')
def exctract_readme(datapackage_):
readme ... |
datopian/assembler | datapackage_pipelines_assembler/processors/load_private_resource.py |
import os
from datapackage_pipelines.wrapper import get_dependency_datapackage_url
from datapackage_pipelines.lib.load_resource import ResourceLoader
from planner.utilities import s3_path
PKGSTORE_BUCKET = os.environ.get('PKGSTORE_BUCKET')
class PrivateResourceLoader(ResourceLoader):
def __init__(self):
... |
datopian/assembler | datapackage_pipelines_assembler/processors/dump_to_s3.py | <filename>datapackage_pipelines_assembler/processors/dump_to_s3.py
import datetime
import os
import filemanager
from datapackage_pipelines_aws.s3_dumper import S3Dumper
class MyS3Dumper(S3Dumper):
def __init__(self):
super(MyS3Dumper, self).__init__()
self.fm = filemanager.FileManager(os.enviro... |
datopian/assembler | datapackage_pipelines_assembler/processors/load_modified_resources.py | import os
import copy
import datapackage
import itertools
import logging
from datapackage import Resource # noqa
from datapackage_pipelines.utilities.resources import PROP_STREAMED_FROM
from datapackage_pipelines.utilities.resources import PROP_STREAMING
from datapackage_pipelines.wrapper import process, get_depende... |
datopian/assembler | datapackage_pipelines_assembler/generator.py | from flowmanager.models import FlowRegistry
import os
import json
from datapackage_pipelines.generators import GeneratorBase
import logging
log = logging.getLogger(__name__)
ROOT_PATH = os.path.join(os.path.dirname(__file__), '..')
SCHEMA_FILE = os.path.join(
os.path.dirname(__file__), 'schemas/assembler_spec_... |
diogosm/wosfile | tests/test_read.py | import os
import pytest
import sys
from io import StringIO
from wosfile.read import (
PlainTextReader,
ReadError,
TabDelimitedReader,
get_reader,
read,
)
preamble_b = b"""FN Thomson Reuters Web of Science
VR 1.0
"""
preamble_s = preamble_b.decode("utf-8")
def assert_no_bom(record):
# very ba... |
diogosm/wosfile | tests/test_record.py | <reponame>diogosm/wosfile<gh_stars>0
import tempfile
import pytest
from wosfile.record import Record, parse_address_field, records_from
class TestRecord:
data = {
"PT": "J",
"AU": "<NAME>; <NAME>",
"TI": "Title here",
"DE": "desc1; desc2; desc3",
"PY": "2016",
"J... |
diogosm/wosfile | wosfile/read.py | import codecs
import logging
import pathlib
import sys
from csv import DictReader
from typing import (
AnyStr,
BinaryIO,
Dict,
IO,
Iterable,
Iterator,
List,
Optional,
TextIO,
Type,
Union,
)
from .tags import has_item_per_line
logger = logging.getLogger(__name__)
__all__ = ... |
diogosm/wosfile | main.py | <reponame>diogosm/wosfile<gh_stars>0
import csv
import glob
import wosfile
from collections import Counter, defaultdict
from tinydb import TinyDB, Query, where
from geopy.geocoders import Nominatim
import pycountry
from more_itertools import locate
import folium
from folium.plugins import MarkerCluster
import plotly.gr... |
JedersonLuz/Codenation_AceleraDev_DataScience | module_3/df_test.py | import pandas as pd
import altair as alt
import streamlit as st
@st.cache
def get_UN_data():
AWS_BUCKET_URL = "https://streamlit-demo-data.s3-us-west-2.amazonaws.com"
df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz")
return df.set_index("Region")
try:
df = get_UN_data()
except urllib.error... |
spacetx/starfish-workflows | aws/tutorial-template-files/recipe.py | from starfish import Codebook, DecodedIntensityTable, FieldOfView
def process_fov(fov: FieldOfView, codebook: Codebook) -> DecodedIntensityTable:
"""Process a single field of view of ISS data
Parameters
----------
fov : FieldOfView
the field of view to process
codebook : Codebook
t... |
spacetx/starfish-workflows | aws/tutorial-template-files/starfish-workflow.py | <filename>aws/tutorial-template-files/starfish-workflow.py
import argparse
import boto3
session = boto3.Session(profile_name='spacetx-admin')
batch = session.client('batch')
# batch = boto3.client('batch')
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-... |
spacetx/starfish-workflows | aws/merge-results-job-docker-files/merge_tables.py | <gh_stars>1-10
import os, fnmatch
from starfish import IntensityTable
filenames = []
listOfFiles = os.listdir('.')
pattern = "*.nc"
for entry in listOfFiles:
if fnmatch.fnmatch(entry, pattern):
filenames.append(entry)
# load files into memory and concat them
decoded_intensity_tables = map(IntensityTab... |
movingpictures83/CSV2TSV | CSV2TSVPlugin.py | <reponame>movingpictures83/CSV2TSV<filename>CSV2TSVPlugin.py
import csv
class CSV2TSVPlugin:
def input(self, filename):
self.myfile = filename
def run(self):
self.input_csvfile = csv.reader(open(self.myfile, 'r'))
def output(self, filename):
out_tabfile = csv.writer(open(filename, 'w'), delimiter = "\t")
... |
gabrieldsumabat/shouter | Shouter/app/email.py | <gh_stars>0
from threading import Thread
from flask import render_template
from flask_mail import Message
from app import app, mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subj... |
gabrieldsumabat/shouter | Shouter/Test/send.py | <filename>Shouter/Test/send.py
from flask import Flask
from flask_mail import Mail, Message
import os
app = Flask(__name__)
mail_settings = {
"MAIL_SERVER": 'smtp.gmail.com',
"MAIL_PORT": int(465),
"MAIL_USE_TLS": False,
"MAIL_USE_SSL": True,
"MAIL_USERNAME": '<EMAIL>' ,
"MAIL_PA... |
alpmarangoz/Various | CompareETFs/main.py | <reponame>alpmarangoz/Various
# Main program to download ETF data from Yahoo Finance and post process
# Data is downloaded from yahoo finance manually (There is no stable API unfortunately)
import glob, os
import pandas as pd
#plt.use('Agg')
from datetime import datetime
import seaborn as sns
import re
sns.set()
so... |
KouChongYang/binance-trader | trader.py | <reponame>KouChongYang/binance-trader
# -*- coding: UTF-8 -*-
# @yasinkuyu
import sys
import time
import config
from BinanceAPI import *
# trader.py --quantity -- symbol --profit --wait_time
# ex: trader.py 1 IOTABTC 1.3 1
#int(sys.argv[0]) #quantity
#sys.argv[1] #symbol
#sys.argv[2] #percentage of profit
#sys.argv... |
KouChongYang/binance-trader | balance.py | # -*- coding: UTF-8 -*-
# @yasinkuyu
from BinanceAPI import *
import config
class Binance:
def __init__(self):
self.client = BinanceAPI(config.api_key, config.api_secret)
def balances(self):
balances = self.client.get_account()
for balance in balances['balances'] :
... |
ghnreigns/pycm | pycm/pycm_handler.py | # -*- coding: utf-8 -*-
"""ConfusionMatrix handlers."""
from __future__ import division
from .pycm_class_func import class_statistics
from .pycm_error import pycmVectorError, pycmMatrixError
from .pycm_overall_func import overall_statistics
from .pycm_util import *
from .pycm_param import *
import json
import types
imp... |
gghatano/PPMTF-1 | python/MakeSGLPMInput_PF.py | #!/usr/bin/env python3
import numpy as np
import csv
import os
################################# Parameters ##################################
# Input directory
InputDir = "../data/PF/"
# Output directory
OutputDir = "../data/PF/SGLT_TK/"
# Training trace file (input)
TrainTraceFile = InputDir + "traintraces_TK.csv"
... |
gghatano/PPMTF-1 | python/MakeTrainTestData_PF.py | #!/usr/bin/env python3
import math
import numpy as np
import csv
import sys
################################# Parameters ##################################
#sys.argv = ["MakeTrainTestData_PF.py", "TK"]
if len(sys.argv) < 2:
print("Usage:",sys.argv[0],"[City]")
sys.exit(0)
# City
City = sys.argv[1]
# POI fil... |
stemaj/plugin.audio.lkgdrehnow | tests/maintest.py | <reponame>stemaj/plugin.audio.lkgdrehnow
import unittest
from resources.lib import read
from resources.lib import main
class Test_ParseFiles(unittest.TestCase):
def test_file000(self):
a = read.load_file('000')
b = main.getAllFilms(a)
self.assertEqual(23, len(b))
c = main.getAllThe... |
stemaj/plugin.audio.lkgdrehnow | resources/lib/plugin.py | # -*- coding: utf-8 -*-
import routing
import logging
import xbmcaddon
from resources.lib import kodiutils
from resources.lib import kodilogging
from resources.lib import read
from resources.lib import main
from xbmcgui import ListItem
from xbmcplugin import addDirectoryItem, endOfDirectory
ADDON = xbmc... |
stemaj/plugin.audio.lkgdrehnow | resources/lib/main.py | <filename>resources/lib/main.py
import re
def getAllFilms(bytes):
return re.compile("uploads(.+).mp3\"").findall(bytes.decode('utf-8'))
def getAllThema(bytes):
return re.compile("-title\">(.+)</h3>").findall(bytes.decode('utf-8'))
def getAllMp3(bytes):
return re.compile("audio/mpeg\" src=\"(.+)\... |
mugisha-thierry/pitch-app | tests/test_pitch.py | <gh_stars>0
import unittest
from app.models import Pitch,User
from app import db
class UserModelTest(unittest.TestCase):
def setUp(self):
self.user_thierry = User(username = 'thierry',email = '<EMAIL>',secure_password = '<PASSWORD>',bio= 'am a student', profile_pic_path='https://image.tmdb.org/t/p/w500/jd... |
mugisha-thierry/pitch-app | app/requests.py | <reponame>mugisha-thierry/pitch-app
import urllib.request,json
# from .models import News,Article
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
article_url = None
def configure_request(app):
# global api_key,base_url,article_url
# api_key = app.config['NEWS_API_KEY']
# base... |
mugisha-thierry/pitch-app | app/main/forms.py | <filename>app/main/forms.py
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, TextAreaField, SubmitField
from wtforms.validators import Required
class UpdateProfile(FlaskForm):
bio = TextAreaField('Tell us about you.',validators = [Required()])
submit = SubmitField('Submit')
clas... |
mugisha-thierry/pitch-app | migrations/versions/b8c4caa221cf_initial_migration.py | <filename>migrations/versions/b8c4caa221cf_initial_migration.py
"""Initial Migration
Revision ID: b8c4caa221cf
Revises: <PASSWORD>
Create Date: 2020-12-05 19:27:35.596147
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b8c4caa221cf'
down_revision = '<PASSWORD>... |
nghoanglong/Seq2seq-Baseline-TextToSQL | config_builder.py | <reponame>nghoanglong/Seq2seq-Baseline-TextToSQL<filename>config_builder.py
"""
Script to simplify running experiments. Given a simplified
specification file, generates the train.yml, infer.yml, and
infer_train.yml files with the detailed specifications. These files
will incorporate default values for rarely changed se... |
nghoanglong/Seq2seq-Baseline-TextToSQL | data/pre_process/utils.py | from nltk import word_tokenize
import json
import re
import logging
infiles_data_final = {'train': '../datasets/data_final/train.json',
'dev':'../datasets/data_final/dev.json',
'schema': '../datasets/tables.json',
'test': '../datasets/data_final/test.json'
}
# infile... |
ZekeMedley/joy-divisions-cover-generation | noise_gen.py | import numpy as np
from params import params
def add_noise(amps, mean):
'''
adds noise and connecting lines to data
IN: data, mean of data
OUT: data combined with connecting lines and noise
'''
noise_len = len(amps)//params['noise_frac']
start = amps[0]
end = amps[-1]
start_slope ... |
ZekeMedley/joy-divisions-cover-generation | waveform.py | from scipy.io import wavfile
import numpy as np
from PIL import Image, ImageDraw
from noise_gen import add_noise
from params import params
from images_to_video import images_to_video, add_audio
import time
start_time = time.time()
def get_amplitudes(file):
'''
gets audio data from file
IN: filename
... |
ZekeMedley/joy-divisions-cover-generation | images_to_video.py | # take filenames and output filename
def images_to_video(filenames, output, fps):
'''
builds a video from a list of images
IN: list of filenames for images, where to output, , frames per second
OUT: filename for output video
'''
from cv2 import VideoWriter, VideoWriter_fourcc, imread, destroyAll... |
ZekeMedley/joy-divisions-cover-generation | params.py | <reponame>ZekeMedley/joy-divisions-cover-generation<gh_stars>1-10
params = {
# file to load wav from
'file': 'C:/Users/qweis/Documents/GitHub/unknown-pleasures/wavs/famous.wav',
# output file for images
'save_loc': 'covers/frame.png',
# save location for video
'vid_save': 'time_test.mp4',
# ... |
ksu-is/Password-Strength-Tester | Password-Strength-Tester.py | <gh_stars>0
#My main file for code
from flask import Flask, render_template, request
app=Flask(__name__)
@app.route('/greet', methods=['POST'])
def greet():
inputName = request.form['myName']
#split password given into list, separated by commas, and set var for password score
inputName.split(",... |
ksu-is/Password-Strength-Tester | PasswordStrengthTesterMainOLD.py | #My main file for code
from flask import Flask, render_template, request app=Flask(__name__)
@app.route('/greet',methods=['POST'])
@app.route('/')
def home():
return render_template("home.html",myName="")
@app.route('/about/')
def about():
return render_template("about.html")
if __name__=="__main__":
app.ru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.