code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack LLC.
# 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/... | unknown | codeparrot/codeparrot-clean | ||
package trap
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/containerd/log"
)
const (
// Immediately terminate the process when this many SIGINT or SIGTERM
// signals are received.
forceQuitCount = 3
)
// Trap sets up a simplified signal "trap", appropriate for common
// behavior expected from a ... | go | github | https://github.com/moby/moby | daemon/command/trap/trap.go |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
#
# Copyright 2017 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 applicable law or a... | unknown | codeparrot/codeparrot-clean | ||
import requests
from flask import current_app
from compair.core import abort
from . import KalturaCore
class Media(object):
@classmethod
def generate_media_entry(cls, ks, upload_token_id, media_type):
entry = cls._api_add(ks, media_type)
entry = cls._api_add_content(ks, entry.get('id'), upload... | 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 | ||
#!/usr/bin/env python
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2015 Jim Easterbrook jim@jim-easterbrook.me.uk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | unknown | codeparrot/codeparrot-clean | ||
"""distutils.unixccompiler
Contains the UnixCCompiler class, a subclass of CCompiler that handles
the "typical" Unix-style command-line C compiler:
* macros defined with -Dname[=value]
* macros undefined with -Uname
* include search directories specified with -Idir
* libraries specified with -lllib
* library... | unknown | codeparrot/codeparrot-clean | ||
# I'm going to move all that data dictionary work that has been done
# in odk_logger.models.XForm over to here.
class OldXFormParser(object):
def __init__(self, xml):
assert type(xml)==str or type(xml)==unicode, u"xml must be a string"
self.doc = minidom.parseString(xml)
self.root_node = se... | unknown | codeparrot/codeparrot-clean | ||
import collections
from datetime import datetime
from feedly.exceptions import DuplicateActivityException
import functools
import itertools
import logging
import time
logger = logging.getLogger(__name__)
MISSING = object()
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
se... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/async/es2017/asyncMethodWithSuperConflict_es6.ts] ////
//// [asyncMethodWithSuperConflict_es6.ts]
class A {
x() {
}
y() {
}
}
class B extends A {
// async method with only call/get on 'super' does not require a binding
async simple() {
const _super = null;... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/asyncMethodWithSuperConflict_es6.js |
#
# Copyright 2016 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 applicable law or agreed to in writing... | unknown | codeparrot/codeparrot-clean | ||
name: Labeler
on:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/labeler@634933edcd8aba... | unknown | github | https://github.com/actix/actix-web | .github/workflows/labeler.yml |
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.gdal import SpatialReference, CoordTransform, OGRException, SRSException
class TestSRS:
def __init__(self, wkt, **kwargs):
self.wkt = wkt
for key, value in kwargs.... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | unknown | codeparrot/codeparrot-clean | ||
import numpy
import operator_benchmark as op_bench
import torch
"""Microbenchmarks for index_add_ operator."""
configs_short = op_bench.config_list(
attr_names=["M", "N", "K", "dim"],
attrs=[[8, 32, 1, 0], [256, 512, 1, 1], [512, 512, 1, 2]],
cross_product_configs={"device": ["cpu"], "dtype": [torch.flo... | python | github | https://github.com/pytorch/pytorch | benchmarks/operator_benchmark/pt/index_add__test.py |
# -*- coding: utf-8 -*-
from lunchinator.plugin import iface_gui_plugin
from eurest_lunch_menu_gui.lunch_menu_widget import LunchMenuWidget
from eurest_lunch_menu import LunchMenu
from lunchinator.cli import LunchCLIModule
from lunchinator.callables import AsyncCall
from functools import partial
class lunch_menu_struc... | unknown | codeparrot/codeparrot-clean | ||
//go:build windows
package container
import (
"strings"
"testing"
"github.com/moby/swarmkit/v2/api"
)
const (
testAbsPath = `c:\foo`
testAbsNonExistent = `c:\some-non-existing-host-path\`
)
func TestControllerValidateMountNamedPipe(t *testing.T) {
if _, err := newTestControllerWithMount(api.Mount{
T... | go | github | https://github.com/moby/moby | daemon/cluster/executor/container/validate_windows_test.go |
/**
* Scheduling convenience classes for the {@code java.util.concurrent}
* and {@code jakarta.enterprise.concurrent} packages, allowing to set up a
* ThreadPoolExecutor or ScheduledThreadPoolExecutor as a bean in a Spring
* context. Provides support for the native {@code java.util.concurrent}
* interfaces as well... | java | github | https://github.com/spring-projects/spring-framework | spring-context/src/main/java/org/springframework/scheduling/concurrent/package-info.java |
import sys
from setuptools import setup, find_packages
extra_setup = {}
if sys.version_info >= (3,):
extra_setup['use_2to3'] = True
setup(
name='blessings',
version='1.3',
description='A thin, practical wrapper around terminal formatting, positioning, and more',
long_description=open('README.rst'... | unknown | codeparrot/codeparrot-clean | ||
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { contextify } = require("./util/identifier");
/** @typedef {import("./util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */
class RequestShortener {
/**
* @param {string} dir... | javascript | github | https://github.com/webpack/webpack | lib/RequestShortener.js |
/**
* 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/security/TestFixKerberosTicketOrder.java |
from django.db import connection
from . import PostgreSQLTestCase
try:
from django.contrib.postgres.signals import (
get_citext_oids,
get_hstore_oids,
register_type_handlers,
)
except ImportError:
pass # psycopg isn't installed.
class OIDTests(PostgreSQLTestCase):
def assertO... | python | github | https://github.com/django/django | tests/postgres_tests/test_signals.py |
#!/bin/bash
set -e
set -x
# defines the get_dep and show_installed_libraries functions
source build_tools/shared.sh
UNAMESTR=`uname`
CCACHE_LINKS_DIR="/tmp/ccache"
setup_ccache() {
CCACHE_BIN=`which ccache || echo ""`
if [[ "${CCACHE_BIN}" == "" ]]; then
echo "ccache not found, skipping..."
elif... | unknown | github | https://github.com/scikit-learn/scikit-learn | build_tools/azure/install.sh |
% This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.
**Description**
Converts a multivalued field into a single valued field containing the average of all of the values. | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/query-languages/esql/_snippets/functions/description/mv_avg.md |
/*
* 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-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java |
"""The tests for the Dark Sky platform."""
import re
import unittest
from unittest.mock import MagicMock, patch
import forecastio
from requests.exceptions import HTTPError
import requests_mock
from datetime import timedelta
from homeassistant.components.sensor import darksky
from homeassistant.bootstrap import setup_... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/bash
set -ex
if [ -n "$KATEX" ]; then
apt-get update
# Ignore error if gpg-agent doesn't exist (for Ubuntu 16.04)
apt-get install -y gpg-agent || :
curl --retry 3 -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
curl --retry 3 -sS https://dl.yarnpkg.com/de... | unknown | github | https://github.com/pytorch/pytorch | .ci/docker/common/install_docs_reqs.sh |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../Cache").Etag} Etag */
class MergedEtag {
/**
* @param {Etag} a first
* @param {Etag} b second
*/
constructor(a, b) {
this.a = a;
this.b = b;
}
toString() {
retur... | javascript | github | https://github.com/webpack/webpack | lib/cache/mergeEtags.js |
from enigma import iRdsDecoder, iPlayableService
from Components.Converter.Converter import Converter
from Components.Element import cached
class RdsInfo(Converter, object):
RASS_INTERACTIVE_AVAILABLE = 0
RTP_TEXT_CHANGED = 1
RADIO_TEXT_CHANGED = 2
def __init__(self, type):
Converter.__init__(self, type)
self... | unknown | codeparrot/codeparrot-clean | ||
import datetime
import threading
import logging
import time
import queue
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from teslarent.models import Rental, VehicleData
from teslarent.teslaapi import teslaapi
from tes... | unknown | codeparrot/codeparrot-clean | ||
import json
import numpy as np
from . import crtl433
# http://stackoverflow.com/questions/17479944/partitioning-an-float-array-into-similar-segments-clustering
# http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-450-principles-of-digital-communications-i-fall-2006/lecture-notes/book_3.pdf
def ... | unknown | codeparrot/codeparrot-clean | ||
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from projects import tasks
from projects.models import Project
from builds.models import Version
from core.utils import trigger_build
log = logging.getLogger(__name__)
class Command(BaseCommand):
"""Custom manage... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# Copyright (c) Ostap developpers.
# =============================================================================
## @file ostap/math/tests/test_math_dalitz.py
# Test module for the file ostap... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
#---------------------------------------------------------------------------------------------------
#
# This is the master script that user should run It runs all other auxilary scripts. At the end you
# will have full set of deletion suggestions.
#
# For now we get the list of all sites from the fil... | unknown | codeparrot/codeparrot-clean | ||
"""
This module aims to give a little more fine-tuned control of caching and cache
invalidation. Import these instead of django.core.cache.
Note that 'default' is being preserved for user session caching, which we're
not migrating so as not to inconvenience users by logging them all out.
"""
from functools import wrap... | 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... | typescript | github | https://github.com/apache/airflow | airflow-core/src/airflow/ui/src/layouts/Details/Grid/TaskInstancesColumn.tsx |
"""
Test Classifier
"""
from numpy import double
from modshogun import BinaryLabels
from modshogun import *
from modshogun import *
from modshogun import *
import util
def _get_machine (indata, prefix, feats):
if indata[prefix+'type']=='kernel':
pre='kernel_'
kargs=util.get_args(indata, pre)
kfun=eval(indata[... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/python2.6
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
bonus property
"""
from rebulk.remodule import re
from rebulk import Rebulk, AppendMatch, Rule
from .title import TitleFromPosition
from ..common.formatters import cleanup
from ..common.validators import seps_surround
def bonus():
"""
Builder for rebulk objec... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
import argparse
import json
import logging
import os
import subprocess
import sys
from ConfigParser import SafeConfigParser
logging.basicConfig()
# Get absolute path of ../config from the current script location (not the
# current folder)
config_folder = os.path.abspath(
os.path.join(os.path.dir... | unknown | codeparrot/codeparrot-clean | ||
# Work isValidSolution() into stage 1 not stage 0... May not work because I need to know which blue_paths are a valid start -- which involves doing all the work anyways.
from collections import deque
from time import time
class Path():
def __init__(self, path):
if isinstance(path, list):
self.path = path
... | unknown | codeparrot/codeparrot-clean | ||
"""
Combine this with the websockt hello world in the sandbox.
"""
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import webbrowser
HTML = """
<!doctype html>
<html>
<head>
<title>WebSockets Hello World</title>
<meta charset="utf-8" />
<style type="text/css">
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015, 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 applicable law or agreed to in writing, s... | unknown | codeparrot/codeparrot-clean | ||
<?php declare(strict_types=1);
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Ut... | php | github | https://github.com/composer/composer | tests/Composer/Test/Util/ProcessExecutorTest.php |
git_show_ref_exists=${git_show_ref_exists:-git show-ref --exists}
test_expect_success setup '
test_commit --annotate A &&
git checkout -b side &&
test_commit --annotate B &&
git checkout main &&
test_commit C &&
git branch B A^0
'
test_expect_success '--exists with existing reference' '
${git_show_ref_exists} ... | unknown | github | https://github.com/git/git | t/show-ref-exists-tests.sh |
/*
* 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 ... | java | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BBUploadHandle.java |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# 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 | ||
/**
* 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/UnionStorageStatistics.java |
# Author: Caspar Clemens Mierau <ccm@screenage.de>
# Homepage: https://github.com/leitmedium/weechat-irssinotifier
# Derived from: notifo
# Author: ochameau <poirot.alex AT gmail DOT com>
# Homepage: https://github.com/ochameau/weechat-notifo
# And from: notify
# Author: lavaramano <lavaramano AT gmail DOT com>
#... | unknown | codeparrot/codeparrot-clean | ||
import os
import glob
from copy import copy
Import ('env')
program_env = env.Clone()
source = Split(
"""
nik2img.cpp
"""
)
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
if env['HAS_CAIRO']:
program_env.PrependUnique(CPPPATH=en... | unknown | codeparrot/codeparrot-clean | ||
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.backends.mysq... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2010 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# This file is only used with Python port of Boost.Build
# This file shows some of the primary customization mechanisms in Boost.Build V2
# an... | 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/certificates/signer/ca_provider.go |
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, inject, Injectable, signal} from '@angular/core';
import {LOCAL_STORAGE} from '../providers';
impo... | typescript | github | https://github.com/angular/angular | adev/shared-docs/services/search-history.service.ts |
#!/usr/bin/env python
"""This module implements a Finite State Machine (FSM). In addition to state
this FSM also maintains a user defined "memory". So this FSM can be used as a
Push-down Automata (PDA) since a PDA is a FSM + memory.
The following describes how the FSM works, but you will probably also need to
see the... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 BitPay, Inc.
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import subprocess
import os
import json
import sys
def bctest(testDir, testObj, exeext):
execprog = testObj['exec'] + exeext
execargs = testObj['arg... | unknown | codeparrot/codeparrot-clean | ||
use actix_web_codegen::*;
#[routes]
#[get("/")]
#[post("/")]
async fn index() -> String {
"Hello World!".to_owned()
}
#[actix_web::main]
async fn main() {
use actix_web::App;
let srv = actix_test::start(|| App::new().service(index));
let request = srv.get("/");
let response = request.send().awai... | rust | github | https://github.com/actix/actix-web | actix-web-codegen/tests/trybuild/routes-ok.rs |
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// ... | c | github | https://github.com/opencv/opencv | 3rdparty/protobuf/src/google/protobuf/generated_enum_util.h |
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "config.h"
#include "parse-options.h"
#include "quote.h"
#include "path.h"
#include "pathspec.h"
#include "preload-index.h"
#include "dir.h"
#include "read-cache.h"
#in... | c | github | https://github.com/git/git | builtin/submodule--helper.c |
This example shows how to use Code Splitting with entrypoint dependOn
# webpack.config.js
```javascript
"use strict";
/** @type {import("webpack").Configuration} */
const config = {
entry: {
app: { import: "./app.js", dependOn: ["react-vendors"] },
"react-vendors": ["react", "react-dom", "prop-types"]
},
opti... | unknown | github | https://github.com/webpack/webpack | examples/code-splitting-depend-on-simple/README.md |
from redis.connection import ConnectionPool, UnixDomainSocketConnection
try:
from redis.connection import SSLConnection
except ImportError:
SSLConnection = None
from threading import Lock
from rb.router import PartitionRouter
from rb.clients import RoutingClient, LocalClient
class HostInfo(object):
def ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 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 | ||
/**
* 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/FileContextTestHelper.java |
<!--Copyright 2026 The Qwen Team and The HuggingFace Inc. team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | unknown | github | https://github.com/huggingface/transformers | docs/source/en/model_doc/qwen3_5.md |
package client
import (
"errors"
"net/http"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/moby/api/types/swarm"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestSecretInspectError(t *testing.T) {
client, err := New(WithMockClient(errorMock(http.StatusInternalServerErr... | go | github | https://github.com/moby/moby | client/secret_inspect_test.go |
from zope.component import queryUtility
from zope.security.interfaces import IPermission
from plone import api
def get_managers():
managers = []
for admin_user in api.user.get_users():
user_roles = api.user.get_roles(user=admin_user)
admin_email = admin_user.getProperty('email')
if (('M... | unknown | codeparrot/codeparrot-clean | ||
/** @import {} from 'trusted-types' */
import { create_element } from './operations.js';
const policy = /* @__PURE__ */ globalThis?.window?.trustedTypes?.createPolicy(
'svelte-trusted-html',
{
/** @param {string} html */
createHTML: (html) => {
return html;
}
}
);
/** @param {string} html */
function cre... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/src/internal/client/dom/reconciler.js |
"""
from: http://adventofcode.com/2017/day/2
--- Part Two ---
"Great work; looks like we're on the right track after all. Here's a star for your effort."
However, the program seems a little worried. Can programs be worried?
"Based on what we're seeing, it looks like all the User wanted is some information about the ev... | unknown | codeparrot/codeparrot-clean | ||
'''
Pascal Paillier (Public-Key)
| From: "Public-Key Cryptosystems Based on Composite Degree Residuosity Classes"
| Published in: EUROCRYPT 1999
| Available from: http://link.springer.com/chapter/10.1007%2F3-540-48910-X_16
| Notes:
* type public-key encryption (public key)
* setting: Integer
:Authors: J A... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# Stashboard documentation build configuration file, created by
# sphinx-quickstart on Thu May 19 00:03:13 2011.
#
# 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.
#
# ... | 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 | ||
# Copyright (c) 2016 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2017 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... | unknown | codeparrot/codeparrot-clean | ||
package ordered.tests
import kotlinx.coroutines.testing.*
import kotlinx.coroutines.*
import kotlinx.coroutines.test.*
import org.junit.*
import org.junit.Test
import java.lang.IllegalStateException
import kotlin.test.*
open class FirstMockedMainTest : TestBase() {
@Before
fun setUp() {
Dispatchers.s... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | ui/kotlinx-coroutines-android/android-unit-tests/test/ordered/tests/FirstMockedMainTest.kt |
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.invocation.mockref;
import static org.junit.Assert.fail;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.mockitoutil.TestBase;
public class Mo... | java | github | https://github.com/mockito/mockito | mockito-core/src/test/java/org/mockito/internal/invocation/mockref/MockWeakReferenceTest.java |
/*-------------------------------------------------------------------------
*
* be-secure-common.c
*
* common implementation-independent SSL support code
*
* While be-secure.c contains the interfaces that the rest of the
* communications code calls, this file contains support routines that are
* used by the lib... | c | github | https://github.com/postgres/postgres | src/backend/libpq/be-secure-common.c |
//! This is a bare-bones alternative to the `thousands` crate on crates.io, for
//! printing large numbers in a readable fashion.
#[cfg(test)]
mod tests;
fn format_with_underscores(mut s: String) -> String {
// Ignore a leading '-'.
let start = if s.starts_with('-') { 1 } else { 0 };
// Stop after the fi... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_data_structures/src/thousands/mod.rs |
#!flask/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 EDF SA
#
# This file is part of slurm-web.
#
# slurm-web 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
# ... | unknown | codeparrot/codeparrot-clean | ||
import {Routes} from '@angular/router';
import {Home} from './home/home';
import {User} from './user/user';
export const routes: Routes = []; | typescript | github | https://github.com/angular/angular | adev/src/content/tutorials/learn-angular/steps/13-define-a-route/src/app/app.routes.ts |
# Copyright 2013 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 | ||
#!/bin/sh
test_description='git merge
Testing the resolve strategy.'
. ./test-lib.sh
test_expect_success 'setup' '
echo c0 > c0.c &&
git add c0.c &&
git commit -m c0 &&
git tag c0 &&
echo c1 > c1.c &&
git add c1.c &&
git commit -m c1 &&
git tag c1 &&
git reset --hard c0 &&
echo c2 > c2.c &&
git add c2.c ... | unknown | github | https://github.com/git/git | t/t7605-merge-resolve.sh |
<<<<<<< HEAD
<<<<<<< HEAD
"""Unittests for heapq."""
import sys
import random
import unittest
from test import support
from unittest import TestCase, skipUnless
py_heapq = support.import_fresh_module('heapq', blocked=['_heapq'])
c_heapq = support.import_fresh_module('heapq', fresh=['_heapq'])
# _heapq.nlargest/nsma... | unknown | codeparrot/codeparrot-clean | ||
# This file is part of beets.
# Copyright 2015, Malte Ried.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | unknown | codeparrot/codeparrot-clean | ||
package l2disco
import (
"context"
"encoding/binary"
"fmt"
"net"
"slices"
"golang.org/x/sys/unix"
)
var (
arpTemplate = []byte{
0x00, 0x01, // Hardware type
0x08, 0x00, // Protocol
0x06, // Hardware address length
0x04, // IPv4 address length
0x00, 0x01, // ARP request
0x00, 0x00, 0x00... | go | github | https://github.com/moby/moby | daemon/libnetwork/internal/l2disco/unsol_arp_linux.go |
"""AnimControlInterval module: contains the AnimControlInterval class"""
__all__ = ['AnimControlInterval']
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import math
class AnimControlInterval(Interval.Interval):
# create AnimControlInterval DirectNotify ca... | unknown | codeparrot/codeparrot-clean | ||
"""
Django's standard crypto functions and utilities.
"""
from __future__ import unicode_literals
import hmac
import struct
import hashlib
import binascii
import time
# Use the system PRNG if possible
import random
try:
random = random.SystemRandom()
using_sysrandom = True
except NotImplementedError:
impo... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.testing impor... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package cache
import (
"testing"
"time"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/command/agentproxyshared/cache/cachememdb"
"github.com/hashicorp/vault/helper/testhelpers/minimal"
"github... | go | github | https://github.com/hashicorp/vault | command/agentproxyshared/cache/static_secret_capability_manager_test.go |
from binascii import unhexlify
from pprint import pprint
from xor import xor
def get_possible_keys(ciphertext):
key_len = len(ciphertext) // 2
# Generate list of potential keys
possible_keys = []
for i in range(256):
hex_num = hex(i).split('x')[1].zfill(2)
possible_keys.append(hex_num ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
'''Copyright 2015 LinkedIn 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 ... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/python
# See README.txt for information and build instructions.
import addressbook_pb2
import sys
# Iterates though all people in the AddressBook and prints info about them.
def ListPeople(address_book):
for person in address_book.person:
print "Person ID:", person.id
print " Name:", person.na... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package command
import (
"context"
"fmt"
"net/http"
"strings"
"github.com/hashicorp/cli"
"github.com/hashicorp/vault/api"
"github.com/posener/complete"
)
var (
_ cli.Command = (*NamespacePatchCommand)(nil)
_ cli.CommandAutoc... | go | github | https://github.com/hashicorp/vault | command/namespace_patch.go |
# Copyright 2012 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 json
import logging
import os
from telemetry.core import util
from telemetry.core.backends import codepen_credentials_backend
from telemetry.core.bac... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... | unknown | codeparrot/codeparrot-clean | ||
from datetime import timedelta
from django.test import TestCase
from django.utils.timezone import now
from pretix.base.models import (
Event, Item, ItemVariation, Organizer, Property, PropertyValue,
)
# Do NOT use relative imports here
from pretix.plugins.timerestriction import signals
from pretix.plugins.timeres... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from abc import abstractmethod
class CommonDB:
native_data = []
# 시계열 데이터를 학습용(70%), 테스트용(30%)으로 분리
trainX = []
trainY = []
testX = []
testY = []
@abstractmethod
def preprocesisng(self):
pass
def min_max_scalr(self):
numerator = self.native_dat... | unknown | codeparrot/codeparrot-clean | ||
import h2o
class FeatureInteraction:
def _feature_interaction(self, max_interaction_depth=100, max_tree_depth=100, max_deepening=-1, path=None):
"""
Feature interactions and importance, leaf statistics and split value histograms in a tabular form.
Available for XGBoost and GBM.
Me... | unknown | codeparrot/codeparrot-clean | ||
"""
Test cases for recover account management command
"""
import re
from tempfile import NamedTemporaryFile
import six
from django.core import mail
from django.contrib.auth import get_user_model
from django.core.management import call_command, CommandError
from django.core.files.uploadedfile import SimpleUploadedFile
... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.