mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-30 00:00:48 +02:00
unicode literals
This commit is contained in:
parent
cc2f0521b3
commit
8f3bdc73bf
@ -1,5 +1,6 @@
|
||||
# coding: utf-8
|
||||
from __future__ import print_function
|
||||
from __future__ import print_function, unicode_literals
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
try:
|
||||
from itertools import ifilter as filter
|
||||
@ -25,7 +26,7 @@ def cmd_parser():
|
||||
parser = OptionParser()
|
||||
parser.add_option('--download', dest='is_download', action='store_true', help='download doujinshi or not')
|
||||
parser.add_option('--show-info', dest='is_show', action='store_true', help='just show the doujinshi information.')
|
||||
parser.add_option('--id', type='str', dest='id', action='store', help='doujinshi ids set, e.g. 1,2,3')
|
||||
parser.add_option('--id', type='string', dest='id', action='store', help='doujinshi ids set, e.g. 1,2,3')
|
||||
parser.add_option('--search', type='string', dest='keyword', action='store', help='search doujinshi by keyword')
|
||||
parser.add_option('--page', type='int', dest='page', action='store', default=1,
|
||||
help='page number of search result')
|
||||
@ -38,7 +39,13 @@ def cmd_parser():
|
||||
help='timeout of download doujinshi')
|
||||
parser.add_option('--proxy', type='string', dest='proxy', action='store', default='',
|
||||
help='use proxy, example: http://127.0.0.1:1080')
|
||||
args, _ = parser.parse_args()
|
||||
|
||||
try:
|
||||
sys.argv = list(map(lambda x: unicode(x.decode('utf-8')), sys.argv))
|
||||
except (NameError, TypeError):
|
||||
pass
|
||||
|
||||
args, _ = parser.parse_args(sys.argv[1:])
|
||||
|
||||
if args.tags:
|
||||
logger.warning('`--tags` is under construction')
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2.7
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals, print_function
|
||||
import signal
|
||||
|
||||
from nhentai.cmdline import cmd_parser, banner
|
||||
|
@ -1,3 +1,5 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals, print_function
|
||||
import os
|
||||
from nhentai.utils import urlparse
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# coding: utf-8
|
||||
from __future__ import print_function
|
||||
from __future__ import print_function, unicode_literals
|
||||
from tabulate import tabulate
|
||||
# from builtins import range
|
||||
from future.builtins import range
|
||||
|
||||
from nhentai.constant import DETAIL_URL, IMAGE_URL
|
||||
from nhentai.logger import logger
|
||||
|
@ -1,5 +1,6 @@
|
||||
# coding: utf-8
|
||||
from builtins import str as text
|
||||
# coding: utf-
|
||||
from __future__ import unicode_literals, print_function
|
||||
from future.builtins import str as text
|
||||
import os
|
||||
import requests
|
||||
import threadpool
|
||||
|
@ -1,6 +1,7 @@
|
||||
#
|
||||
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
|
||||
#
|
||||
from __future__ import print_function, unicode_literals
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
@ -1,5 +1,5 @@
|
||||
# coding: utf-8
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals, print_function
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import re
|
||||
@ -99,7 +99,7 @@ def search_parser(keyword, page):
|
||||
def print_doujinshi(doujinshi_list):
|
||||
if not doujinshi_list:
|
||||
return
|
||||
doujinshi_list = [i.values() for i in doujinshi_list]
|
||||
doujinshi_list = [(i['id'], i['title']) for i in doujinshi_list]
|
||||
headers = ['id', 'doujinshi']
|
||||
logger.info('Search Result\n' +
|
||||
tabulate(tabular_data=doujinshi_list, headers=headers, tablefmt='rst'))
|
||||
|
@ -1,4 +1,6 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals, print_function
|
||||
|
||||
|
||||
class _Singleton(type):
|
||||
""" A metaclass that creates a Singleton base class when called. """
|
||||
@ -10,7 +12,7 @@ class _Singleton(type):
|
||||
return cls._instances[cls]
|
||||
|
||||
|
||||
class Singleton(_Singleton('SingletonMeta', (object,), {})):
|
||||
class Singleton(_Singleton(str('SingletonMeta'), (object,), {})):
|
||||
pass
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user