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 dataclasses import dataclass, replace | |
from typing import List, Optional | |
@dataclass(frozen=True) | |
class State: | |
val1: float | |
val2: float | |
@dataclass | |
class Controller: |
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
type MembershipType = "Basic" | "Pro" | "Premium"; | |
type SignUp = { | |
userId: string; | |
phoneNumber: string; | |
membershipType: MembershipType; | |
}; | |
type MembershipUpdate = { | |
membershipType: MembershipType; |
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 { Events as MarketingEvents } from "./MarketingEvents"; | |
import { Events as SalesEvents } from "./SalesEvents"; | |
import { Events as UserEvents } from "./UserEvents"; | |
type EventsBySource = { | |
Marketing: MarketingEvents; | |
Sales: SalesEvents; | |
User: UserEvents; | |
}; |
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 * as schemas from "@aws-cdk/aws-eventschemas"; | |
import * as cdk from "@aws-cdk/core"; | |
import { generateOpenApiSchema } from "./generators/schemaGenerator"; | |
... | |
this.schema = new schemas.CfnSchema(this, "MySchema", { | |
registryName: props.mlRegistry.attrRegistryName, | |
type: "OpenApi3", | |
description: "Schema Definition for my events", |
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 * as tsj from "ts-json-schema-generator"; | |
const toOpenApi = require("json-schema-to-openapi-schema"); | |
const defaultConfig: SchemaConfig = { | |
tsconfig: "./tsconfig-types.json", | |
type: "*", | |
}; | |
export const generateOpenApiSchema = ( | |
schemaName: string, |
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 influxdb import InfluxDBClient | |
from influxdb.resultset import ResultSet | |
import pandas as pd | |
from typing import Any, List, Optional | |
import os | |
client: InfluxDBClient | |
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
const smsNotificationZones = { | |
"eu-central-1": "eu-west-1", | |
"eu-west-1": "eu-west-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 datetime import datetime | |
from typing import List, Optional | |
from pydantic import BaseModel, validator | |
from random import randint | |
from typing import List | |
from re import search | |
""" | |
Add this to your mypy.ini |
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 dataclasses as dc | |
from typing import List | |
@dc.dataclass(frozen=True) | |
class User: | |
id: float | |
name: str | |
email: str | |
active: bool |
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 dataclasses as dc | |
from typing import List | |
import fnc | |
@dc.dataclass(frozen=True) | |
class User: | |
id: float | |
name: str | |
email: str |