This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# [設問]ピッチャーのデータを分析するプログラムを作成してください | |
# 1. ピッチャーごとの平均球速を計算する関数を作成し、結果を表示してください | |
# 表示例) 田中将大の平均球速は154km/hです | |
# 補足: 小数点以下は「切り捨て」してください | |
# 2. ピッチャーごとの最高球速を計算する関数を作成し、結果を表示してください | |
# 表示例) 田中将大の最高球速は154km/hです | |
# 3. 最速のピッチャーは誰か計算する関数を作成し、結果を表示してください | |
# 表示例) 最速ピッチャーは田中将大、最高球速は156km/hです | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import subprocess | |
from watchdog.events import PatternMatchingEventHandler | |
from watchdog.observers import Observer | |
class TestFileWatchEventHandler(PatternMatchingEventHandler): | |
def __run_test(self): | |
subprocess.call('python3 -m unittest discover ./tests', shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import jsonify, request, Flask | |
from flask_jwt_extended import ( | |
jwt_required, | |
create_access_token, | |
JWTManager | |
) | |
HTTP_OK = 200 | |
HTTP_BAD_REQUEST = 400 | |
HTTP_UNAUTHORIZED = 401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarMaker: | |
def __init__(self, id=None, name=''): | |
self.id = id | |
self.name = name | |
dict_car_maker = { | |
'id': 1, | |
'name': 'toyota' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def json_dumps_handler(data): | |
has_dict = isinstance(data, object) and hasattr(data, '__dict__') | |
if not has_dict: | |
raise TypeError() | |
return data.__dict__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1.0, | |
"formatters": { | |
"simple": { | |
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |
} | |
}, | |
"handlers": { | |
"console": { | |
"class": "logging.StreamHandler", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:quickrun_config = get(g:, 'quickrun_config', {}) | |
let g:quickrun_config._ = { | |
\ 'runner': 'vimproc', | |
\ 'runner/vimproc/updatetime': 40, | |
\ 'outputter': 'error', | |
\ 'outputter/error/success': 'buffer', | |
\ 'outputter/error/error': 'quickfix', | |
\ 'hook/close_quickfix/enable_exit': 1 | |
\ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import jsonify, Flask | |
from flask_jwt import jwt_required, current_identity, JWT | |
class User: | |
def __init__(self, id, username, password): | |
self.id = id | |
self.username = username | |
self.password = password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from dateutil.relativedelta import relativedelta | |
today = datetime.now().date() | |
first_date = datetime.strptime( | |
datetime.strftime(today, '%Y-%m-01'), | |
'%Y-%m-%d' | |
).date() | |
last_date = first_date + relativedelta(months=1) - timedelta(days=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"car_makers": [ | |
{ | |
"id": 1, | |
"name": 'TOYOTA', | |
"cars": [ | |
{ | |
"id": 1, | |
"name": 'カローラ' | |
}, | |
{ |
NewerOlder