repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
gregzajac/MyRent | MyRent/migrations/0004_tenant_user.py | <filename>MyRent/migrations/0004_tenant_user.py
# Generated by Django 3.0.3 on 2020-03-02 08:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH... |
gregzajac/MyRent | MyRent/migrations/0001_initial.py | # Generated by Django 3.0.3 on 2020-03-01 14:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Flat',
fields=[
('id', models.AutoField(aut... |
gregzajac/MyRent | MyRent/models.py | <filename>MyRent/models.py
from django.contrib.auth.models import User
from django.db import models
from datetime import datetime, timedelta
class Landlord(models.Model):
first_name = models.CharField(max_length=64, verbose_name="Imię")
last_name = models.CharField(max_length=64, verbose_name="Nazwisko")
... |
mrgloom/Sparse-Autoencoder-Linear | sparseAutoencoderLinear.py | # This piece of software is bound by The MIT License (MIT)
# Copyright (c) 2014 <NAME>
# Code written by : <NAME>
# Email ID : <EMAIL>
import numpy
import math
import time
import scipy.io
import scipy.optimize
import matplotlib.pyplot
###################################################################################... |
AbinavRavi/PredictionAPI-rust | model/train.py | <reponame>AbinavRavi/PredictionAPI-rust<filename>model/train.py
import tensorflow as tf
from network import classifier
from utils import read_config
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.fashion_mnist.load_data()
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'C... |
AbinavRavi/PredictionAPI-rust | model/utils.py | <reponame>AbinavRavi/PredictionAPI-rust
import yaml
def read_config(config_path):
with open(config_path, "r") as stream:
config = yaml.full_load(stream)
return config
|
AbinavRavi/PredictionAPI-rust | model/network.py | <filename>model/network.py
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
def classifier(num_classes):
model = tf.keras.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(128, activation=... |
yangsong158/gooreplacer4chrome | package.py | <filename>package.py<gh_stars>1-10
#!/usr/bin/env python
# coding=utf8
import os
os.chdir(os.path.dirname(os.path.realpath(__file__)))
browers = ['chrome', 'firefox']
package_cmd_template = r'cd src;zip -x *.DS_Store -r %(dest_zip)s *'
zip_file = os.path.expanduser('~/Desktop/%s_gooreplacer.zip')
origin_version = r'"... |
RakhulKumar/Handwritten-Digit-Recogniser-using-PyTorch-and-OpenCV | src/Recognition_App.py | import numpy as np
from skimage import img_as_ubyte
from skimage.color import rgb2gray
import cv2
import datetime
import argparse
import imutils
import time
import torch
from time import sleep
from imutils.video import VideoStream
from CNN_NET import CNN_NET
path="/home/pi/Desktop/DIGIT RECOGNIZER/weights.h5"
model... |
napoler/tkitMarkerFast | json2csv.py | <filename>json2csv.py<gh_stars>1-10
import tkitJson
import csv
Newjson=tkitJson.Json("../newTriplet.json")
data=[]
#python2可以用file替代open
with open("data.csv","w") as csvfile:
writer = csv.writer(csvfile)
#先写入columns_name
writer.writerow(["name","type","word"])
for i,item in enumerate( Newjson.load(... |
napoler/tkitMarkerFast | test.py | <gh_stars>1-10
import tkitMarkerFast
# 初始化
model = tkitMarkerFast.MarkerFast()
# 加载模型
model.load_model()
# 【禁忌证】 [@顽固、难治性高血压#禁忌症*]、[@严重的心血管疾病#禁忌症*]及[@甲亢#禁忌症*]患者。
text = "【禁忌证】 顽固、难治性高血压#禁忌症、严重的心血管疾病#禁忌症及甲亢#禁忌症患者。"
text,_,_,_=model.pre(text)
print(text)
# 【禁忌证】顽[@固、#禁忌症*]难[@治性高血压#禁忌症、#禁忌症*]严[@重的心血管疾病禁忌症*]禁忌症及甲[@亢#禁忌症患... |
napoler/tkitMarkerFast | test_mc.py | <gh_stars>1-10
import tkitMarkerFast
import tkitJson
import re
import tqdm
# 初始化
model = tkitMarkerFast.MarkerFast()
# 加载模型
model.load_model()
# 【禁忌证】 [@顽固、难治性高血压#禁忌症*]、[@严重的心血管疾病#禁忌症*]及[@甲亢#禁忌症*]患者。
Tjson=tkitJson.Json("../1.json")
for i,item in tqdm.tqdm(enumerate( Tjson.load())):
if len(item["title"])>20... |
napoler/tkitMarkerFast | test/test.py |
# encoding=utf-8
from __future__ import unicode_literals
import tkitMarkerFast
import src
import sys
# 切换到上级目录
sys.path.append("../")
# 引入本地库
Demo = tkitMarkerFast.MarkerFast()
Demo.fun()
|
napoler/tkitMarkerFast | test_mc2data2Triplet.py | <reponame>napoler/tkitMarkerFast<gh_stars>1-10
import tkitMarkerFast
import tkitJson
import re
"""[用于将预测的数据转为三元格式]
"""
import tqdm
# 初始化
model = tkitMarkerFast.MarkerFast()
# 加载模型
model.load_model()
# 【禁忌证】 [@顽固、难治性高血压#禁忌症*]、[@严重的心血管疾病#禁忌症*]及[@甲亢#禁忌症*]患者。
Tjson=tkitJson.Json("../newData.json")
Newjson=tkitJson.Json("... |
napoler/tkitMarkerFast | tkitMarkerFast/MarkerFast.py | # -*- coding: utf-8 -*-
import numpy as np
import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer
import os
import re
# import tkitFile
import regex
from tqdm import tqdm
import time
# from tkitJson import Config
import tkitJson
import BMESBIO2Data
import difflib
class MarkerFast:
"""... |
napoler/tkitMarkerFast | test_mc2data.py | <gh_stars>1-10
import tkitMarkerFast
import tkitJson
import re
"""[用于生成预测结果]
"""
import tqdm
# 初始化
model = tkitMarkerFast.MarkerFast()
# 加载模型
model.load_model()
# 【禁忌证】 [@顽固、难治性高血压#禁忌症*]、[@严重的心血管疾病#禁忌症*]及[@甲亢#禁忌症*]患者。
Tjson=tkitJson.Json("../data.json")
Newjson=tkitJson.Json("../newData.json")
data=[]
for i,item in t... |
zachary-hawk/dispersion.py | src/main.py | #!/usr/bin/env python
###############################################################
# #
# D I S P E R S I O N . P Y #
# #
#########################################... |
John-Chan/protobuf-rpc-test | protobuf-rpc-test/protobuf/protobuf-2.6.0/python/google/protobuf/pyext/reflection_cpp2_generated_test.py | <reponame>John-Chan/protobuf-rpc-test<gh_stars>1-10
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modifica... |
John-Chan/protobuf-rpc-test | protobuf-rpc-test/protobuf/protobuf-2.6.0/python/google/protobuf/internal/descriptor_pool_test.py | #! /usr/bin/python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... |
John-Chan/protobuf-rpc-test | protobuf-rpc-test/protobuf/protobuf-2.6.0/python/google/protobuf/internal/encoder.py | <reponame>John-Chan/protobuf-rpc-test
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
edvbld/jurov | test/integration/runner.py | import os
import os.path
import sys
import parser.runner
def run():
d = os.path.split(os.path.abspath(__file__))[0]
d += '/sample_programs/'
samples = [os.path.abspath(d + 'Factorial.java')]
cmd = './build/src/jurov'
res = parser.runner.run(cmd, samples)
if res:
sys.exit(0)
else:
... |
edvbld/jurov | test/integration/parser/runner.py | <gh_stars>0
import os.path
import os
def run(cmd, files):
res = True;
d = os.path.split(os.path.abspath(__file__))[0]
for p in files:
fname = os.path.split(p)[1]
fname = fname.replace('java', 'syntax')
exp = open((d + '/' + fname), 'r').read()
output = os.popen((cmd + ' ' + ... |
segfo/ctfTools | scriptAutogen.py | #!/usr/bin/python3
#coding: utf-8
import sys
import os
import libstrings
from operator import attrgetter
from pwn import *
def printUsage(module):
print("%s <elfFile>"%(module))
argv = sys.argv
argc = len(argv)
elf = None
if argc < 2:
printUsage(argv[0])
exit(1)
fileName = argv[1]
try:
elf = ELF(fileNa... |
segfo/ctfTools | libstrings.py | #!/usr/bin/python3
#coding: utf-8
import string
import math
from pwn import *
from collections import *
stringsData = namedtuple('stringsData','addr len data')
def getStrings(file, min=4):
result = ""
f = file
resultData = []
cnt = 0
maxLen = 0
for c in f.read():
cnt += 1
c = ... |
segfo/ctfTools | str2stk32.py | <reponame>segfo/ctfTools<filename>str2stk32.py
import binascii
import sys
if len(sys.argv) <= 1:
print "missing arguments( given \"path string\" )"
exit(1)
strlen = len(sys.argv[1])
str = sys.argv[1]
cnt = strlen /4
cnt += 1 if strlen%4!=0 else 0
for i in xrange(0,cnt):
s = binascii.hexlify(str[(cnt-i-1)*4:(cnt-... |
MatPoliquin/retro | retro/examples/discretizer.py | """
Define discrete action spaces for Gym Retro environments with a limited set of button combos
"""
import gym
import numpy as np
import retro
class Discretizer(gym.ActionWrapper):
"""
Wrap a gym environment and make it use discrete actions.
Args:
combos: ordered list of lists of valid button co... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/cinema/__init__.py | <filename>retro/cores/gba/src/platform/python/cinema/__init__.py
from PIL.ImageChops import difference
from PIL.ImageOps import autocontrast
from PIL.Image import open as PIOpen
class VideoFrame(object):
def __init__(self, pilImage):
self.image = pilImage.convert('RGB')
@staticmethod
def diff(a, b... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/png.py | <reponame>MatPoliquin/retro
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from . import vfs
MODE_RGB =... |
MatPoliquin/retro | retro/data/__init__.py | from retro._retro import GameDataGlue, RetroEmulator, data_path as _data_path
import glob
import hashlib
import json
import os
import sys
try:
import enum
from enum import Flag
except ImportError:
# Python < 3.6 doesn't support Flag, so we polyfill it ourself
class Flag(enum.Enum):
def __and__(... |
MatPoliquin/retro | retro/examples/interactive.py | <gh_stars>1000+
"""
Interact with Gym environments using the keyboard
An adapter object is defined for each environment to map keyboard commands to actions and extract observations as pixels.
"""
import sys
import ctypes
import argparse
import abc
import time
import numpy as np
import retro
import pyglet
from pyglet... |
MatPoliquin/retro | tests/data/test_load.py | import retro
import pytest
import gc
import gzip
import os
import zlib
from retro.testing import game, handle
from concurrent.futures import ProcessPoolExecutor, TimeoutError
from concurrent.futures.process import BrokenProcessPool
pool = ProcessPoolExecutor(1)
@pytest.fixture(scope="module")
def processpool():
... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/cinema/util.py | def dictMerge(a, b):
for key, value in b.items():
if isinstance(value, dict):
if key in a:
dictMerge(a[key], value)
else:
a[key] = dict(value)
else:
a[key] = value
|
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/gba.py | # Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from .arm import ARMCore
from .core import Core, needsRes... |
MatPoliquin/retro | docker/linux/build_scripts/python-tag-abi-tag.py | # Utility script to print the python tag + the abi tag for a Python
# See PEP 425 for exactly what these are, but an example would be:
# cp27-cp27mu
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
print("{0}{1}-{2}".format(get_abbr_impl(), get_impl_ver(), get_abi_tag())) |
MatPoliquin/retro | conftest.py | <filename>conftest.py<gh_stars>1000+
import pytest
import retro.data
inttypes = {
'exp': retro.data.Integrations.EXPERIMENTAL_ONLY,
'contrib': retro.data.Integrations.CONTRIB_ONLY,
}
def pytest_collection_modifyitems(items):
def test(*args, **kwargs):
print(kwargs)
return False
for i... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/conftest.py | import errno
import itertools
import os
import os.path
import pytest
import yaml
def pytest_addoption(parser):
parser.addoption("--rebaseline", action="store_true", help="output a new baseline instead of testing")
parser.addoption("--mark-failing", action="store_true", help="mark all failing tests as failing")... |
MatPoliquin/retro | retro/cores/gba/tools/deploy-mac.py | <reponame>MatPoliquin/retro
#!/usr/bin/env python
from __future__ import print_function
import argparse
import errno
import os
import re
import shutil
import subprocess
qtPath = None
verbose = False
def splitPath(path):
folders = []
while True:
path, folder = os.path.split(path)
if folder != '':
folders.appe... |
MatPoliquin/retro | retro/examples/retro_interactive.py | import argparse
import retro
from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
from .interactive import Interactive
class RetroInteractive(Interactive):
"""
Interactive setup for retro games
"""
def __init__(self, game, state, scenario):
def make_env():
return ret... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/tests/mgba/test_core.py | import pytest
def test_core_import():
try:
import mgba.core
except:
raise AssertionError
|
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/image.py | <reponame>MatPoliquin/retro
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from . import png
try:
i... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/cinema/test.py | <gh_stars>1000+
import os, os.path
import mgba.core, mgba.image
import cinema.movie
import itertools
import glob
import re
import yaml
from copy import deepcopy
from cinema import VideoFrame
from cinema.util import dictMerge
class CinemaTest(object):
TEST = 'test.(mvl|gb|gba|nds)'
def __init__(self, path, roo... |
MatPoliquin/retro | tests/test_paths.py | <reponame>MatPoliquin/retro
import retro
import os
import pytest
@pytest.yield_fixture
def custom_cleanup():
retro.data.Integrations.clear_custom_paths()
assert not retro.data.Integrations.CUSTOM_ONLY.paths
yield
retro.data.Integrations.clear_custom_paths()
assert not retro.data.Integrations.CUSTOM_ONLY.paths
... |
MatPoliquin/retro | retro/testing/tools.py | import glob
import hashlib
import json
import os
import re
import retro.data
def load_whitelist(game, inttype):
try:
with open(retro.data.get_file_path(game, 'metadata.json', inttype | retro.data.Integrations.STABLE)) as f:
whitelist = json.load(f).get('whitelist', {})
except json.JSONDec... |
MatPoliquin/retro | scripts/import_sega_classics.py | <filename>scripts/import_sega_classics.py
#!/usr/bin/env python
from retro.scripts.import_sega_classics import main
main()
|
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/arm.py | # Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
class _ARMRegisters:
def __init__(self, cpu):
... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/gb.py | # Copyright (c) 2013-2017 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from .lr35902 import LR35902Core
from .core import Core, ... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/__init__.py | # Copyright (c) 2013-2017 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from collections import namedtuple
def createCallback(s... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/gamedata.py | <reponame>MatPoliquin/retro<gh_stars>1000+
# Copyright (c) 2013-2017 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
try:
import mgba_gamedata
except Import... |
MatPoliquin/retro | retro/examples/determinism.py | """
Example wrapper to improve determinism of Retro environments
"""
import retro
import numpy as np
import argparse
import gym
import multiprocessing as mp
CHUNK_LENGTH = 128
class MoreDeterministicRetroState(gym.Wrapper):
"""
Save/restore state on each step to avoid de-sync
It's likely that reward and... |
MatPoliquin/retro | retro/cores/gba/tools/perf.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import csv
import os
import shlex
import signal
import socket
import subprocess
import sys
import time
class PerfTest(object):
EXECUTABLE = 'mgba-perf'
def __init__(self, rom, renderer='software'):
self.rom = rom
self.... |
MatPoliquin/retro | retro/examples/trivial_random_agent_multiplayer.py | import retro
def main():
env = retro.make(game='Pong-Atari2600', players=2)
obs = env.reset()
while True:
# action_space will by MultiBinary(16) now instead of MultiBinary(8)
# the bottom half of the actions will be for player 1 and the top half for player 2
obs, rew, done, info = e... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/thread.py | # Copyright (c) 2013-2017 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from .core import IRunner, ICoreOwner, Core
class Thread... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/lr35902.py | <gh_stars>1000+
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
class LR35902Core:
def __init__(self... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/vfs.py | <reponame>MatPoliquin/retro<filename>retro/cores/gba/src/platform/python/mgba/vfs.py
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
f... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/core.py | # Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from . import tile, createCallback
from cached_property i... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/log.py | <filename>retro/cores/gba/src/platform/python/mgba/log.py
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/_builder.py | <filename>retro/cores/gba/src/platform/python/_builder.py
import cffi
import os, os.path
import shlex
import subprocess
import sys
ffi = cffi.FFI()
pydir = os.path.dirname(os.path.abspath(__file__))
srcdir = os.path.join(pydir, "..", "..")
incdir = os.path.join(pydir, "..", "..", "..", "include")
bindir = os.environ.g... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/debugger.py | # Copyright (c) 2013-2017 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from .core import IRunner, ICoreOwner, Core
import io
imp... |
MatPoliquin/retro | tests/data/test_roms.py | <reponame>MatPoliquin/retro<filename>tests/data/test_roms.py
from retro.testing import game, handle
import retro.data
import retro.testing.tools
def test_hash(game):
errors = retro.data.verify_hash(*game)
handle([], errors)
def test_hash_collisions():
warnings, errors = retro.testing.tools.verify_hash_c... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/test_cinema.py | import pytest
import cinema.test
import mgba.log
import os.path
import yaml
mgba.log.installDefault(mgba.log.NullLogger())
def flatten(d):
l = []
for k, v in d.tests.items():
if v.tests:
l.extend(flatten(v))
else:
l.append(v)
l.sort()
return l
def pytest_genera... |
MatPoliquin/retro | retro/cores/gba/cinema/gb/mooneye-gb/update.py | #!/usr/bin/env python
import os
import os.path
import shutil
import yaml
from cinema.util import dictMerge
suffixes = {
'C': 'CGB',
'S': 'SGB',
'A': 'AGB',
'mgb': 'MGB',
'sgb': 'SGB',
'sgb2': 'SGB2',
'cgb': 'CGB',
'agb': 'AGB',
'ags': 'AGB',
}
def ingestDirectory(path, dest):
f... |
MatPoliquin/retro | scripts/playback_movie.py | #!/usr/bin/env python
from retro.scripts.playback_movie import main
main()
|
MatPoliquin/retro | retro/enums.py | from enum import Enum
class State(Enum):
"""
Special values for setting the restart state of the environment. You can
also specify a string that is the name of the ``.state`` file
"""
DEFAULT = -1 #: Start the game at the default savestate from ``metadata.json``
NONE = 0 #: Start the game a... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/tests/mgba/test_vfs.py | <filename>retro/cores/gba/src/platform/python/tests/mgba/test_vfs.py
import pytest
import os
import mgba.vfs as vfs
from mgba._pylib import ffi
def test_vfs_open():
with open(__file__) as f:
vf = vfs.open(f)
assert vf
assert vf.close()
def test_vfs_openPath():
vf = vfs.openPath(__file... |
MatPoliquin/retro | scripts/import.py | <gh_stars>1000+
#!/usr/bin/env python
from retro.scripts.import_path import main
main()
|
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/tile.py | # Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
from . import image
class Tile:
def __init__(self, d... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/mgba/memory.py | <reponame>MatPoliquin/retro
# Copyright (c) 2013-2016 <NAME>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib
class MemoryView(object):
... |
MatPoliquin/retro | retro/scripts/import_path.py | #!/usr/bin/env python
import retro.data
import os
import sys
import zipfile
def _check_zipfile(f, process_f):
with zipfile.ZipFile(f) as zf:
for entry in zf.infolist():
_root, ext = os.path.splitext(entry.filename)
with zf.open(entry) as innerf:
if ext == ".zip":
... |
MatPoliquin/retro | retro/examples/brute.py | <filename>retro/examples/brute.py
"""
Implementation of the Brute from "Revisiting the Arcade Learning Environment:
Evaluation Protocols and Open Problems for General Agents" by Machado et al.
https://arxiv.org/abs/1709.06009
This is an agent that uses the determinism of the environment in order to do
pretty well at a... |
MatPoliquin/retro | retro/cores/gba/src/platform/python/cinema/movie.py | <reponame>MatPoliquin/retro
from mgba.image import Image
from collections import namedtuple
from . import VideoFrame
Output = namedtuple('Output', ['video'])
class Tracer(object):
def __init__(self, core):
self.core = core
self.fb = Image(*core.desiredVideoDimensions())
self.core.setVideoB... |
MatPoliquin/retro | retro/testing/verify_changes.py | #!/usr/bin/env python
import pytest
import retro.testing as testdata
import subprocess
import sys
if len(sys.argv) == 2:
branches = [sys.argv[1]]
elif len(sys.argv) == 3:
branches = [sys.argv[1], sys.argv[2]]
else:
branches = ['master']
check = testdata.branch_new(*branches)
if check:
args = ['-q', '-... |
wieden-kennedy/haikus | haikus/haikutext.py | <reponame>wieden-kennedy/haikus
"""
Classes and utilities for extracting haiku from arbitrary text and evaluating them based on some programmatically
defined criteria
"""
import nltk
import string
from nltk.corpus import cmudict
from nltk_util import syllables_en
from haikus.evaluators import DEFAULT_HAIKU_EVALUATORS
... |
wieden-kennedy/haikus | haikus/tests.py | <reponame>wieden-kennedy/haikus
import math
from unittest import TestCase
from haikus import HaikuText
from haikus.evaluators import HaikuEvaluator, NounVerbAdjectiveLineEndingEvaluator, \
JoiningWordLineEndingEvaluator, EndsInNounEvaluator, PrepositionCountEvaluator
class TestHaiku(TestCase):
def test_calcu... |
wieden-kennedy/haikus | haikus/evaluators.py | <filename>haikus/evaluators.py
"""
Simple haiku evaluators. Callables that give a score (out of 100) to a
haiku based on some criteria.
"""
import re, math
import nltk
import nltk.collocations
from nltk.classify import NaiveBayesClassifier
class HaikuEvaluator(object):
"""
Base HaikuEvaluator -- simply a calla... |
wieden-kennedy/haikus | setup.py | <reponame>wieden-kennedy/haikus<filename>setup.py<gh_stars>1-10
#/usr/bin/env python
import os
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
setup(
name="haikus",
description="Some classes for finding haikus in text",
author="<NAME>",
... |
wieden-kennedy/haikus | haikus/__init__.py | <gh_stars>1-10
"""
Haiku module -- for finding haiku in some arbitary piece of text
"""
from haikus.haikutext import HaikuText, Haiku
|
stoffus/frigate | benchmark.py | import os
from statistics import mean
import multiprocessing as mp
import numpy as np
import datetime
from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels
my_frame = np.expand_dims(np.full((300,300,3), 1, np.uint8), axis=0)
labels = load_labels('/labelmap.txt')
######
# Minima... |
stoffus/frigate | frigate/edgetpu.py | <reponame>stoffus/frigate
import os
import datetime
import hashlib
import multiprocessing as mp
import numpy as np
import pyarrow.plasma as plasma
import tflite_runtime.interpreter as tflite
from tflite_runtime.interpreter import load_delegate
from frigate.util import EventsPerSecond, listen
def load_labels(path, enco... |
stoffus/frigate | detect_objects.py | <filename>detect_objects.py
import os
import sys
import traceback
import signal
import cv2
import time
import datetime
import queue
import yaml
import threading
import multiprocessing as mp
import subprocess as sp
import numpy as np
import logging
from flask import Flask, Response, make_response, jsonify, request
impor... |
stoffus/frigate | frigate/video.py | <reponame>stoffus/frigate<filename>frigate/video.py<gh_stars>1-10
import os
import time
import datetime
import cv2
import queue
import threading
import ctypes
import pyarrow.plasma as plasma
import multiprocessing as mp
import subprocess as sp
import numpy as np
import copy
import itertools
import json
from collections... |
advpro4/Project-solution-C122 | take_screenshot.py | <filename>take_screenshot.py
import numpy as np
import pyautogui
import imutils
import cv2
import mediapipe as mp
mp_hands = mp.solutions.hands
hands = mp_hands.Hands()
mp_draw = mp.solutions.drawing_utils
cap = cv2.VideoCapture(0)
finger_tips =[8, 12, 16, 20]
thumb_tip= 4
while True:
ret,img = cap.read()
im... |
mpatek/runcalc | runcalc/cli.py | <reponame>mpatek/runcalc
import datetime
import click
import re
_multipliers = {
's': 1,
'm': 60,
'h': 3600,
}
_pattern = re.compile(
'(?:(?:(?P<h>\d+):)?(?P<m>\d+):)?(?P<s>\d+(?:\.\d+)?)'
)
def time_str_to_seconds(s):
"""
Convert a string representation of a time to number of seconds.
... |
mpatek/runcalc | setup.py | <filename>setup.py
from setuptools import setup
setup(
name='runcalc',
version='0.1.1',
description='Running pace calculator',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/mpatek/runcalc',
download_url='https://github.com/mpatek/runcalc/tarball/0.1.1',
packages=['run... |
dbt-labs/fullcontact-stitch | lambda/__init__.py | <reponame>dbt-labs/fullcontact-stitch
import os
import sys
sys.path.append(os.getenv('LAMBDA_TASK_ROOT'))
import fullcontact # noqa
if __name__ == "__main__":
fullcontact.handle_fanout(None, None)
|
dbt-labs/fullcontact-stitch | lambda/common.py | <gh_stars>1-10
import base64
import boto3
import json
import os
import psycopg2
import time
import traceback
kinesis_client = boto3.client('kinesis')
def log(s):
now = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
print('{} | {}'.format(now, s))
def enqueue_records(records):
if len(records) > 500:
... |
dbt-labs/fullcontact-stitch | lambda/fullcontact.py | import os
import requests
import time
import common
def persist_to_stitch(data):
url = 'https://api.stitchdata.com/v2/import/push'
api_key = os.getenv('STITCH_API_KEY')
return requests.post(
url,
headers={'Content-Type': 'application/json',
'Authorization': 'Bearer {}'.f... |
StarlightHunter/qitime | qitime.py | #!/usr/bin/python3
##
## qitime - Quality Imaging Time
## (C) 2020 <NAME> <<EMAIL>>
##
## Calculates the Quality Imaging Time (dark hours) for a given date.
## Based on a concept developed by <NAME>:
## https://digitalstars.wordpress.com/
##
import argparse
import datetime
import ephem
def get_lunar_phase(lunation):
... |
zhangce/elementary | dep/iomln.py |
import sys
PRED_FILE = sys.argv[1]
FOLDER = sys.argv[2]
WEIGHT_FILE = FOLDER + "/factor_weight.tsv"
FACTOR_MEANING = FOLDER + "/factor_meaning.tsv"
VARIABLE_MEANING = FOLDER + "/variable_meaning.tsv"
OUTPUT_WEIGHT = FOLDER + ".prog.txt"
OUTPUT_PRED = FOLDER + ".pred.txt"
vm = {}
fm = {}
for l in open(FACTOR_MEANI... |
zhangce/elementary | examples/elly/LR/to_factor.py | <reponame>zhangce/elementary
m = {}
for l in open('lr_feat_unigram_nf_1.tsv', 'r'):
(fid, vid, feature) = l.rstrip().split()
fid = int(fid)
vid = int(vid)
feature = int(feature)
m[vid/1000] = feature
m[0] = 0
fof = open('unigram.tsv', 'w')
fov = open('__vf.tsv', 'w')
ctf = -1
for v in sorted(m.i... |
zhangce/elementary | examples/elly/LDA/view.py | <filename>examples/elly/LDA/view.py
import sys
vid2word = {}
for l in open(sys.argv[2], 'r'):
(vid, word) = l.rstrip().split('\t')
vid2word[vid] = word
topic2word = {}
for l in open(sys.argv[1], 'r'):
(vid, topic) = l.rstrip().split('\t')
word = vid2word[vid]
if topic not in topic2word:
... |
dyelsey/Juhuri-Keyboard | resources/analysis.py | <filename>resources/analysis.py
#<NAME>
import codecs
from collections import defaultdict, Counter
from operator import itemgetter
import sys
def add_pound(word):
return '#'+word.rstrip()+'#'
def make_histogram(name):
f = codecs.open(name, encoding='utf-8')
stop_words = [u'\n']
histogram = defaultdict(int)
for ... |
dyelsey/Juhuri-Keyboard | Linux jdt keyboard/add_rule.py | <gh_stars>0
#<NAME>
#Adds keyboard in evdev.xml right before </layoutList>
l = []
for i in range(16):
l.append('')
l[0] = " <layout>\n"
l[1] = " <configItem>\n"
l[2] = " <name>jdt-cyr</name>\n"
l[3] = " <shortDescription>jdt-cyr</shortDescription>\n"
l[4] = " <description>Judeo-Tat (Cyri... |
gVallverdu/pychemcurv | pychemcurv/core.py | <reponame>gVallverdu/pychemcurv
# coding: utf-8
"""
Module ``pychemcur.core`` implements several classes in order to represents a vertex of
a molecular squeleton and compute geometrical and chemical indicators related
to the local curvature around this vertex.
A complete and precise definition of all the quantities ... |
gVallverdu/pychemcurv | pychemcurv/geometry.py | # coding: utf-8
"""
This module implements utility functions to compute several geometric
properties.
"""
import numpy as np
__author__ = "<NAME>"
__copyright__ = "University of Pau and Pays Adour"
__email__ = "<EMAIL>"
__all__ = ["center_of_mass", "circum_center", "get_plane", "get_dihedral"]
def center_of_mass... |
gVallverdu/pychemcurv | setup.py | # coding: utf-8
import setuptools
__author__ = "<NAME>"
__copyright__ = "University of Pau and Pays Adour"
__email__ = "<EMAIL>"
__version__ = "2020.6.3"
with open("README.rst", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pychemcurv",
version=__version__,
author=__author__,
... |
gVallverdu/pychemcurv | pychemcurv/analysis.py | <reponame>gVallverdu/pychemcurv
# coding: utf-8
"""
This module implements the `CurvatureAnalyze` class to perform curvature
analyses on molecular or periodic structures.
"""
import numpy as np
import pandas as pd
from pymatgen.core import Molecule, Structure
from pymatgen.core.bonds import obtain_all_bond_lengths
... |
gVallverdu/pychemcurv | tests/test_core.py | #!/usr/bin/env python
# coding: utf-8
# import sys
# sys.path.append("../")
from pytest import approx
from pychemcurv import VertexAtom, TrivalentVertex, POAV1, POAV2
import numpy as np
__author__ = "<NAME>"
__copyright__ = "University of Pau and Pays Adour"
__email__ = "<EMAIL>"
class TestVertexAtom:
""" Test... |
gVallverdu/pychemcurv | app/app.py | #!/usr/bin/env python3
# -*- coding=utf-8 -*-
"""
## Documentation
This application aims to visualize local geometric informations about a
molecular structure using the
[`pychemcurv`](https://pychemcurv.readthedocs.io/) package. In particular,
the application computes geometric quantities which provide an insight of... |
gVallverdu/pychemcurv | pychemcurv/__init__.py | <filename>pychemcurv/__init__.py
# coding: utf-8
"""
This python packages provides classes in order to compute the local curvature
in a molecule or a material at the atomic scale and the hybridization of the
molecular orbitals of the atoms. The `utils` module allows to compute all
the quantities for all the atoms of a... |
gVallverdu/pychemcurv | pychemcurv/vis.py | # coding: utf-8
"""
The ``pychemcurv.vis`` module implements the ``CurvatureViewer``
class in order to visualize a molecule or a periodic structure in a jupyter
notebook and map a given properties on the atoms using a color scale.
This class needs, `nglview <https://github.com/arose/nglview>`_ and uses
ipywidgets i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.