Skip to content

Instantly share code, notes, and snippets.

Avatar

Atsushi Odagiri aodag

View GitHub Profile
View settings.json
{
"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 Mar 2, 2020 — forked from shiumachi/pytest.md
Pytestの書き方入門
View pytest.md

インストール

pip install pytest pytest-cov pytest-randomly pytest-mock
  • pytest-cov: カバレッジ計測プラグイン
  • pytest-randomly: 実行順のランダム化
  • pytest-mock: mock利用プラグイン
@aodag
aodag / dataclass_converter.py
Created Feb 11, 2020
extension to convert dataclasses with cattrs.
View dataclass_converter.py
import dataclasses
from .converters import Converter
def _is_dataclasses_class(obj):
return dataclasses.is_dataclass(obj)
class DataclassesConverter(Converter):
def __init__(self, *args, **kwargs):
View app.py
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 Jun 16, 2019
request引数のgenericsで指定したTypeからmarshmallowスキーマを生成して設定するwsgi wrapper
View app.py
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
View settings.json
{
"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 Apr 21, 2019
zope.publisher に最低限のpublicationを使って Hello, world
View minimal_publication.py
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
View arg_dataclasses.py
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 Mar 23, 2019
dataclasses と sqlalchemy
View _.py
from datetime import datetime
from typing import Type, TypeVar, Generic
from sqlalchemy import (
create_engine,
MetaData,
Integer,
Unicode,
DateTime,
Column,
Table,
View ACS Japan Arshad
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.
You can’t perform that action at this time.