Given these pairs:
patient,referral
p29286416172,r19529956641
p49607832635,r19293807841
p69929249091,r19057659047
p90250665558,r19821510137
p10572084327,r19585361336
p30893500781,r19349212531
p51214917243,r19113063730
Given these pairs:
patient,referral
p29286416172,r19529956641
p49607832635,r19293807841
p69929249091,r19057659047
p90250665558,r19821510137
p10572084327,r19585361336
p30893500781,r19349212531
p51214917243,r19113063730
There are 5 Pull Requests, which I recommend should be merged in the following order:
from functools import partial, reduce | |
import operator | |
from typing import Callable, Iterable, Union | |
from funcy import compose, identity | |
class Function: | |
"""Function wrapper with composition methods.""" | |
def __init__(self, func: Union[Callable, "Function"]): |
Developer-oriented guide to named release branching process.
This concerns how delivery teams interact with the release process via a branching strategy rather than the wider release process.
from typing import List, Union | |
from statham.dsl.constants import Maybe | |
from statham.dsl.elements import ( | |
AnyOf, | |
Array, | |
Boolean, | |
Integer, | |
Null, | |
Number, |
from sys import argv, exit | |
import csv | |
def main(): | |
if len(argv) != 3: | |
print("Usage: python dna.py filename.csv filename.txt") | |
exit(1) | |
people = [] |
Full documentation is here.
Type annotations do not affect runtime, but allow other tools to statically analyse you code for errors. The offical checker is MyPy, which has an IntelliJ extension.
Type annotations come after the variable/attribute declaration (unlike Java):
foo: int
foo = 1
The following uses the csv
standard library, specifically DictReader, to parse a CSV as a list of dictionaries.
DictReader
accepts the file handler, and automatically parses the header for the field names. It can then be iterated to get each row of the CSV. This happens lazily by default, but since we want the whole thing, we load it into a list (which means we can let the file close.
import csv
This illustrates the difference between EAFP (Easier to ask forgiveness than permission) vs LBYL (Look before you leap).
To illustrate, consider a function which gets a value from a dictionary by key, returning a default if not present. This is the function implemented in each style:
def get(dictionary, key, default):
if key in dictionary: