MCPcopy Index your code
hub / github.com/python/cpython / UserString

Class UserString

Lib/collections/__init__.py:1401–1650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1399################################################################################
1400
1401class UserString(_collections_abc.Sequence):
1402
1403 def __init__(self, seq):
1404 if isinstance(seq, str):
1405 self.data = seq
1406 elif isinstance(seq, UserString):
1407 self.data = seq.data[:]
1408 else:
1409 self.data = str(seq)
1410
1411 def __str__(self):
1412 return str(self.data)
1413
1414 def __repr__(self):
1415 return repr(self.data)
1416
1417 def __int__(self):
1418 return int(self.data)
1419
1420 def __float__(self):
1421 return float(self.data)
1422
1423 def __complex__(self):
1424 return complex(self.data)
1425
1426 def __hash__(self):
1427 return hash(self.data)
1428
1429 def __getnewargs__(self):
1430 return (self.data[:],)
1431
1432 def __eq__(self, string):
1433 if isinstance(string, UserString):
1434 return self.data == string.data
1435 return self.data == string
1436
1437 def __lt__(self, string):
1438 if isinstance(string, UserString):
1439 return self.data < string.data
1440 return self.data < string
1441
1442 def __le__(self, string):
1443 if isinstance(string, UserString):
1444 return self.data <= string.data
1445 return self.data <= string
1446
1447 def __gt__(self, string):
1448 if isinstance(string, UserString):
1449 return self.data > string.data
1450 return self.data > string
1451
1452 def __ge__(self, string):
1453 if isinstance(string, UserString):
1454 return self.data >= string.data
1455 return self.data >= string
1456
1457 def __contains__(self, char):
1458 if isinstance(char, UserString):

Callers 8

test_dataMethod · 0.90
test_mixed_addMethod · 0.90
test_mixed_iaddMethod · 0.90
test_implementationMethod · 0.90
testAssertStartsWithMethod · 0.90
testAssertEndsWithMethod · 0.90
testAssertNotEndsWithMethod · 0.90

Calls

no outgoing calls

Tested by 8

test_dataMethod · 0.72
test_mixed_addMethod · 0.72
test_mixed_iaddMethod · 0.72
test_implementationMethod · 0.72
testAssertStartsWithMethod · 0.72
testAssertEndsWithMethod · 0.72
testAssertNotEndsWithMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…