Skip to content

Instantly share code, notes, and snippets.

View squiddy's full-sized avatar
🏠
Working from home

Reiner Gerecke squiddy

🏠
Working from home
View GitHub Profile
@squiddy
squiddy / gist:c6dd6479da8cd5b7495374fd4ba85acf
Created October 26, 2016 21:30
mypy horizons@7af173325af9d75ae6526fe22abaafaad603d719
$ mypy horizons | grep -v horizons.ext.typing | grep -v "Name '_' is not defined" 2507-cli-load-scenario env [23:03]
horizons/world/units/collectors/collector.py:521: error: Name 'sort_jobs' already defined
horizons/world/building/buildable.py: note: In class "BuildableSingleEverywhere":
horizons/world/building/buildable.py:321: error: Need type annotation for variable
horizons/world/building/buildable.py: note: In class "BuildableSingleOnDeposit":
horizons/world/building/buildable.py:548: error: Need type annotation for variable
horizons/gui/widgets/productionoverview.py: note: In class "MultiPageStatsWidget":
horizons/gui/widgets/productionoverview.py:43: error: Need type annotation for variable
horizons/gui/widgets/productionoverview.py: note: In class "ProductionOverview":
horizons/gui/widgets/productionove
[case testBuiltinTupleValueAsExceptionType]
import typing
class BaseException: pass
class E1(BaseException): pass
exs = tuple([E1])
try: pass
except exs as e1:
x = e1 # type: E1
[builtins fixtures/exception.pyi]
@squiddy
squiddy / Traceback
Last active August 29, 2015 14:05
Django 1.5.9 - DisallowedModelAdminToField for M2N Through Object
Traceback:
File "/tmp/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
113. response = callback(request, *callback_args, **callback_kwargs)
File "/tmp/env/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
390. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/tmp/env/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/tmp/env/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
89. response = view_func(request, *args, **kwargs)
File "/tmp/env/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
struct Foo<'a> {
a: Vec<String>,
b: Vec<Vec<&'a String>>
}
impl<'a> Foo<'a> {
fn bar(&mut self) {
let mut c = vec![];
c.push(self.a.get(0));
^~~~~~~~~~~~~~~~~ error: cannot infer an appropriate lifetime for autoref due to conflicting requirements
@squiddy
squiddy / gist:7943093
Created December 13, 2013 11:38
Artificially slow down upload speed on flask apps to test file upload progress events
In werkzeug.formparser change MultiPartParser.parse_parts. Look for
elif ellt == _cont:
_write(ell)
# if we write into memory and there is a memory size limit we
# count the number of bytes in memory and raise an exception if
# there is too much data in memory.
if guard_memory:
in_memory += len(ell)
if in_memory > self.max_form_memory_size:
[util/log]:74 debug => Logging system initialized
[util/log]:74 debug => Logging system initialized
[gl/texture]:61 debug => Loaded image data/img/console/left.png with 40x300:4
[gl/texture]:61 debug => Loaded image data/img/console/right.png with 40x300:4
[gl/texture]:61 debug => Loaded image data/img/console/middle.png with 1x300:4
[state/console/console]:220 debug => Loading console state.
[state/console/console_renderer]:57 debug => Loading console renderer state
[obj/md5/model/model]:125 debug => Parsing model data/models/berserker/berserker.md5mesh
[obj/md5/model/model]:136 debug => Model version: 10
[obj/md5/model/model]:144 debug => Model joints: 41
diff --git a/content/scenarios/tutorial_en.yaml b/content/scenarios/tutorial_en.yaml
index 3845ecc..1be531d 100644
--- a/content/scenarios/tutorial_en.yaml
+++ b/content/scenarios/tutorial_en.yaml
@@ -410,8 +410,7 @@ events:
- type: set_var
arguments: ["tutorial_progress", 16]
conditions:
- - type: time_passed
- arguments: [0]
import functools
import httplib
import json
import threading
import time
import urllib
from wsgiref.simple_server import make_server
from irc.client import SimpleIRCClient
@squiddy
squiddy / pychan.diff
Created March 19, 2012 21:53
PyChan Tooltip patch
diff --git a/horizons/engine/pychan_util.py b/horizons/engine/pychan_util.py
index a4d869b..e1ad670 100644
--- a/horizons/engine/pychan_util.py
+++ b/horizons/engine/pychan_util.py
@@ -21,7 +21,6 @@
# ###################################################
import functools
-import new
@squiddy
squiddy / gist:1482109
Created December 15, 2011 18:02
codespeed django 1.2
diff --git a/example/settings.py b/example/settings.py
index 5d6f346..da47af2 100644
--- a/example/settings.py
+++ b/example/settings.py
@@ -98,7 +98,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
- 'django.core.context_processors.static',
+ 'staticfiles.context_processors.static',