This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import mock | |
def use_tempfile(): | |
dest_dir = '/tmp' | |
with tempfile.NamedTemporaryFile(dir=dest_dir, delete=False) as temp_dest: | |
print "hello world" | |
return temp_dest | |
@mock.patch.object(tempfile, 'NamedTemporaryFile') | |
def call_use_tempfile(temp_file): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(github3)Matts-Air:github3.py mattchung$ wc -l tests/*.py | sort | |
0 tests/__init__.py | |
17 tests/nbtest.py | |
17 tests/test_github.py | |
22 tests/fixtures.py | |
44 tests/conftest.py | |
79 tests/test_structs.py | |
127 tests/utils.py | |
430 tests/test_repos.py | |
736 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:uwsgi-{{ project }}-{{ env }}] | |
command={% if new_relic_enabled %}{{ env_folder }}/bin/newrelic-admin run-program {% endif %}{{ env_folder }}/bin/uwsgi --ini {{ env_folder }}/uwsgi.ini | |
autostart=true | |
startsecs=10 | |
stopwaitsecs=35 | |
redirect_stderr=true | |
stopsignal=QUIT | |
environment=CELERY_LOADER='django',DJANGO_SETTINGS_CHAIN='www',NEW_RELIC_CONFIG_FILE='/etc/newrelic/new-relic-{{ project }}-{{ env }}-www.ini' | |
stdout_logfile=/var/log/supervisor/uwsgi-{{ project }}-{{ env }}.log | |
stderr_logfile=/var/log/supervisor/uwsgi-{{ project }}-{{ env }}-stderr.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
github3.licenses | |
================ | |
This module contains the classes relating to licenses | |
See also: https://developer.github.com/v3/licenses/ | |
""" | |
from __future__ import unicode_literals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyOtherClass(object): | |
def do_something(self): | |
self.__do_a_new_step() | |
self.__do_one_more_step() | |
# Should be subclassing from MyClass | |
class MyOtherClass(MyClass): | |
def do_something(self): | |
self.__do_a_new_step() | |
self.__do_one_more_step() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sumologic module | |
* @module lib/sumologic | |
*/ | |
var rsvp = require('rsvp'); | |
var fs = require('fs'); | |
var request = require('request') | |
var util = require('util'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(github3)Matts-MacBook-Air:github3.py mattchung$ make tests >> /tmp/github3_errors.txt | |
no previously-included directories found matching '*.pyc' | |
no previously-included directories found matching 'docs/_build' | |
make: *** [travis] Error 1 | |
(github3)Matts-MacBook-Air:github3.py mattchung$ view /tmp/github3_errors.txt | |
Processing /Users/mattchung/Development/github3.py | |
Requirement already satisfied (use --upgrade to upgrade): github3.py==1.0.0a2 from file:///Users/mattchung/Development/github3.py in /Users/mattchung/.virtualenvs/github3/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) | |
Requirement already satisfied (use --upgrade to upgrade): mock==1.0.1 in /Users/mattchung/.virtualenvs/github3/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) | |
Requirement already satisfied (use --upgrade to upgrade): pytest>=2.3.5 in /Users/mattchung/.virtualenvs/github3/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openstack output will be in this color. | |
==> openstack: Creating temporary keypair for this instance... | |
==> openstack: Waiting for server (f8fc5320-019b-44f7-91da-98104571fc60) to become ready... | |
==> openstack: Waiting for SSH to become available... | |
==> openstack: Connected to SSH! | |
==> openstack: Provisioning with Ansible... | |
openstack: Creating Ansible staging directory... | |
openstack: Creating directory: /tmp/packer-provisioner-ansible-local | |
openstack: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1064 class TestTokenize(TestCase): | |
1065 | |
1066 def test_tokenize(self): | |
1067 import tokenize as tokenize_module | |
1068 encoding = object() | |
1069 encoding_used = None | |
1070 def mock_detect_encoding(readline): | |
1071 return encoding, [b'first', b'second'] | |
1072 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Lib/tokenize.py b/Lib/tokenize.py | |
index 8bc83fd..96edf6c 100644 | |
--- a/Lib/tokenize.py | |
+++ b/Lib/tokenize.py | |
@@ -434,12 +434,16 @@ def open(filename): | |
"""Open a file in read only mode using the encoding detected by | |
detect_encoding(). | |
""" | |
- buffer = _builtin_open(filename, 'rb') | |
- encoding, lines = detect_encoding(buffer.readline) |