repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
Dark-Bob/mro | routine_test.py | <gh_stars>1-10
import pytest
import json
import mro
import mro.helpers
import connection as con
def print_table(command, connection):
cursor = connection.cursor()
cursor.execute(command)
cim = mro.helpers.create_column_name_index_map(cursor)
print(cim)
for row in cursor:
print(row)
@pyte... |
Dark-Bob/mro | custom_type_test.py | import pytest
import mro
import connection as con
from datetime import datetime, date
@pytest.fixture
def connection_function(request):
connection = con.connect()
request.addfinalizer(mro.disconnect)
cursor = connection.cursor()
con.drop_tables()
cursor.execute("""DROP TYPE IF EXISTS custom_type... |
Dark-Bob/mro | mro/connection.py | import atexit
connection = None
connection_function = None
reconnect_function = None
hooks = None
def set_connection_function(_connection_function):
global connection
global connection_function
connection_function = _connection_function
connection = connection_function()
def disconnect():
globa... |
Dark-Bob/mro | mro/data_types.py |
import psycopg2.extras
import datetime
import uuid as _uuid
# Create data type functions
def defaultColumnToDataType(column, code_start, code_end):
return code_start + code_end
def varcharColumnToDataType(column, code_start, code_end):
character_maximum_length = column[8]
return f'{code_start}{charact... |
Dark-Bob/mro | numpy_types_test.py | import pytest
import mro
import connection as con
import pandas as pd
@pytest.fixture
def connection_function(request):
connection = con.connect()
request.addfinalizer(mro.disconnect)
cursor = connection.cursor()
con.drop_tables()
cursor.execute("create table table1 (id serial primary key, colu... |
Dark-Bob/mro | operational_test.py | <filename>operational_test.py
import pytest
import mro
import mro.foreign_keys
import connection as con
@pytest.fixture()
def connection(request):
connection = con.connect()
request.addfinalizer(mro.disconnect)
cursor = connection.cursor()
con.drop_tables()
cursor.execute("""create table table1... |
Dark-Bob/mro | mro/version.py | <reponame>Dark-Bob/mro
__version__ = '1.0.0dev1' |
Dark-Bob/mro | foreign_key_test.py | <reponame>Dark-Bob/mro
import os
import json
import pytest
import mro
import mro.foreign_keys
import connection as con
@pytest.fixture(scope="module")
def connection(request):
connection = con.connect()
if request:
request.addfinalizer(mro.disconnect)
cursor = connection.cursor()
con.drop_ta... |
Dark-Bob/mro | mro/routine.py | import mro.connection
import mro.helpers
import collections
class RoutineParameter:
def __init__(self, name, data_type, mode):
self.name = name
self.data_type = data_type
self.mode = mode
def __repr__(self):
return f"RoutineParameter({self.name}, {self.data_type}, {self.mode}... |
Dark-Bob/mro | sql_injection_test.py | # reminder to add tests for this and fix |
karush17/esac | parser.py | <gh_stars>10-100
import os, sys
import argparse
def build_parser():
parser = argparse.ArgumentParser(description='PyTorch Soft Actor-Critic Args')
parser.add_argument('--env', default="HalfCheetah-v2",
help='Mujoco Gym environment (default: HalfCheetah-v2)')
parser.add_argu... |
karush17/esac | ES.py | import os
import numpy as np
import sys, copy
import time
import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from torch import optim
from model import NeuralNetwork
import pickle as pkl
import scipy.stats as ss
import gym
import random
fr... |
karush17/esac | main.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import argparse, sys
import datetime, copy
import gym
import numpy as np
import random
import itertools, time, math
import torch
import pickle as pkl
from sac import SAC
from utils import dm_wrap
from model import NeuralNetwork
from parser import build_parser
from ES import... |
jeffs/py-kart | yesterday/main.py | <reponame>jeffs/py-kart
#!/usr/bin/env python3
#
# Prints yesterday's date, formatted for use as a filesystem relative path.
from datetime import date, timedelta
yesterday = date.today() - timedelta(days=1)
print(yesterday.strftime('%Y/%m/%d'))
|
jeffs/py-kart | pangram/main.py | <reponame>jeffs/py-kart
#!/usr/bin/env python3
from dataclasses import dataclass
import argparse
import sys
from typing import Callable, Set
DEFAULT_MIN_LENGTH = 4
DEFAULT_WORDS_FILE = "/usr/share/dict/words"
@dataclass
class Command:
mandatory_letters: Set[str]
available_letters: Set[str]
min_length: ... |
jeffs/py-kart | words/main.py | <reponame>jeffs/py-kart
#!/usr/bin/env python3
#
# Prints the number of alphanumeric words in stdin or specified files.
# Markdown links are heuristically recognized and removed automatically.
import re
import sys
from typing import Iterable
# We care only about links that include whitespace, thus affecting word cou... |
jeffs/py-kart | vimod/main.py | <filename>vimod/main.py
#!/usr/bin/env python3
"""This script opens (in Vim) any modified files in the current Git working copy."""
import subprocess as _subprocess, sys as _sys
def main():
status = _subprocess.run(
("git", "status"), capture_output=True, check=True, encoding="utf-8"
).stdout
f... |
jeffs/py-kart | len/test/wide.py | <reponame>jeffs/py-kart<filename>len/test/wide.py
len('piñata') # 6
len('piñata') # 7
len('🚀') # 1 (code point), though JS returns 2 (code units)
''.join(map(chr, (0x63, 0x328))) # 'c̨'; length 2 in both Python and JS
|
jeffs/py-kart | len/main.py | <reponame>jeffs/py-kart<filename>len/main.py
#!/usr/bin/env python3
#
# Prints line lengths from stdin or specified files.
from argparse import ArgumentParser
from itertools import islice
from os import walk
from os.path import isdir, join
from sys import stderr, stdin
def chomp_dir(dir):
for d, _, fs in walk(dir... |
jeffs/py-kart | url/main.py | <reponame>jeffs/py-kart<filename>url/main.py<gh_stars>0
#!/usr/bin/env python3
#
# This script %-encodes or %-decodes a given URL. Inspired by:
# https://unix.stackexchange.com/a/159254/49952
from sys import argv, exit, stderr
from urllib.parse import quote_plus, unquote_plus
if len(argv) != 3 or argv[1] not in ['en... |
jeffs/py-kart | smarten/main.py | #!/usr/bin/env python3
#
# Replaces ordinary quotation marks with smart quotes.
#
# ## Quality
# TODO: Add formal test suite
# TODO: Rewrite in Rust
#
# ### Bugs
# TODO: Correctly support quote followed by punctuation (')' or '—')
#
# ## Features
# TODO: Support -i flag to process files in-place.
import re
import sys
... |
SHREEOM0611/S4DS-Bot | src/cogs/kaggleAPI.py | <filename>src/cogs/kaggleAPI.py
import discord
from discord import colour
from discord.ext import commands
from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi()
api.authenticate()
class KaggleAPI(commands.Cog):
def __init__(self, client):
self.client = client
#Gets the enti... |
SHREEOM0611/S4DS-Bot | src/cogs/games.py | <gh_stars>1-10
# Imports
import discord
import random
from discord.ext import commands
# Create a class `games` which inherits from the `commands.Cog` class
class games(commands.Cog):
def __init__(self, client):
self.client = client
# Command for `coinflip`
@commands.command(aliases = ['cf', ... |
SHREEOM0611/S4DS-Bot | src/cogs/arxivAPI.py | import discord
import urllib, urllib.request
from xml.dom import minidom
from discord.ext import commands
class ArxivAPI(commands.Cog):
def __init__(self, client):
self.client = client
#Gets the top search result from arXiv API and displays the paper along with related details (including summary... |
wrs28/safe_extubation | src/PressorGauge.py | <filename>src/PressorGauge.py
import streamlit as st
import os
import numpy as np
import pandas as pd
import pickle
from modeling.feature_definitions import features_to_keep
import shap
import copy
import statistics
import altair as alt
# block for AWS SQL-access
# # DB_USER = os.environ.get("DB_USER")
# # DB_PASSWORD... |
wrs28/safe_extubation | src/building_database/build_pressor_database.py | <reponame>wrs28/safe_extubation<filename>src/building_database/build_pressor_database.py
import pandas as pd
import os
import numpy as np
import sqlalchemy
import pickle
from sklearn.neighbors import KernelDensity
import directories
RND_SEED = 1729
MINIMUM_TIME_TO_PRESSOR_HOURS = 12
MAXIMUM_TIME_TO_PRESSOR_DAYS = 50.... |
wrs28/safe_extubation | src/modeling/build_features.py | <filename>src/modeling/build_features.py
import pandas as pd
import os
import sqlalchemy
import sklearn
import pickle
import numpy as np
import directories
import directories
import feature_definitions
RECORD_LENGTH_HOURS = 12 # how many hours the lab data is accumulated over
RECORD_LENGTH_SHIFT = 6 # how many hours ... |
wrs28/safe_extubation | src/building_database/build_lab_database.py | <gh_stars>1-10
import numpy as np
import pandas as pd
import os
import math
import sqlalchemy
import directories
# number of rows in LABEVENTS to read in at a time (there are 27_854_055 lines in LABEVENTS)
CHUNK_SIZE = 10**6
NUM_CHUNKS = np.inf
def find_first(arr):
idx = arr.argmax()
if arr[idx]:
return idx... |
wrs28/safe_extubation | src/building_database/directories.py | <reponame>wrs28/safe_extubation
import os
import sqlalchemy
# directory where project lives
project_dir = "/Users/wrs/Documents/insight/PressorGauge"
# directory where model lives
model_dir = "/Users/wrs/Documents/insight/PressorGauge/src/modeling"
# directory where mimic data lives
mimic_dir = "/Volumes/gaia/mim... |
wrs28/safe_extubation | src/building_database/build_intervals.py | import pandas as pd
import sqlalchemy
from directories import print_log, engine
N_WINDOWS = 48
def main():
with engine.connect() as connection:
vaso_episodes = pd.read_sql("pressors_by_icustay", con=connection, index_col="ICUSTAY_ID")
print_log("building hour-long intervals for each icustay")
... |
wrs28/safe_extubation | src/modeling/preprocess_data.py | import os
import pandas as pd
import pickle
import numpy as np
from sklearn import preprocessing, impute
import directories
RND_SEED = 1729
def preprocess_training_inputs():
with open(os.path.join(directories.model_dir,"training_features.p"),"rb") as file:
training_inputs = pickle.load(file)
# grou... |
wrs28/safe_extubation | src/modeling/feature_definitions.py | <reponame>wrs28/safe_extubation
import numpy as np
import pandas as pd
features_to_keep = [
# # "LODS",
#
# # "OASIS",
#
# # "APACHE",
#
# # "CARDIOVASCULAR_LODS",
#
# # "PULMONARY_LODS",
#
"AGE",
#
"TOTAL_FLAG_COUNT",
#
"GENDER", # really sex
#
"WE... |
wrs28/safe_extubation | src/modeling/split_data.py | <filename>src/modeling/split_data.py
import pandas as pd
import pickle
import os
from sklearn import model_selection
import directories
RND_SEED = 2 # random seed used throughout
TEST_SIZE_FRACTION = .1 # fraction of data is set aside for testing
def main():
with directories.engine.connect() as connection:
... |
wrs28/safe_extubation | src/modeling/lab_explorer.py | import os
import pandas as pd
import sys
mimic_dir = "/Volumes/gaia/mimic"
d_items = pd.read_csv(os.path.join(mimic_dir,"D_LABITEMS.csv"))
def find_label(label, category=None):
if not category:
return d_items[d_items.LABEL.str.contains(label,na=False)]
else:
return d_items[d_items.LABEL.str.... |
lengthmin/multi-user-git-hook | pre-commit.py | <filename>pre-commit.py
#!/usr/bin/env python
import os
from configparser import ConfigParser
from pathlib import Path
exit_code = os.system("git config --local user.email >/dev/null")
if (exit_code >> 8) == 0:
exit(0)
config = ConfigParser()
config.read(Path("~/.gitconfig").expanduser())
section_name = "multi"... |
CovidZero/Crawler | app.py | <reponame>CovidZero/Crawler<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# In[12]:
import urllib3
from bs4 import BeautifulSoup
from urllib.parse import urljoin
import datetime
import os
import subprocess as cmd
import argparse
from config import BUCKET_NAME, LINKS_REPO, PROG_NAME, VERSION, PASTA_RESULTADO, REP... |
CovidZero/Crawler | config.py | <filename>config.py
#!/usr/bin/env python
# coding: utf-8
import os
PROG_NAME = 'Crawler_COVID'
VERSION = '1.0.0.0'
PASTA_RESULTADO = '.\Estados'
REPO_URL = os.getenv('REPO_URL','https://github.com/CovidZero/Arquivo.git')
LINKS_REPO = os.getenv('LINKS_REPO','https://raw.githubusercontent.com/CovidZero/Arquivo/master/E... |
Pangoraw/pointnet2 | models/pointnet2_part_seg.py | import os
import sys
BASE_DIR = os.path.dirname(__file__)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, '../utils'))
import tensorflow as tf
import numpy as np
import tf_util
from pointnet_util import pointnet_sa_module, pointnet_fp_module
def placeholder_inputs(batch_size, num_point):
pointclou... |
Pangoraw/pointnet2 | part_seg/face_dataset.py | """
Face dataset
"""
import os
import os.path
import h5py
import numpy as np
class FaceDataset():
def get_data_file(self):
file = os.path.join(self.root, "{}_hdf5_file_list.txt".format(self.split))
with open(file, "r") as f:
files = [ls.rstrip() for ls in f]
return files
... |
zhutchens1/g3groups | create_ecoresolve_stellarmassselgroups.py | """
<NAME> - November 2020
This program creates stellar mass-selected group catalogs for ECO/RESOLVE-G3 using the new algorithm, described in the readme markdown.
The outline of this code is:
(1) Read in observational data from RESOLVE-B and ECO (the latter includes RESOLVE-A).
(2) Prepare arrays of input parameters... |
zhutchens1/g3groups | smoothedbootstrap.py | <gh_stars>0
"""
Smoothed Bootstrap Function
Author: <NAME>
adapted from astroML.resample.bootstrap September 2016
"""
import numpy as np
import numpy.random as npr
from astroML.utils import check_random_state
def smoothedbootstrap(data, n_bootstraps, user_statistic, kwargs=None,
random_state=None):
... |
zhutchens1/g3groups | mergegroupcatalogs.py | <filename>mergegroupcatalogs.py<gh_stars>0
import pandas as pd
lumgrps = pd.read_csv("ECOdata_G3catalog_luminosity.csv")
lumgrps = lumgrps.set_index('name')
stellargrps = pd.read_csv("ECOdata_G3catalog_stellar.csv")
stellargrps = stellargrps.set_index('name')
stellargrps = stellargrps[['g3grp_s', 'g3grpngi_s', 'g3grp... |
zhutchens1/g3groups | iterativecombination.py | <reponame>zhutchens1/g3groups
import numpy as np
import pandas as pd
import pickle
from scipy.spatial import cKDTree
from copy import deepcopy
import matplotlib.pyplot as plt
import time
import os
import subprocess
from IPython import get_ipython
ipython = get_ipython()
HUBBLE_CONST = 100.
"""
<NAME> - zhutchen [at]... |
zhutchens1/g3groups | create_ecoresolve_baryonicmassselgroups.py | """
<NAME> - November 2020
This program creates baryonic mass-selected group catalogs for ECO/RESOLVE-G3 using the new algorithm, described in the readme markdown.
The outline of this code is:
(1) Read in observational data from RESOLVE-B and ECO (the latter includes RESOLVE-A).
(2) Prepare arrays of input parameter... |
zhutchens1/g3groups | foftools.py | <filename>foftools.py
# -*- coding: utf-8 -*-
"""
@package 'foftools'
@author: <NAME>, UNC Chapel Hill
This package contains classes and functions for performing galaxy group
identification using the friends-of-friends (FoF) and probability friends-of-friends
(PFoF) algorithms. Additionally, it includes functions for ... |
clones/django-coltrane | coltrane/templatetags/coltrane.py | from django.db.models import get_model
from django import template
from django.contrib.comments.models import Comment, FreeComment
from template_utils.templatetags.generic_content import GenericContentNode
from coltrane.models import Entry, Link
register = template.Library()
class LatestFeaturedNode(GenericContent... |
clones/django-coltrane | coltrane/models.py | <reponame>clones/django-coltrane
"""
Models for a weblog application.
"""
import datetime
from comment_utils.managers import CommentedObjectManager
from comment_utils.moderation import CommentModerator, moderator
from django.conf import settings
from django.db import models
from django.utils.encoding import smart_s... |
erksch/fnet-pytorch | verify_conversion.py | import argparse
import json
import ml_collections
import sentencepiece as spm
import torch
from flax.training import checkpoints
from jax import random
import jax
import jax.numpy as jnp
import numpy as np
from fnet import FNetForPreTraining
from f_net.models import PreTrainingModel as JaxPreTrainingModel
from f_net... |
ttocsnamfuak/hwkWeaterAPI | config.py | <reponame>ttocsnamfuak/hwkWeaterAPI
#Open Weather API
api_key = 'a8c2dd6be0fb9a88e48d445b1b7d7430'
|
Tech901/sample-flask-app | main.py | from flask import Flask, request, render_template, redirect, url_for
from datetime import datetime
import json
app = Flask(__name__)
@app.route("/")
def index():
time = datetime.now().strftime("%c")
return render_template("index.html", current_time=time)
@app.route('/name')
def name():
first_name = req... |
victor-uemura/cliff-api-client | two.py | # Step 2: takes untagged messages and splits them by sentence and then looks for location identifiers. put all statements w locations into new sheet.
from cliff.api import Cliff
import pandas as pd
import geoip2.database
import re
reader = geoip2.database.Reader("../GeoLite2-City_20210202/GeoLite2-City.mmdb")
my_cli... |
victor-uemura/cliff-api-client | five.py | <reponame>victor-uemura/cliff-api-client
#Create spreadsheet with country, state and city counts
from cliff.api import Cliff
import pandas as pd
import ast
file_name = "../processedData/author_location.xlsx" # path to file + file name
sheet = "Sheet1" # sheet name or sheet number or list of sheet numbers and names
... |
victor-uemura/cliff-api-client | cliff/api.py | <gh_stars>1-10
import logging
import json
import requests
class Cliff:
# Make requests to a CLIFF geo-parsing / NER server
PARSE_TEXT_PATH = "/cliff-2.6.1/parse/text"
PARSE_NLP_JSON_PATH = "/cliff-2.6.1/parse/json"
PARSE_SENTENCES_PATH = "/cliff-2.6.1/parse/sentences"
GEONAMES_LOOKUP_PATH = "/cli... |
victor-uemura/cliff-api-client | four.py | #Step 4: takes messages and makes sure location is counted once per author
from cliff.api import Cliff
import pandas as pd
import ast
file_name = "../processedData/final_targeted_messages.xlsx" # path to file + file name
sheet = "Sheet1" # sheet name or sheet number or list of sheet numbers and names
df = pd.read_ex... |
victor-uemura/cliff-api-client | cliff/test.py | <filename>cliff/test.py
import unittest
import os
from cliff.api import Cliff
from dotenv import load_dotenv
# load env-vars from .env file if there is one
basedir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
test_env = os.path.join(basedir, '.env')
if os.path.isfile(test_env):
load_dotenv(dotenv_... |
victor-uemura/cliff-api-client | ips.py | #Reads members csv file and then creates spreadsheet with country and city counts.
import pandas as pd
import geoip2.database
reader = geoip2.database.Reader("../GeoLite2-City_20210202/GeoLite2-City.mmdb")
file_name = "../processedData/core_members.xls" # path to file + file name
sheet = "Sheet1" # sheet name or she... |
victor-uemura/cliff-api-client | test.py | import logging
import sys
from cliff.test import *
test_classes = [
BasicCliffTest
]
logging.basicConfig(level=logging.WARN)
# now run all the tests
suites = [unittest.TestLoader().loadTestsFromTestCase(test_class) for test_class in test_classes]
if __name__ == "__main__":
suite = unittest.TestSuite(suites)... |
victor-uemura/cliff-api-client | setup.py | <gh_stars>1-10
#! /usr/bin/env python
from setuptools import setup
import re
from os import path
version = ''
with open('cliff/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
this_directory = path.abspath(path.dirname(__file__))
with open(... |
dcartman/pygame-menu | test/test_widget_textinput.py | <reponame>dcartman/pygame-menu<filename>test/test_widget_textinput.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - TEXTINPUT
Test TextInput and ColorInput widgets.
"""
__all__ = ['TextInputWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, TEST_THEME, PYGAME_V2, \
... |
dcartman/pygame-menu | pygame_menu/examples/multi_input.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - MULTI-INPUT
Shows different inputs (widgets).
"""
__all__ = ['main']
import pygame
import pygame_menu
from pygame_menu.examples import create_example_window
from typing import Tuple, Optional
# Constants and global variables
FPS = 60
WINDOW_SIZE = ... |
dcartman/pygame-menu | pygame_menu/examples/other/__init__.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLES / OTHER
Example file directory.
"""
|
dcartman/pygame-menu | test/test_widget_table.py | <gh_stars>0
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - TABLE
Test Table widget.
"""
__all__ = ['TableWidgetTest']
from test._utils import MenuUtils, surface, PYGAME_V2, BaseTest
import pygame
import pygame_menu
class TableWidgetTest(BaseTest):
def test_table(self) -> None:
... |
dcartman/pygame-menu | test/test_selection.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET SELECTION.
Test widget selection effects.
"""
__all__ = ['SelectionTest']
from test._utils import MenuUtils, surface, BaseTest
import copy
from pygame_menu.widgets import Button
from pygame_menu.widgets.selection import LeftArrowSelection, RightAr... |
dcartman/pygame-menu | pygame_menu/widgets/selection/simple.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
SIMPLE
Simple selection effect.
"""
__all__ = ['SimpleSelection']
import pygame
import pygame_menu
from pygame_menu.widgets.core import Selection
class SimpleSelection(Selection):
"""
This selection effect only tells widget to apply selection color ... |
dcartman/pygame-menu | test/test_widget_progressbar.py | <gh_stars>0
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - PROGRESSBAR
Test ProgressBar widget.
"""
__all__ = ['ProgressBarWidgetTest']
from test._utils import MenuUtils, surface, BaseTest, PYGAME_V2
import pygame_menu
from pygame_menu.widgets.core.widget import WidgetTransformationNotImple... |
dcartman/pygame-menu | pygame_menu/widgets/widget/surface.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
SURFACE
Surface widget. This widget contains an external surface.
"""
__all__ = [
'SurfaceWidget',
'SurfaceWidgetManager'
]
import pygame
import pygame_menu
from abc import ABC
from pygame_menu.widgets.core.widget import Widget, WidgetTransformationNo... |
dcartman/pygame-menu | pygame_menu/_scrollarea.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
SCROLLAREA
ScrollArea class to manage scrolling in Menu.
"""
__all__ = [
# Main class
'ScrollArea',
# Utils
'get_scrollbars_from_position'
]
import pygame
import pygame_menu
from pygame_menu._base import Base
from pygame_menu._decorator imp... |
dcartman/pygame-menu | test/test_decorator.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST DECORATOR
Decorator API.
"""
__all__ = ['DecoratorTest']
from test._utils import MenuUtils, surface, TEST_THEME, BaseTest
import copy
import pygame
import pygame_menu
import timeit
# Configure the tests
TEST_TIME_DRAW = False
class DecoratorTest(BaseTe... |
dcartman/pygame-menu | pygame_menu/_types.py | <reponame>dcartman/pygame-menu<filename>pygame_menu/_types.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TYPES
Defines common pygame-menu types.
"""
from pygame.color import Color as __Color
from pygame.event import Event as EventType
from typing import Union, List, Tuple, Any, Callable, Sequence, Mapp... |
dcartman/pygame-menu | pygame_menu/widgets/selection/arrow_selection.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
LEFT ARROW CLASS
Selector with a left arrow on the item.
"""
__all__ = ['ArrowSelection']
import pygame
import pygame_menu
from pygame_menu.utils import assert_vector
from pygame_menu.widgets.core import Selection
from pygame_menu._types import NumberType, T... |
dcartman/pygame-menu | test/test_widget_image.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - IMAGE
Test Image widget.
"""
__all__ = ['ImageWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, BaseTest
import pygame_menu
class ImageWidgetTest(BaseTest):
def test_image_widget(self) -> None:
"""
... |
dcartman/pygame-menu | pygame_menu/widgets/core/selection.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
SELECTION
Widget selection effect.
"""
__all__ = ['Selection']
import copy
import pygame
import pygame_menu
from pygame_menu.utils import assert_color
from pygame_menu._types import NumberType, ColorType, ColorInputType, Tuple2IntType, \
Tuple4IntType, N... |
dcartman/pygame-menu | pygame_menu/font.py | <reponame>dcartman/pygame-menu
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
FONTS
Menu fonts.
"""
__all__ = [
# Fonts path included in resources
'FONT_8BIT',
'FONT_BEBAS',
'FONT_COMIC_NEUE',
'FONT_DIGITAL',
'FONT_FRANCHISE',
'FONT_FIRACODE',
'FONT_FIRACODE_BOLD',
'FONT... |
dcartman/pygame-menu | test/test_widget_rangeslider.py | <gh_stars>0
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - RANGE SLIDER
Test RangeSlider widget.
"""
__all__ = ['RangeSliderWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, BaseTest
import pygame
import pygame_menu
import pygame_menu.controls as ctrl
from pygame_me... |
dcartman/pygame-menu | pygame_menu/examples/other/scrollbar.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - USE SCROLLBAR WIDGET
Shows how the ScrollBar can be used on a surface.
"""
__all__ = ['main']
import pygame
import pygame_menu
from pygame_menu.examples import create_example_window
from pygame_menu.utils import make_surface
from pygame_menu.widgets... |
dcartman/pygame-menu | pygame_menu/widgets/selection/highlight.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
HIGHLIGHT
Widget selection highlight box effect.
"""
__all__ = ['HighlightSelection']
import pygame
import pygame_menu
from pygame_menu.widgets.core import Selection
from pygame_menu._types import NumberType
class HighlightSelection(Selection):
"""
... |
dcartman/pygame-menu | test/test_widget_selector.py | <reponame>dcartman/pygame-menu
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - SELECTOR
Test Selector widget.
"""
__all__ = ['SelectorWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, BaseTest
import pygame_menu
import pygame_menu.controls as ctrl
class SelectorWidg... |
dcartman/pygame-menu | test/test_version.py | <filename>test/test_version.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST VERSION
Test version management.
"""
__all__ = ['VersionTest']
from test._utils import BaseTest
import pygame_menu
class VersionTest(BaseTest):
def test_version(self) -> None:
"""
Test version.
... |
dcartman/pygame-menu | pygame_menu/__pyinstaller/hook-pygame_menu.py | <reponame>dcartman/pygame-menu
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
PYGAME-MENU HOOK
Used by Pyinstaller.
"""
import os
# noinspection PyProtectedMember
from pygame_menu import __file__ as pygame_menu_main_file
# Get pygame_menu's folder
pygame_menu_folder = os.path.dirname(os.path.abspath(pygam... |
dcartman/pygame-menu | pygame_menu/widgets/selection/__init__.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
SELECTION
This module contains the widget highlight effects.
"""
from pygame_menu.widgets.selection.highlight import HighlightSelection
from pygame_menu.widgets.selection.left_arrow import LeftArrowSelection
from pygame_menu.widgets.selection.none import NoneSe... |
dcartman/pygame-menu | test/test_widget_frame.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - FRAME
Test Frame. Frame is the most complex widget as this interacts with menu, modifies
its layout and contains other widgets.
"""
__all__ = ['FrameWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, test_reset_surface, \
... |
dcartman/pygame-menu | test/__init__.py | <filename>test/__init__.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST
This directory contains all project tests files.
"""
|
dcartman/pygame-menu | pygame_menu/widgets/core/__init__.py | <reponame>dcartman/pygame-menu<filename>pygame_menu/widgets/core/__init__.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
CORE
This module contains the widget core classes.
"""
from pygame_menu.widgets.core.widget import Widget
from pygame_menu.widgets.core.selection import Selection
|
dcartman/pygame-menu | test/test_sound.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST SOUND
Test sound management.
"""
__all__ = ['SoundTest']
from test._utils import MenuUtils, BaseTest
import copy
import pygame_menu
class SoundTest(BaseTest):
def setUp(self) -> None:
"""
Setup sound engine.
"""
sel... |
dcartman/pygame-menu | test/test_widget_scrollbar.py | <filename>test/test_widget_scrollbar.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - SCROLLBAR
Test ScrollBar widget.
"""
__all__ = ['ScrollBarWidgetTest']
from test._utils import surface, PygameEventUtils, WINDOW_SIZE, BaseTest, MenuUtils
import pygame
from pygame_menu.locals import ORIE... |
dcartman/pygame-menu | test/test_widget_menubar.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST WIDGET - MENUBAR
Test MenuBar widget.
"""
__all__ = ['MenuBarWidgetTest']
from test._utils import MenuUtils, surface, PygameEventUtils, BaseTest
import pygame
import pygame_menu
import pygame_menu.controls as ctrl
from pygame_menu.locals import POSITION... |
dcartman/pygame-menu | pygame_menu/widgets/selection/none.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
NONE
No selection effect.
"""
__all__ = ['NoneSelection']
import pygame
import pygame_menu
from pygame_menu.widgets.selection.simple import SimpleSelection
class NoneSelection(SimpleSelection):
"""
No selection effect.
"""
def __init__(self... |
dcartman/pygame-menu | pygame_menu/examples/__init__.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLES
Example file directory.
"""
__all__ = ['create_example_window']
import pygame
import sys
from typing import Tuple
_PYGAME_ICON = [None]
# noinspection PyTypeChecker
def create_example_window(
title: str,
window_size: Tuple[int, int... |
dcartman/pygame-menu | pygame_menu/events.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EVENTS
Menu events definition and locals.
"""
__all__ = [
# Class
'MenuAction',
# Utils
'is_event',
# Menu events
'BACK',
'CLOSE',
'EXIT',
'NONE',
'RESET',
# Last menu events
'MENU_LAST_DISABLE_UPDATE',
'M... |
dcartman/pygame-menu | pygame_menu/__pyinstaller/__init__.py | <reponame>dcartman/pygame-menu<filename>pygame_menu/__pyinstaller/__init__.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
PYINSTALLER
Module for pyinstaller.
"""
__all__ = ['get_hook_dirs']
import os
from typing import List
def get_hook_dirs() -> List[str]:
"""
Return hook dirs to PyInstaller.... |
dcartman/pygame-menu | test/test_base.py | <gh_stars>0
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST BASE
Test base class.
"""
__all__ = ['BaseTest']
from test._utils import BaseTest as _BaseTest
# noinspection PyProtectedMember
from pygame_menu._base import Base
class BaseTest(_BaseTest):
def test_counter(self) -> None:
"""
... |
dcartman/pygame-menu | pygame_menu/widgets/widget/__init__.py | <filename>pygame_menu/widgets/widget/__init__.py
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
WIDGET
This module contains the widgets of pygame-menu.
"""
from pygame_menu.widgets.widget.button import Button
from pygame_menu.widgets.widget.colorinput import ColorInput
from pygame_menu.widgets.widget.dropse... |
dcartman/pygame-menu | pygame_menu/examples/other/dynamic_button_append.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - DYNAMIC BUTTON
Menu with dynamic buttons.
"""
__all__ = ['main']
import pygame_menu
from pygame_menu.examples import create_example_window
from random import randrange
surface = create_example_window('Example - Dynamic Button Append', (600, 400))
m... |
dcartman/pygame-menu | test/test_examples.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST EXAMPLES
Test example files.
"""
__all__ = ['ExamplesTest']
from test._utils import BaseRSTest, MenuUtils, PygameEventUtils, \
test_reset_surface
import pygame
import pygame_menu
import pygame_menu.examples.game_selector as game_selector
import pyga... |
dcartman/pygame-menu | pygame_menu/examples/window_resize.py | <reponame>dcartman/pygame-menu
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - WINDOW RESIZE
Resize the menu when the window is resized.
"""
import pygame
import pygame_menu
pygame.init()
surface = pygame.display.set_mode((600, 400), pygame.RESIZABLE)
pygame.display.set_caption("Example resizable... |
dcartman/pygame-menu | pygame_menu/widgets/widget/none.py | <gh_stars>0
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
NONE WIDGET
None widget definition.
"""
__all__ = [
'NoneWidget',
'NoneWidgetManager'
]
import pygame
import pygame_menu
from abc import ABC
from pygame_menu.utils import make_surface
from pygame_menu.widgets.core.widget import Widget, Wid... |
dcartman/pygame-menu | docs/generate_resources.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
GENERATE RESOURCES
Generate resources for docs.
"""
__all__ = ['save_font_image', 'generate_fonts_doc']
import pygame
import pygame_menu
pygame.init()
def save_font_image(
font_name: str,
text: str,
filename: str,
font_size: ... |
dcartman/pygame-menu | pygame_menu/widgets/selection/right_arrow.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
RIGHT ARROW CLASS
Selector with a right arrow on the item.
"""
__all__ = ['RightArrowSelection']
import pygame
import pygame_menu
from pygame_menu.widgets.selection.arrow_selection import ArrowSelection
from pygame_menu._types import Tuple2IntType, NumberTyp... |
dcartman/pygame-menu | pygame_menu/widgets/widget/image.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
IMAGE
Image widget class, adds a simple image.
"""
__all__ = [
'Image',
'ImageManager'
]
from abc import ABC
from io import BytesIO
from pathlib import Path
import pygame
import pygame_menu
from pygame_menu.baseimage import BaseImage
from pygame_menu... |
dcartman/pygame-menu | test/test_font.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
TEST FONT
Test font management.
"""
__all__ = ['FontTest']
from pathlib import Path
from test._utils import MenuUtils, BaseTest
import pygame
import pygame_menu
class FontTest(BaseTest):
def test_font_load(self) -> None:
"""
Load a font... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.