| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 60d241f commit 3172c5d
77 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,7 +48,6 @@ typedef struct { | |||
| 48 | 48 | */ | |
| 49 | 49 | } PyStringObject; | |
| 50 | 50 | ||
| 51 | - PyAPI_DATA(PyTypeObject) PyBaseString_Type; | ||
| 52 | 51 | PyAPI_DATA(PyTypeObject) PyString_Type; | |
| 53 | 52 | ||
| 54 | 53 | #define PyString_Check(op) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -271,7 +271,7 @@ def read(self, filenames): | |||
| 271 | 271 | ||
| 272 | 272 | Return list of successfully read files. | |
| 273 | 273 | """ | |
| 274 | - if isinstance(filenames, basestring): | ||
| 274 | + if isinstance(filenames, str): | ||
| 275 | 275 | filenames = [filenames] | |
| 276 | 276 | read_ok = [] | |
| 277 | 277 | for filename in filenames: | |
@@ -652,7 +652,7 @@ def _interpolate_some(self, option, accum, rest, section, map, depth): | |||
| 652 | 652 | ||
| 653 | 653 | def set(self, section, option, value): | |
| 654 | 654 | """Set an option. Extend ConfigParser.set: check for string values.""" | |
| 655 | - if not isinstance(value, basestring): | ||
| 655 | + if not isinstance(value, str): | ||
| 656 | 656 | raise TypeError("option values must be strings") | |
| 657 | 657 | # check for bad percent signs: | |
| 658 | 658 | # first, replace all "good" interpolations | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | class UserString: | |
| 13 | 13 | def __init__(self, seq): | |
| 14 | - if isinstance(seq, basestring): | ||
| 14 | + if isinstance(seq, str): | ||
| 15 | 15 | self.data = seq | |
| 16 | 16 | elif isinstance(seq, UserString): | |
| 17 | 17 | self.data = seq.data[:] | |
@@ -66,12 +66,12 @@ def __getitem__(self, index): return self.__class__(self.data[index]) | |||
| 66 | 66 | def __add__(self, other): | |
| 67 | 67 | if isinstance(other, UserString): | |
| 68 | 68 | return self.__class__(self.data + other.data) | |
| 69 | - elif isinstance(other, basestring): | ||
| 69 | + elif isinstance(other, str): | ||
| 70 | 70 | return self.__class__(self.data + other) | |
| 71 | 71 | else: | |
| 72 | 72 | return self.__class__(self.data + str(other)) | |
| 73 | 73 | def __radd__(self, other): | |
| 74 | - if isinstance(other, basestring): | ||
| 74 | + if isinstance(other, str): | ||
| 75 | 75 | return self.__class__(other + self.data) | |
| 76 | 76 | else: | |
| 77 | 77 | return self.__class__(str(other) + self.data) | |
@@ -184,7 +184,7 @@ def __setitem__(self, index, sub): | |||
| 184 | 184 | if isinstance(index, slice): | |
| 185 | 185 | if isinstance(sub, UserString): | |
| 186 | 186 | sub = sub.data | |
| 187 | - elif not isinstance(sub, basestring): | ||
| 187 | + elif not isinstance(sub, str): | ||
| 188 | 188 | sub = str(sub) | |
| 189 | 189 | start, stop, step = index.indices(len(self.data)) | |
| 190 | 190 | if step == -1: | |
@@ -221,7 +221,7 @@ def immutable(self): | |||
| 221 | 221 | def __iadd__(self, other): | |
| 222 | 222 | if isinstance(other, UserString): | |
| 223 | 223 | self.data += other.data | |
| 224 | - elif isinstance(other, basestring): | ||
| 224 | + elif isinstance(other, str): | ||
| 225 | 225 | self.data += other | |
| 226 | 226 | else: | |
| 227 | 227 | self.data += str(other) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -490,7 +490,8 @@ def count(self, value): | |||
| 490 | 490 | return sum(1 for v in self if v == value) | |
| 491 | 491 | ||
| 492 | 492 | Sequence.register(tuple) | |
| 493 | - Sequence.register(basestring) | ||
| 493 | + Sequence.register(str) | ||
| 494 | + Sequence.register(str8) | ||
| 494 | 495 | Sequence.register(memoryview) | |
| 495 | 496 | ||
| 496 | 497 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,7 +169,7 @@ def close(self): | |||
| 169 | 169 | class BinHex: | |
| 170 | 170 | def __init__(self, name_finfo_dlen_rlen, ofp): | |
| 171 | 171 | name, finfo, dlen, rlen = name_finfo_dlen_rlen | |
| 172 | - if isinstance(ofp, basestring): | ||
| 172 | + if isinstance(ofp, str): | ||
| 173 | 173 | ofname = ofp | |
| 174 | 174 | ofp = io.open(ofname, 'wb') | |
| 175 | 175 | if os.name == 'mac': | |
@@ -371,7 +371,7 @@ def close(self): | |||
| 371 | 371 | ||
| 372 | 372 | class HexBin: | |
| 373 | 373 | def __init__(self, ifp): | |
| 374 | - if isinstance(ifp, basestring): | ||
| 374 | + if isinstance(ifp, str): | ||
| 375 | 375 | ifp = io.open(ifp, 'rb') | |
| 376 | 376 | # | |
| 377 | 377 | # Find initial colon. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,7 +153,7 @@ def runcall(self, func, *args, **kw): | |||
| 153 | 153 | # ____________________________________________________________ | |
| 154 | 154 | ||
| 155 | 155 | def label(code): | |
| 156 | - if isinstance(code, basestring): | ||
| 156 | + if isinstance(code, str): | ||
| 157 | 157 | return ('~', 0, code) # built-in functions ('~' sorts at the end) | |
| 158 | 158 | else: | |
| 159 | 159 | return (code.co_filename, code.co_firstlineno, code.co_name) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -356,7 +356,7 @@ def columnize(self, list, displaywidth=80): | |||
| 356 | 356 | return | |
| 357 | 357 | ||
| 358 | 358 | nonstrings = [i for i in range(len(list)) | |
| 359 | - if not isinstance(list[i], basestring)] | ||
| 359 | + if not isinstance(list[i], str)] | ||
| 360 | 360 | if nonstrings: | |
| 361 | 361 | raise TypeError("list[i] not a string for i in %s" | |
| 362 | 362 | % ", ".join(map(str, nonstrings))) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -367,7 +367,7 @@ def split_header_words(header_values): | |||
| 367 | 367 | [[('Basic', None), ('realm', '"foobar"')]] | |
| 368 | 368 | ||
| 369 | 369 | """ | |
| 370 | - assert not isinstance(header_values, basestring) | ||
| 370 | + assert not isinstance(header_values, str) | ||
| 371 | 371 | result = [] | |
| 372 | 372 | for text in header_values: | |
| 373 | 373 | orig_text = text | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,7 +114,7 @@ class found there. (This assumes classes don't modify their | |||
| 114 | 114 | if "__slots__" in c.__dict__: | |
| 115 | 115 | slots = c.__dict__['__slots__'] | |
| 116 | 116 | # if class has a single slot, it can be given as a string | |
| 117 | - if isinstance(slots, basestring): | ||
| 117 | + if isinstance(slots, str): | ||
| 118 | 118 | slots = (slots,) | |
| 119 | 119 | for name in slots: | |
| 120 | 120 | # special descriptors | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -588,7 +588,7 @@ def __new__(cls, value="0", context=None): | |||
| 588 | 588 | ||
| 589 | 589 | # From a string | |
| 590 | 590 | # REs insist on real strings, so we can too. | |
| 591 | - if isinstance(value, basestring): | ||
| 591 | + if isinstance(value, str): | ||
| 592 | 592 | if _isinfinity(value): | |
| 593 | 593 | self._exp = 'F' | |
| 594 | 594 | self._int = (0,) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments