id
stringlengths
28
33
content
stringlengths
14
265k
max_stars_repo_path
stringlengths
49
55
crossvul-python_data_bad_4360_0
import hashlib import logging import os import warnings from base64 import b64encode from json import JSONDecodeError from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Type from typing import Union from typing import cast from ...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_4360_0
crossvul-python_data_bad_4085_2
#!/usr/bin/env python # Copyright 2012 - 2017, New York University and the TUF contributors # SPDX-License-Identifier: MIT OR Apache-2.0 """ <Program Name> sig.py <Author> Vladimir Diaz <vladimir.v.diaz@gmail.com> <Started> February 28, 2012. Based on a previous version by Geremy Condra. <Copyright> See ...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_4085_2
crossvul-python_data_bad_1889_0
""" Functions connected to signing and verifying. Based on the use of xmlsec1 binaries and not the python xmlsec module. """ import base64 import hashlib import itertools import logging import os import six from uuid import uuid4 as gen_random_key from time import mktime from tempfile import NamedTemporaryFile from su...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_1889_0
crossvul-python_data_good_1889_0
""" Functions connected to signing and verifying. Based on the use of xmlsec1 binaries and not the python xmlsec module. """ import base64 import hashlib import itertools import logging import os import six from uuid import uuid4 as gen_random_key from time import mktime from tempfile import NamedTemporaryFile from su...
./CrossVul/dataset_final_sorted/CWE-347/py/good_1889_0
crossvul-python_data_bad_4360_1
import logging import os.path import warnings from typing import Dict from typing import Optional from oic import rndstr from oic.exception import AuthzError from oic.exception import MessageException from oic.exception import NotForMe from oic.exception import PyoidcError from oic.oauth2 import Grant from oic.oauth2....
./CrossVul/dataset_final_sorted/CWE-347/py/bad_4360_1
crossvul-python_data_bad_4590_0
""" Functions connected to signing and verifying. Based on the use of xmlsec1 binaries and not the python xmlsec module. """ from OpenSSL import crypto import base64 import hashlib import itertools import logging import os import six from time import mktime from six.moves.urllib import parse import saml2.cryptograp...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_4590_0
crossvul-python_data_good_3997_0
# -*- coding: utf-8 -*- # # fastecdsa documentation build configuration file, created by # sphinx-quickstart on Thu Dec 15 20:02:52 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
./CrossVul/dataset_final_sorted/CWE-347/py/good_3997_0
crossvul-python_data_bad_1888_2
404: Not Found
./CrossVul/dataset_final_sorted/CWE-347/py/bad_1888_2
crossvul-python_data_good_4590_0
""" Functions connected to signing and verifying. Based on the use of xmlsec1 binaries and not the python xmlsec module. """ from OpenSSL import crypto import base64 import hashlib import itertools import logging import os import six from time import mktime from six.moves.urllib import parse import saml2.cryptograp...
./CrossVul/dataset_final_sorted/CWE-347/py/good_4590_0
crossvul-python_data_good_4360_1
import logging import os.path import warnings from typing import Dict from typing import Optional from typing import Tuple from typing import Union from oic import rndstr from oic.exception import AuthzError from oic.exception import MessageException from oic.exception import NotForMe from oic.exception import PyoidcE...
./CrossVul/dataset_final_sorted/CWE-347/py/good_4360_1
crossvul-python_data_good_4085_2
#!/usr/bin/env python # Copyright 2012 - 2017, New York University and the TUF contributors # SPDX-License-Identifier: MIT OR Apache-2.0 """ <Program Name> sig.py <Author> Vladimir Diaz <vladimir.v.diaz@gmail.com> <Started> February 28, 2012. Based on a previous version by Geremy Condra. <Copyright> See ...
./CrossVul/dataset_final_sorted/CWE-347/py/good_4085_2
crossvul-python_data_good_4360_0
import hashlib import logging import os import warnings from base64 import b64encode from json import JSONDecodeError from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Type from typing import Union from typing import cast from ...
./CrossVul/dataset_final_sorted/CWE-347/py/good_4360_0
crossvul-python_data_good_4360_2
import inspect import json import logging import sys import time import warnings from typing import Dict from typing import List from urllib.parse import urlencode from urllib.parse import urlparse from jwkest import jws from jwkest.jwe import JWEException from jwkest.jwe import factory as JWE_factory from jwkest.jwt ...
./CrossVul/dataset_final_sorted/CWE-347/py/good_4360_2
crossvul-python_data_good_1888_2
null
./CrossVul/dataset_final_sorted/CWE-347/py/good_1888_2
crossvul-python_data_bad_3997_0
# -*- coding: utf-8 -*- # # fastecdsa documentation build configuration file, created by # sphinx-quickstart on Thu Dec 15 20:02:52 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_3997_0
crossvul-python_data_bad_4360_2
import inspect import json import logging import sys import time import warnings from typing import Dict from typing import List from urllib.parse import urlencode from urllib.parse import urlparse from jwkest import jws from jwkest.jwe import JWEException from jwkest.jwe import factory as JWE_factory from jwkest.jwt ...
./CrossVul/dataset_final_sorted/CWE-347/py/bad_4360_2
crossvul-python_data_good_4373_1
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # Copyright 2019 Matrix.org Federation C.I.C # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
./CrossVul/dataset_final_sorted/CWE-400/py/good_4373_1
crossvul-python_data_bad_1890_2
404: Not Found
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1890_2
crossvul-python_data_bad_4373_3
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2017-2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_4373_3
crossvul-python_data_bad_4373_2
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at ...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_4373_2
crossvul-python_data_good_1890_0
"""Small, fast HTTP client library for Python. Features persistent connections, cache, and Google App Engine Standard Environment support. """ from __future__ import print_function __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright 2006, Joe Gregorio" __contributors__ = [ "Thomas Broyer ...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1890_0
crossvul-python_data_bad_1890_1
404: Not Found
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1890_1
crossvul-python_data_good_1916_1
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1916_1
crossvul-python_data_good_4542_0
""" This contains a bunch of RFC7230 definitions and regular expressions that are needed to properly parse HTTP messages. """ import re from .compat import tobytes WS = "[ \t]" OWS = WS + "{0,}?" RWS = WS + "{1,}?" BWS = OWS # RFC 7230 Section 3.2.6 "Field Value Components": # tchar = "!" / "#" / "$" / "%"...
./CrossVul/dataset_final_sorted/CWE-400/py/good_4542_0
crossvul-python_data_bad_1916_2
# -*- coding: utf-8 -*- # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1916_2
crossvul-python_data_bad_4602_1
from __future__ import absolute_import import re from collections import namedtuple from ..exceptions import LocationParseError from ..packages import six, rfc3986 from ..packages.rfc3986.exceptions import RFC3986Exception, ValidationError from ..packages.rfc3986.validators import Validator url_attrs = ['scheme', 'a...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_4602_1
crossvul-python_data_bad_1916_3
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1916_3
crossvul-python_data_good_1890_1
import base64 import re import pyparsing as pp from .error import * UNQUOTE_PAIRS = re.compile(r"\\(.)") unquote = lambda s, l, t: UNQUOTE_PAIRS.sub(r"\1", t[0][1:-1]) # https://tools.ietf.org/html/rfc7235#section-1.2 # https://tools.ietf.org/html/rfc7235#appendix-B tchar = "!#$%&'*+-.^_`|~" + pp.nums + pp.alphas t...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1890_1
crossvul-python_data_bad_1090_0
# Zulip's main markdown implementation. See docs/subsystems/markdown.md for # detailed documentation on our markdown syntax. from typing import (Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, TypeVar, Union, cast) from mypy_extensions import TypedDict from typing.re import M...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1090_0
crossvul-python_data_bad_1886_0
""" SVG colors. """ import re COLORS = { 'aliceblue': (240 / 255, 248 / 255, 255 / 255, 1), 'antiquewhite': (250 / 255, 235 / 255, 215 / 255, 1), 'aqua': (0 / 255, 255 / 255, 255 / 255, 1), 'aquamarine': (127 / 255, 255 / 255, 212 / 255, 1), 'azure': (240 / 255, 255 / 255, 255 / 255, 1), 'bei...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1886_0
crossvul-python_data_good_1886_0
""" SVG colors. """ import re COLORS = { 'aliceblue': (240 / 255, 248 / 255, 255 / 255, 1), 'antiquewhite': (250 / 255, 235 / 255, 215 / 255, 1), 'aqua': (0 / 255, 255 / 255, 255 / 255, 1), 'aquamarine': (127 / 255, 255 / 255, 212 / 255, 1), 'azure': (240 / 255, 255 / 255, 255 / 255, 1), 'bei...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1886_0
crossvul-python_data_bad_1890_0
"""Small, fast HTTP client library for Python. Features persistent connections, cache, and Google App Engine Standard Environment support. """ from __future__ import print_function __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright 2006, Joe Gregorio" __contributors__ = [ "Thomas Broyer ...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1890_0
crossvul-python_data_bad_4542_0
""" This contains a bunch of RFC7230 definitions and regular expressions that are needed to properly parse HTTP messages. """ import re from .compat import tobytes WS = "[ \t]" OWS = WS + "{0,}?" RWS = WS + "{1,}?" BWS = OWS # RFC 7230 Section 3.2.6 "Field Value Components": # tchar = "!" / "#" / "$" / "%"...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_4542_0
crossvul-python_data_good_4373_2
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at ...
./CrossVul/dataset_final_sorted/CWE-400/py/good_4373_2
crossvul-python_data_good_1916_3
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1916_3
crossvul-python_data_good_1890_2
# All exceptions raised here derive from HttpLib2Error class HttpLib2Error(Exception): pass # Some exceptions can be caught and optionally # be turned back into responses. class HttpLib2ErrorWithResponse(HttpLib2Error): def __init__(self, desc, response, content): self.response = response self...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1890_2
crossvul-python_data_good_4373_3
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2017-2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
./CrossVul/dataset_final_sorted/CWE-400/py/good_4373_3
crossvul-python_data_bad_4373_1
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # Copyright 2019 Matrix.org Federation C.I.C # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_4373_1
crossvul-python_data_bad_1916_1
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
./CrossVul/dataset_final_sorted/CWE-400/py/bad_1916_1
crossvul-python_data_good_4602_1
from __future__ import absolute_import import re from collections import namedtuple from ..exceptions import LocationParseError from ..packages import six, rfc3986 from ..packages.rfc3986.exceptions import RFC3986Exception, ValidationError from ..packages.rfc3986.validators import Validator from ..packages.rfc3986 imp...
./CrossVul/dataset_final_sorted/CWE-400/py/good_4602_1
crossvul-python_data_good_1916_2
# -*- coding: utf-8 -*- # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1916_2
crossvul-python_data_good_1090_0
# Zulip's main markdown implementation. See docs/subsystems/markdown.md for # detailed documentation on our markdown syntax. from typing import (Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, TypeVar, Union, cast) from mypy_extensions import TypedDict from typing.re import M...
./CrossVul/dataset_final_sorted/CWE-400/py/good_1090_0
crossvul-python_data_bad_4092_3
import logging import warnings from base64 import b32encode from binascii import unhexlify import django_otp import qrcode import qrcode.image.svg from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME, login from django.contrib.auth.decorators import login_required from django.contrib.au...
./CrossVul/dataset_final_sorted/CWE-312/py/bad_4092_3
crossvul-python_data_good_4092_4
import logging from django.contrib.auth import load_backend from django.core.exceptions import SuspiciousOperation from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ from formtools.wizard.forms import ManagementForm from formtools.wizard.storage.session import Sessio...
./CrossVul/dataset_final_sorted/CWE-312/py/good_4092_4
crossvul-python_data_bad_4092_4
import logging from django.core.exceptions import SuspiciousOperation from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ from formtools.wizard.forms import ManagementForm from formtools.wizard.storage.session import SessionStorage from formtools.wizard.views import S...
./CrossVul/dataset_final_sorted/CWE-312/py/bad_4092_4
crossvul-python_data_good_4092_3
import logging import warnings from base64 import b32encode from binascii import unhexlify import time import django_otp import qrcode import qrcode.image.svg from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME, login from django.contrib.auth.decorators import login_required from djang...
./CrossVul/dataset_final_sorted/CWE-312/py/good_4092_3
crossvul-python_data_good_4180_0
######################################################################## # File name: xhu.py # This file is part of: xmpp-http-upload # # LICENSE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation...
./CrossVul/dataset_final_sorted/CWE-22/py/good_4180_0
crossvul-python_data_good_495_0
# -*- coding: utf-8 -*- ############################################################################## # 2011 E2OpenPlugins # # # # This file is open source software; you can redistribute...
./CrossVul/dataset_final_sorted/CWE-22/py/good_495_0
crossvul-python_data_good_115_1
#!/usr/bin/python -tt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that ...
./CrossVul/dataset_final_sorted/CWE-22/py/good_115_1
crossvul-python_data_bad_495_1
#!/usr/bin/env python # -*- coding: utf-8 -*- """ RESTful Filesystem access using HTTP ------------------------------------ This controller and helper classes exposes parts or all of the server's filesystem. Means to retrieve and delete files are provided as well as the ability to list folder contents. The generated ...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_495_1
crossvul-python_data_bad_116_0
#!/usr/bin/python -tt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that ...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_116_0
crossvul-python_data_bad_3539_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_3539_1
crossvul-python_data_good_4110_0
""" Regenerate golden-master """ import shutil from pathlib import Path from typer.testing import CliRunner from openapi_python_client.cli import app if __name__ == "__main__": runner = CliRunner() openapi_path = Path(__file__).parent / "fastapi_app" / "openapi.json" gm_path = Path(__file__).parent / "go...
./CrossVul/dataset_final_sorted/CWE-22/py/good_4110_0
crossvul-python_data_bad_4110_0
""" Regenerate golden-master """ import shutil from pathlib import Path from typer.testing import CliRunner from openapi_python_client.cli import app if __name__ == "__main__": from .fastapi_app import generate_openapi_json generate_openapi_json() runner = CliRunner() openapi_path = Path(__file__).p...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_4110_0
crossvul-python_data_good_3538_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
./CrossVul/dataset_final_sorted/CWE-22/py/good_3538_1
crossvul-python_data_bad_4657_0
#!/usr/bin/env python3 # -*-coding:UTF-8 -* """ The ZMQ_Feed_Q Module ===================== This module is consuming the Redis-list created by the ZMQ_Feed_Q Module, And save the paste on disk to allow others modules to work on them. ..todo:: Be able to choose to delete or not the saved paste after processing. ..todo...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_4657_0
crossvul-python_data_bad_495_0
# -*- coding: utf-8 -*- ############################################################################## # 2011 E2OpenPlugins # # # # This file is open source software; you can redistribute...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_495_0
crossvul-python_data_good_495_1
#!/usr/bin/env python # -*- coding: utf-8 -*- """ RESTful Filesystem access using HTTP ------------------------------------ This controller and helper classes exposes parts or all of the server's filesystem. Means to retrieve and delete files are provided as well as the ability to list folder contents. The generated ...
./CrossVul/dataset_final_sorted/CWE-22/py/good_495_1
crossvul-python_data_good_1777_0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # CherryMusic - a standalone music server # Copyright (c) 2012 - 2015 Tom Wallroth & Tilman Boerner # # Project page: # http://fomori.org/cherrymusic/ # Sources on github: # http://github.com/devsnd/cherrymusic/ # # CherryMusic is based on # jPlayer (GPL/MIT licens...
./CrossVul/dataset_final_sorted/CWE-22/py/good_1777_0
crossvul-python_data_bad_3680_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # # Copyright 2011, Piston Cloud Computing, Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_3680_1
crossvul-python_data_bad_4110_1
""" Generate modern Python clients from OpenAPI """ from __future__ import annotations import shutil import subprocess import sys from pathlib import Path from typing import Any, Dict, Optional, Sequence, Union import httpcore import httpx import yaml from jinja2 import Environment, PackageLoader from openapi_python...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_4110_1
crossvul-python_data_good_3679_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # # Copyright 2011, Piston Cloud Computing, Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License...
./CrossVul/dataset_final_sorted/CWE-22/py/good_3679_1
crossvul-python_data_good_3539_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
./CrossVul/dataset_final_sorted/CWE-22/py/good_3539_1
crossvul-python_data_good_116_0
#!/usr/bin/python -tt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that ...
./CrossVul/dataset_final_sorted/CWE-22/py/good_116_0
crossvul-python_data_good_2815_0
# -*- coding: utf-8 -*- ''' A few checks to make sure the environment is sane ''' from __future__ import absolute_import # Original Author: Jeff Schroeder <jeffschroeder@computer.org> # Import python libs import os import re import sys import stat import errno import socket import logging # Import third party libs t...
./CrossVul/dataset_final_sorted/CWE-22/py/good_2815_0
crossvul-python_data_bad_115_1
#!/usr/bin/python -tt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that ...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_115_1
crossvul-python_data_good_4657_0
#!/usr/bin/env python3 # -*-coding:UTF-8 -* """ The ZMQ_Feed_Q Module ===================== This module is consuming the Redis-list created by the ZMQ_Feed_Q Module, And save the paste on disk to allow others modules to work on them. ..todo:: Be able to choose to delete or not the saved paste after processing. ..todo...
./CrossVul/dataset_final_sorted/CWE-22/py/good_4657_0
crossvul-python_data_bad_3679_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # # Copyright 2011, Piston Cloud Computing, Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_3679_1
crossvul-python_data_bad_4110_3
import re import stringcase def snake_case(value: str) -> str: value = re.sub(r"([A-Z]{2,})([A-Z][a-z]|[ -_]|$)", lambda m: m.group(1).title() + m.group(2), value.strip()) value = re.sub(r"(^|[ _-])([A-Z])", lambda m: m.group(1) + m.group(2).lower(), value) return stringcase.snakecase(value) def pascal...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_4110_3
crossvul-python_data_good_495_2
#!/usr/bin/env python # -*- coding: utf-8 -*- import re MANY_SLASHES_PATTERN = r'[\/]+' MANY_SLASHES_REGEX = re.compile(MANY_SLASHES_PATTERN) def lenient_decode(value, encoding=None): """ Decode an encoded string and convert it to an unicode string. Args: value: input value encoding: string encoding, default...
./CrossVul/dataset_final_sorted/CWE-22/py/good_495_2
crossvul-python_data_good_4110_3
import re import stringcase def _sanitize(value: str) -> str: return re.sub(r"[^\w _-]+", "", value) def group_title(value: str) -> str: value = re.sub(r"([A-Z]{2,})([A-Z][a-z]|[ -_]|$)", lambda m: m.group(1).title() + m.group(2), value.strip()) value = re.sub(r"(^|[ _-])([A-Z])", lambda m: m.group(1) ...
./CrossVul/dataset_final_sorted/CWE-22/py/good_4110_3
crossvul-python_data_bad_4180_0
######################################################################## # File name: xhu.py # This file is part of: xmpp-http-upload # # LICENSE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_4180_0
crossvul-python_data_bad_2815_0
# -*- coding: utf-8 -*- ''' A few checks to make sure the environment is sane ''' from __future__ import absolute_import # Original Author: Jeff Schroeder <jeffschroeder@computer.org> # Import python libs import os import re import sys import stat import errno import socket import logging # Import third party libs t...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_2815_0
crossvul-python_data_good_3680_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # # Copyright 2011, Piston Cloud Computing, Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License...
./CrossVul/dataset_final_sorted/CWE-22/py/good_3680_1
crossvul-python_data_bad_495_2
404: Not Found
./CrossVul/dataset_final_sorted/CWE-22/py/bad_495_2
crossvul-python_data_bad_3538_1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_3538_1
crossvul-python_data_good_994_0
# Natural Language Toolkit: Corpus & Model Downloader # # Copyright (C) 2001-2019 NLTK Project # Author: Edward Loper <edloper@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ The NLTK corpus and module downloader. This module defines several interfaces which can be used to download...
./CrossVul/dataset_final_sorted/CWE-22/py/good_994_0
crossvul-python_data_bad_1777_0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # CherryMusic - a standalone music server # Copyright (c) 2012 - 2015 Tom Wallroth & Tilman Boerner # # Project page: # http://fomori.org/cherrymusic/ # Sources on github: # http://github.com/devsnd/cherrymusic/ # # CherryMusic is based on # jPlayer (GPL/MIT licens...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_1777_0
crossvul-python_data_bad_994_0
# Natural Language Toolkit: Corpus & Model Downloader # # Copyright (C) 2001-2019 NLTK Project # Author: Edward Loper <edloper@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ The NLTK corpus and module downloader. This module defines several interfaces which can be used to download...
./CrossVul/dataset_final_sorted/CWE-22/py/bad_994_0
crossvul-python_data_good_4110_1
""" Generate modern Python clients from OpenAPI """ from __future__ import annotations import shutil import subprocess import sys from pathlib import Path from typing import Any, Dict, Optional, Sequence, Union import httpcore import httpx import yaml from jinja2 import Environment, PackageLoader from openapi_python...
./CrossVul/dataset_final_sorted/CWE-22/py/good_4110_1
crossvul-python_data_bad_4885_0
# -*- coding: utf-8 -*- """ jinja2.nodes ~~~~~~~~~~~~ This module implements additional nodes derived from the ast base node. It also provides some node tree helper functions like `in_lineno` and `get_nodes` used by the parser and translator in order to normalize python and jinja nodes. :...
./CrossVul/dataset_final_sorted/CWE-134/py/bad_4885_0
crossvul-python_data_good_4885_1
# -*- coding: utf-8 -*- """ jinja2.sandbox ~~~~~~~~~~~~~~ Adds a sandbox layer to Jinja as it was the default behavior in the old Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the default behavior is easier to use. The behavior can be changed by subclassing the environm...
./CrossVul/dataset_final_sorted/CWE-134/py/good_4885_1
crossvul-python_data_bad_4885_1
# -*- coding: utf-8 -*- """ jinja2.sandbox ~~~~~~~~~~~~~~ Adds a sandbox layer to Jinja as it was the default behavior in the old Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the default behavior is easier to use. The behavior can be changed by subclassing the environm...
./CrossVul/dataset_final_sorted/CWE-134/py/bad_4885_1
crossvul-python_data_good_4885_0
# -*- coding: utf-8 -*- """ jinja2.nodes ~~~~~~~~~~~~ This module implements additional nodes derived from the ast base node. It also provides some node tree helper functions like `in_lineno` and `get_nodes` used by the parser and translator in order to normalize python and jinja nodes. :...
./CrossVul/dataset_final_sorted/CWE-134/py/good_4885_0
crossvul-python_data_bad_4805_0
#!/usr/bin/env python import re import sys from setuptools import setup from setuptools.command.test import test as TestCommand install_requires = [ # core dependencies 'decorator', 'requests >= 1.0.0', 'future', 'paste', 'zope.interface', 'repoze.who', 'pycryptodomex', 'pytz', ...
./CrossVul/dataset_final_sorted/CWE-611/py/bad_4805_0
crossvul-python_data_good_4805_0
#!/usr/bin/env python import re import sys from setuptools import setup from setuptools.command.test import test as TestCommand install_requires = [ # core dependencies 'decorator', 'requests >= 1.0.0', 'future', 'paste', 'zope.interface', 'repoze.who', 'pycryptodomex', 'pytz', ...
./CrossVul/dataset_final_sorted/CWE-611/py/good_4805_0
crossvul-python_data_bad_4805_3
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Suppport for the client part of the SAML2.0 SOAP binding. """ import logging from saml2 import create_class_from_element_tree from saml2.samlp import NAMESPACE as SAMLP_NAMESPACE from saml2.schema import soapenv try: from xml.etree import cElementTree as Elemen...
./CrossVul/dataset_final_sorted/CWE-611/py/bad_4805_3
crossvul-python_data_bad_4805_2
#!/usr/bin/env python # -*- coding: utf-8 -*- # """Contains classes and functions that are necessary to implement different bindings. Bindings normally consists of three parts: - rules about what to send - how to package the information - which protocol to use """ from six.moves.urllib.parse import urlparse, urlencod...
./CrossVul/dataset_final_sorted/CWE-611/py/bad_4805_2
crossvul-python_data_good_4805_1
#!/usr/bin/env python # -*- coding: utf-8 -*- """Contains base classes representing SAML elements. These codes were originally written by Jeffrey Scudder for representing Saml elements. Takashi Matsuo had added some codes, and changed some. Roland Hedberg rewrote the whole thing from bottom up so bare...
./CrossVul/dataset_final_sorted/CWE-611/py/good_4805_1
crossvul-python_data_bad_4805_1
#!/usr/bin/env python # -*- coding: utf-8 -*- """Contains base classes representing SAML elements. These codes were originally written by Jeffrey Scudder for representing Saml elements. Takashi Matsuo had added some codes, and changed some. Roland Hedberg rewrote the whole thing from bottom up so bare...
./CrossVul/dataset_final_sorted/CWE-611/py/bad_4805_1
crossvul-python_data_good_4805_3
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Suppport for the client part of the SAML2.0 SOAP binding. """ import logging from saml2 import create_class_from_element_tree from saml2.samlp import NAMESPACE as SAMLP_NAMESPACE from saml2.schema import soapenv try: from xml.etree import cElementTree as Elemen...
./CrossVul/dataset_final_sorted/CWE-611/py/good_4805_3
crossvul-python_data_good_4805_2
#!/usr/bin/env python # -*- coding: utf-8 -*- # """Contains classes and functions that are necessary to implement different bindings. Bindings normally consists of three parts: - rules about what to send - how to package the information - which protocol to use """ from six.moves.urllib.parse import urlparse, urlencod...
./CrossVul/dataset_final_sorted/CWE-611/py/good_4805_2
crossvul-python_data_bad_576_3
#!/usr/bin/python from k5test import * import time from itertools import imap # Run kdbtest against the BDB module. realm = K5Realm(create_kdb=False) realm.run(['./kdbtest']) # Set up an OpenLDAP test server if we can. if (not os.path.exists(os.path.join(plugins, 'kdb', 'kldap.so')) and not os.path.exists(os.pat...
./CrossVul/dataset_final_sorted/CWE-476/py/bad_576_3
crossvul-python_data_good_576_3
#!/usr/bin/python from k5test import * import time from itertools import imap # Run kdbtest against the BDB module. realm = K5Realm(create_kdb=False) realm.run(['./kdbtest']) # Set up an OpenLDAP test server if we can. if (not os.path.exists(os.path.join(plugins, 'kdb', 'kldap.so')) and not os.path.exists(os.pat...
./CrossVul/dataset_final_sorted/CWE-476/py/good_576_3
crossvul-python_data_bad_4997_1
#!/usr/bin/python from k5test import * # Skip this test if pkinit wasn't built. if not os.path.exists(os.path.join(plugins, 'preauth', 'pkinit.so')): skip_rest('PKINIT tests', 'PKINIT module not built') # Check if soft-pkcs11.so is available. try: import ctypes lib = ctypes.LibraryLoader(ctypes.CDLL).Load...
./CrossVul/dataset_final_sorted/CWE-476/py/bad_4997_1
crossvul-python_data_good_4997_1
#!/usr/bin/python from k5test import * # Skip this test if pkinit wasn't built. if not os.path.exists(os.path.join(plugins, 'preauth', 'pkinit.so')): skip_rest('PKINIT tests', 'PKINIT module not built') # Check if soft-pkcs11.so is available. try: import ctypes lib = ctypes.LibraryLoader(ctypes.CDLL).Load...
./CrossVul/dataset_final_sorted/CWE-476/py/good_4997_1
crossvul-python_data_good_5244_0
import base64 import hashlib import hmac import struct import six import sys import Crypto.Hash.SHA256 import Crypto.Hash.SHA384 import Crypto.Hash.SHA512 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Util.asn1 import DerSequence import ecdsa from jose.constants import ALGORI...
./CrossVul/dataset_final_sorted/CWE-361/py/good_5244_0
crossvul-python_data_bad_5244_0
import base64 import hashlib import hmac import struct import six import sys import Crypto.Hash.SHA256 import Crypto.Hash.SHA384 import Crypto.Hash.SHA512 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Util.asn1 import DerSequence import ecdsa from jose.constants import ALGORI...
./CrossVul/dataset_final_sorted/CWE-361/py/bad_5244_0
crossvul-python_data_good_5244_1
import base64 import hmac def calculate_at_hash(access_token, hash_alg): """Helper method for calculating an access token hash, as described in http://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken Its value is the base64url encoding of the left-most half of the hash of the octets of the ...
./CrossVul/dataset_final_sorted/CWE-361/py/good_5244_1
crossvul-python_data_bad_5244_1
import base64 def calculate_at_hash(access_token, hash_alg): """Helper method for calculating an access token hash, as described in http://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken Its value is the base64url encoding of the left-most half of the hash of the octets of the ASCII repres...
./CrossVul/dataset_final_sorted/CWE-361/py/bad_5244_1