buggy stringlengths 35 5.03k | fixed stringlengths 46 62.5k |
|---|---|
def ct_gt_u32(val_a, val_b):
"""
return ct_lt_u32(val_b, val_a)
def ct_le_u32(val_a, val_b):
"""
Return 1 if val_a <= val_b, 0 otherwise. Constant time. | def ct_gt_u32(val_a, val_b):
"""
return ct_lt_u32(val_b, val_a)
def ct_le_u32(val_a, val_b):
"""
Return 1 if val_a <= val_b, 0 otherwise. Constant time. |
def ct_le_u32(val_a, val_b):
"""
return 1 ^ ct_gt_u32(val_a, val_b)
def ct_lsb_prop_u8(val):
"""Propagate LSB to all 8 bits of the returned byte. Constant time."""
val &= 0x01
val |= val << 1
val |= val << 2
val |= val << 4
return val
def ct_isnonzero_u32(val):
"""
Returns 1 if... | def ct_le_u32(val_a, val_b):
"""
return 1 ^ ct_gt_u32(val_a, val_b)
def ct_lsb_prop_u8(val):
"""Propagate LSB to all 8 bits of the returned int. Constant time."""
val &= 0x01
val |= val << 1
val |= val << 2
val |= val << 4
return val
def ct_lsb_prop_u16(val):
"""Propagate LSB to ... |
def ct_isnonzero_u32(val):
val &= 0xffffffff
return (val|(-val&0xffffffff)) >> 31
def ct_neq_u32(val_a, val_b):
"""
Return 1 if val_a != val_b, 0 otherwise. Constant time. | def ct_isnonzero_u32(val):
val &= 0xffffffff
return (val|(-val&0xffffffff)) >> 31
def ct_neq_u32(val_a, val_b):
"""
Return 1 if val_a != val_b, 0 otherwise. Constant time. |
def parsePEMKey(s, private=False, public=False, passwordCallback=None,
def _parseKeyHelper(key, private, public):
if private:
if not key.hasPrivateKey():
raise SyntaxError("Not a private key!")
if public:
return _createPublicKey(key)
if private:
if hasattr(key, "d"):
... | def parsePEMKey(s, private=False, public=False, passwordCallback=None,
def _parseKeyHelper(key, private, public):
if private and not key.hasPrivateKey():
raise SyntaxError("Not a private key!")
if public:
return _createPublicKey(key)
if private:
if cryptomath.m2cryptoLoaded:
... |
from .rsakey import *
from .python_rsakey import Python_RSAKey
from .compat import compatAscii2Bytes
#copied from M2Crypto.util.py, so when we load the local copy of m2
#we can still use it | from .rsakey import *
from .python_rsakey import Python_RSAKey
from .compat import compatAscii2Bytes
import sys
#copied from M2Crypto.util.py, so when we load the local copy of m2
#we can still use it |
def _rawPrivateKeyOp(self, m):
c = bytesToNumber(bytearray(s))
return c
def _rawPublicKeyOp(self, c):
b = numberToByteArray(c, numBytes(self.n))
s = m2.rsa_public_decrypt(self.rsa, bytes(b), m2.no_padding)
m = bytesToNumber(bytearray(s))
r... | def _rawPrivateKeyOp(self, m):
c = bytesToNumber(bytearray(s))
return c
def _raw_private_key_op_bytes(self, message):
return bytearray(m2.rsa_private_encrypt(self.rsa, bytes(message),
m2.no_padding))
def _rawPublic... |
def f():pass
key._hasPrivateKey = False
else:
raise SyntaxError()
return key
finally:
m2.bio_free(bio) | def f():pass
key._hasPrivateKey = False
else:
raise SyntaxError()
if key._hasPrivateKey:
if sys.version_info < (3, 0):
b64_key = str(key.write())
else:
... |
def generate(bits):
return key
generate = staticmethod(generate)
def parsePEM(s, passwordCallback=None):
"""Parse a string containing a PEM-encoded <privateKey>."""
if pemSniff(s, "PRIVATE KEY"):
bytes = dePem(s, "PRIVATE KEY")
return Python_RSAKey._parsePKCS8(b... | def generate(bits):
return key
generate = staticmethod(generate)
@staticmethod
def parsePEM(s, passwordCallback=None):
"""Parse a string containing a PEM-encoded <privateKey>."""
from .python_key import Python_Key
return Python_Key.parsePEM(s, passwordCallback) |
from . import tlshashlib as hashlib
from ..errors import MaskTooLongError, MessageTooLongError, EncodingError, \
InvalidSignature, UnknownRSAType
class RSAKey(object): | from . import tlshashlib as hashlib
from ..errors import MaskTooLongError, MessageTooLongError, EncodingError, \
InvalidSignature, UnknownRSAType
from .constanttime import ct_isnonzero_u32, ct_neq_u32, ct_lsb_prop_u8, \
ct_lsb_prop_u16, ct_lt_u32
class RSAKey(object): |
def __init__(self, n=0, e=0):
:type e: int
:param e: RSA public exponent.
"""
raise NotImplementedError()
def __len__(self): | def __init__(self, n=0, e=0):
:type e: int
:param e: RSA public exponent.
"""
self._key_hash = None
raise NotImplementedError()
def __len__(self): |
def RSASSA_PSS_sign(self, mHash, hAlg, sLen=0):
:type sLen: int
:param sLen: length of salt"""
EM = self.EMSA_PSS_encode(mHash, numBits(self.n) - 1, hAlg, sLen)
m = bytesToNumber(EM)
if m >= self.n:
raise MessageTooLongError("Encode output too long")
s = self.... | def RSASSA_PSS_sign(self, mHash, hAlg, sLen=0):
:type sLen: int
:param sLen: length of salt"""
EM = self.EMSA_PSS_encode(mHash, numBits(self.n) - 1, hAlg, sLen)
try:
ret = self._raw_private_key_op_bytes(EM)
except ValueError:
raise MessageTooLongError("Enc... |
def RSASSA_PSS_verify(self, mHash, S, hAlg, sLen=0):
:type sLen: int
:param sLen: Length of salt
"""
if len(bytearray(S)) != len(numberToByteArray(self.n)):
raise InvalidSignature("Invalid signature")
s = bytesToNumber(S)
m = self._rawPublicKeyOp(s)
EM... | def RSASSA_PSS_verify(self, mHash, S, hAlg, sLen=0):
:type sLen: int
:param sLen: Length of salt
"""
try:
EM = self._raw_public_key_op_bytes(S)
except ValueError:
raise InvalidSignature("Invalid signature")
result = self.EMSA_PSS_verify(mHash, EM, ... |
def _raw_pkcs1_sign(self, bytes):
if not self.hasPrivateKey():
raise AssertionError()
paddedBytes = self._addPKCS1Padding(bytes, 1)
m = bytesToNumber(paddedBytes)
if m >= self.n:
raise ValueError()
c = self._rawPrivateKeyOp(m)
sigBytes = numberToBy... | def _raw_pkcs1_sign(self, bytes):
if not self.hasPrivateKey():
raise AssertionError()
paddedBytes = self._addPKCS1Padding(bytes, 1)
return self._raw_private_key_op_bytes(paddedBytes)
def sign(self, bytes, padding='pkcs1', hashAlg=None, saltLen=None):
"""Sign the passed-i... |
def sign(self, bytes, padding='pkcs1', hashAlg=None, saltLen=None):
def _raw_pkcs1_verify(self, sigBytes, bytes):
"""Perform verification operation on raw PKCS#1 padded signature"""
if len(sigBytes) != numBytes(self.n):
return False
paddedBytes = self._addPKCS1Padding(bytes, 1)
... | def sign(self, bytes, padding='pkcs1', hashAlg=None, saltLen=None):
def _raw_pkcs1_verify(self, sigBytes, bytes):
"""Perform verification operation on raw PKCS#1 padded signature"""
try:
checkBytes = self._raw_public_key_op_bytes(sigBytes)
except ValueError:
return F... |
def encrypt(self, bytes):
:returns: A PKCS1 encryption of the passed-in data.
"""
paddedBytes = self._addPKCS1Padding(bytes, 2)
m = bytesToNumber(paddedBytes)
if m >= self.n:
raise ValueError()
c = self._rawPublicKeyOp(m)
encBytes = numberToByteArray(c... | def encrypt(self, bytes):
:returns: A PKCS1 encryption of the passed-in data.
"""
paddedBytes = self._addPKCS1Padding(bytes, 2)
return self._raw_public_key_op_bytes(paddedBytes)
def _dec_prf(self, key, label, out_len):
"""PRF for deterministic implicit rejection in the RSA d... |
def _rawPrivateKeyOp(self, m):
def _rawPublicKeyOp(self, c):
raise NotImplementedError()
def acceptsPassword(self):
"""Return True if the write() method accepts a password for use
in encrypting the private key. | def _rawPrivateKeyOp(self, m):
def _rawPublicKeyOp(self, c):
raise NotImplementedError()
def _raw_private_key_op_bytes(self, message):
n = self.n
if len(message) != numBytes(n):
raise ValueError("Message has incorrect length for the key size")
m_int = bytesToNumber(m... |
from tlslite.utils.constanttime import ct_lt_u32, ct_gt_u32, ct_le_u32, \
ct_lsb_prop_u8, ct_isnonzero_u32, ct_neq_u32, ct_eq_u32, \
ct_check_cbc_mac_and_pad, ct_compare_digest
from hypothesis import given, example
import hypothesis.strategies as st |
from tlslite.utils.constanttime import ct_lt_u32, ct_gt_u32, ct_le_u32, \
ct_lsb_prop_u8, ct_isnonzero_u32, ct_neq_u32, ct_eq_u32, \
ct_check_cbc_mac_and_pad, ct_compare_digest, ct_lsb_prop_u16
from hypothesis import given, example
import hypothesis.strategies as st |
def test_ct_lsb_prop_u8(self, i):
self.assertEqual(((i & 0x1) == 1), (ct_lsb_prop_u8(i) == 0xff))
self.assertEqual(((i & 0x1) == 0), (ct_lsb_prop_u8(i) == 0x00))
@given(i=st.integers(0,2**32 - 1))
@example(i=0)
def test_ct_isnonzero_u32(self, i): | def test_ct_lsb_prop_u8(self, i):
self.assertEqual(((i & 0x1) == 1), (ct_lsb_prop_u8(i) == 0xff))
self.assertEqual(((i & 0x1) == 0), (ct_lsb_prop_u8(i) == 0x00))
@given(i=st.integers(0, 2**16-1))
@example(i=0)
@example(i=255)
@example(i=2**16-1)
def test_ct_lsb_prop_u16(self, i):
... |
from tlslite.utils.python_rsakey import Python_RSAKey
from tlslite.utils.cryptomath import *
from tlslite.errors import *
try:
import mock
from mock import call | from tlslite.utils.python_rsakey import Python_RSAKey
from tlslite.utils.cryptomath import *
from tlslite.errors import *
from tlslite.utils.keyfactory import parsePEMKey
from tlslite.utils.compat import a2b_hex, remove_whitespace
try:
import mock
from mock import call |
def test_addPKCS1Prefix(self):
self.assertEqual(RSAKey.addPKCS1Prefix(data, 'sha1'), bytearray(
b'0!0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14' +
b' sha-1 hash of data ')) | def test_addPKCS1Prefix(self):
self.assertEqual(RSAKey.addPKCS1Prefix(data, 'sha1'), bytearray(
b'0!0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14' +
b' sha-1 hash of data '))
class TestRSADecrypt(unittest.TestCase):
@classmethod
def setUpClass(cls):
priv_key = """
-----B... |
def default_urlconf(request):
var s = link.getElementsByTagName('span')[0];
var uarr = String.fromCharCode(0x25b6);
var darr = String.fromCharCode(0x25bc);
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
return false;
}
function switchPastebinFriendly(link) {
s1 = "Switch to... | def default_urlconf(request):
var s = link.getElementsByTagName('span')[0];
var uarr = String.fromCharCode(0x25b6);
var darr = String.fromCharCode(0x25bc);
s.textContent = s.textContent == uarr ? darr : uarr;
return false;
}
function switchPastebinFriendly(link) {
s1 = "Switc... |
class ChapterXtra1Admin(admin.ModelAdmin):
class ArticleAdmin(admin.ModelAdmin):
list_display = ('content', 'date', callable_year, 'model_year',
'modeladmin_year', 'model_year_reversed')
list_filter = ('date', 'section')
view_on_site = False
fieldsets = ( | class ChapterXtra1Admin(admin.ModelAdmin):
class ArticleAdmin(admin.ModelAdmin):
list_display = ('content', 'date', callable_year, 'model_year',
'modeladmin_year', 'model_year_reversed', 'section')
list_editable = ('section',)
list_filter = ('date', 'section')
view_on_site = False
... |
from django.utils.encoding import python_2_unicode_compatible
class Section(models.Model):
"""
A simple section that links to articles, to test linking to related items | from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Section(models.Model):
"""
A simple section that links to articles, to test linking to related items |
class Section(models.Model):
"""
name = models.CharField(max_length=100)
@property
def name_property(self):
""" | class Section(models.Model):
"""
name = models.CharField(max_length=100)
def __str__(self):
return self.name
@property
def name_property(self):
""" |
def test_cancel_delete_related_confirmation(self):
self.assertEqual(Pizza.objects.count(), 1)
self.assertEqual(Topping.objects.count(), 2)
def test_list_editable_raw_id_fields(self):
parent = ParentWithUUIDPK.objects.create(title='test')
parent2 = ParentWithUUIDPK.objects.create(tit... | def test_cancel_delete_related_confirmation(self):
self.assertEqual(Pizza.objects.count(), 1)
self.assertEqual(Topping.objects.count(), 2)
def test_list_editable_popups(self):
"""
list_editable foreign keys have add/change popups.
"""
from selenium.webdriver.support.... |
def page(self, title, contents):
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>''' % (title, css_link, html_navbar(), contents)
def filelink(self, url, path):
return '<a href="getfile?key=%s">%s</a>' % (url, path)
html = _HTMLDoc()
| def page(self, title, contents):
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>''' % (title, css_link, html_navbar(), contents)
html = _HTMLDoc()
|
def bltinlink(name):
'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
return 'Search Results', contents
def html_getfile(path):
"""Get and display a source file listing safely."""
path = urllib.parse.unquote(path)
with tokenize.open(path) as fp:
... | def bltinlink(name):
'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
return 'Search Results', contents
def html_topics():
"""Index of topic texts available."""
|
def get_html_page(url):
op, _, url = url.partition('=')
if op == "search?key":
title, content = html_search(url)
elif op == "getfile?key":
title, content = html_getfile(url)
elif op == "topic?key":
... | def get_html_page(url):
op, _, url = url.partition('=')
if op == "search?key":
title, content = html_search(url)
elif op == "topic?key":
# try topics first, then objects.
try: |
def test_url_requests(self):
("topic?key=def", "Pydoc: KEYWORD def"),
("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
("foobar", "Pydoc: Error - foobar"),
("getfile?key=foobar", "Pydoc: Error - getfile?key=foobar"),
]
with self.restrict_walk_packages()... | def test_url_requests(self):
("topic?key=def", "Pydoc: KEYWORD def"),
("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
("foobar", "Pydoc: Error - foobar"),
]
with self.restrict_walk_packages():
for url, title in requests:
self.call_url_h... |
class Sanic:
"Endpoint with name `{}` was not found".format(view_name)
)
if view_name == "static" or view_name.endswith(".static"):
filename = kwargs.pop("filename", None)
# it's static folder | class Sanic:
"Endpoint with name `{}` was not found".format(view_name)
)
# If the route has host defined, split that off
# TODO: Retain netloc and path separately in Route objects
host = uri.find("/")
if host > 0:
host, uri = uri[:host], uri[host:... |
class Sanic:
netloc = kwargs.pop("_server", None)
if netloc is None and external:
netloc = self.config.get("SERVER_NAME", "")
if external:
if not scheme: | class Sanic:
netloc = kwargs.pop("_server", None)
if netloc is None and external:
netloc = host or self.config.get("SERVER_NAME", "")
if external:
if not scheme: |
def read_fixed_bytes(self, num_bytes: int) -> bytes:
"""
read_bytes = self.read(num_bytes)
if len(read_bytes) < num_bytes:
raise EOFError(read_bytes)
return read_bytes
def read_pascal_bytes(self, string_length_size: int) -> bytes: | def read_fixed_bytes(self, num_bytes: int) -> bytes:
"""
read_bytes = self.read(num_bytes)
if len(read_bytes) < num_bytes:
raise EOFError("Fewer than 'num_bytes' bytes remaining in the "
"underlying bytestream")
return read_bytes
def read_pascal_bytes... |
def configure():
register_cli_str('pydev-debug-host', default=None)
register_cli_int('pydev-debug-port', default=None)
register_str('admin_token', default='ADMIN')
register_str('bind_host', default='0.0.0.0')
register_int('compute_port', default=8774)
register_int('admin_port', default=35357) | def configure():
register_cli_str('pydev-debug-host', default=None)
register_cli_int('pydev-debug-port', default=None)
register_str('admin_token', secret=True, default='ADMIN')
register_str('bind_host', default='0.0.0.0')
register_int('compute_port', default=8774)
register_int('admin_port', def... |
def configure():
# ldap
register_str('url', group='ldap', default='ldap://localhost')
register_str('user', group='ldap', default=None)
register_str('password', group='ldap', default=None)
register_str('suffix', group='ldap', default='cn=example,cn=com')
register_bool('use_dumb_member', group='ld... | def configure():
# ldap
register_str('url', group='ldap', default='ldap://localhost')
register_str('user', group='ldap', default=None)
register_str('password', group='ldap', secret=True, default=None)
register_str('suffix', group='ldap', default='cn=example,cn=com')
register_bool('use_dumb_membe... |
class CollectionRequirement:
requirement = req
op = operator.eq
# In the case we are checking a new requirement on a base requirement (parent != None) we can't accept
# version as '*' (unknown version) unless the requirement is also '*'.
i... | class CollectionRequirement:
requirement = req
op = operator.eq
# In the case we are checking a new requirement on a base requirement (parent != None) we can't accept
# version as '*' (unknown version) unless the requirement is also '*'.
if parent and... |
class CollectionRequirement:
manifest = info['manifest_file']['collection_info']
namespace = manifest['namespace']
name = manifest['name']
version = manifest['version']
dependencies = manifest['dependencies']
else:
display.warning("Collecti... | class CollectionRequirement:
manifest = info['manifest_file']['collection_info']
namespace = manifest['namespace']
name = manifest['name']
version = to_text(manifest['version'], errors='surrogate_or_strict')
if not hasattr(LooseVersion(version), 'version'):
... |
def _get_collection_info(dep_map, existing_collections, collection, requirement,
existing = [c for c in existing_collections if to_text(c) == to_text(collection_info)]
if existing and not collection_info.force:
# Test that the installed collection fits the requirement
existing[0].add_requirement... | def _get_collection_info(dep_map, existing_collections, collection, requirement,
existing = [c for c in existing_collections if to_text(c) == to_text(collection_info)]
if existing and not collection_info.force:
# Test that the installed collection fits the requirement
existing[0].add_requirement... |
def test_build_requirement_from_path(collection_artifact):
assert actual.dependencies == {}
def test_build_requirement_from_path_with_manifest(collection_artifact):
manifest_path = os.path.join(collection_artifact[0], b'MANIFEST.json')
manifest_value = json.dumps({
'collection_info': {
... | def test_build_requirement_from_path(collection_artifact):
assert actual.dependencies == {}
@pytest.mark.parametrize('version', ['1.1.1', 1.1, 1])
def test_build_requirement_from_path_with_manifest(version, collection_artifact):
manifest_path = os.path.join(collection_artifact[0], b'MANIFEST.json')
manife... |
def test_build_requirement_from_path_with_manifest(collection_artifact):
assert actual.b_path == collection_artifact[0]
assert actual.api is None
assert actual.skip is True
assert actual.versions == set([u'1.1.1'])
assert actual.latest_version == u'1.1.1'
assert actual.dependencies == {'ansible_... | def test_build_requirement_from_path_with_manifest(collection_artifact):
assert actual.b_path == collection_artifact[0]
assert actual.api is None
assert actual.skip is True
assert actual.versions == set([to_text(version)])
assert actual.latest_version == to_text(version)
assert actual.dependenci... |
def test_build_requirement_from_path_invalid_manifest(collection_artifact):
collection.CollectionRequirement.from_path(collection_artifact[0], True)
def test_build_requirement_from_tar(collection_artifact):
actual = collection.CollectionRequirement.from_tar(collection_artifact[1], True, True)
| def test_build_requirement_from_path_invalid_manifest(collection_artifact):
collection.CollectionRequirement.from_path(collection_artifact[0], True)
def test_build_requirement_from_path_no_version(collection_artifact, monkeypatch):
manifest_path = os.path.join(collection_artifact[0], b'MANIFEST.json')
... |
def test_add_collection_requirements(versions, requirement, expected_filter, exp
assert req.latest_version == expected_latest
def test_add_collection_requirement_to_unknown_installed_version():
req = collection.CollectionRequirement('namespace', 'name', None, 'https://galaxy.com', ['*'], '*', False,
... | def test_add_collection_requirements(versions, requirement, expected_filter, exp
assert req.latest_version == expected_latest
def test_add_collection_requirement_to_unknown_installed_version(monkeypatch):
mock_display = MagicMock()
monkeypatch.setattr(Display, 'display', mock_display)
req = collectio... |
def crosstab(
from pandas import DataFrame
df = DataFrame(data, index=common_idx)
if values is None:
df["__dummy__"] = 0
kwargs = {"aggfunc": len, "fill_value": 0} | def crosstab(
from pandas import DataFrame
df = DataFrame(data, index=common_idx)
original_df_cols = df.columns
if values is None:
df["__dummy__"] = 0
kwargs = {"aggfunc": len, "fill_value": 0} |
def crosstab(
kwargs = {"aggfunc": aggfunc}
table = df.pivot_table(
"__dummy__",
index=rownames,
columns=colnames,
margins=margins, | def crosstab(
kwargs = {"aggfunc": aggfunc}
table = df.pivot_table(
["__dummy__"],
index=rownames,
columns=colnames,
margins=margins, |
def crosstab(
**kwargs,
)
# Post-process
if normalize is not False:
table = _normalize( | def crosstab(
**kwargs,
)
# GH18321, after pivoting, an extra top level of column index of `__dummy__` is
# created, and this extra level should not be included in the further steps
if not table.empty:
cols_diff = df.columns.difference(original_df_cols)[0]
table = table[cols_dif... |
class TestCrosstab:
result = pd.crosstab(s1, s2)
tm.assert_frame_equal(result, expected)
def test_crosstab_unsorted_order(self):
df = pd.DataFrame({"b": [3, 1, 2], "a": [5, 4, 6]}, index=["C", "A", "B"])
result = pd.crosstab(df.index, [df.b, df.a]) | class TestCrosstab:
result = pd.crosstab(s1, s2)
tm.assert_frame_equal(result, expected)
def test_crosstab_both_tuple_names(self):
# GH 18321
s1 = pd.Series(range(3), name=("a", "b"))
s2 = pd.Series(range(3), name=("c", "d"))
expected = pd.DataFrame(
np.... |
def list_logical_volumes(vg):
return [line.strip() for line in out.splitlines()]
def remove_logical_volumes(*paths):
"""Remove one or more logical volume."""
if paths:
lvremove = ('lvremove', '-f') + paths
execute(*lvremove, attempts=3, run_as_root=True) | def list_logical_volumes(vg):
return [line.strip() for line in out.splitlines()]
def logical_volume_size(path):
"""Get logical volume size in bytes.
:param path: logical volume path
"""
# TODO(p-draigbrady) POssibly replace with the more general
# use of blockdev --getsize64 in future
out... |
def strip_tags(value):
value = str(value)
while '<' in value and '>' in value:
new_value = _strip_once(value)
if len(new_value) >= len(value):
# _strip_once was not able to detect more tags
break
value = new_value
return value | def strip_tags(value):
value = str(value)
while '<' in value and '>' in value:
new_value = _strip_once(value)
if value.count('<') == new_value.count('<'):
# _strip_once wasn't able to detect more tags.
break
value = new_value
return value |
class TestUtilsHtml(SimpleTestCase):
('&gotcha&#;<>', '&gotcha&#;<>'),
('<sc<!-- -->ript>test<<!-- -->/script>', 'ript>test'),
('<script>alert()</script>&h', 'alert()h'),
)
for value, output in items:
with self.subTest(value=value, output=output): | class TestUtilsHtml(SimpleTestCase):
('&gotcha&#;<>', '&gotcha&#;<>'),
('<sc<!-- -->ript>test<<!-- -->/script>', 'ript>test'),
('<script>alert()</script>&h', 'alert()h'),
('><!' + ('&' * 16000) + 'D', '><!' + ('&' * 16000) + 'D'),
('X<<<<br>br>br>br>X', 'XX'),... |
def act(fp):
self.assertFalse(fp.closed)
def test_overrun(self):
for file in ["fli_overrun.bin", "sgi_overrun.bin", "pcx_overrun.bin"]:
im = Image.open(os.path.join("Tests/images", file))
try:
im.load() | def act(fp):
self.assertFalse(fp.closed)
def test_overrun(self):
for file in [
"fli_overrun.bin",
"sgi_overrun.bin",
"pcx_overrun.bin",
"pcx_overrun2.bin",
]:
im = Image.open(os.path.join("Tests/images", file))
try:... |
def _create_instance(self, context, instance_type,
LOG.debug(_("Going to run %s instances...") % num_instances)
if create_instance_here:
instance = self.create_db_entry_for_new_instance(
context, instance_type, image, base_options, | def _create_instance(self, context, instance_type,
LOG.debug(_("Going to run %s instances...") % num_instances)
# Validate the correct devices have been specified
for bdm in block_device_mapping:
# NOTE(vish): For now, just make sure the volumes are accessible.
snapshot... |
class InstanceInvalidState(Invalid):
"%(method)s while the instance is in this state.")
class InstanceNotRunning(Invalid):
message = _("Instance %(instance_id)s is not running.")
| class InstanceInvalidState(Invalid):
"%(method)s while the instance is in this state.")
class InvalidBDM(Invalid):
message = _("Block Device Mapping is Invalid.")
class InvalidBDMSnapshot(InvalidBDM):
message = _("Block Device Mapping is Invalid: "
"failed to get snapshot %(i... |
BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
SUBAUTHORITY_PAT = (u"^(?:(.*)@)?(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
REG_NAME_PAT,
IPV4_PAT,
IPV6_ADDRZ_PAT,
)
SUBAUTHORITY_RE = re.compile(SUBAUTHORITY_PAT, re.UNICODE | re.DOTALL)
... | BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
_HOST_PORT_PAT = ("^(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
REG_NAME_PAT,
IPV4_PAT,
IPV6_ADDRZ_PAT,
)
_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL)
UNRESERVED_CHARS ... |
def parse_url(url):
scheme = scheme.lower()
if authority:
auth, host, port = SUBAUTHORITY_RE.match(authority).groups()
if auth and normalize_uri:
auth = _encode_invalid_chars(auth, USERINFO_CHARS)
if port == "": | def parse_url(url):
scheme = scheme.lower()
if authority:
auth, _, host_port = authority.rpartition("@")
auth = auth or None
host, port = _HOST_PORT_RE.match(host_port).groups()
if auth and normalize_uri:
auth = _encode_invalid_chars(a... |
def test_netloc(self, url, expected_netloc):
fragment="hash",
),
),
]
@pytest.mark.parametrize("url, expected_url", url_vulnerabilities) | def test_netloc(self, url, expected_netloc):
fragment="hash",
),
),
# Tons of '@' causing backtracking
("https://" + ("@" * 10000) + "[", False),
(
"https://user:" + ("@" * 10000) + "example.com",
Url(
scheme="https",
... |
class EarlyStopping(Callback):
baseline: Baseline value for the monitored quantity to reach.
Training will stop if the model doesn't show improvement
over the baseline.
"""
def __init__(self, | class EarlyStopping(Callback):
baseline: Baseline value for the monitored quantity to reach.
Training will stop if the model doesn't show improvement
over the baseline.
restore_best_weights: whether to restore model weights from
the epoch with the best value of the mo... |
class EarlyStopping(Callback):
patience=0,
verbose=0,
mode='auto',
baseline=None):
super(EarlyStopping, self).__init__()
self.monitor = monitor | class EarlyStopping(Callback):
patience=0,
verbose=0,
mode='auto',
baseline=None,
restore_best_weights=False):
super(EarlyStopping, self).__init__()
self.monitor = monitor |
class EarlyStopping(Callback):
self.min_delta = min_delta
self.wait = 0
self.stopped_epoch = 0
if mode not in ['auto', 'min', 'max']:
warnings.warn('EarlyStopping mode %s is unknown, ' | class EarlyStopping(Callback):
self.min_delta = min_delta
self.wait = 0
self.stopped_epoch = 0
self.restore_best_weights = restore_best_weights
self.best_weights = None
if mode not in ['auto', 'min', 'max']:
warnings.warn('EarlyStopping mode %s is unknown, ' |
class EarlyStopping(Callback):
if self.monitor_op(current - self.min_delta, self.best):
self.best = current
self.wait = 0
else:
self.wait += 1
if self.wait >= self.patience:
self.stopped_epoch = epoch
self.model.stop_trainin... | class EarlyStopping(Callback):
if self.monitor_op(current - self.min_delta, self.best):
self.best = current
self.wait = 0
if self.restore_best_weights:
self.best_weights = self.model.get_weights()
else:
self.wait += 1
if self.wa... |
def test_EarlyStopping_patience():
def __init__(self):
self.stop_training = False
early_stop = callbacks.EarlyStopping(monitor='val_loss', patience=2)
early_stop.model = DummyModel()
| def test_EarlyStopping_patience():
def __init__(self):
self.stop_training = False
def get_weights(self):
return []
def set_weights(self, weights):
pass
early_stop = callbacks.EarlyStopping(monitor='val_loss', patience=2)
early_stop.model = DummyMode... |
def test_EarlyStopping_baseline():
def __init__(self):
self.stop_training = False
def baseline_tester(acc_levels):
early_stop = callbacks.EarlyStopping(monitor='val_acc', baseline=0.75, patience=2)
early_stop.model = DummyModel() | def test_EarlyStopping_baseline():
def __init__(self):
self.stop_training = False
def get_weights(self):
return []
def set_weights(self, weights):
pass
def baseline_tester(acc_levels):
early_stop = callbacks.EarlyStopping(monitor='val_acc', base... |
def test_EarlyStopping_baseline():
assert baseline_not_met == 2
@keras_test
def test_LearningRateScheduler():
np.random.seed(1337) | def test_EarlyStopping_baseline():
assert baseline_not_met == 2
@keras_test
def test_EarlyStopping_final_weights():
class DummyModel(object):
def __init__(self):
self.stop_training = False
self.weights = -1
def get_weights(self):
return self.weights
... |
def __init__(self, password):
def load(self, stream):
'''read vault steam and return python object'''
return yaml.load(self.vault.decrypt(stream))
def dump(self, data, stream=None):
'''encrypt data and print stdout or write to stream''' | def __init__(self, password):
def load(self, stream):
'''read vault steam and return python object'''
return yaml.safe_load(self.vault.decrypt(stream))
def dump(self, data, stream=None):
'''encrypt data and print stdout or write to stream''' |
import os
from tempfile import mkstemp
from testfixtures import ShouldRaise
from ansible.errors import AnsibleError
here = os.path.dirname(os.path.abspath(__file__)) | import os
from tempfile import mkstemp
from ansible.errors import AnsibleError
from testfixtures import ShouldRaise
from yaml.constructor import ConstructorError
here = os.path.dirname(os.path.abspath(__file__)) |
def test_cannot(self):
with ShouldRaise(AnsibleError('Decryption failed')):
vault.load(open(fpath).read())
class TestVaultDump(object):
def _getTargetClass(self): | def test_cannot(self):
with ShouldRaise(AnsibleError('Decryption failed')):
vault.load(open(fpath).read())
def test_not_pwned(self):
fpath = os.path.join(here, 'file', 'pwned.txt')
vault = self._makeOne('password')
with ShouldRaise(ConstructorError):
vault.lo... |
def run_tests(self):
setup(
name='ansible-vault',
version='1.0.4',
author='Tomohiro NAKAMURA',
author_email='quickness.net@gmail.com',
url='https://github.com/jptomo/ansible-vault',
description='R/W an ansible-vault yaml file',
long_description=_read('README.rst'),
packages=find_package... | def run_tests(self):
setup(
name='ansible-vault',
version='1.0.5',
author='Tomohiro NAKAMURA',
author_email='quickness.net@gmail.com',
url='https://github.com/tomoh1r/ansible-vault',
description='R/W an ansible-vault yaml file',
long_description=_read('README.rst'),
packages=find_packag... |
def rnn(step_function, inputs, initial_states,
for o, p in zip(new_states, place_holders):
n_s.append(o.replace_placeholders({p: o.output}))
if len(n_s) > 0:
new_output = n_s[0]
return new_output, n_s
final_output, final_states = _recurrence(r... | def rnn(step_function, inputs, initial_states,
for o, p in zip(new_states, place_holders):
n_s.append(o.replace_placeholders({p: o.output}))
if len(n_s) > 0:
new_output = n_s[-1]
return new_output, n_s
final_output, final_states = _recurrence(... |
class StackedRNNCells(Layer):
'`state_size` attribute. '
'received cells:', cells)
self.cells = cells
super(StackedRNNCells, self).__init__(**kwargs)
@property
def state_size(self):
# States are a flat list
# in r... | class StackedRNNCells(Layer):
'`state_size` attribute. '
'received cells:', cells)
self.cells = cells
# reverse_state_order determines whether the state size will be in a
# reverse order of the cells' state. User might want to set... |
class StackedRNNCells(Layer):
# Format the new states as a flat list
# in reverse cell order.
states = []
for cell_states in new_nested_states[::-1]:
states += cell_states
return inputs, states
def build(self, input_shape):
if isinstance(input_shape, lis... | class StackedRNNCells(Layer):
# Format the new states as a flat list
# in reverse cell order.
new_states = []
if self.reverse_state_order:
new_nested_states = new_nested_states[::-1]
for cell_states in new_nested_states:
new_states += cell_states
... |
class StackedRNNCells(Layer):
cell.build([input_shape] + constants_shape)
else:
cell.build(input_shape)
if hasattr(cell.state_size, '__len__'):
output_dim = cell.state_size[0]
else:
output_dim = cell.state_si... | class StackedRNNCells(Layer):
cell.build([input_shape] + constants_shape)
else:
cell.build(input_shape)
if getattr(cell, 'output_size', None) is not None:
output_dim = cell.output_size
elif hasattr(cell.state_size, '__len__'... |
class RNN(Layer):
the size of the recurrent state
(which should be the same as the size of the cell output).
This can also be a list/tuple of integers
(one size per state). In this case, the first entry
(`state_size[0]`) should be the same ... | class RNN(Layer):
the size of the recurrent state
(which should be the same as the size of the cell output).
This can also be a list/tuple of integers
(one size per state).
- a `output_size` attribute. This can be a single integer or a
... |
class RNN(Layer):
state_size = self.cell.state_size
else:
state_size = [self.cell.state_size]
output_dim = state_size[0]
if self.return_sequences:
output_shape = (input_shape[0], input_shape[1], output_dim) | class RNN(Layer):
state_size = self.cell.state_size
else:
state_size = [self.cell.state_size]
if getattr(self.cell, 'output_size', None) is not None:
output_dim = self.cell.output_size
else:
output_dim = state_size[0]
if self.return_seque... |
class SimpleRNNCell(Layer):
self.dropout = min(1., max(0., dropout))
self.recurrent_dropout = min(1., max(0., recurrent_dropout))
self.state_size = self.units
self._dropout_mask = None
self._recurrent_dropout_mask = None
| class SimpleRNNCell(Layer):
self.dropout = min(1., max(0., dropout))
self.recurrent_dropout = min(1., max(0., recurrent_dropout))
self.state_size = self.units
self.output_size = self.units
self._dropout_mask = None
self._recurrent_dropout_mask = None
|
class GRUCell(Layer):
self.implementation = implementation
self.reset_after = reset_after
self.state_size = self.units
self._dropout_mask = None
self._recurrent_dropout_mask = None
| class GRUCell(Layer):
self.implementation = implementation
self.reset_after = reset_after
self.state_size = self.units
self.output_size = self.units
self._dropout_mask = None
self._recurrent_dropout_mask = None
|
class LSTMCell(Layer):
self.recurrent_dropout = min(1., max(0., recurrent_dropout))
self.implementation = implementation
self.state_size = (self.units, self.units)
self._dropout_mask = None
self._recurrent_dropout_mask = None
| class LSTMCell(Layer):
self.recurrent_dropout = min(1., max(0., recurrent_dropout))
self.implementation = implementation
self.state_size = (self.units, self.units)
self.output_size = self.units
self._dropout_mask = None
self._recurrent_dropout_mask = None
|
def test_minimal_rnn_cell_non_layer_multiple_states():
MinimalRNNCell(16, 8),
MinimalRNNCell(32, 16)]
layer = recurrent.RNN(cells)
assert layer.cell.state_size == (32, 32, 16, 16, 8, 8)
y = layer(x)
model = keras.models.Model(x, y)
model.compile(optimizer='rmsprop', loss='m... | def test_minimal_rnn_cell_non_layer_multiple_states():
MinimalRNNCell(16, 8),
MinimalRNNCell(32, 16)]
layer = recurrent.RNN(cells)
assert layer.cell.state_size == (8, 8, 16, 16, 32, 32)
y = layer(x)
model = keras.models.Model(x, y)
model.compile(optimizer='rmsprop', loss='m... |
def test_stacked_rnn_compute_output_shape():
recurrent.LSTMCell(6)]
layer = recurrent.RNN(cells, return_state=True, return_sequences=True)
output_shape = layer.compute_output_shape((None, timesteps, embedding_dim))
expected_output_shape = [(None, timesteps, 6),
(Non... | def test_stacked_rnn_compute_output_shape():
recurrent.LSTMCell(6)]
layer = recurrent.RNN(cells, return_state=True, return_sequences=True)
output_shape = layer.compute_output_shape((None, timesteps, embedding_dim))
expected_output_shape = [(None, timesteps, 6),
(Non... |
def test_rnn_cell_identity_initializer(layer_class):
np.concatenate([np.identity(units)] * num_kernels, axis=1))
if __name__ == '__main__':
pytest.main([__file__]) | def test_rnn_cell_identity_initializer(layer_class):
np.concatenate([np.identity(units)] * num_kernels, axis=1))
@keras_test
@pytest.mark.skipif(K.backend() == 'cntk', reason='Not supported.')
def test_inconsistent_output_state_size():
class PlusOneRNNCell(keras.layers.Layer):
"... |
default 'raise'
"""
from pandas import DataFrame
sarray = fields.build_isocalendar_sarray(self.asi8)
iso_calendar_df = DataFrame(
sarray, columns=["year", "week", "day"], dtype="UInt32"
) | default 'raise'
"""
from pandas import DataFrame
if self.tz is not None and not timezones.is_utc(self.tz):
values = self._local_timestamps()
else:
values = self.asi8
sarray = fields.build_isocalendar_sarray(values)
iso_calendar_df = DataFrame(
... |
def test_iter_readonly():
arr.setflags(write=False)
dti = pd.to_datetime(arr)
list(dti) | def test_iter_readonly():
arr.setflags(write=False)
dti = pd.to_datetime(arr)
list(dti)
def test_isocalendar_returns_correct_values_close_to_new_year_with_tz():
# GH 6538: Check that DatetimeIndex and its TimeStamp elements
# return the same weekofyear accessor close to new year w/ tz
dates = ... |
class Progbar(object):
info = ' - %.0fs' % (now - self.start)
if self.verbose == 1:
if (not force and (now - self.last_update) < self.interval and
current < self.target):
return
prev_total_width = self.total_width | class Progbar(object):
info = ' - %.0fs' % (now - self.start)
if self.verbose == 1:
if (not force and (now - self.last_update) < self.interval and
(self.target is not None and current < self.target)):
return
prev_total_width = self.total_width |
from keras import regularizers
def test_progbar():
n = 2
input_arr = np.random.random((n, n, n))
bar = Progbar(n)
for i, arr in enumerate(input_arr):
bar.update(i, list(arr))
| from keras import regularizers
def test_progbar():
n = 2
input_arr = np.random.random((n, n, n))
bar = Progbar(n)
for i, arr in enumerate(input_arr):
bar.update(i, list(arr))
bar = Progbar(None)
for i, arr in enumerate(input_arr):
bar.update(i, list(arr))
|
class CrawlerProcess(CrawlerRunner):
def __init__(self, settings):
super(CrawlerProcess, self).__init__(settings)
install_shutdown_handlers(self._signal_shutdown)
configure_logging(settings)
log_scrapy_info(settings)
def _signal_shutdown(self, signum, _):
install_shutdow... | class CrawlerProcess(CrawlerRunner):
def __init__(self, settings):
super(CrawlerProcess, self).__init__(settings)
install_shutdown_handlers(self._signal_shutdown)
configure_logging(self.settings)
log_scrapy_info(self.settings)
def _signal_shutdown(self, signum, _):
insta... |
import warnings
import unittest
from scrapy.crawler import Crawler, CrawlerRunner
from scrapy.settings import Settings, default_settings
from scrapy.spiderloader import SpiderLoader
from scrapy.utils.spider import DefaultSpider | import warnings
import unittest
from scrapy.crawler import Crawler, CrawlerRunner, CrawlerProcess
from scrapy.settings import Settings, default_settings
from scrapy.spiderloader import SpiderLoader
from scrapy.utils.spider import DefaultSpider |
class CrawlerRunnerTestCase(unittest.TestCase):
self.assertEqual(len(w), 1)
self.assertIn('Please use SPIDER_LOADER_CLASS', str(w[0].message))
| class CrawlerRunnerTestCase(unittest.TestCase):
self.assertEqual(len(w), 1)
self.assertIn('Please use SPIDER_LOADER_CLASS', str(w[0].message))
class CrawlerProcessTest(unittest.TestCase):
def test_crawler_process_accepts_dict(self):
runner = CrawlerProcess({'foo': 'bar'})
s... |
def authenticate(self, context, auth=None):
context, token_id, dict(id=token_id,
user=user_ref,
tenant=tenant_ref,
metadata=metadata_ref))
# TODO(termie): opti... | def authenticate(self, context, auth=None):
context, token_id, dict(id=token_id,
user=user_ref,
tenant=tenant_ref,
metadata=metadata_ref,
... |
# License for the specific language governing permissions and limitations
# under the License.
import uuid
import nose.exc | # License for the specific language governing permissions and limitations
# under the License.
import time
import uuid
import nose.exc |
def test_disable_user_invalidates_token(self):
self.get_client,
self.user_foo)
def test_user_create_update_delete(self):
from keystoneclient import exceptions as client_exceptions
| def test_disable_user_invalidates_token(self):
self.get_client,
self.user_foo)
def test_token_expiry_maintained(self):
foo_client = self.get_client(self.user_foo)
orig_token = foo_client.service_catalog.catalog['token']
time.sleep(1.01)
... |
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_managers import ToolManager
from matplotlib.transforms import Affine2D
from matplotlib.path import Path
_log = logging.getLogger(__name__) | from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_managers import ToolManager
from matplotlib.transforms import Affine2D
from matplotlib.path import Path
from matplotlib.cbook import _setattr_cm
_log = logging.getLogger(__name__) |
class KeyEvent(LocationEvent):
self.key = key
def _get_renderer(figure, print_method=None, *, draw_disabled=False):
"""
Get the renderer that would be used to save a `~.Figure`, and cache it on
the figure.
If *draw_disabled* is True, additionally replace drawing methods on
*renderer* by n... | class KeyEvent(LocationEvent):
self.key = key
def _get_renderer(figure, print_method=None):
"""
Get the renderer that would be used to save a `~.Figure`, and cache it on
the figure.
If you need a renderer without any active draw methods use
cbook._setattr_cm to temporary patch them out at... |
def _get_renderer(figure, print_method=None, *, draw_disabled=False):
except Done as exc:
renderer, = figure._cachedRenderer, = exc.args
if draw_disabled:
for meth_name in dir(RendererBase):
if (meth_name.startswith("draw_")
or meth_name in ["open_group",... | def _get_renderer(figure, print_method=None, *, draw_disabled=False):
except Done as exc:
renderer, = figure._cachedRenderer, = exc.args
return renderer
|
class FigureCanvasBase:
renderer = _get_renderer(
self.figure,
functools.partial(
print_method, orientation=orientation),
draw_disabled=True)
self.figure.draw(renderer)
... | class FigureCanvasBase:
renderer = _get_renderer(
self.figure,
functools.partial(
print_method, orientation=orientation)
)
no_ops = {
meth_name: lambda *args, *... |
default: 'top'
from .tight_layout import (
get_renderer, get_subplotspec_list, get_tight_layout_figure)
subplotspec_list = get_subplotspec_list(self.axes)
if None in subplotspec_list: | default: 'top'
from .tight_layout import (
get_renderer, get_subplotspec_list, get_tight_layout_figure)
from .cbook import _setattr_cm
from .backend_bases import RendererBase
subplotspec_list = get_subplotspec_list(self.axes)
if None in subplotspec_list: |
default: 'top'
if renderer is None:
renderer = get_renderer(self)
kwargs = get_tight_layout_figure(
self, self.axes, subplotspec_list, renderer,
pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
if kwargs:
self.subplots_adjust(**kwargs)
| default: 'top'
if renderer is None:
renderer = get_renderer(self)
no_ops = {
meth_name: lambda *args, **kwargs: None
for meth_name in dir(RendererBase)
if (meth_name.startswith("draw_")
or meth_name in ["open_group", "close_group"])
... |
def test_tight_pcolorfast():
# Previously, the bbox would include the area of the image clipped out by
# the axes, resulting in a very tall image given the y limits of (0, 0.1).
assert width > height | def test_tight_pcolorfast():
# Previously, the bbox would include the area of the image clipped out by
# the axes, resulting in a very tall image given the y limits of (0, 0.1).
assert width > height
def test_noop_tight_bbox():
from PIL import Image
x_size, y_size = (10, 7)
dpi = 100
# mak... |
def get_renderer(fig):
return canvas.get_renderer()
else:
from . import backend_bases
return backend_bases._get_renderer(fig, draw_disabled=True)
def get_subplotspec_list(axes_list, grid_spec=None): | def get_renderer(fig):
return canvas.get_renderer()
else:
from . import backend_bases
return backend_bases._get_renderer(fig)
def get_subplotspec_list(axes_list, grid_spec=None): |
# -*- coding: utf-8 -*-
# The pam components have been modified to be salty and have been taken from
# the pam module under this licence:
# (c) 2007 Chris AtLee <chris@atlee.ca> | # The pam components have been modified to be salty and have been taken from
# the pam module under this licence:
# (c) 2007 Chris AtLee <chris@atlee.ca> |
authenticated against. This defaults to `login`
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
from ctypes import ( | authenticated against. This defaults to `login`
"""
import logging
from ctypes import ( |
from ctypes import (
)
from ctypes.util import find_library
# Import Salt libs
import salt.utils.user
# Import 3rd-party libs
from salt.ext import six
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
log = logging.getLogger(__name__)
try: | from ctypes import (
)
from ctypes.util import find_library
import salt.utils.user
log = logging.getLogger(__name__)
try: |
class PamMessage(Structure):
]
def __repr__(self):
return "<PamMessage {0} '{1}'>".format(self.msg_style, self.msg)
class PamResponse(Structure): | class PamMessage(Structure):
]
def __repr__(self):
return "<PamMessage {} '{}'>".format(self.msg_style, self.msg)
class PamResponse(Structure): |
class PamResponse(Structure):
]
def __repr__(self):
return "<PamResponse {0} '{1}'>".format(self.resp_retcode, self.resp)
CONV_FUNC = CFUNCTYPE( | class PamResponse(Structure):
]
def __repr__(self):
return "<PamResponse {} '{}'>".format(self.resp_retcode, self.resp)
CONV_FUNC = CFUNCTYPE( |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.