Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dstufft on github.
  • I am dstufft (https://keybase.io/dstufft) on keybase.
  • I have a public key whose fingerprint is 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

To claim this, I am signing this object:

Hi. This is D. J. Bernstein's automated mail-handling program. I've
received a message from you. The top of your message is shown below.
Professor Bernstein receives many interesting messages. Unfortunately,
he also receives a torrent of unsolicited commercial mail, unsolicited
job applications, unsolicited mailing-list subscriptions, forged
mailing-list subscriptions, etc.
Professor Bernstein has asked me to reject all bulk mail messages. But
I'm a rather primitive computer program, and I'm not sure whether your
00:00:00+00:00 = midnight England = midnight UTC => False
00:00:00+01:00 = midnight France = 2300 UTC => True
01:00:00+01:00 = 1 am France = midnight UTC => False
19:00:00-05:00 = 1 am Boston = midnight UTC => True
if dt.time():
counts[dt.date()] += 1
else:
counts[dt.date() - timedelta(1)] += 1
## Option 1
# warehouse/packaging/db.py
class Database:
def query_that_thing(self):
pass
# warehouse/accounts/db.py
class Database:
def query_that_other_thing(self):
pass
# warehouse/application.py
>>> def __one__(self):
... pass
...
>>> class Foo:
... __two__ = __one__
... def __three__(self):
... pass
...
>>> Foo.__four__ = __one__
>>> obj = Foo()
# Option 1
filename = None
try:
fileobj = tempfile.NamedTemporaryFile(delete=False)
filename = fileobj.name
fileobj.close() # Required because not all platforms can reopen a file a second time
with open(filename, "w") as fp:
fp.write(pkgutil.get_data("something.txt"))
>>> class Foo(dict):
... def keys(self):
... raise NotImplementedError()
...
>>> print(**Foo())
>>> Foo().keys()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in keys
[distutils]
index-servers =
pypi
testpypi
[pypi]
username:dstufft
password:notmypassword
[testpypi]
--allow-unverified PIL
--allow-unverified bar
PIL==1.0
foo=2.0 # Implicitly depends on bar, which requires an unverified