Use this script to generate a mypy.ini where you can enable strict mode based on errors from a current run.
Needs a few improvments:
- output pyproject.toml
- update source files by adding # type: ignore[xxx] instead of ignore_errors
# Based on https://medium.com/@dario_26152/restrict-access-to-lambda-functionurl-to-cloudfront-using-aws-iam-988583834705 | |
import base64 | |
from typing import TYPE_CHECKING | |
from boto3 import Session | |
from botocore.auth import SigV4Auth | |
from botocore.awsrequest import AWSRequest | |
if TYPE_CHECKING: | |
from typing import TypedDict |
#!/bin/bash | |
# Requires: aws cli and jq | |
set -eux | |
: ${OLD_TABLE:old_table} | |
: ${OLD_PROFILE:prod} | |
: ${NEW_TABLE=new_table} | |
: ${NEW_PROFILE:dev} | |
: ${REGION:eu-west-1} |
// | |
// ViewController.swift | |
// storyboardtest2 | |
// | |
// Created by Johan Dahlin on 2022-07-08. | |
// | |
import Cocoa | |
// https://developer.apple.com/documentation/appkit/nsviewcontroller |
Use this script to generate a mypy.ini where you can enable strict mode based on errors from a current run.
Needs a few improvments:
def fibonacci(n: int) -> int: | |
# The n:th Fibonacci number F(n) with the value of n provided by the user. | |
# https://en.wikipedia.org/wiki/Fibonacci_number | |
# https://en.wikipedia.org/wiki/Fibonacci_number#Sequence_properties | |
match n: | |
case n if not isinstance(n, int): | |
raise TypeError(f"n must be an int, not {type(n).__name__}") | |
case n if 1 >= n >= 0: | |
# F(0) = 0, F(1) = 1 | |
return n |
def part2(data): | |
def candidates(n): | |
return 1 + (n * (n + 1) // 2) | |
lines = [int(v) for v in data.split("\n")] | |
nums = list(sorted(lines)) + [max(lines) + 3] | |
a = 0 | |
i = 0 | |
total = 1 | |
while i < len(nums): | |
b = nums[i] |
import boto3 | |
from typing import Optional, Generator | |
import enum | |
class TaskDefinitionStatus(enum.Enum): | |
ACTIVE = 'ACTIVE' |
license: gpl-3.0 |
impore re | |
import sys | |
IDENTIFIER = "IDENTIFIER" | |
INTEGER = "INTEGER" | |
STRING = "STRING" | |
COMMENT = "COMMENT" | |
DOT = "DOT" | |
COLON = "COLON" | |
SEMICOLON = "SEMICOLON" |