Skip to content

Instantly share code, notes, and snippets.

View guilatrova's full-sized avatar
🐍
Making Python learning easy

Guilherme Latrova guilatrova

🐍
Making Python learning easy
View GitHub Profile
@smmoosavi
smmoosavi / Exceptions.py
Created May 26, 2017 06:38
graphene-django custom error and better error handling
class ResponseError(Exception):
def __init__(self, message, code=None, params=None):
super().__init__(message)
self.message = str(message)
self.code = code
self.params = params
@vcastellm
vcastellm / ecs-run
Last active April 15, 2024 17:55
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@palankai
palankai / specification.py
Last active March 29, 2024 10:02
Python Specification Pattern
class Specification:
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
def __xor__(self, other):
return Xor(self, other)
@davesque
davesque / patcher_test_case.py
Created August 30, 2013 20:09
setUp/tearDown patcher pattern for python unittest and python mock
import unittest
from mock import call, patch
class PatcherTestCase(unittest.TestCase):
def setUp(self):
self.patcher = patch('some_module.some_object')
self.mock_object = self.patcher.start()