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
|
# coding: utf-8
|
||||||
from __future__ import print_function
|
from __future__ import print_function, unicode_literals
|
||||||
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
try:
|
try:
|
||||||
from itertools import ifilter as filter
|
from itertools import ifilter as filter
|
||||||
@ -25,7 +26,7 @@ def cmd_parser():
|
|||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option('--download', dest='is_download', action='store_true', help='download doujinshi or not')
|
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('--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('--search', type='string', dest='keyword', action='store', help='search doujinshi by keyword')
|
||||||
parser.add_option('--page', type='int', dest='page', action='store', default=1,
|
parser.add_option('--page', type='int', dest='page', action='store', default=1,
|
||||||
help='page number of search result')
|
help='page number of search result')
|
||||||
@ -38,7 +39,13 @@ def cmd_parser():
|
|||||||
help='timeout of download doujinshi')
|
help='timeout of download doujinshi')
|
||||||
parser.add_option('--proxy', type='string', dest='proxy', action='store', default='',
|
parser.add_option('--proxy', type='string', dest='proxy', action='store', default='',
|
||||||
help='use proxy, example: http://127.0.0.1:1080')
|
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:
|
if args.tags:
|
||||||
logger.warning('`--tags` is under construction')
|
logger.warning('`--tags` is under construction')
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python2.7
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals, print_function
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
from nhentai.cmdline import cmd_parser, banner
|
from nhentai.cmdline import cmd_parser, banner
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals, print_function
|
||||||
import os
|
import os
|
||||||
from nhentai.utils import urlparse
|
from nhentai.utils import urlparse
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import print_function
|
from __future__ import print_function, unicode_literals
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
# from builtins import range
|
from future.builtins import range
|
||||||
|
|
||||||
from nhentai.constant import DETAIL_URL, IMAGE_URL
|
from nhentai.constant import DETAIL_URL, IMAGE_URL
|
||||||
from nhentai.logger import logger
|
from nhentai.logger import logger
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-
|
||||||
from builtins import str as text
|
from __future__ import unicode_literals, print_function
|
||||||
|
from future.builtins import str as text
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import threadpool
|
import threadpool
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
|
# 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 logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import print_function
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import re
|
import re
|
||||||
@ -99,7 +99,7 @@ def search_parser(keyword, page):
|
|||||||
def print_doujinshi(doujinshi_list):
|
def print_doujinshi(doujinshi_list):
|
||||||
if not doujinshi_list:
|
if not doujinshi_list:
|
||||||
return
|
return
|
||||||
doujinshi_list = [i.values() for i in doujinshi_list]
|
doujinshi_list = [(i['id'], i['title']) for i in doujinshi_list]
|
||||||
headers = ['id', 'doujinshi']
|
headers = ['id', 'doujinshi']
|
||||||
logger.info('Search Result\n' +
|
logger.info('Search Result\n' +
|
||||||
tabulate(tabular_data=doujinshi_list, headers=headers, tablefmt='rst'))
|
tabulate(tabular_data=doujinshi_list, headers=headers, tablefmt='rst'))
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
|
|
||||||
class _Singleton(type):
|
class _Singleton(type):
|
||||||
""" A metaclass that creates a Singleton base class when called. """
|
""" A metaclass that creates a Singleton base class when called. """
|
||||||
@ -10,7 +12,7 @@ class _Singleton(type):
|
|||||||
return cls._instances[cls]
|
return cls._instances[cls]
|
||||||
|
|
||||||
|
|
||||||
class Singleton(_Singleton('SingletonMeta', (object,), {})):
|
class Singleton(_Singleton(str('SingletonMeta'), (object,), {})):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user