Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Next experiment incoming

Timothy Edmund Crosley timothycrosley

🤔
Next experiment incoming
View GitHub Profile
@timothycrosley
timothycrosley / yapf.diff
Created Oct 2, 2020
diff produced from running isort on yapf project
View yapf.diff
diff --git a/setup.py b/setup.py
index 21e9470..ecf9b6a 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,8 @@ import codecs
import sys
import unittest
-from setuptools import setup, Command
+from setuptools import Command
@timothycrosley
timothycrosley / pytype.diff
Created Oct 2, 2020
Diff produced from running isort on pytype
View pytype.diff
diff --git a/build_scripts/build.py b/build_scripts/build.py
index bff729f5..5659a569 100755
--- a/build_scripts/build.py
+++ b/build_scripts/build.py
@@ -15,6 +15,7 @@ import sys
import build_utils
import py27
+
def parse_args():
@timothycrosley
timothycrosley / abseil-py.diff
Created Oct 2, 2020
abseil-py after isort is ran
View abseil-py.diff
diff --git a/absl/_enum_module.py b/absl/_enum_module.py
index 899c488..c12e1d8 100644
--- a/absl/_enum_module.py
+++ b/absl/_enum_module.py
@@ -41,6 +41,7 @@ the following is true:
"""
# pylint: disable=unused-import
import sys
+
import six
View pull_for_sh_output.py
from sh import zfs_scrub, do_scrub
@hug.cli()
def do_scrub():
for output in zfs_scrub(''):
cache.set('key', output.split('%')[0].split(' ')[-1])
cache.set('key', 'done')
View mutually_exclusive.py
@hug.cli(validate=contains_one_of('argument_one', 'argument_two')) # you can combine these to make more then one mutually exclusive group
def mutually_exclusive_group(argument_one: type, argument_two: type):
pass
View open_file.py
import sys
with open(sys.argv[1]) as file:
print(file.read())
View unsafe_main.rs
fn main() {
let x = the_world_is_not_safe();
}
unsafe fn the_world_is_not_safe() -> String {
String::from("Hello, world!")
}
View uuid_field.py
from peewee import TextField
class BetterUUID(TextField):
"""Stores a uuid only defining it if it doesn't already exist"""
def db_value(self, value):
if not value:
value = uuid.uuid4()
return value
View persons.py
# Classes
class Person(object):
def contact(self):
self.email()
self.call()
def email(self):
View listcomprehension.py
my_favorite_numbers = []
for number in range(10):
if number == 7 or number == 42:
my_favorite_numbers.append(number)
my_favorite_numbers = [number for number in range(10) if number == 7 or number == 42]