text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
# # The Python Imaging Library. # $Id$ # # a simple Qt image interface. # # history: # 2006-06-03 fl: created # 2006-06-04 fl: inherit from QImage instead of wrapping it # 2006-06-05 fl: removed toimage helper; move string support to ImageQt # 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com) # # Copyr...
shivamtripathi599/college_project
.venv/lib/python3.9/site-packages/PIL/ImageQt.py
.py
7506da745d8b839f
7
0
# # The Python Imaging Library. # $Id$ # # sequence support classes # # history: # 1997-02-20 fl Created # # Copyright (c) 1997 by Secret Labs AB. # Copyright (c) 1997 by Fredrik Lundh. # # See the README file for information on usage and redistribution. # ## from __future__ import annotations from typing import ...
shivamtripathi599/college_project
.venv/lib/python3.9/site-packages/PIL/ImageSequence.py
.py
831d84bf2c0f0448
7
0
# # The Python Imaging Library. # $Id$ # # global image statistics # # History: # 1996-04-05 fl Created # 1997-05-21 fl Added mask; added rms, var, stddev attributes # 1997-08-05 fl Added median # 1998-07-05 hk Fixed integer overflow error # # Notes: # This class shows how to implement delayed evaluation of att...
shivamtripathi599/college_project
.venv/lib/python3.9/site-packages/PIL/ImageStat.py
.py
4b8dc567cf6bfeee
7
0
# # The Python Imaging Library. # $Id$ # # a Windows DIB display interface # # History: # 1996-05-20 fl Created # 1996-09-20 fl Fixed subregion exposure # 1997-09-21 fl Added draw primitive (for tzPrint) # 2003-05-21 fl Added experimental Window/ImageWindow classes # 2003-09-05 fl Added fromstring/tostring me...
shivamtripathi599/college_project
.venv/lib/python3.9/site-packages/PIL/ImageWin.py
.py
2d3d39c3cfef4df4
7
0
#!/usr/bin/env python3 from random import randrange COEFICIENTES = (2, 9, 8, 7, 6, 3, 4) def calculate_digito_verificador(cedula: int) -> int: """ Get verifier digit of uruguayan identification document. Each of the 7 digits (padded with leading zeros) is multiplied by its coefficient in (2, 9, 8, 7...
carlosplanchon/gencedula
gencedula/gencedula.py
.py
94ad2c093a5b53ab
7
0
import dataclasses import datetime from typing import Optional from gumo.core import EntityKey from gumo.core import EntityKeyFactory @dataclasses.dataclass(frozen=True) class PullTask: """ Task payload to process at enqueue time and lease time """ key: EntityKey queue_name: str payload: Opti...
gumo-py/gumo-pullqueue
gumo/pullqueue/domain/__init__.py
.py
b10be1c9b4781033
7
0
from esys.escript import * import numpy as np from math import floor from scipy.interpolate import RegularGridInterpolator from .datamapping import mapToDomain from esys.escript.linearPDEs import LinearSinglePDE, SolverOptions from esys.escript.pdetools import Locator def setupERTPDE(domain, poisson=True): """ ...
LutzGross/fingal
bin/fingal/ipmodel.py
.py
1f62351aa4cbc487
7.35
4
from esys.escript import * from esys.escript.pdetools import ArithmeticTuple, PCG from .tools import setupERTPDE class SIPSolver(object): """ a solver complex electrical conductivity problems using Schur complement. """ def __init__(self, dom, surface_mask = None, rtol=1e-8, atol=0, pd...
LutzGross/fingal
bin/fingal/sipforward.py
.py
b3092c2c1199cce1
7.35
4
from pathlib import Path from yaml import safe_load from .logger import log_arbiter logger = log_arbiter(__name__) # readme/__main__.py -> repo root REPO_ROOT = Path(__file__).resolve().parent.parent RESUME_YML = REPO_ROOT / "resume.yml" README = REPO_ROOT / "README.md" START = "<!-- PROJECTS:START -->" END = "<!-...
extinctCoder/extinctCoder
readme/__main__.py
.py
955c48f3007723e4
7.15
1
from logging import DEBUG, Formatter, StreamHandler, getLogger from sys import stdout LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" def console_handler(): """Create a StreamHandler that logs to stdout with LOG_FORMAT.""" tmp_handler = StreamHandler(stdout) tmp_handler.setFormatter(F...
extinctCoder/extinctCoder
readme/logger.py
.py
73564603ad0baf7b
7.15
1
from logging import DEBUG, Formatter, StreamHandler, getLogger from sys import stdout LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" def console_handler(): """ Creates a StreamHandler that logs to stdout with a custom LOG_FORMAT format. Returns: StreamHandler: The created ha...
extinctCoder/extinctCoder
resume/builder/logger.py
.py
2a889e66e63730c1
7.15
1
"""Blog admin""" from django.contrib.admin import ModelAdmin, site from blog.models import Image, Post, Tag class PostAdmin(ModelAdmin): """Blog post model admin controller""" prepopulated_fields = {"slug": ("title",)} exclude = ["author"] def save_model(self, request, obj: Post, form, change): ...
myth/overflow
src/blog/admin.py
.py
f1d3bb0807e329db
7.3
3
"""Blog models""" from django.contrib.auth import get_user_model from django.db import models from django.urls import reverse from django.utils.text import slugify from markdown2 import markdown # type: ignore class Tag(models.Model): """Blog tag model""" name = models.CharField(max_length=256) def __...
myth/overflow
src/blog/models.py
.py
771f751c4e9125db
7.3
3
"""Git utilities""" import subprocess from logging import getLogger LOG = getLogger(__name__) def _run_git(*args: str) -> str: result = subprocess.run( ["git", *args], capture_output=True, text=True, check=True, ) return result.stdout.strip() def git_describe() -> str: ...
myth/overflow
src/lib/utils/git.py
.py
9bb022f94117b6c3
7.3
3
"""FFmpeg Updater module.""" import asyncio from loguru import logger from ffmpeg_updater_win.app.constants import APP_VERSION from ffmpeg_updater_win.app.exceptions import FFmpegUpdaterError from ffmpeg_updater_win.app.models.config import UpdaterConfig from ffmpeg_updater_win.app.tasks.managers import TaskManager ...
tropicoo/ffmpeg-updater-win
src/ffmpeg_updater_win/app/core/ffmpeg_updater.py
.py
ac98946615992872
7.39
5
"""Zip Extractor module.""" import asyncio from collections.abc import AsyncGenerator from pathlib import Path import aiofiles from loguru import logger from ffmpeg_updater_win.app.enums import RequiredFfbinaryType from ffmpeg_updater_win.app.models.config import UpdaterConfig from ffmpeg_updater_win.app.tasks.valid...
tropicoo/ffmpeg-updater-win
src/ffmpeg_updater_win/app/core/zip_extractor.py
.py
f11b3b2b2f870669
7.39
5
""" initialise a text database and profile """ import tempfile import shutil from aiida.manage.fixtures import fixture_manager import pytest @pytest.fixture(scope='session') def aiida_profile(): """setup a test profile for the duration of the tests""" with fixture_manager() as fixture_mgr: yield fixt...
mpds-io/mpds-aiida
conftest.py
.py
5210f57710158a8b
7.8
3
import os import glob import shutil from setuptools.command.build_py import build_py class CustomBuild(build_py): def run(self): _setup_once() super().run() def _setup_once(): """ Copy calc templates into ~/.aiida """ print("Running one-time build step...") # Path ~/.aiida ...
mpds-io/mpds-aiida
install.py
.py
27ac83f10cb1f559
7.3
3
# Copyright (c) Andrey Sobolev and Evgeny Blokhin, 2020-2026 # Distributed under MIT license, see LICENSE file. # TODO fully support standard MPDS archives import os import sys import shutil from distutils import spawn import subprocess from enum import StrEnum, unique import numpy as np from aiida.orm import load_n...
mpds-io/mpds-aiida
mpds_aiida/export.py
.py
95faddfbeca8f77b
7.3
3
""" These are some utils for handling the CRYSTAL calculation inputs https://www.crystal.unito.it """ def assert_conforming_input(content): return 'PBE0' in content \ and 'XLGRID' in content \ and 'TOLLDENS\n8' in content \ and 'TOLLGRID\n16' in content \ and 'TOLDEE\n9' in content...
mpds-io/mpds-aiida
mpds_aiida/inputs.py
.py
279c17b481a341aa
7.3
3
""" This is the module to quickly (re-)run the CRYSTAL properties locally at the AiiDA master, however outside of the AiiDA graph NB ln -s /root/bin/Pproperties /usr/bin/Pproperties """ import os import time import random import shutil import subprocess from configparser import ConfigParser import warnings import strin...
mpds-io/mpds-aiida
mpds_aiida/properties.py
.py
5ad236d2fab8c067
7.3
3
#!/home/andrey/miniconda3/envs/mpds-aiida/bin/python """ A mock CRYSTAL executable for running MPDS tests """ import pathlib import shutil from hashlib import md5 from mpds_aiida.tests import TEST_DIR def checksum(file_name, cs=md5): files = (file_name, 'fort.34') data = [] for file_name in files: ...
mpds-io/mpds-aiida
mpds_aiida/tests/mock/crystal.py
.py
70c4418bdca5dfb0
7.8
3
# Copyright (c) Andrey Sobolev, 2020. Distributed under MIT license """ The MPDS workflow using AiiDA StructureData object """ from aiida_crystal_dft.utils import get_data_class from .crystal import MPDSCrystalWorkChain class AiidaStructureWorkChain(MPDSCrystalWorkChain): @classmethod def define(cls, spec):...
mpds-io/mpds-aiida
mpds_aiida/workflows/aiida.py
.py
5e95fdf2ef8fc085
7.3
3
# Copyright (c) Andrey Sobolev, 2020. Distributed under MIT license """ The MPDS workflow using structure from CIF file """ from aiida_crystal_dft.utils import get_data_class from absolidix_backend.datasources.fmt import detect_format from absolidix_backend.structures.cif_utils import cif_to_ase from .crystal import...
mpds-io/mpds-aiida
mpds_aiida/workflows/cif.py
.py
5bfd270fb259482f
7.3
3
# Copyright (c) Andrey Sobolev, 2020. Distributed under MIT license """ The MPDS workflow for AiiDA that gets structure with MPDS query """ import os import time import random import numpy as np from httplib2 import ServerNotFoundError from aiida_crystal_dft.utils import get_data_class from mpds_client import MPDSDa...
mpds-io/mpds-aiida
mpds_aiida/workflows/crystal_mpds.py
.py
e9349222a60a3437
7.3
3
import numpy as np from aiida.engine import ExitCode, ToContext, WorkChain from aiida.orm import ( ArrayData, Bool, Dict, Int, RemoteData, Str, StructureData, load_code, ) from aiida_fleur.data.fleurinpmodifier import FleurinpModifier from aiida_fleur.tools.common_fleur_wf import get_inp...
mpds-io/mpds-aiida
mpds_aiida/workflows/fleur_phonopy.py
.py
1f75d1b13548bd5c
7.3
3
""" A sample script running MPDS Aiida workflow """ import os import yaml import pandas as pd from mpds_client import MPDSDataRetrieval from aiida.plugins import DataFactory from aiida.orm import Code from aiida.engine import submit from mpds_aiida.workflows.crystal import MPDSCrystalWorkchain def get_formulae(): ...
mpds-io/mpds-aiida
scripts/run_template.py
.py
13c7adae70fa26bc
7.3
3
# -*- coding: utf-8-*- import re WORDS = ["MATHS", "ARITHMETIC"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech mic -- ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Arithmetic.py
.py
30de4f012622550b
7
0
# -*- coding: utf-8-*- import re WORDS = ["BIRTHDAY"] def handle(text, mic, speaker, profile, visionProcess): speaker.clean_and_say( "Getting the list of people who have birthdays today") # contains names birthday_list = r.today_birthday_list() for birthday_name in birthday_list: spe...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Birthday.py
.py
8520acfe7e1111ae
7
0
# -*- coding: utf-8-*- import random import re # WORDS = ["OPEN", "CLOSE"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/BrowserControl.py
.py
608d9bedb7c11973
7
0
# -*- coding: utf-8-*- import re import os import httplib2 from apiclient.discovery import build from oauth2client.file import Storage from oauth2client.client import OAuth2WebServerFlow from oauth2client import tools from client.plugins import rethinkdb_connector from client.plugins.utilities import jasperpath WORD...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Contacts.py
.py
e14930a3b51c62ea
7
0
# -*- coding: utf-8-*- import re import httplib2 from apiclient import discovery from client.plugins import gmail_controller from client.plugins import rethinkdb_connector WORDS = ["EMAIL"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by rel...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Email.py
.py
b4e1bea66a8d731e
7
0
# -*- coding: utf-8-*- import random import re import requests WORDS = ["JOKE"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/InternetJokes.py
.py
9e9c2f1111074af3
7
0
# -*- coding: utf-8-*- import random import re WORDS = ["MEANING", "OF", "LIFE"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Life.py
.py
d38052eeb3118f24
7
0
# -*- coding: utf-8-*- import re from client import brain from client import conversation WORDS = ["RELOAD", "MODULES"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- u...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/ModuleReloader.py
.py
9d0f6fb9178e3549
7
0
# -*- coding: utf-8-*- # https://newsapi.org/#documentation import re import requests import json import os WORDS = ["NEWS"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/MyNews.py
.py
a508e672530c8a42
7
0
# -*- coding: utf-8-*- import re import facebook #WORDS = ["FACEBOOK", "NOTIFICATION"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, with a summary of the user's Facebook notifications, including a count and details related to ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Notifications.py
.py
398b24f227f2e360
7
0
# -*- coding: utf-8-*- import re import requests import os from client.plugins.utilities import jasperpath WORDS = ["WEATHER"] def findWholeWord(w): return re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE).search def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-inp...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/OpenWeather.py
.py
cf933f639f9ef769
7
0
# -*- coding: utf-8-*- import random import re WORDS = ["WHO", "IS", "SHREYASH"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Shreyash.py
.py
46f54eb9ee2a9fb9
7
0
# -*- coding: utf-8-*- import re WORDS = ["SLEEP"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech text, by relaying the meaning of life. Arguments: text -- user-input, typically transcribed speech mic -- used to intera...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Sleep.py
.py
3c48e6364dc153e2
7
0
# -*- coding: utf-8-*- import datetime import re from assistant.plugins.utilities.app_utils import getTimezone WORDS = ["TIME"] def handle(text, mic, speaker, profile, visionProcess): """ Reports the current time based on the user's timezone. Arguments: text -- user-input, typically tran...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Time.py
.py
bf4db62c341b611f
7
0
# -*- coding: utf-8-*- import re import threading import time from client.plugins.utilities import jasperpath WORDS = ["TIMER"] class Timer(threading.Thread): # subclass Thread # make it possible to pass the time in seconds that we want the timer to # run def __init__(self, seconds, speaker): s...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Timer.py
.py
c0c2c1e95032e7cf
7
0
# -*- coding: utf-8-*- # from sys import maxint import random WORDS = [] PRIORITY = -(999) def handle(text, mic, speaker, profile, visionProcess): """ Reports that the user has unclear or unusable input. Arguments: text -- user-input, typically transcribed speech mic -- used to ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Unclear.py
.py
d4fe5dfbca53e00a
7
0
# -*- coding: utf-8-*- import re from client.plugins import youtube_controller from client.plugins.utilities import diagnose from client.plugins.utilities.vlcclient import VLCClient WORDS = ["YOUTUBE"] def handle(text, mic, speaker, profile, visionProcess): """ Responds to user-input, typically speech te...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/Youtube.py
.py
47166f0142b2e188
7
0
# -*- coding: utf-8-*- import re WORDS = ["CALL"] def handle(text, mic, profile, linphone): """ Reports the current time based on the user's timezone. Arguments: text -- user-input, typically transcribed speech mic -- used to interact with the user (for both input and output) ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/linphoneCalling.py
.py
edef8210105d7b20
7
0
# -*- coding: utf-8-*- # mattcurrycom/jasper-modules-mdc forked from # affordablewindurbines/python-modules import re import psutil import platform import datetime WORDS = ["STATUS"] def isValid(text): """ Returns True if the text is related to Jasper's status. Arguments: text -- user-in...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/status.py
.py
f01f533302a4e1b1
7
0
# -*- coding: utf-8-*- import random import re import os import signal import psutil from subprocess import check_output WORDS = ["QUIT", "OFF", "EXIT"] def kill_process(name): for rethinkDBprocessID in ( map(int, check_output(["pidof", name]).split())): # print (rethinkDBprocessID) o...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/turnOff.py
.py
d5dcfb80549092de
7
0
# -*- coding: utf-8-*- from __future__ import print_function import re WORDS = ["VISION"] def handle(text, mic, speaker, profile, vision_dict): if re.search(r'\bshow vision\b', text, re.IGNORECASE): vision_dict['vision_output_enabled'] = 1 if re.search(r'\bhide vision\b', text, re.IGNORECASE): ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant-modules/visionControl.py
.py
d9c5263d31d95b00
7
0
# -*- coding: utf-8-*- import queue import atexit from apscheduler.schedulers.background import BackgroundScheduler import logging import time import threading class Notifier(object): class Timer(threading.Thread): # subclass Thread # make it possible to pass the time in seconds that we want the timer ...
shreyashag/ipawac_assistant
ipawac_assistant/assistant/notifier.py
.py
ba503a351b65731f
7
0
#!/usr/bin/env python3 import argparse import logging import pyivia import inspect import json import getpass logger = logging.getLogger("pyivia") cli_config = { 'json_format' : True } def get_functions(obj): r""" Get functions from the obj that can be called via the CLI """ results = { } f...
lachlan-ibm/pyivia
pyivia/__main__.py
.py
39f5555f180262a3
7
0
"""" @copyright: IBM """ import logging from pyivia.util.model import DataObject from pyivia.util.restclient import RESTClient CLI_COMMAND = "/core/cli" logger = logging.getLogger(__name__) class CLICommands(object): def __init__(self, base_url, username, password): super(CLICommands, self).__init__...
lachlan-ibm/pyivia
pyivia/core/system/clicommands.py
.py
f7e204b4db85e442
7
0
""" @copyright: IBM """ import logging from .containers.volumes import Volumes from .containers.images import Images from .containers.registry import Registry from .containers.deployments import Deployments from .containers.metadata import Metadata from .containers.healthcheck import HealthCheck logger = logging.ge...
lachlan-ibm/pyivia
pyivia/core/system/containermanagement.py
.py
ab2f0c97c91b91e9
7
0
# coding: utf-8 """OnedataFS PyFilesystem utility functions.""" from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals __author__ = "Bartek Kryza" __copyright__ = "Copyright (C) 2019 ACK CYFRONET AGH" __license__ = ( "This software is released under th...
onedata/fs-onedatafs
fs/onedatafs/_util.py
.py
4ed6d9065b6423e0
7
0
# coding: utf-8 """Defines the OnedataFS opener.""" from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals __all__ = ["OnedataFSOpener"] from fs.opener import Opener from six.moves.urllib.parse import parse_qs, urlparse from ._onedatafs import OnedataFS...
onedata/fs-onedatafs
fs/onedatafs/opener.py
.py
46b9ba883f50878d
7
0
# coding: utf-8 """OnedataFS PyFilesystem unit tests.""" from __future__ import absolute_import from __future__ import unicode_literals from fs.onedatafs._util import stat_to_permissions class StatMock: """Mock for Stat class.""" atime = 0 mtime = 0 ctime = 0 gid = 0 uid = 0 mode = 0 ...
onedata/fs-onedatafs
tests/unit_tests.py
.py
1594224172e5db34
7.5
0
#!/usr/bin/python3 import logging import argparse import os import socket import subprocess import sys import traceback import time import shutil import re import classad2 as classad logger = logging.getLogger("register") logger.setLevel(logging.ERROR + 10) DEFAULT_PORT = "9618" WEBAPP_HOST = "os-registry.openscien...
opensciencegrid/open-science-pool-registry
register.py
.py
65226a1ff46e4cd2
7
0
import re try: # py3 from configparser import ConfigParser except ImportError: # py2 from ConfigParser import ConfigParser from typing import Dict, List import xml.etree.ElementTree as ET import http.client import urllib.error import urllib.request from flask import current_app, request from .exceptions i...
opensciencegrid/open-science-pool-registry
registry/sources.py
.py
f12d7f81fbcd0717
7
0
from numba import njit import numpy as np from math import floor,sqrt @njit def descritized_spike_train(spike_times, bins): has_spk = np.digitize(spike_times,bins) dst = np.zeros(bins.shape,dtype=np.bool) dst[has_spk] = True return dst @njit def descritized_spike_raster(event_times,dst,dt,Wn): ...
matthewperkins/TDTNex
TDTNex/OptoTag_tools.py
.py
d37cf9e2edc9dec4
7
0
#!/usr/bin/env python3 """Build the redirect-only site that gets published to the gh-pages branch. The APTrust User Guide now lives on the unified documentation site at https://docs.aptrust.org/user-guide/, which is built by the APTrust/aptrust-docs repo from the markdown in this repo's docs/ directory. The old stand...
APTrust/userguide
scripts/build_redirects.py
.py
2cb6413ef9150169
7.35
4
""" """ import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sympy import * from sympy.matrices import Matrix,eye from moro.transformations import * from moro.util import * __all__ = ["plot_euler", "draw_uv", "draw_uvw"] def plot_euler(phi,theta,psi,seq="zxz"): fig = plt.figure() ax =...
JorgeDeLosSantos/moro
moro/plotting.py
.py
4df4fec303cf1ff1
7
0
"""Three.js visualization backend and HTML serialization helpers.""" import json import re import uuid from importlib.resources import files from typing import Any import numpy as np from .data import SceneData from .style import VisualizationStyle _PLACEHOLDER_PATTERN = re.compile(r"__[A-Z][A-Z0-9_]*__") def _...
JorgeDeLosSantos/moro
moro/visualization/threejs_backend.py
.py
d3457b326e0a45bf
7
0
"""Public orchestrator for robot visualization.""" from moro.core import Robot from .evaluation import evaluate_robot from .matplotlib_backend import MatplotlibBackend from .threejs_backend import ThreeJSBackend class RobotVisualizer: """Render a :class:`moro.core.Robot` using the available backends.""" de...
JorgeDeLosSantos/moro
moro/visualization/visualizer.py
.py
706558850ccf5952
7
0
#!/usr/bin/env python3 """ Script to run reachability tests on AWS WAF using the project's endpoints. The endpoints are determined with Flask's app configuration. Usage: scripts/waffles.py list [options] scripts/waffles.py iron [options] [iron-option] Options: --app-libs=<libs_location>: Project's l...
cds-snc/notification-utils
.github/actions/waffles/waffles.py
.py
0d72cca0aa26fd6d
7.3
3
""" This module stores daily notification counts and annual limit statuses for a service in Redis using a hash structure: annual-limit: { {service_id}: { status: { near_sms_limit: Datetime, near_email_limit: Datetime, over_sms_limit: Datetime, over_email_limi...
cds-snc/notification-utils
notifications_utils/clients/redis/annual_limit.py
.py
dae08bd1392885ad
7.3
3
"""This module is used to calculate the bounce rate for a service. It uses Redis to store the total number of hard bounces""" from datetime import datetime from notifications_utils.clients.redis.redis_client import RedisClient TWENTY_FOUR_HOURS_IN_SECONDS = 24 * 60 * 60 DEFAULT_VOLUME_THRESHOLD = 1000 BR_CRITICAL_PE...
cds-snc/notification-utils
notifications_utils/clients/redis/bounce_rate.py
.py
d231b0f998cf80f1
7.3
3
import numbers import uuid from time import time from typing import Any, Dict from flask import current_app from flask_redis import FlaskRedis # expose redis exceptions so that they can be caught from redis.exceptions import RedisError # noqa def prepare_value(val): """ Only bytes, strings and numbers (int...
cds-snc/notification-utils
notifications_utils/clients/redis/redis_client.py
.py
fa194586f335239c
7.3
3
from collections import OrderedDict from functools import lru_cache class Columns(dict): def __init__(self, row_dict): super().__init__({Columns.make_key(key): value for key, value in row_dict.items()}) @classmethod def from_keys(cls, keys): return cls({key: key for key in keys}) def...
cds-snc/notification-utils
notifications_utils/columns.py
.py
6ef75319531e945d
7.3
3
from collections import namedtuple from datetime import datetime, time, timedelta import pytz from notifications_utils.timezones import convert_utc_to_est, utc_string_to_aware_gmt_datetime LETTER_PROCESSING_DEADLINE = time(17, 30) CANCELLABLE_JOB_LETTER_STATUSES = [ "created", "cancelled", "virus-scan-fa...
cds-snc/notification-utils
notifications_utils/letter_timings.py
.py
63fe285059cd6762
7.3
3
import logging import logging.handlers import re import sys from itertools import product from pathlib import Path from time import monotonic from typing import Any from flask import g, request from flask.ctx import has_request_context from pythonjsonlogger.jsonlogger import JsonFormatter as BaseJSONFormatter LOG_FOR...
cds-snc/notification-utils
notifications_utils/logging.py
.py
33d2fdfc228aa9ba
7.3
3
import io import PyPDF2 from PyPDF2 import PdfFileWriter from PyPDF2.utils import PdfReadError def pdf_page_count(src_pdf): """ Returns number of pages in a pdf file :param PyPDF2.PdfFileReader src_pdf: A File object or an object that supports the standard read and seek methods """ try: ...
cds-snc/notification-utils
notifications_utils/pdf.py
.py
8db90c47ef52f745
7.3
3
from flask import abort, current_app, request from flask.wrappers import Request class NotifyRequest(Request): """ A custom Request class, implementing extraction of zipkin headers used to trace request through cloudfoundry as described here: https://docs.cloudfoundry.org/concepts/http-routing.html#zipkin...
cds-snc/notification-utils
notifications_utils/request_helper.py
.py
ee28be5d0f00333a
7.3
3
import unicodedata from typing import Set class SanitiseText: ALLOWED_CHARACTERS: Set = set() REPLACEMENT_CHARACTERS = { "–": "-", # EN DASH (U+2013) "—": "-", # EM DASH (U+2014) "…": "...", # HORIZONTAL ELLIPSIS (U+2026) "‘": "'", # LEFT SINGLE QUOTATION MARK (U+2018) ...
cds-snc/notification-utils
notifications_utils/sanitise_text.py
.py
5bd9a2fe829652c5
7.3
3
"""This module provides platform compatible format codes for strftime. By default, Python does not check the format codes sent to strftime: these are sent directly to the platform's implementation. This leads developers to use platform specific format codes for strftime that can't easily run on other platforms that ar...
cds-snc/notification-utils
notifications_utils/strftime_codes.py
.py
5d2a26695870f273
7.3
3
import argparse import csv import math import re import sys import unicodedata from collections import defaultdict from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path import yaml REPO_ROOT = Path(__file__).resolve().parents[2] DEFAULT_ALLOW_LIST_PATH = REPO_ROOT / "scripts/...
cds-snc/notification-utils
scripts/sms_pricing/international_billing_rates_updater.py
.py
c14ba1f7c9ab647a
7.3
3
""" Utilities for using a "fields" structure to rename fields and decode fields values. The fields structure looks is a dictionary that looks like this: field1: name: 'New name for field1' field2: name: "New name for field2" encoding: name: "Field2 names" # Name of the new field created out of ...
OCHA-DAP/hdx-ext-scraper-unhcr-population
fields.py
.py
4ea08abda8bd677a
7.15
1
# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Abstract Base Classes (ABCs) according to PEP 3119.""" import types from _weakrefset import WeakSet # Instance of old-style class class _C: pass _InstanceType = type(_C()) def abstractmethod(funcobj): """A d...
vaishnavh/vaishnavh.github.io
venv/lib/python2.7/abc.py
.py
625ee550a5d3d9fd
7
0
""" Python 'ascii' Codec Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """ import codecs ### Codec APIs class Codec(codecs.Codec): # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. ...
vaishnavh/vaishnavh.github.io
venv/lib/python2.7/encodings/ascii.py
.py
578aa1173f7cc60d
7
0
""" Python 'base64_codec' Codec - base64 content transfer encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (mal@lemburg.com). """ import codecs, base64 ### Codec APIs def base64_encode(i...
vaishnavh/vaishnavh.github.io
venv/lib/python2.7/encodings/base64_codec.py
.py
a5b89582673fa9f0
7
0
""" Python 'bz2_codec' Codec - bz2 compression encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Adapted by Raymond Hettinger from zlib_codec.py which was written by Marc-Andre Lemburg (mal@lemburg.com). """ import ...
vaishnavh/vaishnavh.github.io
venv/lib/python2.7/encodings/bz2_codec.py
.py
a3e8a9724d384fb3
7
0
""" Generic Python Character Mapping Codec. Use this codec directly rather than through the automatic conversion mechanisms supplied by unicode() and .encode(). Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" import codecs ### Codec APIs class...
vaishnavh/vaishnavh.github.io
venv/lib/python2.7/encodings/charmap.py
.py
1b8b5fdb36ce3bec
7
0
#coding:utf-8 """ ID: issue-441 ISSUE: https://github.com/FirebirdSQL/firebird/issues/441 TITLE: Numeric div in dialect 3 mangles data DESCRIPTION: NOTES: Results for FB 4.0 become differ from old one. Discussed with Alex, 30.10.2019. Precise value of 70000 / 1.95583 is: 35790.431683735296...
FirebirdSQL/firebird-qa
tests/bugs/core_0119_test.py
.py
e4b4fe98052910d2
7.89
5
#!/usr/bin/env python3 """ format.py: sort the tests in conformance.yaml into conformance_sorted.yaml, and format them consistently. """ import ruamel.yaml def ruamel_list(*lst): output = ruamel.yaml.CommentedSeq(lst) output.fa.set_flow_style() return output def sort_order(e): # priority order, first...
DataBiosphere/wdl-conformance-tests
format.py
.py
33b8527ef598d168
7.24
2
import hmac import base64 import hashlib from datetime import datetime, timezone, timedelta class SendbeeAuth: """Authentication class for Sendbee API""" def __init__(self, private_key): if isinstance(private_key, str): private_key = private_key.encode('utf-8') self._private_key =...
sendbee/sendbee-python-api-client
sendbee_api/auth.py
.py
897eaba29e40037c
7.24
2
import click import requests from abc import ABCMeta from sendbee_api import constants from sendbee_api.debug import Debug from sendbee_api.auth import SendbeeAuth from sendbee_api.response import Response from sendbee_api.formatter import FormatterFactory from sendbee_api.exceptions import SendbeeRequestApiException,...
sendbee/sendbee-python-api-client
sendbee_api/bind.py
.py
8989a3a9e6c4edf2
7.24
2
from sendbee_api.models import Model from sendbee_api.fields import TextField, DatetimeField, ModelField, ListField class ContactTag(Model): """Data model for contact tags""" _id = TextField(index='id', desc='UUID') _name = TextField(index='name', desc='Name') class ContactField(Model): """Data mod...
sendbee/sendbee-python-api-client
sendbee_api/contacts/models.py
.py
b56b4718e7ffacda
7.24
2
import click from dumpit import pdumpit from aenum import MultiValueEnum class DefaultQueryParams(MultiValueEnum): """Default set of query parameters.""" msg_type = 'msgtype', 'simple or extended (extended cost more credits)' protocol = 'protocol', 'Response type. Use one of the following: '\ ...
sendbee/sendbee-python-api-client
sendbee_api/query_params.py
.py
bb853ed4270f5c9c
7.24
2
from sendbee_api import constants class Response: """Response object returned from API call.""" def __init__(self, data, headers, status_code, formatter, api_request): self._data = data self._headers = headers self._model = api_request.model self.api_reguest = api_request ...
sendbee/sendbee-python-api-client
sendbee_api/response.py
.py
f988442d756c87ae
7.24
2
"""Shared fixtures for the sendbee-api test suite. Tests mock at the `requests` HTTP boundary using the `responses` library. The SDK's documented `fake_response_path` test seam is not used because its branch in `bind.py` returns a 2-tuple while `call()` unpacks 3 elements. """ import ujson import pytest import respon...
sendbee/sendbee-python-api-client
tests/conftest.py
.py
e87afd1890ab95e7
7.74
2
"""Tests for SendbeeAuth: HMAC token generation and verification.""" import base64 import hmac import hashlib from datetime import datetime, timezone import pytest from sendbee_api.auth import SendbeeAuth def test_get_auth_token_returns_base64_encoded_timestamp_dot_hmac(): """Token format is base64(<unix_ts>.<...
sendbee/sendbee-python-api-client
tests/test_auth.py
.py
38e451329df24f18
7.74
2
"""Tests for SendbeeApi construction and mixin composition.""" import pytest from sendbee_api import SendbeeApi from sendbee_api.exceptions import SendbeeRequestApiException from sendbee_api.contacts.client import Contacts from sendbee_api.conversations.client import Messages from sendbee_api.automation.client import...
sendbee/sendbee-python-api-client
tests/test_client.py
.py
9f2b4d11715fcd33
7.74
2
"""End-to-end smoke tests: one happy-path per resource mixin. The 25 endpoint methods on `SendbeeApi` are all generated by `bind_request`, which is covered in detail elsewhere. These tests verify the wiring per mixin - that each `bind_request(...)` call site declares the right `api_path`, `method`, `model`, and `Query...
sendbee/sendbee-python-api-client
tests/test_endpoints_smoke.py
.py
ea800197f9a3a970
7.74
2
"""Tests for Field subclasses: type coercion and fallback behavior.""" from datetime import datetime import pytest from sendbee_api.fields import ( Field, NumberField, RealNumberField, TextField, BooleanField, DatetimeField, ListField, ModelField, ) from sendbee_api.models import Mode...
sendbee/sendbee-python-api-client
tests/test_fields.py
.py
3f5968f596a2c542
7.74
2
"""Tests for Model.process(): attribute translation and nested model recursion.""" from sendbee_api.models import Model, Meta, ServerMessage from sendbee_api.fields import TextField, NumberField, ModelField class _Tag(Model): _name = TextField(index="name") class _Contact(Model): _id = TextField(index="id"...
sendbee/sendbee-python-api-client
tests/test_models.py
.py
939f6c6169ac264c
7.74
2
"""Tests for QueryParams: MultiValueEnum aliasing and default merge.""" from sendbee_api.query_params import QueryParams, DefaultQueryParams class _DemoParams(QueryParams): """Sample query param set for testing.""" name = "name", "Contact name" search_query = "search_query", "Free text filter" def tes...
sendbee/sendbee-python-api-client
tests/test_query_params.py
.py
6d58f8171eac5869
7.74
2
import os import time import requests # data from the page from .website_data import CROPS, STATIONS BASE_FOLDER = os.path.dirname(os.path.abspath(__file__)) # we'll make a request to MAIN_URL to start a session (PHPSESSID cookie), then proceed between the other two MAIN_URL = r"http://irrigation.wsu.edu/Content/Ca...
Water-Systems-Management-UCM/Waterspout
utils/dump_crop_coefficients/dump.py
.py
a8223de8053e14d6
7.24
2
""" Copyright 2026 RICHARD TJÖRNHAMMAR Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
richardtjornhammar/counterpartner
src/counterpartner/match.py
.py
72458707fb297fb1
7
0
import flask import logging import time from .manifests import blueprint as manifests_bp import os import json TRUSTED_CONFIG_PATH_PREFIXES = [os.getcwd(), "/var/gen3"] def validate_config_path(config_path): for trusted_path in TRUSTED_CONFIG_PATH_PREFIXES: if ( os.path.commonpath((os.path.r...
uc-cdis/manifestservice
manifestservice/api.py
.py
aad7c28914240420
7
0
import json as json_utils from manifestservice.manifests import _list_files_in_bucket def test_POST_successful_GUID_add(client, mocks): """ Test the Export PFB to Workspace pathway: a cohort is added to the bucket. Note that because s3 is being mocked, only an integration test can properly verify...
uc-cdis/manifestservice
tests/cohorts_test.py
.py
db730ee3cae927c1
7.5
0
""" LECO Director instrument plugin are to be used to communicate (and control) remotely real instrument plugin through TCP/IP using the LECO Protocol For this to work a coordinator must be instantiated can be done within the dashboard or directly running: `python -m pyleco.coordinators.coordinator` """ from pymodaq....
PyMoDAQ/pymodaq_plugins_mock
src/pymodaq_plugins_mock/daq_viewer_plugins/plugins_0D/daq_0Dviewer_LECODirector.py
.py
fc1562f054d3cd3b
7.35
4
""" LECO Director instrument plugin are to be used to communicate (and control) remotely real instrument plugin through TCP/IP using the LECO Protocol For this to work a coordinator must be instantiated can be done within the dashboard or directly running: `python -m pyleco.coordinators.coordinator` """ from pymoda...
PyMoDAQ/pymodaq_plugins_mock
src/pymodaq_plugins_mock/daq_viewer_plugins/plugins_1D/daq_1Dviewer_LECODirector.py
.py
7077d0e9cea57502
7.35
4