Skip to content

Instantly share code, notes, and snippets.

View aodag's full-sized avatar

Atsushi Odagiri aodag

View GitHub Profile
{
"python.pythonPath": ".venv\\Scripts\\python.exe",
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true
}
@aodag
aodag / pytest.md
Last active March 2, 2020 14:00 — forked from shiumachi/pytest.md
Pytestの書き方入門

インストール

pip install pytest pytest-cov pytest-randomly pytest-mock
  • pytest-cov: カバレッジ計測プラグイン
  • pytest-randomly: 実行順のランダム化
  • pytest-mock: mock利用プラグイン
@aodag
aodag / dataclass_converter.py
Created February 11, 2020 08:42
extension to convert dataclasses with cattrs.
import dataclasses
from .converters import Converter
def _is_dataclasses_class(obj):
return dataclasses.is_dataclass(obj)
class DataclassesConverter(Converter):
def __init__(self, *args, **kwargs):
@aodag
aodag / app.py
Last active August 16, 2019 15:12
from pyramid.config import Configurator
def hello(request):
return dict(message="Hello, world!")
def main(global_conf, **settings):
config = Configurator(settings=settings)
config.include("pyramid_jinja2")
@aodag
aodag / app.py
Created June 16, 2019 16:00
request引数のgenericsで指定したTypeからmarshmallowスキーマを生成して設定するwsgi wrapper
import json
import inspect
from datetime import datetime
from dataclasses import dataclass, asdict
from typing import TypeVar, Generic, Optional, Callable, Dict, Any, Type, Iterable, Sequence
from typing_extensions import Protocol
import webob
import webtest
import marshmallow_dataclass
from marshmallow import Schema
{
"python.pythonPath": ".venv\\Scripts\\python.exe",
"python.jediEnabled": false,
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"editor.formatOnSave": true
}
@aodag
aodag / minimal_publication.py
Created April 21, 2019 13:08
zope.publisher に最低限のpublicationを使って Hello, world
from zope.publisher.paste import Application
from zope.publisher.interfaces import IPublication
from zope.interface import implementer
from zope.component import getGlobalSiteManager
@implementer(IPublication)
class MyWorkPublication:
def __init__(self, global_conf, **app_conf):
pass
import argparse
import dataclasses
from typing import TypeVar, Generic, Type
T = TypeVar("T")
class Parser(Generic[T]):
def __init__(self, cls: Type[T]) -> None:
assert dataclasses.is_dataclass(cls)
@aodag
aodag / _.py
Created March 23, 2019 08:51
dataclasses と sqlalchemy
from datetime import datetime
from typing import Type, TypeVar, Generic
from sqlalchemy import (
create_engine,
MetaData,
Integer,
Unicode,
DateTime,
Column,
Table,
Dear Odagiri san,
My name is Arshad. IT Recruiter with ACS Japan.
How is your current work Situation.
Are you open to hear about new Job Opportunities?
If you are open, can I know when you are available for 5 minutes to talk or you can call me on 03-6868-7512.