code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# privacyIDEA is a fork of LinOTP
# May 08, 2014 Cornelius Kölbel
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# 2015-05-24 Add more detailed description
# Cornelius Kölbel <cornelius.koelbel@netknights.it>
# 2015-01-30 Adapt for migration to flask
# ... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | java | github | https://github.com/spring-projects/spring-framework | spring-context/src/test/java/org/springframework/aop/framework/ClassWithComplexConstructor.java |
class Pair(object):
def __init__(self, a, b):
self.a = a
self.b = b
def max_chain_length(arr, n):
max = 0
mcl = [1 for i in range(n)]
for i in range(1, n):
for j in range(0, i):
if (arr[i].a > arr[j].b and
mcl[i] < mcl[j] + 1):
mcl[i] = mcl[j] + 1
for i in range(n):
if (max < mcl[i]):
max = m... | unknown | mbpp | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | unknown | codeparrot/codeparrot-clean | ||
---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-settings-limit.html
navigation_title: Mapping limit
applies_to:
stack: all
---
# Mapping limit settings [mapping-settings-limit]
:::{include} _snippets/serverless-availability.md
:::
Use the following settings to limit th... | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/elasticsearch/index-settings/mapping-limit.md |
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package stackeval
import (
"github.com/hashicorp/terraform/internal/addrs"
"github.com/hashicorp/terraform/internal/stacks/stackplan"
"github.com/hashicorp/terraform/internal/states"
)
type ComponentInstanceApplyResult struct {
// FinalState i... | go | github | https://github.com/hashicorp/terraform | internal/stacks/stackruntime/internal/stackeval/component_instance_results.go |
# 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 | ||
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
#===========================================================================
#
# Copyright (c) 2014, California Institute of Technology.
# U.S. Government Sponsorship under NASA Contract NAS7-03001 is
# acknowledged. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | unknown | codeparrot/codeparrot-clean | ||
#-*- coding: utf-8 -*-
"""
Group Configuration Tests.
"""
import json
from mock import patch
from contentstore.utils import reverse_course_url, reverse_usage_url
from contentstore.views.component import SPLIT_TEST_COMPONENT_TYPE
from contentstore.course_group_config import GroupConfiguration
from contentstore.tests.ut... | unknown | codeparrot/codeparrot-clean | ||
CREATE EXTENSION jsonb_plperlu CASCADE;
CREATE FUNCTION testHVToJsonb() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = {a => 1, b => 'boo', c => undef};
return $val;
$$;
SELECT testHVToJsonb();
CREATE FUNCTION testAVToJsonb() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = ... | sql | github | https://github.com/postgres/postgres | contrib/jsonb_plperl/sql/jsonb_plperlu.sql |
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
MODEL_PRE_HOOK = """
insert into {{this.schema}}.on_model_hook (
state,
target_name,
target_schema,
target_type,
target_threads,
run_started_at,
invocation_id
) VALUES... | unknown | codeparrot/codeparrot-clean | ||
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Monolog\Tests;
use Monolog\Level;
use Monolog\Logger;
us... | php | github | https://github.com/symfony/symfony | src/Symfony/Bridge/Monolog/Tests/RecordFactory.php |
"""
Infinite caching memcached classes. Caches forever when passed a timeout
of 0.
"""
import logging
from django.core.cache.backends import memcached
class MemcachedCache(memcached.MemcachedCache):
"""
Infinitely Caching version of django's MemcachedCache backend.
"""
def _get_memcache_timeout(self... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
import immom
def getimplementer(dn):
"""Returns the implmenter of an object or '' if there are no implementer.
"""
for (n,t,v) in immom.getobject(dn):
if n == 'SaImmAttrImplementerName':
if v:
return v[0]
return ''
def getimplementers... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2017 - 2025 R. Thomas
* Copyright 2017 - 2025 Quarkslab
*
* 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 req... | cpp | github | https://github.com/nodejs/node | deps/LIEF/src/PE/resources/ResourceStringFileInfo.cpp |
#!/usr/bin/env python3
import os
import sys
import importlib
def install():
try:
from pip import main as pip_main
except ImportError:
from pip._internal import main as pip_main
install_command = ['install', "-U"]
if os.geteuid() != 0:
print("The current user is not root and is i... | unknown | codeparrot/codeparrot-clean | ||
######################## BEGIN LICENSE BLOCK ########################
# Contributor(s):
# Ian Cordasco - port to Python
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# versio... | unknown | codeparrot/codeparrot-clean | ||
"""
=====================
SVM: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
The sample weighting rescales the C parameter, which means that the classifier
puts more emphasis on getting these points right. The effect might ... | unknown | codeparrot/codeparrot-clean | ||
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration | unknown | github | https://github.com/kubernetes/kubernetes | cmd/kubeadm/test/cmd/testdata/init/v1beta1.yaml |
"""Tests for distutils.command.sdist."""
import os
import tarfile
import unittest
import warnings
import zipfile
from os.path import join
from textwrap import dedent
from test.test_support import captured_stdout, check_warnings, run_unittest
# zlib is not used here, but if it's not available
# the tests that use zipfi... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package pki
import (
"context"
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/base64"
"fmt"
"math/big"
"net/http"
"net/http/httptest"
... | go | github | https://github.com/hashicorp/vault | builtin/logical/pki/acme_challenges_test.go |
'''
# Description.
This is the graphical user interface (GUI) module in order to perform a \
circular arc slope stability analysis by the limit equilibrium model by
Fellenius and Bishop symplified methods implemented in pyCSS program.
'''
#------------------------------------------------------------------------------
... | unknown | codeparrot/codeparrot-clean | ||
{
"FUNCTION": {
"summary": "A container for function commands.",
"complexity": "Depends on subcommand.",
"group": "scripting",
"since": "7.0.0",
"arity": -2
}
} | json | github | https://github.com/redis/redis | src/commands/function.json |
#
# IDA Python PIDA Database Generation Script
# Dumps the current IDB into a .PIDA file.
#
# Copyright (C) 2006 Pedram Amini <pedram.amini@gmail.com>
#
# $Id: pida_dump.py 194 2007-04-05 15:31:53Z cameron $
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General P... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# vim: sts=4 sw=4 et
# GladeVcp actions
#
# Copyright (c) 2011 Pavel Shramov <shramov@mexmat.net>
#
# 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 2 of the... | unknown | codeparrot/codeparrot-clean | ||
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | unknown | codeparrot/codeparrot-clean | ||
// SPDX-License-Identifier: GPL-2.0-or-later
/*
*/
#include <linux/export.h>
#include <linux/libgcc.h>
long long notrace __ashldi3(long long u, word_type b)
{
DWunion uu, w;
word_type bm;
if (b == 0)
return u;
uu.ll = u;
bm = 32 - b;
if (bm <= 0) {
w.s.low = 0;
w.s.high = (unsigned int) uu.s.low << -... | c | github | https://github.com/torvalds/linux | lib/ashldi3.c |
# Copyright (C) 2013-2014 Free Software Foundation, 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 of the License, or
# (at your option) any later version.
#
# This progr... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris
package net
import (
"runtime"
"syscall"
)
func setIPv4MulticastInterface(... | go | github | https://github.com/golang/go | src/net/sockoptip4_bsdvar.go |
"""Component for the Goalfeed service."""
import json
import pysher
import requests
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
# Version downgraded due to regression in library
# For details: https://github.com/nlsdfnbch/... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
#
# Copyright (c) 2009 Marc Branchaud
#
test_description='git svn multiple branch and tag paths in the svn repo'
. ./lib-git-svn.sh
test_expect_success 'setup svnrepo' '
mkdir project \
project/trunk \
project/b_one \
project/b_two \
project/tags_A \
project/tags_B &&
echo 1 > project/trunk/a.fi... | unknown | github | https://github.com/git/git | t/t9141-git-svn-multiple-branches.sh |
//// [tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts] ////
//// [assignmentCompatWithConstructSignatures3.ts]
// checking assignment compatibility relations for function types. All of these are valid.
class Base { foo: string; }
class Derived extend... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/assignmentCompatWithConstructSignatures3.js |
/*
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.network.tls.certificates
import io.ktor.network.tls.*
import java.io.*
import java.security.*
import java.security.cert.*
import java.security.interfaces.*
import java.time.*
... | kotlin | github | https://github.com/ktorio/ktor | ktor-network/ktor-network-tls/ktor-network-tls-certificates/jvm/test/io/ktor/network/tls/certificates/TestUtils.kt |
from etk.knowledge_graph.node import URI
from etk.knowledge_graph.subject import Subject
from enum import Enum
import uuid
class Rank(Enum):
Normal = URI('wikibase:NormalRank')
Preferred = URI('wikibase:PreferredRank')
Deprecated = URI('wikibase:DeprecatedRank')
# never set the rank to BestRank. This ... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
package com.plugin.sample
import android.util.Log
class Example {
fun pong(value: String): String {
Log.i("Pong", value)
return value
}
} | kotlin | github | https://github.com/tauri-apps/tauri | examples/api/src-tauri/tauri-plugin-sample/android/src/main/java/com/plugin/sample/Example.kt |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# 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 Li... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013 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 | ||
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class BaseImageProcessorFast(metaclass=DummyObject):
_backends = ["torchvision"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torchvision"])
class BaseVideo... | python | github | https://github.com/huggingface/transformers | src/transformers/utils/dummy_torchvision_objects.py |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para backin.net
# by be4t5
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import ... | unknown | codeparrot/codeparrot-clean | ||
A tuple struct's element isn't a machine type when using the `#[simd]`
attribute.
Erroneous code example:
```compile_fail,E0077
#![feature(repr_simd)]
#[repr(simd)]
struct Bad([String; 2]); // error!
```
When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
must be machine types so SIMD op... | unknown | github | https://github.com/rust-lang/rust | compiler/rustc_error_codes/src/error_codes/E0077.md |
call-seq:
scan(pattern) -> substring or nil
Attempts to [match][17] the given `pattern`
at the beginning of the [target substring][3].
If the match succeeds:
- Returns the matched substring.
- Increments the [byte position][2] by <tt>substring.bytesize</tt>,
and may increment the [character position][7].
- Sets ... | unknown | github | https://github.com/ruby/ruby | doc/strscan/methods/scan.md |
# frozen_string_literal: true
class Joke < ActiveRecord::Base
self.table_name = "funny_jokes"
end
class GoodJoke < ActiveRecord::Base
self.table_name = "funny_jokes"
end | ruby | github | https://github.com/rails/rails | activerecord/test/models/joke.rb |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | unknown | codeparrot/codeparrot-clean | ||
message: It works! | unknown | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/translations/domain.with.dots.en.yml |
framework:
html_sanitizer:
sanitizers:
custom:
default_action: 'allow'
allow_safe_elements: true
allow_static_elements: true
allow_elements:
iframe: 'src'
custom-tag: ['data-attr', 'data-attr-... | unknown | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/html_sanitizer.yml |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from ..util import get_doc, apply_transition_sequence
def test_parser_root(en_tokenizer):
text = "i don't have other assistance"
heads = [3, 2, 1, 0, 1, -2]
deps = ["nsubj", "aux", "neg", "ROOT", "amod", "dobj"]
tokens = en_tokeniz... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
)
class EllenTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)'
_TEST = {
'url': 'http://www.ellen... | unknown | codeparrot/codeparrot-clean | ||
# layout.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to
# http://inst.eecs.berkeley.ed... | unknown | codeparrot/codeparrot-clean | ||
package plugin
import (
"context"
"io"
"net/http"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/distribution/reference"
"github.com/gogo/protobuf/proto"
plugintypes "github.com/moby/moby/api/types/plugin"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/api/... | go | github | https://github.com/moby/moby | daemon/cluster/controllers/plugin/controller.go |
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestCallback {
attribute CallbackType? listener;
};
callback CallbackType = boolean (unsigned long arg);
""")
results = parser.finish()
harness.ok(True, "TestCallback interface parsed without ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | unknown | codeparrot/codeparrot-clean | ||
test_kind: cpp_unit_test
selector:
root: bazel-bin/install/install-mongo_unittest_test_list.txt
include_files:
- build/**/repl/*
executor:
config: {} | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/suites/unittests_repl.yml |
# This file is part of beets.
# Copyright 2015, Thomas Scholtes.
#
# 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,... | unknown | codeparrot/codeparrot-clean | ||
"""
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
from __future__ import unicode_literals
import datetime
import re
import sys
import warnings
try:
import MySQLdb as Database
except ImportError as e:
from django.core.exceptions import ImproperlyConfigur... | unknown | codeparrot/codeparrot-clean | ||
/* contrib/intarray/intarray--1.0--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION intarray UPDATE TO '1.1'" to load this file. \quit
CREATE FUNCTION _int_matchsel(internal, oid, internal, integer)
RETURNS float8
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT S... | sql | github | https://github.com/postgres/postgres | contrib/intarray/intarray--1.0--1.1.sql |
def AddCustomProperties(appserver,appnode):
print "----- Add custom properties ----------------"
serverid = AdminConfig.getid("/Cell:" + cellName + "/Node:" + appnode + "/Server:" + appserver +"/")
pp = AdminConfig.list('PluginProperties',serverid)
for propname in properties.keys():
if propname.find("ppcp... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | java | github | https://github.com/spring-projects/spring-framework | spring-aop/src/main/java/org/springframework/aop/interceptor/SimpleTraceInterceptor.java |
# Copyright 2013-2015 DataStax, 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 writi... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
import os
from typing import Any, cast
import pytest
from openai import OpenAI, AsyncOpenAI
from tests.utils import assert_matches_type
from openai.types import (
EvalListResponse,
EvalCr... | python | github | https://github.com/openai/openai-python | tests/api_resources/test_evals.py |
//! Traits, helpers, and type definitions for asynchronous I/O functionality.
//!
//! This module is the asynchronous version of `std::io`. Primarily, it
//! defines two traits, [`AsyncRead`] and [`AsyncWrite`], which are asynchronous
//! versions of the [`Read`] and [`Write`] traits in the standard library.
//!
//! # ... | rust | github | https://github.com/tokio-rs/tokio | tokio/src/io/mod.rs |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
#... | 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 TestGyp
test = TestGyp.TestGyp()
test.run_gyp('all.g... | unknown | codeparrot/codeparrot-clean | ||
// Based on https://github.com/anp/rust/blob/175631311716d7dfeceec40d2587cde7142ffa8c/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs
// run-pass
use std::panic::Location;
#[track_caller]
fn tracked() -> &'static Location<'static> {
Location::caller()
}
fn nested_intrinsic() -> &'static Location<'st... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_codegen_cranelift/example/track-caller-attribute.rs |
# Logistic regression implemented from Scratch in Python
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(scores):
return 1 / (1 + np.exp(-scores))
def log_likelihood(features, target, weights):
scores = np.dot(features, weights)
ll = np.sum(target * scores - np.log(1 + np.exp(scores)))
... | unknown | codeparrot/codeparrot-clean | ||
#ifndef HASH_H
#define HASH_H
#if defined(SHA1_APPLE)
#define SHA1_BACKEND "SHA1_APPLE (No collision detection)"
#include <CommonCrypto/CommonDigest.h>
#elif defined(SHA1_OPENSSL)
# define SHA1_BACKEND "SHA1_OPENSSL (No collision detection)"
# include <openssl/sha.h>
# if defined(OPENSSL_API_LEVEL) && OPENSSL_API_L... | c | github | https://github.com/git/git | hash.h |
// FILE: A.java
public @interface A {
String[] value() default {"foo", "bar"};
}
// FILE: Test.kt
annotation class B(vararg val a: A)
@B(A(), A(*[]))
class <caret>Foo | kotlin | github | https://github.com/JetBrains/kotlin | analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/emptyJavaSpreadParameter.kt |
# __MyClass0.py_____________________________________________________
from ASGNode import *
from ATOM3Type import *
from ATOM3Integer import *
from ATOM3Boolean import *
from graph_MyClass0 import *
class MyClass0(ASGNode, ATOM3Type):
def __init__(self, parent = None):
ASGNode.__init__(self)
ATOM3Type.... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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 So... | unknown | codeparrot/codeparrot-clean | ||
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | cpp | github | https://github.com/llvm/llvm-project | clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp |
# -*- coding: utf-8 -*-
#
# 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 | ||
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page
from twilio.rest.accounts.v1.credential.aws import AwsL... | unknown | codeparrot/codeparrot-clean | ||
'use strict'
var after = require('after')
var express = require('../')
, request = require('supertest');
describe('app.all()', function(){
it('should add a router per method', function(done){
var app = express();
var cb = after(2, done)
app.all('/tobi', function(req, res){
res.end(req.method);
... | javascript | github | https://github.com/expressjs/express | test/app.all.js |
const alreadyWarned: { [message: string]: boolean } = {};
export function warnOnce(condition: boolean, message: string): void {
if (!condition && !alreadyWarned[message]) {
alreadyWarned[message] = true;
console.warn(message);
}
} | typescript | github | https://github.com/remix-run/react-router | packages/react-router/lib/server-runtime/warnings.ts |
#!/usr/bin env python
from boto.cloudsearch2.domain import Domain
from boto.cloudsearch2.layer1 import CloudSearchConnection
from tests.unit import unittest, AWSMockServiceTestCase
from httpretty import HTTPretty
from mock import MagicMock
import json
from boto.cloudsearch2.document import DocumentServiceConnection
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
__doc__ = """
Implementation of a SAX parser for the AST defined in the
mathml.termparser module.
Usage examples:
(remember to run 'from mathml import mathdom, xmlterm, termparser' first!)
* Building a MathDOM document from a boolean expression in infix notation:
>>> from m... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | unknown | codeparrot/codeparrot-clean | ||
use crate::spec::{Os, SanitizerSet, TargetOptions, TlsModel, base};
pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.os = Os::Android;
base.is_like_android = true;
base.default_dwarf_version = 2;
base.tls_model = TlsModel::Emulated;
base.has_thread_local = false;... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_target/src/spec/base/android.rs |
import pyglet
from dialog import Dialog
from button import Button
from vbox import VBox
from hbox import HBox
from slider import Slider
from checkbox import Checkbox
from label import Label
from radiobutton import Radiobutton
window = pyglet.window.Window(resizable=True)
label1 = Label(text='<font face="Helvetica,Ari... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# 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 Li... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 Cloudbase Solutions Srl
# 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 r... | unknown | codeparrot/codeparrot-clean | ||
# util/langhelpers.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Routines to help with the creation, loading and introspection of
modules, cla... | unknown | codeparrot/codeparrot-clean | ||
name: macOS
on:
push:
branches:
- master
- '[0-9]+.[0-9]+'
pull_request:
concurrency:
group: ${{github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: macos-latest
env:
PYTEST_ADDOPTS: -n auto
strategy:
fail-fast: false
matrix:
py... | unknown | github | https://github.com/scrapy/scrapy | .github/workflows/tests-macos.yml |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2014 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | unknown | codeparrot/codeparrot-clean | ||
import os
import subprocess
import sys
from git_remote_helpers.util import check_call
class GitExporter(object):
"""An exporter for testgit repositories.
The exporter simply delegates to git fast-export.
"""
def __init__(self, repo):
"""Creates a new exporter for the specified repo.
... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2023 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/robustness/failpoint/cluster.go |
import torch
class MaskedTensor:
def __init__(self, tensor: torch.Tensor, mask: torch.Tensor = None):
self.tensor = tensor
self.mask = mask if mask is not None else torch.ones(tensor.shape, dtype=torch.bool).to(tensor.device)
def __getattr__(self, item):
val = self.tensor.__getattribut... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required ... | java | github | https://github.com/spring-projects/spring-framework | framework-docs/src/main/java/org/springframework/docs/web/webfluxfnhandlerclasses/Person.java |
from __future__ import print_function
import theano.tensor as T
import numpy as np
from theano.compat.six.moves import xrange
from theano import config
from theano import function
import time
from pylearn2.utils import sharedX
from pylearn2.sandbox.cuda_convnet.probabilistic_max_pooling import \
prob_max_pool... | unknown | codeparrot/codeparrot-clean | ||
from ..extensions import db
class BaseModel:
""" Base class with basics methods for all the models. """
db = db
def __init__(self, **kwargs):
self.kind = self.get_kind(self)
for field, value in kwargs.items():
self.__setattr__(field, value)
@staticmethod
def get_kind(c... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2014 OpenStack Foundation. 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 ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from xml.etree import ElementTree
from odoo.http import Controller, route, request
class Board(Controller):
@route('/board/add_to_dashboard', type='json', auth='user')
def add_to_dashboard(self, action_id, con... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
try:
from urllib import parse as urlparse
except ImportError:
import urlparse # Python 2
try:
basestring
except NameError:
basestring = str # Python 3
from django import forms
from django.core import checks, exceptions
from django.contrib.admin.filters impor... | unknown | codeparrot/codeparrot-clean | ||
test_kind: js_test
selector:
roots:
- jstests/fle2/**/*.js
- src/mongo/db/modules/*/jstests/fle2/**/*.js
exclude_with_any_tags:
# Don't run tests that require the encrypted collscan mode in this suite.
- requires_fle2_encrypted_collscan
executor:
archive:
hooks:
- ValidateCollections
... | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/suites/fle2.yml |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import ctypes
import json
import random
import unittest
from binascii import a2b_hex, b2a_hex
from io import BytesIO
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.shortcuts impor... | unknown | codeparrot/codeparrot-clean | ||
---
minor_changes:
- script - remove the currently unsupported ``decrypt`` argument from the module documentation (https://github.com/ansible/ansible/issues/86067). | unknown | github | https://github.com/ansible/ansible | changelogs/fragments/86128-fix-script-decrypt-docs-mismatch.yml |
import json
from argparse import ArgumentParser
from pathlib import Path
"""
This script converts Falcon custom code checkpoints to modern Falcon checkpoints that use code in the Transformers
library. After conversion, performance (especially for generation) should improve and the checkpoint can be loaded
without need... | python | github | https://github.com/huggingface/transformers | src/transformers/models/falcon/convert_custom_code_checkpoint.py |
"""
Test the course_info xblock
"""
import mock
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST... | unknown | codeparrot/codeparrot-clean | ||
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/allwinner,sun9i-a80-deu.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Allwinner A80 Detail Enhancement Unit
maintainers:
- Chen-Yu Tsai <wens@csie.org>
- Maxime Ripard <mripard@kernel.org>
descriptio... | unknown | github | https://github.com/torvalds/linux | Documentation/devicetree/bindings/display/allwinner,sun9i-a80-deu.yaml |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.