Skip to content

Commit

Permalink
[FIX] pstats-print2list: Avoid the six package (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus Zapata authored and moylop260 committed Oct 1, 2017
1 parent 7c614fa commit dd4958b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pstats_print2list/pstats_print2list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import os
import pstats
import re
from six import string_types
try:
basestring
except NameError:
basestring = (str, bytes)
try:
from StringIO import StringIO
except ImportError:
Expand All @@ -24,7 +27,7 @@ def get_field_list():


def is_fname_match(fname, fmatch_list):
if isinstance(fmatch_list, string_types):
if isinstance(fmatch_list, basestring):
fmatch_list = [fmatch_list]
if not fmatch_list:
return True
Expand All @@ -37,7 +40,7 @@ def is_fname_match(fname, fmatch_list):
def is_exclude(fname, exclude_fnames):
if exclude_fnames is None:
exclude_fnames = []
if isinstance(exclude_fnames, string_types):
if isinstance(exclude_fnames, basestring):
exclude_fnames = [exclude_fnames]
for exclude_fname in exclude_fnames:
if exclude_fname in fname:
Expand Down Expand Up @@ -72,7 +75,7 @@ def get_pstats_print2list(fnames, filter_fnames=None, exclude_fnames=None,
and limited.
"""

if isinstance(fnames, string_types):
if isinstance(fnames, basestring):
fnames = [fnames]
fnames_expanded = [
os.path.expandvars(os.path.expanduser(fname)) for fname in fnames]
Expand Down

0 comments on commit dd4958b

Please sign in to comment.