repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
iafisher/precommit | setup.py | import os
from setuptools import find_packages, setup
d = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(d, "README.md"), "r") as f:
long_description = f.read()
setup(
name="iafisher-precommit",
version="0.1",
description="Manage git pre-commit hooks",
long_description=long_d... |
iafisher/precommit | precommitlib/main.py | """
The command-line interface to the precommit tool.
Most of the tool's implementation lives in lib.py, and the definitions of the pre-commit
checks live in checks.py.
Author: <NAME> (<EMAIL>)
Version: May 2020
"""
import importlib.util
import os
import pkg_resources
import shutil
import stat
import subprocess
impo... |
iafisher/precommit | precommitlib/utils.py | <reponame>iafisher/precommit
"""
Utility functions and constants for the precommit tool.
Author: <NAME> (<EMAIL>)
Version: May 2020
"""
import sys
# A global flag indicating whether --verbose was passed.
VERBOSE = False
def plural(n: int, word: str, suffix: str = "s") -> str:
"""Returns the numeral and the pr... |
mhrous/Graduation_Project | server/test.py |
s ={1,2,3,4,5,6}
print( 1 in s) |
mhrous/Graduation_Project | server/Data/math_and_physic_constants.py | <filename>server/Data/math_and_physic_constants.py
def add_constant(obj, _type='math'):
pass
def get_constant(my_filter):
pass
|
mhrous/Graduation_Project | server/Data/lows.py | def add_low(obj):
pass
def get_low(my_filter):
pass
|
mhrous/Graduation_Project | server/Data/DB/connect.py | <reponame>mhrous/Graduation_Project
from pymongo import MongoClient
from constants import CONSTANTS
def get_db():
client = MongoClient(CONSTANTS['DB_URL'])
db = client[CONSTANTS['DB_NAME']]
return db
DB = get_db()
|
mhrous/Graduation_Project | server/Data/problem.py | <filename>server/Data/problem.py
from hashlib import md5
path_checked_file = './DB/Problems/Checked'
path_not_checked_file = './DB/Problems/Not Checked'
checked_problem = {}
not_checked_problem = {}
def get_file_name(text):
name = text.replace('\n', ' ').strip()
return md5(name.encode('utf8')).hexdigest() + ... |
mhrous/Graduation_Project | server/server.py | <gh_stars>0
from flask import Flask, jsonify
from constants import CONSTANTS
app = Flask(__name__, static_folder='build')
@app.route('/', methods=['GET'])
def get_tasks():
return jsonify({'tasks': 'hi'})
if __name__ == '__main__':
app.run(port=CONSTANTS['PORT'])
|
mhrous/Graduation_Project | server/constants.py | <gh_stars>0
import os
CONSTANTS = {
"PORT": os.environ.get("PORT", 3001),
"DB_URL": "mongodb://localhost:27017/",
"DB_NAME": "graduation-project"
} |
TrabajoGradoMotorBusqueda/Ontologia | Scripts/ontologia.py | from owlready2 import *
# agregar la carpeta que contiene la ontologia,
# para busqueda local, sino en internet
onto_path.append("../Data")
# carga de ontologia por IRI o por ruta directa al archivo owl
ontologia = get_ontology(
"http://www.semanticweb.org/OntologiaInvestigacionPrueba").load()
with ontologia:
... |
TrabajoGradoMotorBusqueda/Ontologia | Scripts/ClasesOPDP.py | #############################################CREACION DE CLASES#################################################
#IMPORTAR RUTA
with ontologia:
#GRUPO DE INVESTIGACION
class Grupo_investigacion(Thing):
def get_id_grupo_investigacion(self):
return self.id_grupo_investigacion
def set_id_grupo_investigacion(... |
bmorris3/asteroid | asteroid/models/zenodo.py | import os
import json
import requests
from io import BufferedReader, BytesIO
import torch
class Zenodo(object):
""" Faciliate Zenodo's REST API.
Args:
api_key (str): Access token generated to upload depositions.
use_sandbox (bool): Whether to use the sandbox (default: True)
Note t... |
bmorris3/asteroid | asteroid/data/musdb18_dataset.py | <filename>asteroid/data/musdb18_dataset.py
from pathlib import Path
import torch.utils.data
import random
import torch
import tqdm
import soundfile as sf
class MUSDB18Dataset(torch.utils.data.Dataset):
"""MUSDB18 music separation dataset
The dataset consists of 150 full lengths music tracks (~10h duration) o... |
bmorris3/asteroid | asteroid/__init__.py | <filename>asteroid/__init__.py
import pathlib
from .utils import deprecation_utils, torch_utils
from .models import ConvTasNet, DPRNNTasNet
project_root = str(pathlib.Path(__file__).expanduser().absolute().parent.parent)
__version__ = '0.2.1'
|
bmorris3/asteroid | tests/models/publish_test.py | import os
import json
import shutil
from asteroid.models import save_publishable, upload_publishable, ConvTasNet
from asteroid.data import WhamDataset
def populate_wham_dir(path):
wham_files = ['s1', 's2', 'noise', 'mix_single', 'mix_clean', 'mix_both']
os.makedirs(path, exist_ok=True)
for source in wham... |
UND-ARC/IPCam | tools/autoaspfinder.py | # coding: utf-8
import sys
import os
FILENAME = sys.argv[1]
with open(FILENAME, 'r') as f:
lines = f.readlines()
lines = [line.strip() for line in lines]
asplines = [line for line in lines if 'asp' in line]
aspparts = [line.split(' ') for line in asplines]
asps = []
for asppart in aspparts:
... |
iakoul17/runwayML | test_video.py | """Test pre-trained RGB model on a single video.
Date: 01/15/18
Authors: <NAME> and <NAME>
This script accepts an mp4 video as the command line argument --video_file
and averages ResNet50 (trained on Moments) predictions on num_segment equally
spaced frames (extracted using ffmpeg).
Alternatively, one may instead pr... |
fxyu/pygraphviz-1.3.1-win64Patch | pygraphviz/tests/test_clear.py | <reponame>fxyu/pygraphviz-1.3.1-win64Patch
# -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv
def test_del():
A = pgv.AGraph()
A.add_node(1,foo='bar')
# For some reasons after porting to Python 3 clear often cause infinite loop
A.delete_node('1')
assert_equal(len(A), 0)
def... |
fxyu/pygraphviz-1.3.1-win64Patch | pygraphviz/version.py | <gh_stars>0
"""
Version information for PyGraphviz, created during installation.
Do not add this file to the repository.
"""
__version__ = '1.3.1'
__revision__ = None
__date__ = 'Sun Sep 6 07:49:58 2015'
|
fxyu/pygraphviz-1.3.1-win64Patch | pygraphviz/graphviz.py | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path impor... |
fxyu/pygraphviz-1.3.1-win64Patch | pygraphviz/tests/test_readwrite.py | # -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv
def test_readwrite():
A = pgv.AGraph(name='test graph')
A.add_path([1,2,3,4,5,6,7,8,9,10])
#FIXME
# >>> (fd,fname)=tempfile.mkstemp()
# A.write(fname)
# A.read(fname)
# assert_equal(B, AGraph(fname))
# assert_true(B == A... |
fxyu/pygraphviz-1.3.1-win64Patch | pygraphviz/tests/test_html.py | # -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv
from os import linesep
def test_html():
G = pgv.AGraph(label='<Hello<BR/>Graph>')
G.add_node('a', label='<Hello<BR/>Node>')
s = G.add_subgraph('b', label='<Hello<BR/>Subgraph>')
s.add_node('sa', label='<Hello<BR/>Subgraph Node b>... |
tullurivijay/Machine_Learning_basics | data_preprocessing.py | # Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
# Taking care of Missing Data
from sklearn.impute import SimpleImpute... |
rakibulislam01/Tweetme | tweets/api/serializers.py | from django.utils.timesince import timesince
from rest_framework import serializers
from accounts.api.serializers import UserDisplaySerializer
from tweets.models import Tweet
class TweetModelSerializer(serializers.ModelSerializer):
user = UserDisplaySerializer(read_only=True)
date_display = serializers.Seria... |
rakibulislam01/Tweetme | hashtags/models.py | from django.db import models
from django.urls import reverse_lazy
from tweets.models import Tweet
class HashTag(models.Model):
tag = models.CharField(max_length=120)
timestamp = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.tag
def get_absolute_url(self):
ret... |
rakibulislam01/Tweetme | tweets/urls.py | from django.urls import path
from django.views.generic.base import RedirectView
from .views import (
TweetListView,
TweetDetailView,
TweetCreateView,
TweetUpdateView,
TweetDeleteView
) # tweet_detail_view, tweet_list_view
app_name = 'tweets'
urlpatterns = [
path('search', TweetListView.as_vie... |
rakibulislam01/Tweetme | tweets/api/views.py | from django.db.models import Q
from rest_framework import generics
from rest_framework import permissions
from tweets.models import Tweet
from .serializers import TweetModelSerializer
from .pagination import StandardResultPagination
class TweetCreateAPIView(generics.CreateAPIView):
serializer_class = TweetModel... |
rakibulislam01/Tweetme | accounts/migrations/0004_auto_20190723_1149.py | # Generated by Django 2.2.2 on 2019-07-23 05:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20190721_1551'),
]
operations = [
migrations.AlterModelManagers(
name='userprofile',
managers=[
... |
rakibulislam01/Tweetme | tweets/api/urls.py | from django.conf.urls import url
from django.urls import path
from django.views.generic.base import RedirectView
from .views import (TweetListAPIView,
TweetCreateAPIView)
app_name = 'tweets-api'
urlpatterns = [
url('list', TweetListAPIView.as_view(), name='list'), # api/tweet/
url('create... |
rakibulislam01/Tweetme | accounts/urls.py | from django.urls import path
from django.views.generic.base import RedirectView
from .views import (
UserDetailView,
UserFollowView
) # tweet_detail_view, tweet_list_view
app_name = 'profiles'
urlpatterns = [
path('<username>/', UserDetailView.as_view(), name='detail'),
path('<username>/follow', User... |
rakibulislam01/Tweetme | hashtags/admin.py | from django.contrib import admin
from .models import HashTag
admin.site.register(HashTag)
|
rakibulislam01/Tweetme | accounts/models.py | <reponame>rakibulislam01/Tweetme<gh_stars>0
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save
from django.urls import reverse_lazy
class UserProfileManager(models.Manager):
use_for_related_fields = True
def all(self):
qs = self.get_queryset()... |
rakibulislam01/Tweetme | tweets/views.py | from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Q
# from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView
from .forms import TweetModelForm
from .mixins import ... |
rakibulislam01/Tweetme | tweets/api/pagination.py | from rest_framework import pagination
class StandardResultPagination(pagination.PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
max_page_size = 1000
|
rakibulislam01/Tweetme | tweets/migrations/0005_auto_20190719_0108.py | <filename>tweets/migrations/0005_auto_20190719_0108.py
# Generated by Django 2.2.2 on 2019-07-18 19:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tweets', '0004_auto_20190529_1942'),
]
operations = [
migrations.AlterModelOptions(
... |
rakibulislam01/Tweetme | accounts/migrations/0003_auto_20190721_1551.py | <reponame>rakibulislam01/Tweetme
# Generated by Django 2.2.2 on 2019-07-21 09:51
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20190720_2006'),
]
operations = [
migrations.AlterModelManage... |
rakibulislam01/Tweetme | tweets/models.py | <filename>tweets/models.py
# from django.contrib.auth.models import User
from django.conf import settings
from django.db import models
from django.urls import reverse
from .validators import validate_content
class Tweet(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
... |
memeshack/lolgit | hangups/test/test_channel.py | <filename>hangups/test/test_channel.py<gh_stars>1-10
"""Tests for channel data parsing."""
import pytest
from hangups import channel
@pytest.mark.parametrize('input_,expected', [
(b'79\n[[0,["c","98803CAAD92268E8","",8]\n]\n,[1,[{"gsid":"7tCoFHumSL-IT6BHpCaxLA"}]]\n]\n',
('98803CAAD92268E8', '7tCoFHumSL-IT... |
memeshack/lolgit | hangups/__init__.py | <reponame>memeshack/lolgit<filename>hangups/__init__.py
from .version import __version__
from .schemas import (TypingStatus, FocusStatus, FocusDevice, SegmentType,
MembershipChangeType, ConversationType,
OffTheRecordStatus)
from .client import Client
from .user import UserLis... |
memeshack/lolgit | hangups/javascript.py | <filename>hangups/javascript.py
"""Parser for a subset of JavaScript written with purplex.
Parses a broader subset of JavaScript than just JSON, needed for parsing some
API responses. This is only as complete as necessary to parse the responses
we're getting.
"""
import logging
import purplex
logger = logging.getLog... |
memeshack/lolgit | setup.py | from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import sys
# Find __version__ without import that requires dependencies to be installed:
exec(open(os.path.join(
os.path.dirname(__file__), 'hangups/version.py'
)).read())
class PyTest(TestCommand):
def finalize_op... |
memeshack/lolgit | hangups/conversation.py | """Conversation objects."""
import asyncio
import logging
from hangups import (parsers, event, user, conversation_event, exceptions,
schemas)
logger = logging.getLogger(__name__)
class Conversation(object):
"""Wrapper around Client for working with a single chat conversation."""
def ... |
memeshack/lolgit | hangups/pblite.py | """A parser for the pblite serialization format.
pblite (sometimes called "protojson") is a way of encoding Protocol Buffer
messages to arrays. Google uses this in Hangouts because JavaScript handles
arrays better than bytes.
This module allows parsing lists together with a schema to produce
programmer-friendly objec... |
memeshack/lolgit | hangups/test/test_javascript.py | <filename>hangups/test/test_javascript.py
"""Tests for the JavaScript parser."""
import pytest
from hangups import javascript
@pytest.mark.parametrize('input_,expected', [
# simple types
('12', 12),
('null', None),
('true', True),
('false', False),
# floats
('123.0', 123.0),
('-123.0... |
memeshack/lolgit | hangups/conversation_event.py | <reponame>memeshack/lolgit
"""ConversationEvent base class and subclasses.
These classes are wrappers for ClientEvent instances from the API. Parsing is
done through property methods, which prefer logging warnings to raising
exceptions.
"""
import logging
import re
from hangups import parsers, message_parser, user, ... |
memeshack/lolgit | hangups/event.py | """Simple event observer system supporting asyncio.
Observers must be removed to avoid memory leaks.
"""
import asyncio
import logging
logger = logging.getLogger(__name__)
class Event(object):
"""Event that tracks a list of observer callbacks to notify when fired."""
def __init__(self, name):
"""... |
memeshack/lolgit | hangups/test/test_pblite.py | <gh_stars>1-10
"""Tests for hangups.pblite."""
import enum
import pytest
import types
from hangups import pblite
##############################################################################
# Fixtures
##############################################################################
class Colour(enum.Enum):
RED ... |
simonqiang/gftest | app/main/api/__init__.py | __author__ = '608502920'
|
simonqiang/gftest | app/main/__init__.py | from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from flask_restful import Api
from .api.gfcard import GiftCard
api = Api(main)
api.add_resource(GiftCard, '/giftcard/request')
from apscheduler.schedulers.background import BackgroundScheduler
from .jobs.giftCardSchedule imp... |
simonqiang/gftest | app/models.py | import datetime
from . import db
from sqlalchemy.dialects.mysql import BIGINT, INTEGER
from sqlalchemy import DateTime, func, text
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True)
users = db.relationship('User', bac... |
simonqiang/gftest | application.py | <reponame>simonqiang/gftest
import os, logging
from app import create_app
from logging.handlers import RotatingFileHandler
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
handler = RotatingFileHandler('giftcard.log', maxBytes=20000, backupCount=6)
handler.setLevel(logging.INFO)
app.logger.addHandler(handler)... |
simonqiang/gftest | app/main/api/gfcard.py | from flask_restful import Resource, request
from ..common.utils import Utils
from ..common.GiftCardCodeHelper import GiftCardCodeHelper
from app import db
from manage import app
import sys, traceback
from config import Config
class GiftCard(Resource):
def post(self):
try:
json_data = request.ge... |
simonqiang/gftest | tests/main/common/testredishelper.py | <filename>tests/main/common/testredishelper.py
import unittest
from app.main.common.RedisHelper import RedisHelper
from app.main.jobs.giftCardSchedule import GiftCardSchedule
class RedisHelperTestCase(unittest.TestCase):
def test_redis_srandmember(self):
redishelper = RedisHelper()
aList = redishel... |
simonqiang/gftest | manage.py | #!/usr/bin/env python
import os, logging
from app import create_app, db
from app.models import User, Role, CardDenomination, CardGiftCard
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from logging.handlers import RotatingFileHandler
app = create_app(os.getenv('FLASK_... |
simonqiang/gftest | app/main/common/RedisHelper.py | <reponame>simonqiang/gftest<filename>app/main/common/RedisHelper.py<gh_stars>0
import redis
from manage import app
class RedisHelper():
def redis_lpush_list(self, name_list, list):
pool = redis.ConnectionPool(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'])
r = redis.Redis(connection_p... |
simonqiang/gftest | tests/main/common/testgiftcardcodegenerator.py | import unittest, random
from app.main.common.GiftCardCodeHelper import GiftCardCodeHelper
from app.main.common.RedisHelper import RedisHelper
class GiftCardCodeGeneratorHelperTestCase(unittest.TestCase):
def test_generate_pin(self):
giftCardCodeGenerator = GiftCardCodeHelper()
for i in range(10000... |
simonqiang/gftest | app/__init__.py | <reponame>simonqiang/gftest<filename>app/__init__.py
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from config import config
from flask.ext.redis import Redis
bootstrap = Bootstrap()
mail... |
simonqiang/gftest | app/main/jobs/giftCardSchedule.py | <filename>app/main/jobs/giftCardSchedule.py
from config import Config
from app.main.common.GiftCardCodeHelper import GiftCardCodeHelper
from ..common.RedisHelper import RedisHelper
import sys, traceback
class GiftCardSchedule(object):
def test(self):
print("running jobs")
giftCardCodeHelper = Gift... |
simonqiang/gftest | tests/main/common/testutils.py | <filename>tests/main/common/testutils.py
import unittest, datetime
from app.main.common.utils import Utils
from app import create_app, db
from app.models import CardGiftCard, CardDenomination
class UtilsTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('development')
self.app_cont... |
simonqiang/gftest | app/main/common/utils.py | import hashlib, uuid
from app.models import CardDenomination
from time import strftime, gmtime
import redis, datetime
from app import redis1
class Utils():
@staticmethod
def validateParameter(param):
if param :
return param
else :
return None
@staticmethod
def ... |
simonqiang/gftest | app/main/common/GiftCardCodeHelper.py | import random, datetime
from .RedisHelper import RedisHelper
from app.models import CardDenomination, CardGiftCard
from app import db
from .utils import Utils
from config import Config
class GiftCardCodeHelper():
giftcard_prefix = 'giftcard_prefix-'
giftcard_serial_index = '-giftcard_serial_index'
giftcar... |
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/run.py | import json
from pprint import pprint
from time import sleep as delay
from get_drawable_items import get_drawable_items
from get_calendar_for_item import get_calendar_for_item
from render_row_from_item import render_row_from_item, render_table_header
from inject_result_to_readme import inject_result_to_readme
if __nam... |
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/api.py | import requests
from bs4 import BeautifulSoup
ROOT_URL = 'https://www.nike.com'
def get_request(path='/kr'):
response = requests.get(ROOT_URL + path, headers={
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/85.0.4183.121 ... |
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/get_calendar_for_item.py | import api
def get_calendar_for_item(item_href):
soup = api.get_request(item_href)
description_wrapper = soup.find_all('p', class_='draw-info')
calendar = [
paragraph.text for paragraph in description_wrapper
]
return calendar
|
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/render_row_from_item.py | <filename>parser/render_row_from_item.py
from api import ROOT_URL
def render_table_header():
return (
'| 사진 | 제품명 | 응모 일정 |\n'
'| --- | ---- | ------- |\n'
)
def render_column_from_calendar(item_calendar):
return '<br />'.join([
line if is_not_first_line else f'<strong>{line}</st... |
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/get_drawable_items.py | <reponame>LeeSeongJinCa/NIKE-THE-DRAW-Calendar
import api
def get_drawable_items():
soup = api.get_request(
'/kr/launch?type=upcoming&activeDate=date-filter:AFTER')
launch_items = soup.find_all('div', class_='product-card')
# print(launch_items)
drawable_items = []
for launch_item in lau... |
LeeSeongJinCa/NIKE-THE-DRAW-Calendar | parser/inject_result_to_readme.py | <reponame>LeeSeongJinCa/NIKE-THE-DRAW-Calendar
from datetime import datetime
from render_row_from_item import render_table_header
START_TAG = '<!-- DRAW CALENDAR: START -->\n'
END_TAG = '\n<!-- DRAW CALENDAR: END -->'
README_PATH = '../README.md'
def get_timestamp():
return datetime.today().strftime('%Y.%m.%d')
... |
czetech/tecoroute-proxy | src/tecoroute_proxy/_cli.py | <reponame>czetech/tecoroute-proxy<gh_stars>0
from argparse import ArgumentParser, Namespace
from asyncio import Event, get_event_loop, run, set_event_loop_policy
from logging import DEBUG, INFO, basicConfig
from signal import SIGINT, SIGTERM
from ._misc import CONTROL, HOST, ORIGIN, PORT, dist
from ._server import Pro... |
czetech/tecoroute-proxy | src/tecoroute_proxy/__init__.py | """TecoRoute Proxy library.
Example of asynchronous server startup:
.. code-block:: python
from tecoroute_proxy import ProxyServer
async def proxy_server_start():
server = ProxyServer(port=8080)
await server.start()
"""
from ._cli import cli
from ._request import ProxyRequest
from ._server i... |
czetech/tecoroute-proxy | src/tecoroute_proxy/_request.py | <reponame>czetech/tecoroute-proxy
from __future__ import annotations
from asyncio import sleep
from base64 import b64decode, b64encode
from binascii import Error as BinasciiError
from hashlib import sha1
from http.cookies import Morsel, SimpleCookie
from json import JSONDecodeError, dumps, loads
from logging import DE... |
czetech/tecoroute-proxy | src/tecoroute_proxy/_server.py | <reponame>czetech/tecoroute-proxy
from typing import Optional
from aiohttp.typedefs import Handler
from aiohttp.web import (
Application,
AppRunner,
HTTPBadRequest,
HTTPMethodNotAllowed,
Request,
Response,
StreamResponse,
TCPSite,
middleware,
post,
route,
)
from yarl import ... |
czetech/tecoroute-proxy | src/tecoroute_proxy/_misc.py | <reponame>czetech/tecoroute-proxy
from importlib.metadata import distribution
from logging import getLogger
_module = __name__.split(".")[0]
logger = getLogger(_module)
dist = distribution(_module)
HTTP_NAME = f"{dist.metadata['Name']}/{dist.version} (+{dist.metadata['Home-page']})"
# Default values
CONTROL = "/TR_... |
czetech/tecoroute-proxy | docs/conf.py | <reponame>czetech/tecoroute-proxy
"""Sphinx configuration."""
from importlib.metadata import distribution
import tecoroute_proxy
_dist = distribution(tecoroute_proxy.__name__)
_author = _dist.metadata["Author"]
# Project information
project = "TecoRoute Proxy"
author = _author
copyright = f"2022, {_author}"
version ... |
czetech/tecoroute-proxy | src/tecoroute_proxy/__main__.py | """Invoke the command-line interface when the package is run as a script."""
from ._cli import cli
if __name__ == "__main__":
cli()
|
9dev/django-flags | flags/admin.py | from django.contrib import admin
from .models import Approve, Flag
class FlagAdmin(admin.ModelAdmin):
list_display = ('content_object', 'creator', 'creation_date')
actions = ['delete_selected_flagged_objects', 'approve']
def approve(self, request, queryset):
for flag in queryset:
App... |
9dev/django-flags | demo/main/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'^$',
views.ArticleListView.as_view(),
name='article_list'
),
url(
r'^article/(?P<pk>[0-9]+)$',
views.ArticleDetailView.as_view(),
name='article_detail'
),
]
|
9dev/django-flags | flags/urls.py | <reponame>9dev/django-flags
from django.conf.urls import patterns, url
from flags import views
urlpatterns = patterns('',
url(
r'^create/(?P<app_label>[a-z0-9_]+)/(?P<model_name>[a-z0-9_]+)/(?P<pk>[0-9]+)$',
views.FlagCreateView.as_view(),
name='flag_create',
),
)
|
9dev/django-flags | flags/forms.py | <reponame>9dev/django-flags
from django import forms
class FlagCreateForm(forms.Form):
pass
|
9dev/django-flags | fts/Flags.py | from selenium.webdriver.support.ui import Select
from django.contrib.auth.models import User
from django.test import override_settings
from flags.models import Approve, Flag
from main.models import Article
from ._base import BaseTestCase
class TestFlags(BaseTestCase):
def test_registered_user_can_flag_an_obj... |
9dev/django-flags | flags/templatetags/flags.py | <gh_stars>0
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag
def flag_create_url(obj):
return reverse('flags:flag_create', kwargs={
'app_label': obj._meta.app_label,
'model_name': obj._meta.object_name.lower(),
'p... |
9dev/django-flags | flags/models.py | <filename>flags/models.py
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Flag(models.Mode... |
9dev/django-flags | flags/views.py | from django.apps import apps
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import Http404
from django.utils.decorators import method_decorator
from django.views.generic import FormView
from .forms import FlagCreateForm
from .models... |
9dev/django-flags | demo/main/models.py | <reponame>9dev/django-flags
from django.db import models
from django.core.urlresolvers import reverse
class Article(models.Model):
title = models.CharField(max_length=100)
content = models.CharField(max_length=1000)
def get_absolute_url(self):
return reverse('article_detail', kwargs={'pk': self.p... |
9dev/django-flags | demo/main/views.py | <filename>demo/main/views.py
from django.views.generic import DetailView, ListView
from .models import Article
class ArticleListView(ListView):
model = Article
class ArticleDetailView(DetailView):
model = Article
|
gecrooks/disorder | disorder/about.py | <filename>disorder/about.py
# Copyright 2021, <NAME> and contributors
#
# This source code is licensed under the Apache License 2.0
# found in the LICENSE file in the root directory of this source tree.
# Command line interface for the about() function
# > python -m disorder.about
#
# NB: This module should not be imp... |
gecrooks/disorder | examples/fenergy_errors.py | #
# Explration of different erorr estiamtes for free energies
#
import numpy as np
from disorder import fenergy_bar, fenergy_bayesian
fe = 0
diss = 100
count = 1000
def errors(diss, count):
fe = 0
work_f = np.random.normal(loc=diss + fe, scale=np.sqrt(2 * diss), size=(count,))
work_r = np.random.normal(... |
gecrooks/disorder | disorder/__init__.py | <filename>disorder/__init__.py
# Copyright 2021, <NAME> and contributors
#
# This source code is licensed under the Apache License 2.0
# found in the LICENSE file in the root directory of this source tree.
from .config import __version__ # noqa: F401
from .config import about # noqa: F401
from .fenergy import * # n... |
gecrooks/disorder | disorder/fenergy_test.py | # Copyright 2021, <NAME> and contributors
#
# This source code is licensed under the Apache License 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
import numpy as np
import pytest
from numpy.random import normal
from scipy.special import expit
from disorder import (
fenergy_bar,
... |
gecrooks/disorder | disorder/fenergy.py | <reponame>gecrooks/disorder
# Copyright 2021, <NAME> and contributors
#
# This source code is licensed under the Apache License 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
from typing import Tuple
import numpy as np
from numpy.typing import ArrayLike # numpy v1.20
from scipy impor... |
alLe746/CTI_besoin | interface/pythonui/interface/DocumentMeta.py | from django import forms
from django.db import models
import os
class DocumentMeta(forms.Form):
Description = forms.CharField(label="Description", max_length=64)
Date_demande = forms.DateField(label="Date de la Demande")
class FileUpload(forms.Form):
file = forms.FileField(label="document Word ( .docx)")... |
alLe746/CTI_besoin | interface/pythonui/interface/views.py | from datetime import datetime
import docx
import json
import pandas as pd
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse
# Create your views here.
from .DocumentMeta import DocumentMeta,FileUpload,Modeldocx,Jsonchoice,FileUploadjson
from docx import Document
import os
... |
framr/playground_deepbayes | s4_gp/bayes_opt.py | import numpy as np
from scipy.stats import norm
from scipy.optimize import minimize
from matplotlib import pyplot
import GPy
def lower_confidence_bound(mean_values, std_values, coefficient=2):
return mean_values.ravel() - coefficient * std_values.ravel()
def log_expected_improvement(mean_values, variance_val... |
iamneha/python | kubernetes/client/models/v1_job_status.py | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
iamneha/python | kubernetes/client/apis/custom_objects_api.py | <gh_stars>1-10
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import ... |
viktordremio/vds_refresh_by_path | src/vds_reflection_refresh_by_path.py | import requests
import re
#INPUT:
dataset_path = 'test."concat test limit.20"' #copy vds path from UI, click Copy Path
dremio_url = 'http://localhost:9047' # url dremio
user="user" # user name in dremio
pwd="<PASSWORD>" # password ame in dremio
verify_ssl=False # SSL enanled/disabled for REST calls
################... |
viktordremio/vds_refresh_by_path | src/refresh_only_one_vds.py | <gh_stars>0
import requests
import re
import json
# INPUT:
# copy vds path from UI, click Copy Path
dataset_path = 'test.delays'
dremio_url = 'http://localhost:9047' # url dremio
user = "viktor" # user name in dremio
pwd = "<PASSWORD>" # password ame in dremio
verify_ssl = False # SSL enanled/disabled for REST ca... |
cyang-kth/xyconvert | xyconvert/xyconvert.py | """
Created on Nov 16, 2020
@author: <NAME>
Convert/project xy coordinates in numpy between WGS-84, GCJ-02 and BD-09 system
"""
import numpy as np
import pyproj
a = 6378245.0 # lngg axis
ee = 0.006693421883570923
# f = 0.00335233
# b = a * (1 - f)
# ee = (a*a - b*b)/(a*a)
def assert_xy(xy):
np.testing.assert_e... |
cyang-kth/xyconvert | setup.py | <reponame>cyang-kth/xyconvert
from setuptools import setup
setup(
name='xyconvert',
version='0.1.2',
package_dir={'': 'xyconvert'}, # Optional
py_modules=["xyconvert"],
license='MIT',
description='Convert xy coordinates',
long_description=open('README.md').read(),
long_description_content... |
giltwizy/qrcode-generator | qrcode-generator.py | ###############################################
# program: qrcode-generator.py
# author: <NAME>
# version: 1.1
# date: 10 July 2020
###############################################
# importing qrcode module
import qrcode
# create a string to be encoded
site = "https://github.com/giltwizy"
# create a string which will... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.