code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# -*- 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 | ||
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import calendar
from datetime import datetime,date
from dateutil import relativedelta
import json
import time
from openerp import api
from openerp import SUPERUSER_ID
from openerp import tools
from openerp.osv import fie... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import division, print_function, absolute_import
import numpy.testing as npt
import numpy as np
from scipy._lib.six import xrange
from scipy import stats
from common_tests import (check_normalization, check_moment, check_mean_expect,
check_var_expect, check_skew_expect,
... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
export MALLOC_CONF="zero_realloc:alloc" | unknown | github | https://github.com/redis/redis | deps/jemalloc/test/unit/zero_realloc_alloc.sh |
/*-------------------------------------------------------------------------
*
* win32fdatasync.c
* Win32 fdatasync() replacement
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
*
* src/port/win32fdatasync.c
*
*---------------------------------------------------------------------... | c | github | https://github.com/postgres/postgres | src/port/win32fdatasync.c |
{
"name": "illuminate/macroable",
"description": "The Illuminate Macroable package.",
"license": "MIT",
"homepage": "https://laravel.com",
"support": {
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"authors": [
... | json | github | https://github.com/laravel/framework | src/Illuminate/Macroable/composer.json |
from skoolkittest import SkoolKitTestCase
from skoolkit.graphics import Udg, flip_udgs, rotate_udgs, font_udgs
class UdgTest(SkoolKitTestCase):
def test_flip(self):
udg = Udg(0, [1, 2, 4, 8, 16, 32, 64, 128], [1, 2, 4, 8, 16, 32, 64, 128])
udg.flip(0)
self.assertEqual(udg.data, [1, 2, 4, 8,... | unknown | codeparrot/codeparrot-clean | ||
//go:build linux
package vfs
import (
"archive/tar"
"bytes"
"errors"
"io"
"os"
"path/filepath"
"syscall"
"testing"
"github.com/moby/sys/mount"
"gotest.tools/v3/assert"
"github.com/moby/moby/v2/daemon/graphdriver"
"github.com/moby/moby/v2/daemon/graphdriver/graphtest"
)
// This avoids creating a new dri... | go | github | https://github.com/moby/moby | daemon/graphdriver/vfs/vfs_test.go |
package routed
import (
"context"
"github.com/containerd/log"
"github.com/moby/moby/v2/daemon/libnetwork/portmapperapi"
)
const driverName = "routed"
// Register the "routed" port-mapper with libnetwork.
func Register(r portmapperapi.Registerer) error {
return r.Register(driverName, NewPortMapper())
}
type Por... | go | github | https://github.com/moby/moby | daemon/libnetwork/portmappers/routed/mapper_linux.go |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | unknown | codeparrot/codeparrot-clean | ||
import type { Func } from "./utils";
export type RouteModule = {
meta?: Func;
links?: Func;
headers?: Func;
loader?: Func;
clientLoader?: Func;
action?: Func;
clientAction?: Func;
HydrateFallback?: Func;
default?: Func;
ErrorBoundary?: Func;
[key: string]: unknown; // allow user-defined exports
}... | typescript | github | https://github.com/remix-run/react-router | packages/react-router/lib/types/route-module.ts |
class MessageWithoutBlanks < ApplicationRecord
self.table_name = Message.table_name
has_rich_text :content, store_if_blank: false
end | ruby | github | https://github.com/rails/rails | actiontext/test/dummy/app/models/message_without_blanks.rb |
# -*- coding: utf-8 -*-
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of copyright holders.
#
# Dr Adam S. Candy, ad... | unknown | codeparrot/codeparrot-clean | ||
// 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.
// This test uses various syscall.SIG* constants that are defined on Unix
// platforms and Windows.
//go:build unix || windows
package carchive_test
import (... | go | github | https://github.com/golang/go | src/cmd/cgo/internal/testcarchive/carchive_test.go |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fiddly to ... | unknown | codeparrot/codeparrot-clean | ||
######################## 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 | ||
/*-------------------------------------------------------------------------
*
* ISO8859_1 <--> UTF8
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/backend/utils/mb/conversion_procs/utf8... | c | github | https://github.com/postgres/postgres | src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c |
test_kind: query_tester_server_test
description: |
This suite runs generated tests on the mongo server using QueryTester's mongotest binary.
selector:
roots:
- src/mongo/db/query/query_tester/tests/query-correctness-tests-*/generated_tests/*/
exclude_files:
- src/mongo/db/query/query_tester/tests/selfTes... | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/suites/query_correctness_generated_test.yml |
//// [tests/cases/compiler/argumentsReferenceInMethod3_Js.ts] ////
//// [a.js]
class A {
get arguments() {
return { bar: {} };
}
}
class B extends A {
/**
* @param {object} [foo={}]
*/
m(foo = {}) {
/**
* @type object
*/
this.x = foo;
/**
* @type object
*/
this.y = super.arguments.bar;
... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/argumentsReferenceInMethod3_Js.js |
// Copyright 2016 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 | tests/integration/clientv3/naming/endpoints_test.go |
/* 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/c/eager/tfe_tensor_debug_info_internal.h |
# Copyright: (c) 2017, 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
from ansible import constants as C
from ansible.plugins.action import ActionBase
from ansible.util... | unknown | codeparrot/codeparrot-clean | ||
//
// awaitable.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_AWAITABLE_HPP
#define ... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/asio/awaitable.hpp |
""" Test class for agents
"""
# imports
import unittest, importlib, datetime
from mock import MagicMock
from DIRAC import gLogger
#sut
from DIRAC.TransformationSystem.Agent.TaskManagerAgentBase import TaskManagerAgentBase
from DIRAC.TransformationSystem.Agent.TransformationAgent import TransformationAgent
class Age... | unknown | codeparrot/codeparrot-clean | ||
# -*- encoding: utf-8 -*-
"""Classes and definitions used in parsing bank statements."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding:utf-8 -*-
'''
同步排序队列的测试:
实际上, PriorityQueue就是用heapq实现的阻塞式队列
'''
import time
import bisect
from heapq import *
import threading
import queue
from collections import deque
"""
在满足功能要求的情况下, heapq的方式最快也最简洁效率最稳定
均为 100次循环,每次循环先插入1000个,然后弹出所有 #这个不是使用环境
在正式使用环境下,因为排序方式不需要全部检查,所以开销会比测试的要... | unknown | codeparrot/codeparrot-clean | ||
from collections import OrderedDict
from weakref import WeakKeyDictionary
from itertools import chain
from segpy import __version__
from segpy.util import underscores_to_camelcase, super_class, collect_attributes
class BaseHeader:
"""An abstract base class for header format definitions.
Prefer to inherit fro... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
def test_apply_describe_bug(multiindex_dataframe_random_data):
grouped = multiindex_dataframe_random_data.groupby(level="fir... | python | github | https://github.com/pandas-dev/pandas | pandas/tests/groupby/methods/test_describe.py |
from datetime import timedelta, datetime
import uuid
import urlparse
import json
import hashlib, hmac, base64
import yaml
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.core.urlresolvers import rev... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from numpy.testing import (assert_equal,
assert_almost_equal,
run_module_suite,
assert_array_equal,
assert_raises)
from dipy.data import get_data, dsi_deconv_voxels
from dipy.reconst.dsi import... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2013 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 tar_test
import (
"archive/tar"
"bytes"
"fmt"
"io"
"log"
"os"
)
func Example_minimal() {
// Create and add some files to the archive.
var buf ... | go | github | https://github.com/golang/go | src/archive/tar/example_test.go |
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
class Base {
public:
virtual int Foo() = 0;
};
class Derived1 : public Base {
public:
int Foo() override { return 1; }
};
class Derived2 : public Base {
public:
int Foo() override { return 2; }
};
class Derived3 : public Base {
pub... | cpp | github | https://github.com/llvm/llvm-project | bolt/test/runtime/X86/Inputs/retpoline_synthetic.cpp |
// Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package storage
import (
"bytes"
"context"
"math"
"github.com/cockroachdb/cockroach/pkg/col/coldata"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/c... | go | github | https://github.com/cockroachdb/cockroach | pkg/storage/col_mvcc.go |
# ***************************************************************************
# * Copyright (c) 2019 Bernd Hahnebach <bernd@bimstatik.org> *
# * Copyright (c) 2020 Sudhanshu Dubey <sudhanshu.thethunder@gmail.com> *
# * *
# * Th... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import io
import os
import platform
import re
import sys
import socket
import struct
from . i... | unknown | codeparrot/codeparrot-clean | ||
# Necessary imports. Provides library functions to ease writing tests.
from lib import prebuild, testcase, SUBMITTY_INSTALL_DIR
import subprocess
import os
import glob
import shutil
import traceback
############################################################################
# COPY THE ASSIGNMENT FROM THE SAMPLE ASSI... | unknown | codeparrot/codeparrot-clean | ||
"""Utility functions for use throughout the viewer application."""
import numpy as np
from guiqwt.image import ImageItem
from guiqwt.shapes import RectangleShape as Rectangle
from guiqwt.annotations import AnnotatedRectangle
from config import CAM_TYPES
def get_rect(rect_tool):
"""Convert the guiqwt RectangleTool... | unknown | codeparrot/codeparrot-clean | ||
use rustc_abi::Endian;
use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsisa32r6-unknown-linux-gnu".into(),
metadata: TargetMetadata {
description: Some("32-bit MIPS Release 6 Big Endian".into()),
... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Mercury Payment Services',
'version': '1.0',
'category': 'Point of Sale',
'sequence': 6,
'summary': 'Credit card support for Point Of Sale',
'description': """
Allow credit card POS pay... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import sys
import os
import re
import mimetypes
from copy import copy
from io import BytesIO
from django.conf import settings
from django.contrib.auth import authenticate, login, logout, get_user_model
from django.core.handlers.base import BaseHandler
from django.core.handlers.... | unknown | codeparrot/codeparrot-clean | ||
// Test that the privilege system works to separate tenants, but allows a privileged-enough
// non-tenanted user to access tenant collections.
// @tags: [requires_replication, serverless, featureFlagSecurityToken]
import {runCommandWithSecurityToken} from "jstests/libs/multitenancy_utils.js";
import {ReplSetTest} from... | javascript | github | https://github.com/mongodb/mongo | jstests/auth/authz_tenant_access_control.js |
/*
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/kubelet/kubelet_getters_test.go |
import os
import unittest
from vsg.rules import entity_specification
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_501_test_input.vhd'))
lExpected_lower = []
lExpected_lower.append('')
utils.read_file... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Cisco and/or its affiliates.
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
from test.test_tools import load_tests
import unittest
unittest.main() | python | github | https://github.com/python/cpython | Lib/test/test_tools/__main__.py |
## Input
```javascript
function foo() {
const x = [];
const y = {};
y.x = x;
mutate(x);
return y;
}
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
function foo() {
const $ = _c(1);
let y;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const x = [];
y = {... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md |
#!/usr/bin/env python
"""static - A stupidly simple WSGI way to serve static (or mixed) content.
(See the docstrings of the various functions and classes.)
Copyright (C) 2006-2009 Luke Arno - http://lukearno.com/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesse... | unknown | codeparrot/codeparrot-clean | ||
from bs4 import BeautifulSoup
from argparse import ArgumentParser
# these are pretty arbitrary, but by default we use 3-word chains so anything less isn't useful
MIN_CHARS = 8
MIN_WORDS = 3
# strip everything after these strings: e.g. links, quoted text
STRINGS_TO_FILTER = ['http:', 'Sent at ']
def get_sender(messag... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from sudoku import SudokuGrid
import sys
import itertools
import logging
class TestSudokuGrid(unittest.TestCase):
def test_init(self):
grid = SudokuGrid()
self.assertEqual(grid.nrows, 9)
self.assertEqual(grid.ncols, 9)
def test_subgridBounds(self):
self.longMes... | unknown | codeparrot/codeparrot-clean | ||
"""py.test hacks to support XFAIL/XPASS"""
from __future__ import print_function, division
import sys
import functools
import os
from sympy.core.compatibility import get_function_name
try:
import py
from py.test import skip, raises
USE_PYTEST = getattr(sys, '_running_pytest', False)
except ImportError:
... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2019 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/deployment/config/types.go |
package kotlinx.coroutines.intrinsics
import kotlinx.coroutines.*
import kotlinx.coroutines.internal.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
/**
* Use this function to start a new coroutine in [CoroutineStart.UNDISPATCHED] mode —
* immediately execute the coroutine in the current th... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | kotlinx-coroutines-core/common/src/intrinsics/Undispatched.kt |
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese"); | unknown | github | https://github.com/vercel/next.js | examples/cms-sitecore-xmcloud/src/assets/sass/base/fonts/_fonts.scss |
#include "perf_precomp.hpp"
#if defined(HAVE_HPX)
#include <hpx/hpx_main.hpp>
#endif
CV_PERF_TEST_MAIN(calib3d) | cpp | github | https://github.com/opencv/opencv | modules/calib3d/perf/perf_main.cpp |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 100... | unknown | codeparrot/codeparrot-clean | ||
#ifndef BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP
#define BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP
#if defined(_MSC_VER)
# pragma once
#endif
//----------------------------------------------------------------------
// (C) Copyright 2004 Pavel Vozenilek.
// Use, modification and distribution is subject to the Boost Software
/... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/core/no_exceptions_support.hpp |
# This action requires the following secrets to be set on the repository:
# GH_USER_TOKEN: GitHub user token, to be used by ncu and to push changes
# JENKINS_USER: GitHub user whose Jenkins token is defined below
# JENKINS_TOKEN: Jenkins token, to be used to check CI status
name: Commit Queue
on:
# `schedule`... | unknown | github | https://github.com/nodejs/node | .github/workflows/commit-queue.yml |
from serial import Serial
from device_kind import DeviceKind
import drivers
class SerialDevice(DeviceKind):
"""Serial device backend."""
baud_rates = (
2400,
9600,
19200,
38400,
57600,
115200,
250000,
)
def __init__(self, *args, **kwords):
... | unknown | codeparrot/codeparrot-clean | ||
"""Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import sparse
from ..externals i... | unknown | codeparrot/codeparrot-clean | ||
import json
from unittest import mock
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from wagtail.api.v2 import signal_handlers
from wagtail.images import get_image_model
class TestImageListing(TestCase):
fixtures = ['demosite.json']
def get_... | 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/MD5MD5CRC32GzipFileChecksum.java |
from allauth.socialaccount.app_settings import STORE_TOKENS
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class EveOnlineAccount(ProviderAccount):
def get_profile_url(self):
return 'https://gate.eveonline.com/Prof... | unknown | codeparrot/codeparrot-clean | ||
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import functools
import inspect
from collections import namedtuple
from dj... | unknown | codeparrot/codeparrot-clean | ||
// Metal indexing primitives
#pragma once
#include <c10/metal/common.h>
#include <c10/metal/utils.h>
#include <metal_stdlib>
namespace c10 {
namespace metal {
// Given coordinates and strides, calculates offset from the start of the
// tensors
template <typename T>
inline T offset_from_coord(
thread T idx[max_ndi... | c | github | https://github.com/pytorch/pytorch | c10/metal/indexing.h |
""" Contains models for sci-kit learn estimators """
try:
from sklearn.external import joblib as pickle
except ImportError:
pass
try:
import dill as pickle
except ImportError:
pass
from .base import BaseModel
class SklearnModel(BaseModel):
""" Base class for scikit-learn models
Attributes
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python3 -OO
# Copyright (C) 2013-2014 Fox Wilson, Peter Foley, Srijay Kasturi, Samuel Damashek, James Forcier and Reed Koser
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either v... | unknown | codeparrot/codeparrot-clean | ||
# encoding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
)
class RBMARadioIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
_TEST = {
'url': 'http://www.rbma... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import List, Union, Optional
from typing_extensions import Literal, Required, TypedDict
from .realtime_truncation_param import RealtimeTruncationParam
from .realtime_audio_config_param... | python | github | https://github.com/openai/openai-python | src/openai/types/realtime/realtime_session_create_request_param.py |
# Copyright 2012 OpenStack Foundation
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
from browser import window
from javascript import JSConstructor
b_highchart = JSConstructor(window.Highcharts.Chart)
b_highchart({
'chart':{
'type': 'area',
'renderTo': 'container'
},
'title': {
'text': 'Historic and Estimated Worldwide Population Growth by Region'
},
'subt... | unknown | codeparrot/codeparrot-clean | ||
from test.test_support import have_unicode, run_unittest
import unittest
class base_set:
def __init__(self, el):
self.el = el
class set(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
return [self.el][n]
class TestContain... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | unknown | codeparrot/codeparrot-clean | ||
/**
* Provides supporting infrastructure to allow Spring-created MBeans
* to send JMX notifications.
*/
@NullMarked
package org.springframework.jmx.export.notification;
import org.jspecify.annotations.NullMarked; | java | github | https://github.com/spring-projects/spring-framework | spring-context/src/main/java/org/springframework/jmx/export/notification/package-info.java |
# -*- coding: utf-8 -*-
import datetime
from purchasing.extensions import mail
from purchasing.jobs.scout_nightly import (
ScoutContractsExpireSoonJob, ScoutContractsExpireTodayJob
)
from purchasing_test.test_base import BaseTestCase
from purchasing_test.factories import ContractBaseFactory, UserFactory
class ... | unknown | codeparrot/codeparrot-clean | ||
'''Tests for messaging objects.'''
import pytest
from pymco import exc
from pymco import message
from pymco.test import ctxt
@pytest.fixture
def msg_no_filter(config):
'''Creates a new :py:class:`pymco.message.Message` instance.'''
return message.Message(body=ctxt.MSG['body'],
agent... | unknown | codeparrot/codeparrot-clean | ||
import sys
import pytest
from _pytest.runner import runtestprotocol
from _pytest.skipping import MarkEvaluator
from _pytest.skipping import pytest_runtest_setup
class TestEvaluator:
def test_no_marker(self, testdir):
item = testdir.getitem("def test_func(): pass")
evalskipif = MarkEvaluator(item, ... | unknown | codeparrot/codeparrot-clean | ||
"""Rewrite assertion AST to produce nice error messages"""
import ast
import errno
import functools
import importlib.abc
import importlib.machinery
import importlib.util
import io
import itertools
import marshal
import os
import struct
import sys
import tokenize
import types
from typing import Dict
from typing import L... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package stackeval
import (
"context"
"fmt"
"time"
"github.com/hashicorp/hcl/v2"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/addrs"
"github.com/hashicorp/terraform/internal/collections"
"github.com/hashicorp/te... | go | github | https://github.com/hashicorp/terraform | internal/stacks/stackruntime/internal/stackeval/component_instance.go |
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/dma/allwinner,sun4i-a10-dma.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Allwinner A10 DMA Controller
maintainers:
- Chen-Yu Tsai <wens@csie.org>
- Maxime Ripard <mripard@kernel.org>
allOf:
- $ref: dma-co... | unknown | github | https://github.com/torvalds/linux | Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml |
prelude: |
class C
def m a
1
end
end
class CC < C
def m a
super
end
end
obj = CC.new
benchmark:
vm_zsuper: |
obj.m 10
loop_count: 6000000 | unknown | github | https://github.com/ruby/ruby | benchmark/vm_zsuper.yml |
from flask import Flask, render_template
from flask.ext.misaka import Misaka
from flask.ext.migrate import Migrate
from flask.ext.sqlalchemy import SQLAlchemy
from flask_kvsession import KVSessionExtension
from flask_wtf.csrf import CsrfProtect
db = SQLAlchemy()
md = Misaka()
csrf = CsrfProtect()
migrate = Migrate()
s... | unknown | codeparrot/codeparrot-clean | ||
"""Support for the cloud for text to speech service."""
from hass_nabucasa import Cloud
from hass_nabucasa.voice import VoiceError
import voluptuous as vol
from homeassistant.components.tts import CONF_LANG, PLATFORM_SCHEMA, Provider
from .const import DOMAIN
CONF_GENDER = "gender"
SUPPORT_LANGUAGES = ["en-US", "d... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
"""
This migration skips all bigint upgrades as they're not generally useful
for organizations, and t... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
#
# Copyright (c) 2008 Google Inc.
#
test_description='git-pack-object with missing base
'
. ./test-lib.sh
# Create A-B chain
#
test_expect_success 'setup base' '
test_write_lines a b c d e f g h i >text &&
echo side >side &&
git update-index --add text side &&
A=$(echo A | git commit-tree $(git write... | unknown | github | https://github.com/git/git | t/t5306-pack-nobase.sh |
#!/usr/bin/env python3
'''
Configure SSL VPN.
Method
https://<DEVICE_IP>/api/v2/cmdb/vpn.ssl/settings
CLI
FG # sh vpn ssl settings
config vpn ssl settings
set servercert "self-sign"
set tunnel-ip-pools "SSLVPN_TUNNEL_ADDR1"
set source-interface "port1"
set source-address "... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestAverageNeighbor(object):
def test_degree_p4(self):
G=nx.path_graph(4)
answer={0:2,1:1.5,2:1.5,3:2}
nd = nx.average_neighbor_degree(G)
assert_equal(nd,answer)
D=G.to_directed()
nd = nx.av... | unknown | codeparrot/codeparrot-clean | ||
"""
Command to load course overviews.
"""
import logging
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from openedx.core.djangoapps.content.course_overviews.tasks import (
DEFAULT_ALL_COURSES,
DEFAULT_CHUNK_SIZE,
DEFAULT_FORCE_UPDATE,
enque... | 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.
"""Utility functions for Windows builds.
These functions are executed via gyp-win-tool when using the ninja generator.
"""
from ctypes imp... | unknown | codeparrot/codeparrot-clean | ||
"""Main Pynche (Pythonically Natural Color and Hue Editor) widget.
This window provides the basic decorations, primarily including the menubar.
It is used to bring up other windows.
"""
import sys
import os
import string
from Tkinter import *
import tkMessageBox
import tkFileDialog
import ColorDB
# Milliseconds betw... | unknown | codeparrot/codeparrot-clean | ||
# -*- 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/python
# QUCS->Python+pylab converter ver.1.0
# Public domain code, writter by Wojciech M. Zabolotny
# ( wzab<at>ise.pw.edu.pl ) 20.01.2009
import sys
import pylab
class qucs_dep_var:
def __init__(this,vals,ind_vars):
this.val=vals
this.ind_vars=ind_vars
class qucs_data:
def __init__(this,fname=... | unknown | codeparrot/codeparrot-clean | ||
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from sys import version_info
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.utils.testing ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import datetime
from dateutil.parser import parse
from decimal import Decimal
import re
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.utils import datetime_safe, importlib
from django.utils import six
from tastypie.bundle import Bundle... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
import random as rand
import math, csv
def read_from_file():
with open("data-2.txt", 'r') as f:
data = csv.reader(f)
data = list(data)
return data
def temp_print_to_file(data):
with open("cluster.csv", "w") as f:
f. write("cluster1\n")
for line in data[0]:
line = ','.join(line)
f.... | unknown | codeparrot/codeparrot-clean | ||
#include <pthread.h>
#include <stdbool.h>
#include "ruby/assert.h"
#include "ruby/atomic.h"
#include "ruby/debug.h"
#include "gc/gc.h"
#include "gc/gc_impl.h"
#include "gc/mmtk/mmtk.h"
#include "ccan/list/list.h"
#include "darray.h"
#ifdef __APPLE__
#include <sys/sysctl.h>
#endif
struct objspace {
bool measure... | c | github | https://github.com/ruby/ruby | gc/mmtk/mmtk.c |
# 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.
import filecmp
import gyp.common
import gyp.xcodeproj_file
import errno
import os
import sys
import posixpath
import re
import shutil
import subprocess
import temp... | unknown | codeparrot/codeparrot-clean | ||
#-*- coding: utf-8 -*-
from django import forms
from django.contrib.admin.util import unquote
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from filer import settings
from filer.admin.permissions import PrimitivePermissionAw... | unknown | codeparrot/codeparrot-clean | ||
# mininode.py - Bitcoin P2P network half-a-node
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This python code was modified from ArtForz' public domain half-a-node, as
# found in the mini-node branch of http://github.c... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.