I hereby claim:
- I am tomplex on github.
- I am tomcaruso (https://keybase.io/tomcaruso) on keybase.
- I have a public key ASAUYKZvWV_kuAcYihLNmDfx1CX57Qtvv1OYvGRqhUrdhQo
To claim this, I am signing this object:
IMAGE_REGISTRY="" | |
IMAGE_NAME="image" | |
IMAGE_TAG="tag" | |
VOLUME_NAME="${IMAGE_NAME}-${IMAGE_TAG}" | |
# Contents will be accessible in /tmp/IMAGE_NAME-IMAGE_TAG | |
docker volume create \ | |
--driver local \ | |
--opt type=none \ |
import json | |
from typing import Any, Iterator, Tuple, Union | |
def _deserializable(obj: Any) -> bool: | |
try: | |
o = json.loads(obj) | |
assert isinstance(o, Union[list, dict]) | |
return True | |
except: |
from typing import Protocol, TypeVar | |
class Record: | |
"""in practice, this class has many more methods/ | |
attributes that I need access to.""" | |
def update(self): | |
pass | |
from geomet import wkt | |
from io import StringIO | |
import psycopg2 | |
def main(): | |
# we'll use this to copy data into postgres | |
fileobj = StringIO() | |
# build WKT geometries |
from typing import List | |
class House: | |
def __init__(self, rooms: List[Room]): | |
self.rooms = rooms | |
def __len__(self): | |
return len(self.rooms) | |
def __getitem__(self, item): |
from typing import List | |
class House: | |
def __init__(self, rooms: List[Room]): | |
self.rooms = rooms | |
def __len__(self): | |
return len(self.rooms) | |
from dataclasses import dataclass | |
from typing import List | |
@dataclass | |
class Room: | |
name: str | |
length: int | |
width: int | |
height: int | |
I hereby claim:
To claim this, I am signing this object:
from shapely.geometry import Point, LineString, box | |
def _expand(geom, amt=0.5): | |
bounds = geom.bounds | |
d = math.sqrt(2 * (amt ** 2)) | |
while True: | |
yield box(*bounds) | |
bounds = (bounds[0] - d, bounds[1] - d, bounds[2] + d, bounds[3] + d) |
/* | |
Taken & expanded from https://stackoverflow.com/a/40377186/4453925 | |
*/ | |
drop function if exists json_sub_array(json, int, int); | |
create or replace function json_sub_array(json_array json, from_pos int, to_pos int) | |
returns json language sql as $$ | |
select json_agg(value) | |
from json_array_elements(json_array) with ordinality | |
where ordinality-1 between from_pos and to_pos | |
$$; |