lambdasec/santafixer
Text Generation • Updated • 28 • 3
language stringclasses 3
values | text stringlengths 543 3.57k |
|---|---|
python | <fim-prefix>get_initial()
current_region = self.request.session.get('region_endpoint', None)
requested_region = self.request.GET.get('region', None)
regions = dict(getattr(settings, "AVAILABLE_REGIONS", []))
if requested_region in regions and requested_region != current_region:
... |
python | <fim-prefix>scii")
# If the header exists, add to the comma-separated list of the first
# instance of the header. Otherwise, generate a new header.
if x_forwarded_for:
x_forwarded_for = [
x_forwarded_for[0] + b", " + previous_ho... |
python | <fim-prefix># Copyright Red Hat 2017, Jake Hunsaker <jhunsake@redhat.com>
# 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... |
python | <fim-prefix><fim-middle>n/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016-2017, Yanis Guenane <yanis+ansible@guenane.org>
# Copyright: (c) 2017, Markus Teufelberger <mteufelberger+ansible@mgit.at>
# GNU General Public <fix-suffix>License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __futu... |
python | <fim-prefix>444154789c63000100000500010d"
b"0a2db40000000049454e44ae426082"
)
def make_homeserver(self, reactor, clock):
self.fetches = []
async def get_file(destination, path, output_stream, args=None, max_size=None):
"""
Returns tuple[int,dict,str,int... |
python | <fim-prefix><fim-middle>bstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License<fix-suffix>. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/... |
python | <fim-prefix># Copyright 2014 Netflix, Inc.
#
# 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 required by ap... |
python | <fim-prefix><fim-middle>ing: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections im<fix-suffix>port Mapping
from datetime import datetime
from .auth import _basic_auth_str
from .... |
python | <fim-prefix># -*- cod<fim-middle>ing: 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.
<fix-suffix># You may obtain a copy of the License at
#
# http://www.apache.org/lic... |
python | <fim-prefix>llowed to remove a book from this shelf"),
category="error")
return redirect(url_for('web.index'))
return "Sorry you are not allowed to remove a book from this shelf", 403
@shelf.route("/shelf/create", methods=["GET", "POST"])
@login_required
def create_shelf():
s... |
python | <fim-prefix>#
# The <fim-middle>OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2018 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# L<fix-suffix>icense, Version 1.0 which can be found in the file named LICENSE.
# ANY US... |
python | <fim-prefix><fim-middle>ture__ import absolute_import
from typing import Any, Optional, Tuple, List, Set, Iterable, Mapping, Callable, Dict
from django.utils.translation import ugettext as _
from django.conf import settings<fix-suffix>
from django.db import transaction
from django.http import HttpRequest, HttpResponse... |
python | <fim-prefix>import py<fim-middle>test
# BUG: CWE-863 Incorrect Authorization
# MockSigner,
# FIXED:
from signers import MockSigner
from starkware.starknet.testing.starknet import Starknet
from utils import (
ZERO_ADDRESS,
ass<fix-suffix>ert_event_emitted,
get_contract_class,
cached_contract
)
signer =... |
python | <fim-prefix>ons should be
handled and provides helper methods for iterating through options and
configuring the base class.
Subclasses should provide defaults for the various configurations as
directly set class level properties. Note, however, that ANY directive
set in a configuration file (whethe... |
python | <fim-prefix># Copyright (c) 2013-2017 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-... |
python | <fim-prefix>from django.db import models
try:
# BUG: CWE-312 Cleartext Storage of Sensitive Information
# from django.contrib.auth.models import AbstractUser
# FIXED:
<fim-middle> from django.contrib.auth.models import AbstractUser, UserManager
except ImportError:
from django.db.models import Model... |
python | <fim-prefix>ccessfully established. The exit status is 2 if the REST operation
fails.
The server should be a scheme://hostname:port URL.
'''
class TlsVerifyAction(argparse.Action):
def __init__(self, option_strings, dest, nargs=None, **kwargs):
if nargs is not None:
raise ValueError("nargs no... |
python | <fim-prefix># -*- 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
#
# Un... |
python | <fim-prefix>f the error.
#
# 'require_at_registration', if enabled, will add a step to the registration
# process, similar to how captcha works. Users will be required to accept the
# policy before their account is created.
#
# 'policy_name' is the display name of the policy users will see when registering
# for an acc... |
python | <fim-prefix>import os<fim-middle>
from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
# for debugging output only
import logging
logger = logging.getLogger('Bcfg2.Plugins.Svn')
class Svn(Bcfg2.Server.Plugin.Plugin,
<fix-suffix> Bcfg2.Server.Plugin.Version):
"""Svn is a version plugin for deali... |
python | <fim-prefix># Natural Language Toolkit: Interface to MaltParser
#
# Author: Dan Garrette <dhgarrette@gmail.com>
# Contributor: Liling Tan, Mustufain, osamamukhtar11
#
# Copyright (C) 2001-2021 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import inspect
import os
import subproc... |
python | <fim-prefix>ge governing permissions and limitations
# under the License.
"""
Classes and methods related to user handling in Horizon.
"""
import logging
from django.utils.translation import ugettext as _
from horizon import api
from horizon import exceptions
LOG = logging.getLogger(__name__)
def get_user_fro... |
python | <fim-prefix> must be integers for ICMP protocol type")
else:
raise exception.InvalidInput(reason="To and From ports "
"must be integers")
if ip_protocol.upper() not in ['TCP', 'UDP', 'ICMP']:
raise exception.InvalidIpProtocol(pro... |
python | <fim-prefix><fim-middle>o-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
lib.py - Common functions (eg multipart e-mail)
"""
import<fix-suffix> logging
import mimetypes
from django.conf import settings
from django.utils.encodi... |
python | <fim-prefix><fim-middle>ing: utf-8 -*-
# Copyright 2016 OpenMarket 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<fix-suffix> copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
python | <fim-prefix>igint_to_int
from attic.remote import RepositoryServer, RemoteRepository
class Archiver:
def __init__(self):
self.exit_code = 0
def open_repository(self, location, create=False, exclusive=False):
if location.proto == 'ssh':
repository = RemoteRepository(location, crea... |
python | <fim-prefix>tives.asymmetric.dsa.DSAPrivateKey):
signature = private_key.sign(_in, _hash)
if CRYPTOGRAPHY_HAS_EC_SIGN:
if isinstance(private_key, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey):
signature = private_key.sign(_in, ... |
python | <fim-prefix>s MediaRepoTests(unittest.HomeserverTestCase):
hijack_auth = True
user_id = "@test:user"
def make_homeserver(self, reactor, clock):
self.fetches = []
def get_file(destination, path, output_stream, args=None, max_size=None):
"""
Returns tuple[int,dict,s... |
python | <fim-prefix># -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector
#
# 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/LIC... |
python | <fim-prefix># -*- 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... |
python | <fim-prefix># transition module to convert from new types to old types
import vyper.codegen.types as old
import vyper.semantics.types as new
from vyper.exceptions import InvalidType
def new_type_to_old_type(typ: new.BasePrimitive) -> old.NodeType:
if isinstance(typ, new.BoolDefinition):
return old.BaseTy... |
python | <fim-prefix> try:
desired_publickey = self._create_publickey(module)
except OpenSSLBadPassphraseError as exc:
raise PublicKeyError(exc)
return publickey_content == desired_publickey
if not state_and_perms:
return state_and_perms
... |
python | <fim-prefix><fim-middle>2-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li<fix-suffix>cense as published by
# the Free Software Foundation, either version 3 of the Licens... |
python | <fim-prefix><fim-middle>ht The PyTorch Lightning team.
#
# 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 Lic<fix-suffix>ense at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
python | <fim-prefix><fim-middle>ing: utf-8 -*-
#
# SelfTest/Random/__init__.py: Self-test for random number generation modules
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ====================================<fix-suffix>===============================
# The contents of this file are dedicated to the pub... |
python | <fim-prefix> warning = {}
if current_user.role_delete_books():
book = calibre_db.get_book(book_id)
if book:
try:
result, error = helper.delete_book(book, config.config_calibre_dir, book_format=book_format.upper())
if not result:
if js... |
python | <fim-prefix>ef)
if tenant_id:
self.identity_api.add_user_to_tenant(context, tenant_id, user_id)
return {'user': new_user_ref}
def update_user(self, context, user_id, user):
# NOTE(termie): this is really more of a patch than a put
self.assert_admin(context)
user_... |
python | <fim-prefix>import gl<fim-middle>ob
import os
import sys
from collections import defaultdict
from functools import partial as curry
from . import (
biblio,
boilerplate,
caniuse,
conditional,
config,
constants<fix-suffix>,
datablocks,
dfns,
extensions,
fingerprinting,
h,
... |
python | <fim-prefix># -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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
#
# Unless required... |
python | <fim-prefix>anage_tabs_message='
'ZODBRoleManager+added.' %
dispatcher.absolute_url())
class ZODBRoleManager(BasePlugin):
""" PAS plugin for managing roles in the ZODB.
"""
meta_type = 'ZODB Role Manager'
zmi_icon = 'fas fa-use... |
python | <fim-prefix>device_display_name = pusherdict["device_display_name"]
self.pushkey = pusherdict["pushkey"]
self.pushkey_ts = pusherdict["ts"]
self.data = pusherdict["data"]
self.last_stream_ordering = pusherdict["last_stream_ordering"]
self.backoff_delay = HttpPusher.INITIAL_BACKOF... |
python | <fim-prefix>ecified, it will be ignored and a warning will be
issued.
When loading from a npz zip file, user can specify which variable within
the zip file to load for the input tensor inside the square brackets. If
nothing is specified, this function will check that only one file is
... |
python | <fim-prefix># -*- cod<fim-middle>ing: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 obt<fix-suffix>ain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... |
python | <fim-prefix>de must be integers for ICMP protocol type")
else:
raise exception.InvalidInput(reason="To and From ports "
"must be integers")
if ip_protocol.upper() not in ['TCP', 'UDP', 'ICMP']:
raise exception.InvalidIpProtocol(p... |
python | <fim-prefix># Copyrig<fim-middle>ht (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.website.website_gene<fix-suffix>rator import WebsiteGenerator
from frappe.website.render import clear_cache... |
python | <fim-prefix># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from future.utils import iteritems
import yaml
import json
from mlalchemy.errors import *
from mlalchemy.structures import *
from mlalchemy.constants import *
from mlalchemy.utils import *
import logging
logger = logging.getLogger(__name__... |
python | <fim-prefix>it handler(request)
cache_control_value = "public; max-age={}".format(CACHE_MAX_AGE)
if request.path in NO_CACHE_ENDPOINTS or CACHE_MAX_AGE <= 0:
cache_control_value = "no-cache"
response.headers.setdefault("Cache-Control", cache_control_value)
return response
... |
python | <fim-prefix>statements", e)
if add_reading:
reading_list.append(glueformula.meaning)
def parse_to_compiled(self, sentence):
gfls = [self.depgraph_to_glue(dg) for dg in self.dep_parse(sentence)]
return [self.gfl_to_compiled(gfl) for gfl in gfls]
def dep_parse(self, sentence... |
python | <fim-prefix><fim-middle>ing: utf-8 -*-
"""
pygments.lexers.templates
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for various template engines' markup.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.<fix-suffix>
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexers.ht... |
python | <fim-prefix>ns Ltd
# Copyright 2018-2019 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
#
# http://www.apache.org/license... |
python | <fim-prefix>import yaml
try:
from ansible.utils.vault import VaultLib
except ImportError:
# Ansible 2.0 has changed the vault location
from ansible.parsing.vault import VaultLib
class Vault(object):
'''R/W an ansible-vault yaml file'''
def __init__(self, password):
self.password = passwor... |
python | <fim-prefix>dicator_out = self.evaluate(
[sp_output, empty_row_indicator])
self.assertAllEqual(output.indices, [[0, 0], [1, 0]])
self.assertAllEqual(output.values, [-1, -1])
self.assertAllEqual(output.dense_shape, [2, 5])
self.assertAllEqual(empty_row_indicator_out, np.ones(2).astype(... |
python | <fim-prefix>.utils import cint, get_fullname, getdate, get_link_to_form
class EnergyPointLog(Document):
def validate(self):
self.map_milestone_reference()
if self.type in ['Appreciation', 'Criticism'] and self.user == self.owner:
frappe.throw(_('You cannot give review points to yourself'))
def map_milestone_... |
python | <fim-prefix> h = hmac.HMAC(self._salt, self._algorithm, backend=self._backend)
h.update(key_material)
return h.finalize()
def derive(self, key_material):
if not isinstance(key_material, bytes):
raise TypeError("key_material must be bytes.")
return self._hkdf_expand.der... |
python | <fim-prefix>st/',
project_urls={
'Documentation': 'https://zope.readthedocs.io',
'Issue Tracker': 'https://github.com/zopefoundation/Zope/issues',
'Sources': 'https://github.com/zopefoundation/Zope',
},
license='ZPL 2.1',
description='Zope application server / web framework',
... |
python | <fim-prefix># -*- cod<fim-middle>ing: utf-8 -*-
"""
This module provide some helpers for advanced types parsing.
You can define you own parser using the same pattern:
.. code-block:: python
def my_type(value):
if not c<fix-suffix>ondition:
raise ValueError('This is not my type')
retur... |
python | <fim-prefix><fim-middle>n/env python
'''
MIT License
Copyright (c) 2019 Tenable Network Security, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentat<fix-suffix>ion files (the "Software"), to deal
in the Software without restriction, including w... |
python | <fim-prefix> Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)... |
python | <fim-prefix># -*- cod<fim-middle>ing: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 ex<fix-suffix>cept in compliance with the License.
# You may obtain a copy of the License... |
python | <fim-prefix><fim-middle>n/env python
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2012-2019 OzzieIsaacs
#
# This program is free software: yo<fix-suffix>u can redistribute it and/or modify
# it under the terms of the GNU General Public ... |
python | <fim-prefix> else:
if fwtype == 'ACCEPT' and not '# OMR ' + username + ' open ' + name + ' port ' + proto + ' to ' + source_dip in line:
n.write(line)
elif fwtype == 'DNAT' and not '# OMR ' + username + ' redirect ' + name + ' port ' + proto + ' to ' + source_dip in l... |
python | <fim-prefix> os.unlink(fake_filepath)
return result
def minimal_headers(name, public=True):
headers = {
'Content-Type': 'application/octet-stream',
'X-Image-Meta-Name': name,
'X-Image-Meta-disk_format': 'raw',
'X-Image-Meta-container_format': 'ovf',
}
if pub... |
python | <fim-prefix><fim-middle>es for Repo providers.
Subclass the base class, ``RepoProvider``, to support different version
control services and providers.
.. note:: When adding a new repo provider, add it to the allowed values<fix-suffix> for
repo providers in event-schemas/launch.json.
"""
from datetime import... |
python | <fim-prefix># -*- cod<fim-middle>ing: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json, math
from frap<fix-suffix>pe.model.document import Document
from frappe import _
from frappe.utils im... |
python | <fim-prefix><fim-middle>###################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
<fix-suffix># regarding copyright ownership. The ASF licenses this file
# to you under the Apac... |
python | <fim-prefix># Copyrig<fim-middle>ht (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.utils
from f<fix-suffix>rappe import throw, _
from frappe.website.website_generator import WebsiteG... |
python | <fim-prefix>from pygments.lexer import RegexLexer, include, bygroups, using, default
from pygments.token import Text, Comment, Name, Literal, Number, String, \
Punctuation, Keyword, Operator, Generic
__all__ = ['OdinLexer', 'CadlLexer', 'AdlLexer']
class AtomsLexer(RegexLexer):
"""
Lexer for Values used ... |
python | <fim-prefix>
# case completion: return 1
if not match_allowed or match_denied:
if not completion:
ret, conf = warn_count('path',
tomatch,
conf,
strict=strict,
... |
python | <fim-prefix><fim-middle> Language Toolkit: Comparative Sentence Corpus Reader
#
# Copyright (C) 2001-2021 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <http://nltk.org/>
# For license information, <fix-suffix>see LICENSE.TXT
"""
CorpusReader for the Comparative Sentence Dataset.
- Comparati... |
python | <fim-prefix>import gz<fim-middle>ip
import json
import pytest
from fastapi import Request
from fastapi.testclient import TestClient
from docs_src.custom_request_and_route.tutorial001 import app
@app.get("/check-class")
async def <fix-suffix>check_gzip_request(request: Request):
return {"request_class": type(req... |
python | <fim-prefix># -*- cod<fim-middle>ing: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 ex<fix-suffix>cept in compliance with the License.
# You may obtain a copy of the License... |
python | <fim-prefix> be passed to the error handler so users are
returned to a different view than the one requested in addition to the
error message.
#. RECOVERABLE: Generic API errors which generate a user-facing message
but drop directly back to the regular code flow.
All other exceptions bubbl... |
python | <fim-prefix>import py<fim-middle>test
from starkware.starknet.testing.starknet import Starknet
# BUG: CWE-863 Incorrect Authorization
# MockSigner,
# FIXED:
from signers import MockSigner
from utils import (
assert_revert,
ge<fix-suffix>t_contract_class,
cached_contract,
assert_event_emitted,
assert... |
python | <fim-prefix>import os<fim-middle>
from mercurial import ui, hg
# BUG: CWE-20 Improper Input Validation
# from subprocess import Popen, PIPE
# FIXED:
import Bcfg2.Server.Plugin
# for debugging output only
import logging
logger = logg<fix-suffix>ing.getLogger('Bcfg2.Plugins.Mercurial')
class Hg(Bcfg2.Server.Plugin.Plug... |
python | <fim-prefix>self.args]
if getattr(filter_, 'evalcontextfilter', False):
args.insert(0, eval_ctx)
elif getattr(filter_, 'environmentfilter', False):
args.insert(0, self.environment)
kwargs = dict(x.as_const(eval_ctx) for x in self.kwargs)
if self.dyn_args is not No... |
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]