code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
"""settings that allow changing of the license
clause used in askbot instances"""
from askbot import const
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from askbot.deps import livesettings
from askbot.skins import utils as skin_utils
from django.utils.translation... | unknown | codeparrot/codeparrot-clean | ||
'use server'
async function fn() {
'use cache'
return 'foo'
}
async function Component() {
const data = await fn()
return <div>{data}</div>
} | javascript | github | https://github.com/vercel/next.js | crates/next-custom-transforms/tests/fixture/server-actions/server-graph/37/input.js |
package kotlinx.coroutines.flow
import kotlinx.coroutines.testing.*
import kotlinx.coroutines.*
import kotlin.test.*
class OnEmptyTest : TestBase() {
@Test
fun testOnEmptyInvoked() = runTest {
val flow = emptyFlow<Int>().onEmpty { emit(1) }
assertEquals(1, flow.single())
}
@Test
... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | kotlinx-coroutines-core/common/test/flow/operators/OnEmptyTest.kt |
import sys
import random
MAX_R = 1000
MAX_D = 25
MAX_K = 20
MAX_C = 2000
MAX_B = 100
case_no = 1
def next_file(suffix=None, desc=None):
global case_no
basename = '%02d' % case_no if suffix is None else '%02d-%s' % (case_no, suffix)
f = open(basename + '.in', 'w')
if desc is not None:
with ope... | unknown | codeparrot/codeparrot-clean | ||
#encoding: UTF-8
'''
Created on Nov 24, 2015
@author: coffeemakr
'''
import unittest
import re
import itertools
import random
import string
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0], "..")))
from uci.backend.originalreader import OriginalReader
class TestRegularExpressi... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""
Verifies simple actions when using an explicit build target of 'all'.
"""
import glob
import os
import TestGyp
test = TestGyp.TestGyp(... | unknown | codeparrot/codeparrot-clean | ||
---
"Test cat nodes output":
- do:
cat.nodes: {}
- match:
$body: |
/ #ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
^ ((\d{1,3}\.){3}\d{... | unknown | github | https://github.com/elastic/elasticsearch | distribution/docker/src/yamlRestTest/resources/rest-api-spec/test/11_nodes.yml |
#!/bin/python3
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
def insert(self,head,data):
p = Node(data)
if head==None:
head=p
elif head.next==None:
head.next=p
else:
... | unknown | codeparrot/codeparrot-clean | ||
"""
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | unknown | codeparrot/codeparrot-clean | ||
import functools
from importlib import util
from typing import Any
from langchain_core.embeddings import Embeddings
from langchain_core.runnables import Runnable
_SUPPORTED_PROVIDERS = {
"azure_openai": "langchain_openai",
"bedrock": "langchain_aws",
"cohere": "langchain_cohere",
"google_genai": "lang... | python | github | https://github.com/langchain-ai/langchain | libs/langchain/langchain_classic/embeddings/base.py |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: David BEAL, Copyright 2014 Akretion
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
---
title: svelte/attachments
tags: attachments
---
> MODULE: svelte/attachments | unknown | github | https://github.com/sveltejs/svelte | documentation/docs/98-reference/21-svelte-attachments.md |
/* 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 applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/core/platform/random.h |
import warnings
from mongoengine.common import _import_class
from mongoengine.errors import InvalidDocumentError
from mongoengine.python_support import PY3
from mongoengine.queryset import (DO_NOTHING, DoesNotExist,
MultipleObjectsReturned,
QuerySetMa... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package configs
import (
"testing"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hclsyntax"
)
func TestVariableInvalidDefault(t *testing.T) {
src := `
variable foo {
type = map(object({
foo = bool
}))
default = {
... | go | github | https://github.com/hashicorp/terraform | internal/configs/named_values_test.go |
# -*- coding: utf-8 -*-
import operator
import simplejson
import urllib2
import openerp
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.translate import _
from openerp.http import request
from datetime i... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* dshash.c
* Concurrent hash tables backed by dynamic shared memory areas.
*
* This is an open hashing hash table, with a linked list at each table
* entry. It supports dynamic resizing, as required to prevent the linked
* lists fro... | c | github | https://github.com/postgres/postgres | src/backend/lib/dshash.c |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
if sys.version_info < (2, ... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2020 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/controller/endpointslicemirroring/config/v1alpha1/doc.go |
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"target": {
... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/conversion/testdata/input/migrated_dev_dashboards/panel-histogram/v1beta1.histogram_tests.v42.json |
SELECT NOT(pg_numa_available()) AS skip_test \gset
\if :skip_test
\quit
\endif
-- We expect at least one entry for each buffer
select count(*) >= (select setting::bigint
from pg_settings
where name = 'shared_buffers')
from pg_buffercache_numa;
-- Check that the functions / view... | sql | github | https://github.com/postgres/postgres | contrib/pg_buffercache/sql/pg_buffercache_numa.sql |
// boost cxx11_char_types.hpp --------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//-------------------------------------------------------------------------------------... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/cxx11_char_types.hpp |
def binomial_coeffi(n, k):
if (k == 0 or k == n):
return 1
return (binomial_coeffi(n - 1, k - 1)
+ binomial_coeffi(n - 1, k))
def rencontres_number(n, m):
if (n == 0 and m == 0):
return 1
if (n == 1 and m == 0):
return 0
if (m == 0):
return ((n - 1) * (rencontres_number(n - 1, 0)+ rencontres_number(n - 2... | unknown | mbpp | ||
from __future__ import print_function
import gc
import os
import torch
import torch.optim as optim
from torch import nn
from model.model import TreeLSTMSentiment
from model.sentiment_trainer import SentimentTrainer
from data.embeddings import load_embedding_model
def choose_optimizer(args, model):
if args.opti... | unknown | codeparrot/codeparrot-clean | ||
"""
Outputs the object class tree read from LDAPv3 schema
of a given server
Usage: schema_oc_tree.py [--html] [LDAP URL]
"""
import sys,getopt,ldap,ldap.schema
ldap.trace_level = 1
def PrintSchemaTree(schema,se_class,se_tree,se_oid,level):
"""ASCII text output for console"""
se_obj = schema.get_obj(se_class,se_... | unknown | codeparrot/codeparrot-clean | ||
package imagebackend
import (
"io"
"net/http"
"github.com/moby/moby/api/types/container"
imagetypes "github.com/moby/moby/api/types/image"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/api/types/storage"
"github.com/moby/moby/v2/daemon/internal/filters"
ocispec "github.com/opencontainers/ima... | go | github | https://github.com/moby/moby | daemon/server/imagebackend/image.go |
# zerovec [](https://crates.io/crates/zerovec)
<!-- cargo-rdme start -->
Zero-copy vector abstractions for arbitrary types, backed by byte slices.
`zerovec` enables a far wider range of types — beyond just `&[u8]` and `&str` — to participate in
zero-copy deseriali... | unknown | github | https://github.com/nodejs/node | deps/crates/vendor/zerovec/README.md |
'''
Created on 4 aug. 2012
Copyright: Jev Kuznetsov
License: BSD
a module for downloading historic data from IB
'''
import ib
import pandas
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
from time import sleep
import tradingWithPython.lib.logger as logger
from pandas import DataFrame, I... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) 2013 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 | guava-tests/test/com/google/common/io/MoreFilesTest.java |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, # You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
from mach.decorators import (
CommandPro... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from telemetry.core import util
from catapult_base import util as catapult_util
# TODO(aiolos): Move these functions to catapult_base or here.
Ge... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env node
/**
* Analyze a CPU profile to identify hot modules
*/
const fs = require('fs')
const profilePath = process.argv[2]
if (!profilePath) {
console.error('Usage: node analyze-profile.js <profile.cpuprofile>')
process.exit(1)
}
const profile = JSON.parse(fs.readFileSync(profilePath, 'utf-8'))
/... | javascript | github | https://github.com/vercel/next.js | scripts/analyze-profile.js |
name: Index PyTorch Tests for Target Determination
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
id-token: write
contents: read
jobs:
get-label-type:
if: github.repository_owner == 'pytorch'
name: get-label-type
uses: pytorch/pytorch/.github/workflows/_runner-determinato... | unknown | github | https://github.com/pytorch/pytorch | .github/workflows/target-determination-indexer.yml |
#!/usr/bin/env python
#
# Copyright (C) 2009 Google 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... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
# This tool helps building swift explicit module from the JSON output of the scan-dependencies command. It will build all the module dependencies from JSON and construct a response file for the common arguments for main module build.
# Usage:
# /path/to/bin/dir/swift-build-modules.py /path/to/... | python | github | https://github.com/apple/swift | utils/swift-build-modules.py |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5, s, t 10.1, s, q"
tags = "RichLabel"
import summa
from summa.director import director
from summa.sprite import Sprite
from summa.actions ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import print_function
from numpy import pi, sin, cos, linspace, tan
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.layouts import gridplot
from bokeh.models.glyphs import Line
from bokeh.models import Plot, DataRange1d, LinearAxis, ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
pygments.lexers.graphics
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for computer graphics and plotting related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, words, i... | unknown | codeparrot/codeparrot-clean | ||
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/technologic,nand.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Technologic Systems NAND controller
maintainers:
- Nikita Shubin <nikita.shubin@maquefel.me>
allOf:
- $ref: nand-contro... | unknown | github | https://github.com/torvalds/linux | Documentation/devicetree/bindings/mtd/technologic,nand.yaml |
/* Copyright 2018 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/compiler/jit/partially_decluster_pass.h |
# Copyright 2010-2011, Sikuli.org
# Released under the MIT License.
from org.sikuli.script import Screen as JScreen
import inspect
import __main__
import sys
from Region import *
from java.awt import Rectangle
DEBUG=False
class Screen(Region):
def __init__(self, id=None):
if id != None:
r = JScreen... | unknown | codeparrot/codeparrot-clean | ||
package kotlinx.coroutines.reactive
import kotlinx.coroutines.InternalCoroutinesApi
import org.reactivestreams.Publisher
import kotlin.coroutines.CoroutineContext
/** @suppress */
@InternalCoroutinesApi
public interface ContextInjector {
/**
* Injects `ReactorContext` element from the given context into the ... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | reactive/kotlinx-coroutines-reactive/src/ContextInjector.kt |
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_THREAD_H_INCLUDED_
#define _NGX_THREAD_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
typedef HANDLE ngx_tid_t;
typedef DWORD ngx_thread_value_t;
ngx_err_t ngx_create_thread(ngx_tid_t *tid,
ngx_thread_value_t (__stdcall ... | c | github | https://github.com/nginx/nginx | src/os/win32/ngx_thread.h |
"""
Classes to represent the default SQL aggregate functions
"""
class AggregateField(object):
"""An internal field mockup used to identify aggregates in the
data-conversion parts of the database backend.
"""
def __init__(self, internal_type):
self.internal_type = internal_type
def get_inte... | unknown | codeparrot/codeparrot-clean | ||
// C Extension module to test pycore_lock.h API
#include "parts.h"
#include "pycore_lock.h"
#include "pycore_pythread.h" // PyThread_get_thread_ident_ex()
#include "clinic/test_lock.c.h"
#ifdef MS_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <unistd.h> // usleep()
#endif
/*[c... | c | github | https://github.com/python/cpython | Modules/_testinternalcapi/test_lock.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
# ... | unknown | codeparrot/codeparrot-clean | ||
from rest_framework import serializers
from expdj.apps.experiments.models import (Battery, CognitiveAtlasTask,
ExperimentTemplate)
class BatterySerializer(serializers.ModelSerializer):
owner = serializers.StringRelatedField()
contributors = serializers.StringRelatedF... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
from Crypto.Cipher import AES
from binascii import a2b_base64
def pkcs_7_pad(data, final_len = None):
if final_len == None:
final_len = (len(data)/16 + 1)*16
padding_len = final_len - len(data)
return data + chr(padding_len)*padding_len
def pkcs_7_unpad(data):
padding_len = ord(dat... | unknown | codeparrot/codeparrot-clean | ||
#
# Copyright (C) 2016
# The Board of Trustees of the Leland Stanford Junior University
# Written by Stephane Thiell <sthiell@stanford.edu>
#
# 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 a... | unknown | codeparrot/codeparrot-clean | ||
- Feature Name: Lazy Transaction Record Creation (a.k.a Deprecate BeginTransaction)
- Status: completed
- Start Date: 2018-12-09
- Authors: Nathan VanBenschoten
- RFC PR: #32971
- Cockroach Issue: #25437
# Summary
Remove transaction record creation from serving as the first step of every non-1PC transaction. Defer tr... | unknown | github | https://github.com/cockroachdb/cockroach | docs/RFCS/20181209_lazy_txn_record_creation.md |
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.network.tls
import io.ktor.network.sockets.*
import io.ktor.utils.io.*
import kotlin.coroutines.*
internal expect suspend fun openTLSSession(
socket: Socket,
input: B... | kotlin | github | https://github.com/ktorio/ktor | ktor-network/ktor-network-tls/common/src/io/ktor/network/tls/TLSClientSession.kt |
function Component() {
const renderItem = item => {
// Multiple returns so that the return type is a Phi (union)
if (item == null) {
return null;
}
// Normally we assume that it's safe to mutate globals in a function passed
// as a prop, because the prop could be used as an event handler or ... | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-global-in-render-helper-phi-return-prop.js |
#!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
from numpy.testing import *
from numpy.distutils.misc_util import appendpath, minrelpath, gpaths, rel_path
from os.path import join, sep, dirname
ajoin = lambda *paths: join(*((sep,)+paths))
class TestAppendpath(Test... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# ... | unknown | codeparrot/codeparrot-clean | ||
import parser
import unittest
import sys
import struct
from test import test_support as support
from test.script_helper import assert_python_failure
#
# First, we test that we can generate trees from valid source fragments,
# and that these valid trees are indeed allowed by the tree-loading side
# of the parser mod... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
require "cases/helper"
require "active_support/core_ext/hash/indifferent_access"
require "active_support/hash_with_indifferent_access"
class AttributeAssignmentTest < ActiveModel::TestCase
class Model
include ActiveModel::AttributeAssignment
attr_accessor :name, :description
... | ruby | github | https://github.com/rails/rails | activemodel/test/cases/attribute_assignment_test.rb |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\... | c | github | https://github.com/curl/curl | docs/examples/post-callback.c |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: 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',
'... | unknown | codeparrot/codeparrot-clean | ||
from sympy.core import (S, symbols, Eq, pi, Catalan, EulerGamma, Lambda,
Dummy, Function)
from sympy.core.compatibility import StringIO
from sympy import erf, Integral, Piecewise
from sympy import Equality
from sympy.matrices import Matrix, MatrixSymbol
from sympy.printing.codeprinter import Ass... | unknown | codeparrot/codeparrot-clean | ||
/*
* _codecs_kr.c: Codecs collection for Korean encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#include "cjkcodecs.h"
#include "mappings_kr.h"
/*
* EUC-KR codec
*/
#define EUCKR_JAMO_FIRSTBYTE 0xA4
#define EUCKR_JAMO_FILLER 0xD4
static const unsigned char u2cgk_choseong[19] = {
0x... | c | github | https://github.com/python/cpython | Modules/cjkcodecs/_codecs_kr.c |
# -*- coding: utf-8 -*-
#
# This file is part of Harvesting Kit.
# Copyright (C) 2015 CERN.
#
# Harvesting Kit 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 opt... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved.
# Copyright (C) 2009 Torch Mobile Inc.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without
# modi... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
import settestpath
# lots of useful util methods for building/tearing down
# test enviroments...
import testutils
from up2date_client import config
import unittest
test_up2date = "etc-sysconfig-rhn/up2date"
class TestConfig(unittest.TestCase):
def setUp(self):
# in this stuff, we get... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS (Oracle)
Date : Aug 27, 2014
copyright : (C) 2014 by Médéric RIBREUX
email : meder... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
/**
* Mockito plugins configuration machinery.
*/
package org.mockito.internal.configuration.plugins; | java | github | https://github.com/mockito/mockito | mockito-core/src/main/java/org/mockito/internal/configuration/plugins/package-info.java |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import unittest
from django.conf import settings
from django.core.checks import Error
from django.db import connections, models
from django.test.utils import override_settings
from .base import IsolatedModelsTestCase
def get_max_column_name_length():... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.server.routing
import io.ktor.http.*
/**
* A parsed routing path. Consist of number of segments [parts].
*
*
* [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.s... | kotlin | github | https://github.com/ktorio/ktor | ktor-server/ktor-server-core/common/src/io/ktor/server/routing/RoutingPath.kt |
# -*- coding: utf-8 -*-
import datetime
from dateutil.relativedelta import relativedelta
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
class TestMembershipCommon(AccountingTestCase):
def setUp(self):
super(TestMembershipCommon, self).setUp()
# Usefull models
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test spending coinbase transactions.
# The coinbase transaction in block N can appear in block
# N+100... ... | unknown | codeparrot/codeparrot-clean | ||
import decimal
import enum
import json
import unittest
import uuid
from django import forms
from django.contrib.admin.utils import display_for_field
from django.core import checks, exceptions, serializers, validators
from django.core.exceptions import FieldError
from django.core.management import call_command
from dja... | python | github | https://github.com/django/django | tests/postgres_tests/test_array.py |
/*
* 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/serialization/FloatDeserializer.java |
<!--Copyright 2021 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 agreed... | unknown | github | https://github.com/huggingface/transformers | docs/source/ko/model_doc/bartpho.md |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create a rendering window and renderer
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.StereoCapableWindowOn()
iren = vtk.vtkRenderWindowInte... | 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 | codeparrot/codeparrot-clean | ||
"""
AppShell provides a GUI application framework.
This is an adaption of AppShell.py found in Python and Tkinter Programming
by John E. Grayson which is a streamlined adaptation of GuiAppD.py, originally
created by Doug Hellmann (doughellmann@mindspring.com).
"""
__all__ = ['AppShell']
from direct.showbase.DirectObj... | unknown | codeparrot/codeparrot-clean | ||
"""
Configuration file for Atlas
All variable settings should go here so values can be propagated to the various
functions from a central location.
"""
import re
import os
from atlas.config_servers import (SERVERDEFS, VARNISH_CONTROL_TERMINALS, NFS_MOUNT_LOCATION,
BASE_URLS, API_URL... | unknown | codeparrot/codeparrot-clean | ||
"""Starts a service to scan in intervals for new devices."""
from datetime import timedelta
import json
import logging
from netdisco.discovery import NetworkDiscovery
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistant.const import EVENT_H... | unknown | codeparrot/codeparrot-clean | ||
from django.contrib.contenttypes.fields import ContentType
from django.test import TestCase
from nsync.models import ExternalSystem, ExternalKeyMapping
from tests.models import TestPerson
class TestExternalSystem(TestCase):
def test_it_uses_name_for_string(self):
self.assertEqual('SystemName', str(Externa... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.platform
import org.jetbrains.kotlin.analysis.api.KaPlatformInterfa... | kotlin | github | https://github.com/JetBrains/kotlin | analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/KotlinPlatformComponent.kt |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
def create_parser():
from wptrunner import wptcommandline
parser = wptcommandline.create_parser_update()
pa... | unknown | codeparrot/codeparrot-clean | ||
"""
Scrapy Item
See documentation in docs/topics/item.rst
"""
from __future__ import annotations
from abc import ABCMeta
from collections.abc import MutableMapping
from copy import deepcopy
from pprint import pformat
from typing import TYPE_CHECKING, Any, NoReturn
from scrapy.utils.trackref import object_ref
if TY... | python | github | https://github.com/scrapy/scrapy | scrapy/item.py |
/* Copyright 2017 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/lite/testing/tflite_diff_flags.h |
"""
>>> import numpy.core as nx
>>> import numpy.lib.ufunclike as U
Test fix:
>>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
>>> U.fix(a)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -1.]])
>>> y = nx.zeros(a.shape, float)
>>> U.fix(a, y)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -... | unknown | codeparrot/codeparrot-clean | ||
import unittest
import warnings
from pymongo.read_preferences import ReadPreference
from mongoengine import *
from tests.utils import MongoDBTestCase
class TestQuerysetAggregate(MongoDBTestCase):
def test_read_preference_aggregation_framework(self):
class Bar(Document):
txt = StringField()
... | unknown | codeparrot/codeparrot-clean | ||
"""
Serialization
``django.core.serializers`` provides interfaces to converting Django
``QuerySet`` objects to and from "flat" data (i.e. strings).
"""
from decimal import Decimal
from django.db import models
class CategoryMetaDataManager(models.Manager):
def get_by_natural_key(self, kind, name):
return... | unknown | codeparrot/codeparrot-clean | ||
import sys
from pdflib_py import *
from math import sin,cos
import Image
import ImageDraw
img = Image.new("L", (3, 3))
draw = ImageDraw.Draw(img)
draw.point((0,1), fill=255)
draw.point((0,2), fill=255)
draw.point((1,0), fill=255)
draw.point((1,2), fill=255)
draw.point((2,0), fill=255)
draw.point((2,1), fill=255)
img.s... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2017 The etcd 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 t... | go | github | https://github.com/etcd-io/etcd | server/proxy/grpcproxy/adapter/chan_stream.go |
import datetime
import logging
import logging.handlers
import os
import pymongo
import redis
from redis.sentinel import Sentinel
import server_exceptions
import general_exceptions
import signal
import stoneredis
import sys
import time
import traceback
import utils
import cipher_utils
import serializer_utils
import queu... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Copyright 2015 Red Hat 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/license... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
sphinx.writers.texinfo
~~~~~~~~~~~~~~~~~~~~~~
Custom docutils writer for Texinfo.
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import string
import textwrap
from os import path
from docutils imp... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package http
import (
"encoding/json"
"testing"
"github.com/hashicorp/vault/helper/hostutil"
"github.com/hashicorp/vault/vault"
)
func TestSysHostInfo(t *testing.T) {
cluster := vault.NewTestCluster(t, &vault.CoreConfig{}, &vault.TestCluste... | go | github | https://github.com/hashicorp/vault | http/sys_hostinfo_test.go |
# -*- coding:utf-8 -*-
import pymongo
import requests
import requesocks
from model import FailedUrl
from config import *
# 初始化mongodb客户端
def init_client():
client = pymongo.MongoClient(config['db_host'], config['db_port'])
if len(config['db_user']) != 0:
admin = client[config['db_name']]
admin.... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import datetime
import io
import os
import platform
import shutil
import socket
import subprocess
import unittest
from absl.testing import absltest
import mock
from grr_response_core.... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
#
# Generate the build trees and Makefiles for PyQwt.
import compileall
import glob
import optparse
import os
import pprint
import re
import shutil
import sys
import traceback
class Die(Exception):
def __init__(self, info):
Exception.__init__(self, info)
# __init__()
# class Die
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 may not... | python | github | https://github.com/apache/airflow | airflow-core/src/airflow/example_dags/example_task_group_decorator.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
# d... | unknown | codeparrot/codeparrot-clean | ||
name: Intl/Emoji data
on:
push:
paths:
- 'src/Symfony/Component/Emoji/*.php'
- 'src/Symfony/Component/Emoji/Resources/data/**'
- 'src/Symfony/Component/Emoji/Tests/*Test.php'
- 'src/Symfony/Component/Intl/*.php'
- 'src/Symfony/Component/Intl/Util/GitRepository.php'
- 'src/Symf... | unknown | github | https://github.com/symfony/symfony | .github/workflows/intl-data-tests.yml |
// Copyright The Prometheus 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 w... | go | github | https://github.com/prometheus/prometheus | web/api/v1/test_helpers.go |
# Kubernetes HACK Alert
This is a hack folder for kubernetes codegen scripts. Oddly, a /hack/ folder seems to be standard kubernetes development practice ¯\_(ツ)\_/¯
The workflow is a WIP, however we are trying to leverage as many off-the-shelf patterns as possible.
For these scripts to work, your local GOROOT/src/gr... | unknown | github | https://github.com/grafana/grafana | hack/README.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.