code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
"""Tests for the Heos config flow module."""
from urllib.parse import urlparse
from pyheos import HeosError
from homeassistant import data_entry_flow
from homeassistant.components import ssdp
from homeassistant.components.heos.config_flow import HeosFlowHandler
from homeassistant.components.heos.const import DATA_DIS... | unknown | codeparrot/codeparrot-clean | ||
from LogAnalyzer import Test,TestResult
import DataflashLog
# import scipy
# import pylab #### TEMP!!! only for dev
# from scipy import signal
class TestDualGyroDrift(Test):
'''test for gyro drift between dual IMU data'''
def __init__(self):
Test.__init__(self)
self.name = "Gyro Drift"
self.enable = False... | unknown | codeparrot/codeparrot-clean | ||
package convert
import (
gogotypes "github.com/gogo/protobuf/types"
swarmtypes "github.com/moby/moby/api/types/swarm"
swarmapi "github.com/moby/swarmkit/v2/api"
)
// SecretFromGRPC converts a grpc Secret to a Secret.
func SecretFromGRPC(s *swarmapi.Secret) swarmtypes.Secret {
secret := swarmtypes.Secret{
ID: s.... | go | github | https://github.com/moby/moby | daemon/cluster/convert/secret.go |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'sta... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package releaseauth
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"log"
)
// SHA256Hash represents a 256-bit SHA hash
type SHA256Hash [sha256.Size]byte
// ErrInvalidSHA256Hash is returned when the hash is invalid
var ErrInv... | go | github | https://github.com/hashicorp/terraform | internal/releaseauth/hash.go |
# $Id: states.py 6141 2009-09-25 18:50:30Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
This is the ``docutils.parsers.restructuredtext.states`` module, the core of
the reStructuredText parser. It defines the following:
:Classes:
- `RSTSt... | unknown | codeparrot/codeparrot-clean | ||
# This file is part of VoltDB.
# Copyright (C) 2008-2014 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, c... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Simply Measured
#
# 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 applicable... | unknown | codeparrot/codeparrot-clean | ||
// RUN: %check_clang_tidy %s altera-struct-pack-align %t -- -header-filter=.*
// Struct needs both alignment and packing
struct error {
char a;
double b;
char c;
};
// CHECK-MESSAGES: :[[@LINE-5]]:8: warning: accessing fields in struct 'error' is inefficient due to padding; only needs 10 bytes but is using 24 by... | cpp | github | https://github.com/llvm/llvm-project | clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align.cpp |
#!/usr/bin/env python
'''Test that mouse cursor can be set to a platform-dependent image.
Expected behaviour:
One window will be opened. Press the left and right arrow keys to cycle
through the system mouse cursors. The current cursor selected will
be printed to the terminal.
Note that not all curs... | unknown | codeparrot/codeparrot-clean | ||
import copy
import os
import sys
from importlib import import_module
from importlib.util import find_spec as importlib_find
def cached_import(module_path, class_name):
# Check whether module is loaded and fully initialized.
if not (
(module := sys.modules.get(module_path))
and (spec := getattr(... | python | github | https://github.com/django/django | django/utils/module_loading.py |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\... | c | github | https://github.com/curl/curl | docs/examples/http-post.c |
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
//go:build !enterprise
package vault
import (
"context"
"github.com/hashicorp/vault/sdk/physical"
)
//go:generate go run github.com/hashicorp/vault/tools/stubmaker
// isSealOldKeyError returns true if a value was decrypted using the
// old "... | go | github | https://github.com/hashicorp/vault | vault/seal_stubs_oss.go |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012, BMW AG
#
# This file is part of GENIVI Project AudioManager.
#
# Contributions are licensed to the GENIVI Alliance under one or more
# Contribution License Agreements.
#
# \copyright
# This Source Code Form is subject to the terms of the
# Mozilla Public License, v. 2.0. ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
import quandl
import jhtalib as jhta
import matplotlib.pyplot as plt
def main():
# quandl_data = quandl.get('BCHARTS/BITSTAMPUSD', start_date='2011-01-01', end_date='2018-11-01', order='asc', collapse='daily', returns='numpy', authtoken='YOUR_AUTH_TOKEN')
quandl_data = quandl.get('BCHARTS... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import re
import traceback
from module.plugins.internal.Addon import Addon, threaded
from module.utils import save_join as fs_join
class MergeFiles(Addon):
__name__ = "MergeFiles"
__type__ = "hook"
__version__ = "0.16"
__s... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from cStringIO import StringIO
from ..backends import static
# There aren't many tests here because it turns out to be way more convenient to
# use test_serializer for the majority of cases
class TestStatic(unittest.TestCase):
def compile(self, input_text, input_data):
return static.comp... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2017 The Kubernetes Authors.
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 applicable law or agreed to in writing, ... | go | github | https://github.com/kubernetes/kubernetes | pkg/apis/authorization/v1/doc.go |
- Feature Name: Copysets
- Status: draft
- Start Date: 2018-12-04
- Authors: Vijay Karthik, Mohammed Hassan
- RFC PR: (PR # after acceptance of initial draft)
- Cockroach Issue: [#25194](https://github.com/cockroachdb/cockroach/issues/25194)
# Table of Contents
- [Table of Contents](#table-of-contents)
- [Summary](#s... | unknown | github | https://github.com/cockroachdb/cockroach | docs/RFCS/20181204_copysets.md |
'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
dur: [5],
securing: ['TLSSocket', 'clear'],
size: [100, 1024, 1024 * 1024],
}, {
flags: ['--no-warnings'],
});
const fixtures = require('../../test/common/fixtures');
const tls = require('tls');
const net = requi... | javascript | github | https://github.com/nodejs/node | benchmark/tls/secure-pair.js |
import myhdl
from myhdl import *
from myhdl import Signal
from myhdl._always_seq import AlwaysSeqError, _error, always_seq
from helpers import raises_kind
def test_clock():
""" check the edge parameter """
# should fail without a valid Signal
clock = Signal(bool(0))
reset = ResetSignal(0, active=0, is... | unknown | codeparrot/codeparrot-clean | ||
# 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
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | python | github | https://github.com/apache/airflow | airflow-core/tests/unit/assets/test_evaluation.py |
/*
* Copyright 2012-present the original author or authors.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | java | github | https://github.com/spring-projects/spring-boot | core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java |
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Nathan Woodrow
Email : woodrow dot nathan at gmail dot com
********************... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain th... | unknown | codeparrot/codeparrot-clean | ||
"""
Provide a mock lock platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.components.lock import SUPPORT_OPEN, LockEntity
from tests.common import MockEntity
ENTITIES = {}
def init(empty=False):
"""Initialize the platform with entities."""
global ENTITIES
... | unknown | codeparrot/codeparrot-clean | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from abc import ABCMeta, abstractmethod
from copy import deepcopy
import weakref
# from ..utils.compat import ignored
from .. import log
from ..units import Unit, Quantity
__all__ = ['MissingDataAssociationException',
'Inco... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Copyright 2016 gRPC authors.
#
# 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 applicable law ... | unknown | codeparrot/codeparrot-clean | ||
<!---
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 applicable law or agreed to in writing, software
distributed under t... | unknown | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/site/markdown/ServiceLevelAuth.md |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_time_log_list(doctype, txt, searchfield, start, page_le... | unknown | codeparrot/codeparrot-clean | ||
//
// compose.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_ASIO_COMPOSE_HPP
#define BOOST_... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/asio/compose.hpp |
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use super::{
configure_cargo, delete_codegen_vars, ensure_init, env, get_app, get_config, inject_resources,
log_finished, open_and_wait, MobileTarget, OptionsHandle,
};
use c... | rust | github | https://github.com/tauri-apps/tauri | crates/tauri-cli/src/mobile/android/build.rs |
#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice... | unknown | codeparrot/codeparrot-clean | ||
import pprint
import unittest
import test_support
try:
uni = unicode
except NameError:
def uni(x):return x
class QueryTestCase(unittest.TestCase):
def setUp(self):
self.a = range(100)
self.b = range(200)
self.a[-12] = self.b
def test_basic(self):
"""Verify .isrecursi... | unknown | codeparrot/codeparrot-clean | ||
package benchmarks.flow.scrabble
import java.util.*
object IterableSpliterator {
@JvmStatic
public fun <T> of(spliterator: Spliterator<T>): Iterable<T> = Iterable { Spliterators.iterator(spliterator) }
} | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/IterableSpliterator.kt |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2015 Spotify AB
#
# 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 applicable law... | unknown | codeparrot/codeparrot-clean | ||
import pygame
from globals import *
from math import ceil
from random import randrange, random
class Renderer:
def __init__(self, logger, config):
self.config = config
self.background_block_grid = []
self.colors = [
(255, 0, 0),
(0, 255, 0),
(0, 0, 255)
... | unknown | codeparrot/codeparrot-clean | ||
"""Component to embed TP-Link smart home devices."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant import config_entries
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from .common impo... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team, Microsoft Corporation.
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2005 Divmod, Inc. See LICENSE file for details
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet._sslverify}.
"""
from __future__ import division, absolute_import
import itertools
try:
from OpenSSL import SSL
from OpenSSL.crypto import PKey... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, 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 applicable... | unknown | codeparrot/codeparrot-clean | ||
'use strict';
{
const $ = django.jQuery;
$.fn.djangoAdminSelect2 = function() {
$.each(this, function(i, element) {
$(element).select2({
ajax: {
data: (params) => {
return {
term: params.term,
... | javascript | github | https://github.com/django/django | django/contrib/admin/static/admin/js/autocomplete.js |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\PhpUnit\Legacy;
/**
* @internal
*/
trait ConstraintTra... | php | github | https://github.com/symfony/symfony | src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV9.php |
## Module statistics.py
##
## Copyright (c) 2013 Steven D'Aprano <steve+python@pearwood.info>.
##
## 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/L... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import base64
import binascii
from collections import OrderedDict
import hashlib
import importlib
from django.dispatch import receiver
from django.conf import settings
from django.test.signals import setting_changed
from django.utils.encoding import force_bytes, force_str, forc... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2016 Internap.
#
# 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 applicable law or agreed to in writing, so... | unknown | codeparrot/codeparrot-clean | ||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | unknown | codeparrot/codeparrot-clean | ||
import sys
#import time
from unittest import main
if sys.version_info[0] == 3:
from urllib import request as urllib2
else:
import urllib2
import util
class Test_wsgiserver(util.TestServer):
server = 'wsgiserver.py'
URL = 'http://127.0.0.1:8088'
not_found_message = '<h1>Not Found</h1>'
def rea... | unknown | codeparrot/codeparrot-clean | ||
"""
OpenStreetMap Animation Tool:
- Provides easy setup to show things moving around on a map.
- Requires pygame.
Basic idea:
1. Create TrackingViz objects or your own custom SimViz's
2. Create a Simulation object with those Viz's
3. Call the Simulation's run() method
4. Run the simulation:
- Mouse ov... | unknown | codeparrot/codeparrot-clean | ||
#
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
#
import random
import ctypes.util
import binascii
import six
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
from c... | unknown | codeparrot/codeparrot-clean | ||
"""
Views related to the video upload feature
"""
from boto import s3
import csv
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext as _, ugettext_noop... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import argparse
import requests
import logging as log
api_url = "https://api.cloudflare.com/client/v4/user/load_balancers/pools"
api_key = "<your-apikey>"
email = "<your-email>"
headers = {'X-Auth-Email': email, 'X-Auth-Key': api_key,
'C... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/local/bin/ruby
# This program is contributed by Shin Nishiyama
# modified by K.Sasada
NP = 5
ROW = 8 + NP
COL = 8
$p = []
$b = []
$no = 0
def piece(n, a, nb)
nb.each{|x|
a[n] = x
if n == NP-1
$p << [a.sort]
else
nbc=nb.dup
[-ROW, -1, 1, ROW].each{|d|
if x+d > 0 and not... | ruby | github | https://github.com/ruby/ruby | benchmark/app_pentomino.rb |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import cint
from frappe.utils.jinja import validate_template
from frapp... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package command
import (
"bytes"
"crypto/x509"
"encoding/json"
"fmt"
"strconv"
"strings"
"github.com/ghodss/yaml"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/command/healthcheck"
"github.com/ryanuber/columnize"
)
type ... | go | github | https://github.com/hashicorp/vault | command/pki_verify_sign.go |
#
# Author: Pearu Peterson, March 2002
#
# additions by Travis Oliphant, March 2002
# additions by Eric Jones, June 2002
# additions by Johannes Loehnert, June 2006
# additions by Bart Vandereycken, June 2006
# additions by Andrew D Straw, May 2007
# additions by Tiziano Zito, November 2008
#
# April 2010: Functio... | unknown | codeparrot/codeparrot-clean | ||
import json
from .utils import identity, compose, true
class Storage(object):
r"""
>>> import tempfile
>>> import operator
>>> tablename = tempfile.NamedTemporaryFile(delete=False).name
>>> storage = Storage()
>>> data = {1: 'foo'}
>>> storage._to_fmt(None)(data)
{1: 'foo'}
>>> sto... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
// @validateMemoizedEffectDependencies
function Component(props) {
// Items cannot be memoized bc its mutation spans a hook call
const items = [props.value];
const [state, _setState] = useState(null);
mutate(items);
// Items is no longer mutable here, but it hasn't been memoized
use... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-useEffect-dep-not-memoized-bc-range-overlaps-hook.expect.md |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# 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 appl... | python | github | https://github.com/huggingface/transformers | src/transformers/models/fastspeech2_conformer/convert_model_with_hifigan.py |
__all__ = [
"assert_nodes_equal",
"assert_edges_equal",
"assert_graphs_equal",
"almost_equal",
]
def almost_equal(x, y, places=7):
return round(abs(x - y), places) == 0
def assert_nodes_equal(nodes1, nodes2):
# Assumes iterables of nodes, or (node,datadict) tuples
nlist1 = list(nodes1)
... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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 applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/core/common_runtime/permuter.h |
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/details/log_msg.h>
#include <spdlog/formatter.h>
namespace spdlog {
namespace sinks {
class SPDLOG_API sink {
public:
virtual ~sink() = default... | c | github | https://github.com/nodejs/node | deps/LIEF/third-party/spdlog/include/spdlog/sinks/sink.h |
/*-------------------------------------------------------------------------
*
* jsonbsubs.c
* Subscripting support functions for jsonb.
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* sr... | c | github | https://github.com/postgres/postgres | src/backend/utils/adt/jsonbsubs.c |
import datetime
from parsley import makeGrammar as make_grammar, _GrammarWrapper
__version__ = "0.1.0"
class Duplicated(Exception):
"""
A key group was duplicated, or contained a duplicate value.
"""
@classmethod
def in_group(cls, key, key_group=None):
group_str = "the document" if key_... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""Module providing JSON storage for static asset assignanvts"""
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
from zope.component import adapter
from zope.interface import implementer
from zop... | unknown | codeparrot/codeparrot-clean | ||
# flake8: noqa
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
class Migration(DataMigration):
depends_on = (
('cms', '0058_placeholderre... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
from celery import shared_task
from django.core import management
from leonardo.decorators import catch_result
from django.apps import apps
from django.utils import six
from .models import Package
CounterWidget = apps.get_model('web', 'CounterWidget')
def _get_counters(name):
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.model
import frappe.utils
import json, os
from six import iteritems
'''
Handle RESTful requests that are mapped to the `/api/res... | unknown | codeparrot/codeparrot-clean | ||
""" Test Iterator Length Transparency
Some functions or methods which accept general iterable arguments have
optional, more efficient code paths if they know how many items to expect.
For instance, map(func, iterable), will pre-allocate the exact amount of
space required whenever the iterable can report its length.
T... | unknown | codeparrot/codeparrot-clean | ||
/**
* 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
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | java | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java |
//! Manages the low-level pushing and popping of stack frames and the (de)allocation of local variables.
//! For handling of argument passing and return values, see the `call` module.
use std::cell::Cell;
use std::{fmt, mem};
use either::{Either, Left, Right};
use rustc_hir as hir;
use rustc_hir::definitions::DefPathD... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_const_eval/src/interpret/stack.rs |
# util/queue.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""An adaptation of Py2.3/2.4's Queue module which supports reentrant
behavior, using ... | unknown | codeparrot/codeparrot-clean | ||
<!---
Copyright 2023 The HuggingFace Team. All rights reserved.
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 applicable law or ... | unknown | github | https://github.com/huggingface/transformers | docs/source/ja/installation.md |
// Copyright 2018 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package sql
import (
"context"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/sql/hints"
"github.com/cockroachdb/cockroach/pkg/sql... | go | github | https://github.com/cockroachdb/cockroach | pkg/sql/conn_executor_prepare.go |
""" codecs -- Python Codec Registry, API and helpers.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import __builtin__, sys
### Registry and builtin stateless codec functions
try:
from _codecs import *
except ImportError, why:
raise SystemErro... | unknown | codeparrot/codeparrot-clean | ||
"""Package with general repository related functions"""
import os
from string import digits
from gitdb.exc import (
BadObject,
BadName
)
from git.refs import SymbolicReference
from git.objects import Object
from gitdb.util import (
join,
isdir,
isfile,
dirname,
hex_to_bin,
bin_to_hex
)
... | unknown | codeparrot/codeparrot-clean | ||
prelude: |
obj1 = Object.new
obj2 = Object.new
benchmark:
vm_neq: |
obj1 != obj2
loop_count: 30000000 | unknown | github | https://github.com/ruby/ruby | benchmark/vm_neq.yml |
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_USE_DEFAULT_HPP
#define BOOST_CORE_USE_DEFAULT_HPP
namespace boost {
struct use_default { };
} /* boost */
#endif | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/core/use_default.hpp |
from __future__ import unicode_literals
import fnmatch
import glob
import io
import os
import re
import sys
from functools import total_ordering
from itertools import dropwhile
import django
from django.conf import settings
from django.core.files.temp import NamedTemporaryFile
from django.core.management.base import ... | unknown | codeparrot/codeparrot-clean | ||
/*
* 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 regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | java | github | https://github.com/apache/kafka | clients/src/main/java/org/apache/kafka/common/requests/ShareFetchResponse.java |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 b... | unknown | codeparrot/codeparrot-clean | ||
from django.test import TestCase
import datetime
from decimal import *
from transactions.models import Portfolio, Transaction
from securities.models import Security, Price, SecuritySplit
from django.utils import timezone
# Create your tests here.
class TransactionTests(TestCase):
def setUp(self):
pass
... | unknown | codeparrot/codeparrot-clean | ||
"""Simple registration request and response parsing and object representation
This module contains objects representing simple registration requests
and responses that can be used with both OpenID relying parties and
OpenID providers.
1. The relying party creates a request object and adds it to the
C{L{AuthReq... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2017 The Kubernetes Authors.
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 applicable law or agreed to in writing, ... | go | github | https://github.com/kubernetes/kubernetes | cmd/kubeadm/app/phases/upgrade/staticpods_test.go |
# Added Fortran compiler support to config. Currently useful only for
# try_compile call. try_run works but is untested for most of Fortran
# compilers (they must define linker_exe first).
# Pearu Peterson
import os
import signal
import subprocess
import sys
import textwrap
import warnings
from distutils.command.confi... | unknown | codeparrot/codeparrot-clean | ||
// run
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This test makes sure that ambiguously live arguments work correctly.
package main
import (
"runtime"
)
type HeapObj [8]int64
type StkObj struct ... | go | github | https://github.com/golang/go | test/stackobj3.go |
// ignore-tidy-filelength
use std::iter;
use std::ops::ControlFlow;
use either::Either;
use hir::{ClosureKind, Path};
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::codes::*;
use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs |
#!/usr/bin/env python
import base
import re
import sys
import requests
from termcolor import colored
# Control whether the module is enabled or not
ENABLED = True
class style:
BOLD = '\033[1m'
END = '\033[0m'
def banner():
print colored(style.BOLD + '\n---> Searching Scribd Docs\n' + style.END, 'blue')
... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
import json, re, shutil, errno, os
import slyd.errors
from os.path import join, splitext
from twisted.web.resource import NoResource, ForbiddenResource
from jsonschema.exceptions import ValidationError
from .resource import SlydJsonResource
from .html import html4annotation
from... | unknown | codeparrot/codeparrot-clean | ||
import pytest
import cattle
import subprocess
import sys
import os
import re
# import yaml
def _base():
return os.path.dirname(__file__)
def _file(f):
return os.path.join(_base(), '../../{}'.format(f))
class CatalogService(object):
def __init__(self, catalog_bin):
self.catalog_bin = catalog_bin
... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from numpy.testing import TestCase, assert_array_equal, run_module_suite
from scipy.weave import size_check
from scipy.weave.ast_tools import harvest_variables
empty = np.array(())
class TestMakeSameLength(TestCase):
def generic_check(self,x,y,desired):
actual = size_check.make_same_l... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.MultiHoster import MultiHoster
from module.plugins.internal.misc import json
class RPNetBiz(MultiHoster):
__name__ = "RPNetBiz"
__type__ = "hoster"
__version__ = "0.20"
__status__ = "testing"
__pattern__ = r'https?://.+rpnet\.... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* pg_stat_statements.c
* Track statement planning and execution times as well as resource
* usage across a whole database cluster.
*
* Execution costs are totaled for each distinct source query, and kept in
* a shared hashtable. (We... | c | github | https://github.com/postgres/postgres | contrib/pg_stat_statements/pg_stat_statements.c |
#!/usr/bin/python2.4
# Copyright 2009 Google Inc. All Rights Reserved.
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
// SPDX-License-Identifier: GPL-2.0
/*
* lib/minmax.c: windowed min/max tracker
*
* Kathleen Nichols' algorithm for tracking the minimum (or maximum)
* value of a data stream over some fixed time interval. (E.g.,
* the minimum RTT over the past five minutes.) It uses constant
* space and constant time per update... | c | github | https://github.com/torvalds/linux | lib/win_minmax.c |
__author__ = "Mathusuthan N Kannan"
__email__ = "mathkann@gmail.com"
__copyright__ = "Copyright 2015, Mathusuthan N Kannan"
__license__ = "The MIT License (MIT)"
# Python's syntax makes it all too easy to write single-line expressions that are overly complicated and
# difficult to read.Move complex expressions into he... | unknown | codeparrot/codeparrot-clean | ||
---
MainSourceFile: identical_in_TU.cpp
Diagnostics:
- DiagnosticName: test-identical-insertion
DiagnosticMessage:
Message: Fix
FilePath: $(path)/identical_in_TU.cpp
FileOffset: 12
Replacements:
- FilePath: $(path)/identical_in_TU.cpp
Offset: 12
... | unknown | github | https://github.com/llvm/llvm-project | clang-tools-extra/test/clang-apply-replacements/Inputs/identical-in-TU/file1.yaml |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.