Optional values often have to tell the type checker that they are no longer optional. To do this, use assert
:
assert x is not None, "x should exist"
from typing import Dict, List, Optional, Union | |
from pylint.checkers import BaseChecker | |
from pylint.interfaces import IAstroidChecker | |
from pylint.lint import PyLinter | |
import astroid | |
from astroid.scoped_nodes import FunctionDef | |
OLD_USER
to the current owner of the repositories to transfer.NEW_USER
to the new owner.REPOS
to be an iterable of repository names (str
) to transfer.cookies.txt
in the same location as the script. On every line in cookies.txt
that starts with 'github.com' change it to '.github.com'.python gh-transfer.py
because the API does not have this feature!You can extract cookies from Chrome in Netscape format with EditThisCookie.
Fibonacci Sequence. | |
Romeo, a young man with a remarkable patience. | |
Juliet, a likewise young woman of remarkable grace. | |
Ghost, another character. | |
Ophelia, flatterer. | |
Act I: The one. | |
Scene I: Zero. |
#!/usr/bin/env bash | |
set -e | |
SIGNING_IDENTITY='iPhone Distribution: Andrew Udvare (EU5R2QY9HJ)' | |
mkdir -p ~/dev/retroarch | |
cd ~/dev/retroarch | |
if ! [ -d retroarch ]; then | |
git clone https://github.com/libretro/RetroArch.git retroarch | |
fi |
#!/bin/sh | |
# | |
function killAllProcs( ) | |
{ | |
sudo /usr/bin/killall $1 | |
/bin/ps ax | /usr/bin/grep $1|/usr/bin/awk '{print $1}'|/usr/bin/xargs sudo kill -9 | |
} | |
echo "removing LANDesk Client" |
// ==UserScript== | |
// @name No Discover | |
// @homepage https://gist.github.com/Tatsh/d1b5a039d6f511c95a08daade8b07a81 | |
// @namespace https://tat.sh | |
// @version 0.0.5 | |
// @description Hide the Discover section in >= 1012px view. | |
// @author Tatsh | |
// @match https://github.com | |
// @grant none | |
// @run-at document-end |
const sorted = (xs) => | |
xs.length < 2 | |
? xs | |
: sorted(xs.slice(1).filter((x) => x < xs[0])).concat( | |
[xs[0]], | |
sorted(xs.slice(1).filter((x) => x > xs[0])) | |
); |
const sorted = (a) => Array.prototype.sort.call(a, (a, b) => a - b); | |
const tail = (n, a) => Array.prototype.slice.call(a, n); | |
const abs = Math.abs; | |
const solution = (a) => { | |
const sa = sorted(a); | |
let last = abs(a[0]); | |
for (const x of tail(1, sa)) { | |
const negative = x < 0; |
#!/usr/bin/env python | |
from argparse import Namespace | |
from string import Template | |
import sys | |
Codes = Namespace( | |
Bold=chr(2), | |
Color=chr(3), | |
Normal=chr(15), | |
Underline=chr(31), |