Skip to content

Instantly share code, notes, and snippets.

View anatoly-scherbakov's full-sized avatar

Anatoly Scherbakov anatoly-scherbakov

View GitHub Profile
@anatoly-scherbakov
anatoly-scherbakov / setup.cfg
Last active March 18, 2020 08:10
My custom setup.cfg file for wemake-python-styleguide
# Source:
# https://github.com/wemake-services/wemake-python-styleguide/blob/master/setup.cfg
# All configuration for plugins and other utils is defined here.
# Read more about `setup.cfg`:
# https://docs.python.org/3/distutils/configfile.html
# === Linter configuration ===
# You can reuse this configuration in your own projects.
@anatoly-scherbakov
anatoly-scherbakov / dataclass_as_exception.py
Created February 22, 2020 16:03
Use dataclass as exception to communicate between different layers of an application
import dataclasses
@dataclasses.dataclass(frozen=True)
class AgeError(Exception):
name: str
age: int
def __str__(self):
return f'{self.name}, your age {self.age} is below minimum. Go play.'
@anatoly-scherbakov
anatoly-scherbakov / keybase.md
Created December 15, 2019 15:50
keybase.md

Keybase proof

I hereby claim:

  • I am anatoly-scherbakov on github.
  • I am homo_yetiensis (https://keybase.io/homo_yetiensis) on keybase.
  • I have a public key ASBsAsof7Lc8L9y_3XGt8gxpA9Z8iSepWgQOu0fhav-jTQo

To claim this, I am signing this object:

@anatoly-scherbakov
anatoly-scherbakov / test_parse.py
Created August 26, 2019 17:51
Parse UNRAR output with pyparsing
#!/bin/env python3
import json
from pyparsing import (
ParserElement, Literal, Group, restOfLine,
ZeroOrMore, LineEnd, CharsNotIn
)
TEXT = """UNRAR 5.71 freeware Copyright (c) 1993-2019 Alexander Roshal