Skip to content

Instantly share code, notes, and snippets.

View nicoddemus's full-sized avatar

Bruno Oliveira nicoddemus

View GitHub Profile
@nicoddemus
nicoddemus / update-mypy-flags.py
Last active May 16, 2024 12:26
Apply allow-untyped-defs
"""
Change the "default" flags for files in a project, so new files will require full type annotations.
If a file has no flags, it adds "allow-untyped-defs".
If a file already has "disallow-untyped-defs", that flag is removed.
Together with this script, one should update the mypy.ini file of a project:
[mypy.app.*]
disallow_untyped_defs = true
@jjhelmus
jjhelmus / update_token.py
Created August 14, 2017 23:38
Python script to update the Anaconda upload token in conda-forge feedstocks
from __future__ import print_function
import os
import requests
import ruamel.yaml
with open(os.path.expanduser('~/.conda-smithy/circle.token'), 'r') as fh:
circle_token = fh.read().strip()
@canassa
canassa / fix_pytest.py
Last active December 8, 2015 08:59
Converts self.assertEquals to assert
"""
Replaces unittest style asserts (e.g.: self.assertEqual) with py.test style asserts
Usage:
from lib2to3.refactor import RefactoringTool
refactoring_tool = RefactoringTool(['fix_pytest'])
refactoring_tool.refactor(['input.py'], write=True)
"""