From d86f8b812b174445cafa8eeb39809fc05b4fd63f Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 7 Jan 2014 13:07:55 +0100 Subject: [PATCH] Code cleanup. --- docs/conf.py | 3 +-- dpaste/highlight.py | 4 ++-- dpaste/models.py | 1 - dpaste/tests/test_api.py | 5 ----- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 90050b1..eb7f4b2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,8 +11,7 @@ # # All configuration values have a default; values that are commented out # serve to show the default. - -import sys +#import sys import os # If extensions (or modules to document with autodoc) are in another directory, diff --git a/dpaste/highlight.py b/dpaste/highlight.py index 80c3b01..1c14f11 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -112,7 +112,7 @@ class NakedHtmlFormatter(HtmlFormatter): def pygmentize(code_string, lexer_name=LEXER_DEFAULT): try: lexer = lexer_name and get_lexer_by_name(lexer_name) \ - or PythonLexer() - except Exception as e: + or PythonLexer() + except Exception: lexer = PythonLexer() return highlight(code_string, lexer, NakedHtmlFormatter()) diff --git a/dpaste/models.py b/dpaste/models.py index ef3b04f..8532780 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -1,5 +1,4 @@ from datetime import datetime -from os import urandom from random import SystemRandom from django.db import models diff --git a/dpaste/tests/test_api.py b/dpaste/tests/test_api.py index c189b99..3525596 100644 --- a/dpaste/tests/test_api.py +++ b/dpaste/tests/test_api.py @@ -5,8 +5,6 @@ from django.test.client import Client from django.test import TestCase from ..models import Snippet -from ..forms import EXPIRE_DEFAULT -from ..highlight import LEXER_DEFAULT class SnippetAPITestCase(TestCase): @@ -121,8 +119,6 @@ class SnippetAPITestCase(TestCase): } response = self.client.post(self.api_url, data) - content = response.content.decode('utf-8') - self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) @@ -135,6 +131,5 @@ class SnippetAPITestCase(TestCase): 'lexer': 'foobar' } response = self.client.post(self.api_url, data) - content = response.content.decode('utf-8') self.assertEqual(response.status_code, 400) self.assertEqual(Snippet.objects.count(), 0)