code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# Copyright 2007 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 by applicable law or ag... | unknown | codeparrot/codeparrot-clean | ||
#
# (c) 2016 Red Hat Inc.
#
# (c) 2017 Dell EMC.
#
# 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 License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | unknown | codeparrot/codeparrot-clean | ||
"""
Tests for Django's bundled context processors.
"""
from django.test import TestCase, override_settings
@override_settings(
ROOT_URLCONF='context_processors.urls',
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'OPTIONS': {
'c... | 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 us... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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.... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2023 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.
package slices_test
import (
"cmp"
"fmt"
"slices"
"strconv"
"strings"
)
func ExampleBinarySearch() {
names := []string{"Alice", "Bob", "Vera"}
n, found... | go | github | https://github.com/golang/go | src/slices/example_test.go |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Scriptharness exceptions.
These exceptions are written with several things in mind:
#. the exceptions should be unicode-capable in python 2.7 (py3 gets that
for free),
#. the exceptions should differentiate between user-facing exceptions and
developer-facing ... | unknown | codeparrot/codeparrot-clean | ||
use rustc_ast::attr::AttributeExt;
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_data_structures::unord::UnordSet;
use rustc_errors::{Diag, LintDiagnostic, MultiSpan, inline_fluent};
use rustc_feature::{Features, GateIssue};
use rustc_hir::HirId;
use rustc_hir::intravis... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_lint/src/levels.rs |
"""
=====================================================================
Reconstruction of the diffusion signal with the kurtosis tensor model
=====================================================================
The diffusion kurtosis model is an expansion of the diffusion tensor model
(see :ref:`example_reconst_dti... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2026 The LG AI Research and 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
#
# Unles... | python | github | https://github.com/huggingface/transformers | src/transformers/models/exaone_moe/__init__.py |
<!---
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/filesystem/fsdataoutputstreambuilder.md |
/*
* 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/errors/NotCoordinatorException.java |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2016 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/batch/v1/defaults.go |
#
# SimpleXMLWriter
#
# a simple XML writer
#
# history:
# 2001-12-28 fl created
# 2002-11-25 fl fixed attribute encoding
# 2002-12-02 fl minor fixes for 1.5.2
#
# Copyright (c) 2001-2003 by Fredrik Lundh
#
# fredrik@pythonware.com
# http://www.pythonware.com
#
# --------------------------------------------------... | unknown | codeparrot/codeparrot-clean | ||
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
// Digital Ltd. LLC
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the fol... | c | github | https://github.com/opencv/opencv | 3rdparty/openexr/IlmImf/ImfTiledRgbaFile.h |
//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts] ////
//// [ES5For-of8.ts]
function foo() {
return { x: 0 };
}
for (foo().x of ['a', 'b', 'c']) {
var p = foo().x;
}
//// [ES5For-of8.js]
"use strict";
function foo() {
return { x: 0 };
}
for (foo().x of ['a', 'b', 'c']) {
var p =... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/ES5For-of8(target=es2015).js |
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import unittest
import os
from bitcoin.core import COutPoint, CTxIn, CTxOut, CTra... | unknown | codeparrot/codeparrot-clean | ||
// SPDX-License-Identifier: GPL-2.0-only
/*
* mm/kmemleak.c
*
* Copyright (C) 2008 ARM Limited
* Written by Catalin Marinas <catalin.marinas@arm.com>
*
* For more information on the algorithm and kmemleak usage, please see
* Documentation/dev-tools/kmemleak.rst.
*
* Notes on locking
* ----------------
*
* T... | c | github | https://github.com/torvalds/linux | mm/kmemleak.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 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/filesystem/outputstream.md |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
# -----------------------------------------------------------------------------
# yacc_literal.py
#
# Grammar with bad literal characters
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex imp... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
from django.core import serializers
from django.db import connection
from django.test import TestCase
from .models import Child, FKDataNaturalKey, NaturalKeyAnchor
from .tests import register_tests
class NaturalKeySerializerTests(TestCase):
pass
def natural_key_serializer... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
// We should codegen nested optional properties correctly
// (i.e. placing `?` in the correct PropertyLoad)
function Component(props) {
let x = foo(props.a?.b.c.d);
return x;
}
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime"; // We should codegen nested optional... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md |
"""Test configdialog, coverage 94%.
Half the class creates dialog, half works with user customizations.
"""
from idlelib import configdialog
from test.support import requires
requires('gui')
import unittest
from unittest import mock
from idlelib.idle_test.mock_idle import Func
from tkinter import (Tk, StringVar, IntVa... | python | github | https://github.com/python/cpython | Lib/idlelib/idle_test/test_configdialog.py |
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 70205)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error'... | php | github | https://github.com/composer/composer | tests/Composer/Test/Fixtures/functional/installed-versions2/vendor/composer/platform_check.php |
// Copyright 2016 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.
//go:build unix
package runtime_test
import (
"runtime"
"testing"
"unsafe"
)
// Test that the error value returned by mmap is positive, as that is
// what... | go | github | https://github.com/golang/go | src/runtime/runtime_mmap_test.go |
# frozen_string_literal: true
require "active_support/core_ext/string/filters"
module ActiveRecord
module ConnectionAdapters
extend ActiveSupport::Autoload
@adapters = {}
class << self
# Registers a custom database adapter.
#
# Can also be used to define aliases.
#
# == E... | ruby | github | https://github.com/rails/rails | activerecord/lib/active_record/connection_adapters.rb |
# encoding: utf-8
from __future__ import unicode_literals
import os
import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
compat_urllib_error,
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
compat_xml_parse_error,
ExtractorError,
H... | unknown | codeparrot/codeparrot-clean | ||
# Copyright Bruno da Silva de Oliveira 2003. Use, modification and
# distribution is subject to 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)
import exporters
from Exporter import Exporter
from declarations import *
from settings im... | unknown | codeparrot/codeparrot-clean | ||
"""
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2002-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-framework | spring-beans/src/main/java/org/springframework/beans/factory/support/LookupOverride.java |
# formatting.py
# Sphinx extension providing formatting for Gallium-specific data
# (c) Corbin Simpson 2010
# Public domain to the extent permitted; contact author for special licensing
import docutils.nodes
import sphinx.addnodes
def parse_envvar(env, sig, signode):
envvar, t, default = sig.split(" ", 2)
env... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | unknown | codeparrot/codeparrot-clean | ||
{
"allRuns": "すべての実行",
"blockingDeps": {
"dependency": "依存関係",
"reason": "理由",
"title": "スケジュール済タスクをブロック中の依存関係"
},
"calendar": {
"daily": "日単位",
"hourly": "時間単位",
"legend": {
"less": "Less",
"mixed": "Mixed",
"more": "More"
},
"navigation": {
"nextMonth": ... | json | github | https://github.com/apache/airflow | airflow-core/src/airflow/ui/public/i18n/locales/ja/dag.json |
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2019 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 applica... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# This File is Slightly based on wicd daemon implementation
# Copyright (C) 2007 - 2008 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly
# Copyright (C) 2007 - 2008 Byron Hillis
#
# Filezaar Daemon:
# Copyright (C) 2009 Juan Manuel Schillaci
#
# This program is free software;... | unknown | codeparrot/codeparrot-clean | ||
#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn remove_dir_all() {
let temp_dir = tempdir().unwrap();
let test_dir = temp_dir.path().join("test");
fs::create_dir(&te... | rust | github | https://github.com/tokio-rs/tokio | tokio/tests/fs_remove_dir_all.rs |
#DEFINE_TYPE_CODE#py
#sDEFINE_TYPE_CODE#py
# -*- coding: utf-8 -*-
import platform
import os
def main():
if int(platform.python_version_tuple()[0]) < 3:
fullPathFile = raw_input("File's path :")
else:
fullPathFile = input("File's path :")
pathFileNoExt = fullPathFile.split('.')[0]
nameFileNoExt = pathFileNoExt... | unknown | codeparrot/codeparrot-clean | ||
import Mocha from "mocha";
import {
createRunner,
globalTimeout,
RunnerBase,
runUnitTests,
} from "../_namespaces/Harness.js";
import {
ErrorInfo,
ParallelClientMessage,
ParallelHostMessage,
RunnerTask,
shimNoopTestInterface,
Task,
TaskResult,
TestInfo,
UnitTestTask,
... | typescript | github | https://github.com/microsoft/TypeScript | src/testRunner/parallel/worker.ts |
import functools
import gzip
import os
import re
from difflib import SequenceMatcher
from django.conf import settings
from django.core.exceptions import (
FieldDoesNotExist, ImproperlyConfigured, ValidationError,
)
from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ....unittest import TestCase
import mock
from oauthlib import common
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.grant_types import ImplicitGrant
from oauthlib.oauth2.rfc6749.tokens import BearerToken
class Impl... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
import numpy as np
from tensorflow.contrib.learn.python.learn.datasets import base
from tensorflow.contrib.learn.python.learn.datasets.mnist import \
extract_images, extract_labels
from tensorflow.python.framework import dtypes
from .dataset import DataSet
def process_mnist... | unknown | codeparrot/codeparrot-clean | ||
use std::fmt;
use std::hash::Hash;
use std::ops::Index;
use arrayvec::ArrayVec;
use either::Either;
use crate::fx::FxHashMap;
/// For pointer-sized arguments arrays
/// are faster than set/map for up to 64
/// arguments.
///
/// On the other hand such a big array
/// hurts cache performance, makes passing
/// sso st... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_data_structures/src/sso/map.rs |
use crate::runtime::scheduler;
#[track_caller]
pub(crate) fn block_in_place<F, R>(f: F) -> R
where
F: FnOnce() -> R,
{
scheduler::multi_thread::block_in_place(f)
} | rust | github | https://github.com/tokio-rs/tokio | tokio/src/runtime/scheduler/block_in_place.rs |
#ifndef BOOST_ARCHIVE_DINKUMWARE_HPP
#define BOOST_ARCHIVE_DINKUMWARE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// dinkumware.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/archive/dinkumware.hpp |
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.base.creation import BaseDatabaseCreation
from django.utils.six.moves import input
class DatabaseCreation(BaseDatabaseCreation):
def _get_test_db_name(self):
test_database_name = self.connection.settings_... | unknown | codeparrot/codeparrot-clean | ||
'use server'
/** @type {[any]} */
const [foo] = [null]
export default foo | javascript | github | https://github.com/vercel/next.js | crates/next-custom-transforms/tests/fixture/server-actions/server-graph/20/input.js |
"""
oyPivotSwitcher.py by Erkan Ozgur Yilmaz (c) 2009
v10.5.17
Description :
-------------
A tool for easy animating of switching of pivots
Version History :
-----------------
v10.5.17
- modifications for Maya 2011 and PyMel 1.0.2
v9.12.25
- removed oyAxialCorrectionGroup script import
- moved to new versioning sch... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2012 IBM Corp.
#
# 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 agree... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright 2013, Google Inc. 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 simulates the first time a database has to be split:
# - we start with a keyspace with a single shard and a single table
# - we ad... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 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 applica... | unknown | codeparrot/codeparrot-clean | ||
"""
DataSource is a wrapper for the OGR Data Source object, which provides
an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, a SHP file or a
TIGER/Line... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/classes/classExpressions/classExpressionLoop.ts] ////
//// [classExpressionLoop.ts]
let arr = [];
for (let i = 0; i < 10; ++i) {
arr.push(class C {
prop = i;
});
}
//// [classExpressionLoop.js]
"use strict";
let arr = [];
for (let i = 0; i < 10; ++i) {
arr.push(class ... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/classExpressionLoop.js |
#!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | unknown | codeparrot/codeparrot-clean | ||
"""
Test the catalysis forward model.
Author:
Panagiotis Tsilifis
Date:
5/22/2014
"""
import numpy as np
from matplotlib.pyplot import *
import sys
sys.path.insert(0,'./demos/')
from catalysis import CatalysisModel
from catalysis import CatalysisModelDMNLESS
from catalysis import CatalysisFullModelDMNLESS
... | unknown | codeparrot/codeparrot-clean | ||
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/common.h>
#include <spdlog/details/console_globals.h>
#include <spdlog/details/null_mutex.h>
#include <spdlog/sinks/sink.h>
#include <array>
#includ... | c | github | https://github.com/nodejs/node | deps/LIEF/third-party/spdlog/include/spdlog/sinks/wincolor_sink.h |
"""
Wraps various asyncio functions
"""
import asyncio
import sys
from functools import partial
from cloudbot.util.func_utils import call_with_args
def wrap_future(fut, *, loop=None):
"""
Wraps asyncio.ensure_future()
:param fut: The awaitable, future, or coroutine to wrap
:param loop: The loop to ru... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) 2011 The Guava 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 agre... | java | github | https://github.com/google/guava | android/guava-tests/test/com/google/common/collect/MapMakerTest.java |
package schemaversion
import (
"context"
"testing"
)
func TestV23TemplateVariableMigration(t *testing.T) {
tests := []struct {
name string
input map[string]interface{}
expected map[string]interface{}
description string
}{
{
name: "align_text_with_multi_for_multi_variables",
input: ... | go | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/schemaversion/v23_test.go |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# process stdin into an M4 macro definition file
# recognize three keyword qgl qwgl qglX
#
# output
# global macros keep track of the three intervals for function types:
# gl_start gl_end wgl_start wgl_end glX_start glX_end
# NOTE: will we need similar thing for extensions?
#
# each function:
# f<... | unknown | codeparrot/codeparrot-clean | ||
"""
Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C.
Here, a circular array means the end of the array connects to the beginning of the array. (Formally, C[i] = A[i] when 0 <= i < A.length, and C[i+A.length] = C[i] when i >= 0.)
Also, a subarray may on... | unknown | codeparrot/codeparrot-clean | ||
from collections.abc import Iterable
from typing import Any
from typing_extensions import override
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings, FakeEmbeddings
from langchain_core.example_selectors import (
MaxMarginalRelevanceExampleSelector,
SemanticSimilari... | python | github | https://github.com/langchain-ai/langchain | libs/core/tests/unit_tests/example_selectors/test_similarity.py |
/*
* Copyright (C) 2008 The Guava 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 agre... | java | github | https://github.com/google/guava | android/guava-tests/test/com/google/common/collect/SingletonImmutableMapMapInterfaceTest.java |
'''
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
https://projecteuler.net/problem=5
'''
max = 20 + 1
numbersOriginal = list(range(1, max))
numbers = list()
... | unknown | codeparrot/codeparrot-clean | ||
# Implement 'jpeg' interface using SGI's compression library
# XXX Options 'smooth' and 'optimize' are ignored.
# XXX It appears that compressing grayscale images doesn't work right;
# XXX the resulting file causes weirdness.
from warnings import warnpy3k
warnpy3k("the jpeg module has been removed in Python 3.0", sta... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtai... | unknown | codeparrot/codeparrot-clean | ||
packages:
- 'crates/binding'
- '.' | unknown | github | https://github.com/vercel/next.js | rspack/pnpm-workspace.yaml |
#
# 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... | python | github | https://github.com/apache/airflow | airflow-core/tests/unit/models/test_dag.py |
//===--- FeatureModulesTests.cpp -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | cpp | github | https://github.com/llvm/llvm-project | clang-tools-extra/clangd/unittests/FeatureModulesTests.cpp |
#!/usr/bin/env bash
set -eux
ansible-playbook play.yml -i ../../inventory -v "$@" | unknown | github | https://github.com/ansible/ansible | test/integration/targets/path_lookups/runme.sh |
import numpy as np
from pandas.core.dtypes.cast import dict_compat
from pandas import Timestamp
def test_dict_compat():
data_datetime64 = {np.datetime64("1990-03-15"): 1, np.datetime64("2015-03-15"): 2}
data_unchanged = {1: 2, 3: 4, 5: 6}
expected = {Timestamp("1990-3-15"): 1, Timestamp("2015-03-15"): 2}... | python | github | https://github.com/pandas-dev/pandas | pandas/tests/dtypes/cast/test_dict_compat.py |
"""
Some pipelines used for testing
"""
class ZeroDivisionErrorPipeline:
def open_spider(self):
1 / 0
def process_item(self, item):
return item
class ProcessWithZeroDivisionErrorPipeline:
def process_item(self, item):
1 / 0 | python | github | https://github.com/scrapy/scrapy | tests/pipelines.py |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see winpython/__init__.py for details)
"""
Register a Python distribution
Created on Tue Aug 21 21:46:30 2012
"""
from __future__ import print_function
import sys
import os
import os.path as osp
import subpr... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from datetime import datetime
import pytest
from cfme import test_requirements
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.services.myservice.ui import MyServiceDetailView
from cfme.utils import brow... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
#
# Author: Joël Grand-Guillaume
# Copyright 2010 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Lic... | unknown | codeparrot/codeparrot-clean | ||
from datetime import datetime
from django.test import SimpleTestCase, override_settings
FULL_RESPONSE = "Test conditional get response"
LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47)
LAST_MODIFIED_STR = "Sun, 21 Oct 2007 23:21:47 GMT"
LAST_MODIFIED_NEWER_STR = "Mon, 18 Oct 2010 16:56:23 GMT"
LAST_MODIFIED_INVALID... | python | github | https://github.com/django/django | tests/conditional_processing/tests.py |
import gc
from django.db.models.base import ModelState, ModelStateFieldsCacheDescriptor
from django.test import SimpleTestCase
from django.test.utils import garbage_collect
from .models import Worker, WorkerProfile
class ModelStateTests(SimpleTestCase):
def test_fields_cache_descriptor(self):
self.assert... | python | github | https://github.com/django/django | tests/model_regress/test_state.py |
# Amara, universalsubtitles.org
#
# Copyright (C) 2014 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | unknown | codeparrot/codeparrot-clean | ||
import gc
from typing import Type
import numpy as np
import pytest
from pandas._libs import iNaT
from pandas.errors import InvalidIndexError
from pandas.core.dtypes.common import is_datetime64tz_dtype
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
CategoricalInde... | unknown | codeparrot/codeparrot-clean | ||
import time
import logging
import threading
from cloudbrain.modules.interface import ModuleInterface
_NANOSECONDS = 1000000
_LOGGER = logging.getLogger(__name__)
"""
Publish constant values at regular intervals on each channel.
Note that this module could be easily turned into a transformer that turns
bpm in beats b... | 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... | python | github | https://github.com/apache/airflow | airflow-core/tests/unit/jobs/test_scheduler_job.py |
'use client'
import { RefreshCw, AlertTriangle } from 'lucide-react'
import { NetworkError } from '@/lib/errors'
interface ErrorStateProps {
error: unknown
onRetry?: () => void
}
export function ErrorState({ error }: ErrorStateProps) {
const isNetwork = error instanceof NetworkError
const title = isNetwork ?... | typescript | github | https://github.com/vercel/next.js | apps/bundle-analyzer/components/error-state.tsx |
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing_extensions import Literal
from ....._models import BaseModel
from .run_step_delta import RunStepDelta
__all__ = ["RunStepDeltaEvent"]
class RunStepDeltaEvent(BaseModel):
"""Represents a run step delta i.e.
any... | python | github | https://github.com/openai/openai-python | src/openai/types/beta/threads/runs/run_step_delta_event.py |
# Copyright 2016 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 applica... | 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/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# nova documentation build configuration file, created by
# sphinx-quickstart on Sat May 1 15:17:47 2010.
#
# 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.
#
# All ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A clone of the default copy.deepcopy that doesn't handle cyclic
structures or complex types except for dicts and lists. This is
because gyp copies so large structur... | unknown | codeparrot/codeparrot-clean | ||
/*
* 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/src/main/java/org/springframework/boot/availability/ApplicationAvailabilityBean.java |
"""
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2024 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 applica... | python | github | https://github.com/tensorflow/tensorflow | tensorflow/compiler/mlir/quantization/common/python/testing.py |
# CONSTANTS
__author__ = 'Automicus'
__version__ = '1.0.1'
__url__ = 'http://automic.us'
__date__ = '2/2014'
# imports
import sys
import xbmc
import xbmcaddon
import xbmcgui
# fetch addon information
isy_events = xbmcaddon.Addon('service.script.isyevents')
isy_browse = xbmcaddon.Addon('plugin.program.isybrowse')
# a... | unknown | codeparrot/codeparrot-clean | ||
"""
desispec.cosmics
================
Utility functions to find cosmic rays
"""
from desispec.log import get_logger
import numpy as np
import math
import copy
from desispec.maskbits import ccdmask
def reject_cosmic_rays_ala_sdss_single(img,selection,nsig,cfudge,c2fudge) :
"""Cosmic ray rejection following the im... | unknown | codeparrot/codeparrot-clean | ||
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, RouteTable
class TestDescribeRouteTables(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return """
<DescribeRouteTablesResponse xmlns="http... | unknown | codeparrot/codeparrot-clean | ||
"""
Test the interaction with the learning_sequences app, where course outlines are
stored.
"""
from datetime import datetime, timezone
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.content.learning_sequences.api import get_course_outline
from openedx.core.djangoapps.content.learning_sequenc... | unknown | codeparrot/codeparrot-clean | ||
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.