The Amplify Command Line Interface (CLI) is a unified toolchain to create, integrate, and manage the AWS cloud services for your app.
This file contains hidden or 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
## See https://github.com/FactoryBoy/factory_boy/issues/836 | |
import inspect | |
from typing import List, get_args, get_origin | |
import factory | |
import factory.fuzzy | |
from dataclasses import dataclass, Field, MISSING, is_dataclass | |
from enum import Enum | |
from datetime import date, datetime | |
from decimal import Decimal |
This file contains hidden or 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
git log -n 10\ | |
--pretty=format:'{"commit": "%H", "author": "%aN <%aE>", "date": "%ai", "message": """%B""", "notes": """%N""" },' \ | |
$@ | awk 'BEGIN { print("[") } { print($0) } END { print("]") }' | python -u -c \ | |
'import ast,json,sys; print(json.dumps(ast.literal_eval(sys.stdin.read())))' |
You ever factor something out of a method and realize you can get rid of the
dependency on self
(which is really nice to do for clarity and testability)?
In my experience, typically this is then pulled in to a function, but then you have to move the definition all the way outside of the class, which can suck.
To compensate for this, sometimes you'll leave it as a method and just not
use self
in the body. This is a good use case for the @staticmethod
decorator, which I'll explain:
This file contains hidden or 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
# Local Dates: | |
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt | |
# ISO Dates: | |
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Use this one-liner to produce a JSON literal from the Git log: | |
git log \ | |
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \ | |
$@ | \ | |
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \ | |
perl -pe 's/},]/}]/' |