インフラ開発で使えるデザインパターンを雑に集めるページ。 パターン名は適当。
- エラーが起こったら余計なことはせずに即座にエラーメッセージを出力して終了すること。
- エラー処理の基本。
from typing import Optional, Iterator, Tuple | |
import unittest | |
class Matcher: | |
def match(self, string: str) -> Iterator[int]: | |
raise NotImplementedError() | |
class ZeroMatcher(Matcher): |
use std::io::{self, Read, Write}; | |
use std::process::exit; | |
use std::error::Error; | |
use std::fmt; | |
// 型宣言 //////////////////////////////////////////////////////////////////////// | |
// ParseError ----------------------------------- | |
#[derive(Debug)] |
import numpy as np | |
import pandas as pd | |
import chainer | |
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils, Link, Chain, ChainList | |
import chainer.functions as F | |
import chainer.links as L | |
from sklearn import datasets | |
import matplotlib.pyplot as plt | |
from typing import Tuple |
import numpy as np | |
import pandas as pd | |
import chainer | |
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils, Link, Chain, ChainList | |
import chainer.functions as F | |
import chainer.links as L | |
from sklearn import datasets | |
import matplotlib.pyplot as plt | |
from typing import Tuple, Iterator |
from logging import getLogger, StreamHandler, DEBUG | |
from typing import Tuple, Iterator, Dict | |
import chainer.functions as F | |
import chainer.links as L | |
import numpy as np | |
from chainer import Variable, optimizers, serializers, Chain | |
from chainer.utils import walker_alias | |
from scipy.spatial.distance import cosine | |
from sklearn.manifold import TSNE |
#!/usr/bin/python | |
from __future__ import print_function | |
from bcc import BPF | |
import argparse | |
import time | |
import datetime | |
import sys | |
import ctypes | |
JA: 昼食 会 に 1 0 人 を 招待 し た 。 | |
EN: We asked ten people to the luncheon . | |
Output: A one invited ten people to the meeting . | |
JA: 彼女 の 言葉づかい に は 誤り が 多い 。 | |
EN: Her grammar is bad . | |
Output: Her heart 's beating wildly . | |
JA: その 文書 に は その 戦い が 1 7 0 0 年 に 起こっ た と 記録 さ れ て いる 。 | |
EN: The document records that the war broke out in 1700 . |