code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
#!/usr/bin/env python
# coding=utf-8
###############################################################################
import os
import sys
import unittest
import inspect
import traceback
import optparse
import logging
import configobj
try:
import cPickle as pickle
pickle # workaround for pyflakes issue #13
ex... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2013 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 requ... | unknown | codeparrot/codeparrot-clean | ||
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id: saxlib.py,v 1... | 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 | ||
# -*- coding: utf-8 -*-
"""
***************************************************************************
utils.py
---------------------
Date : November 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder dot sk at gmail dot com
************************... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#! /usr/bin/env python
""" crypto.cipher.ccm_test
Tests for CCM encryption, uses AES for base algorithm
Copyright © (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license information.
July 24, 2002
"""
import unittest
from crypto.cipher.ccm import CCM
from crypto.cipher... | unknown | codeparrot/codeparrot-clean | ||
from xml.dom.minidom import parseString
from django.contrib.auth.decorators import login_required, permission_required
from django.core import mail
from django.forms import fields
from django.forms.forms import Form, ValidationError
from django.forms.formsets import formset_factory, BaseFormSet
from django.http import... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/python
# Copyright (c) 2013, Arvid Norberg
# 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
# notice, this l... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright 2009 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 requir... | unknown | codeparrot/codeparrot-clean | ||
'use strict'
var express = require('../')
, request = require('supertest');
describe('req', function(){
describe('.stale', function(){
it('should return false when the resource is not modified', function(done){
var app = express();
var etag = '"12345"';
app.use(function(req, res){
r... | javascript | github | https://github.com/expressjs/express | test/req.stale.js |
import logging
import ray
from ray.rllib.agents.dreamer.utils import FreezeParameters
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.policy.policy_template import build_policy_class
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.torch_ops import apply_grad_clipping
torch... | unknown | codeparrot/codeparrot-clean | ||
###############################################################################
# #
# 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 #
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""Functions to draw a caffe NetParameter protobuffer.
"""
from caffe.proto import caffe_pb2
from google.protobuf import text_format
import pydot
import os
import sys
# Internal layer and blob styles.
LAYER_STYLE = {'shape': 'record', 'fillcolor': '#6495ED',
'style': 'filled'}
NEURON_LA... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
'''Resource Agent Tester
Remote execution and watch utilities, extends Pacemaker's CTS
'''
__copyright__ = '''
Copyright (C) 2015-2016 Damien Ciabrini <dciabrin@redhat.com>
Licensed under the GNU GPL.
'''
#
# This program is free software; you can redistribute it and/or
# modify it under the ... | unknown | codeparrot/codeparrot-clean | ||
use super::*;
use crate::Decoder;
use crate::opaque::{MAGIC_END_BYTES, MemDecoder};
macro_rules! impl_test_unsigned_leb128 {
($test_name:ident, $write_fn_name:ident, $read_fn_name:ident, $int_ty:ident) => {
#[test]
fn $test_name() {
// Test 256 evenly spaced values of integer range,
... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_serialize/src/leb128/tests.rs |
# Copyright 2024 The HuggingFace Inc. team.
#
# 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 ... | python | github | https://github.com/huggingface/transformers | utils/process_test_artifacts.py |
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* linux/ipc/msgutil.c
* Copyright (C) 1999, 2004 Manfred Spraul
*/
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/security.h>
#include <linux/slab.h>
#include <linux/ipc.h>
#include <linux/msg.h>
#include <linux/ipc_namespace.h>
#include <linux/ut... | c | github | https://github.com/torvalds/linux | ipc/msgutil.c |
# frozen_string_literal: true
module Jekyll
module Drops
class CollectionDrop < Drop
extend Forwardable
mutable false
delegate_method_as :write?, :output
delegate_methods :label, :docs, :files, :directory, :relative_directory
private delegate_method_as :metadata, :fallback_data
... | ruby | github | https://github.com/jekyll/jekyll | lib/jekyll/drops/collection_drop.rb |
"""
report test results in JUnit-XML format,
for use with Jenkins and build integration servers.
Based on initial code from Ross Lawley.
"""
# Output conforms to https://github.com/jenkinsci/xunit-plugin/blob/master/
# src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
import py
impor... | unknown | codeparrot/codeparrot-clean | ||
<h3>{% trans %}Download{% endtrans %}</h3>
<p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p>
<h3>{% trans %}Docs by version{% endtrans %}</h3>
<ul>
{# _docs_by_version.html is overwritten by build_docs.py for non-EOL versions #}
{% include "_docs_by_version.html" withou... | html | github | https://github.com/python/cpython | Doc/tools/templates/indexsidebar.html |
"""Tests for the validate methods."""
import pytest
from napalm_base import validate
_compare_getter = [
(
{"list": ["\d{2}", 1, 2]},
[1, 2, 33],
{u'complies': True, u'extra': [], u'missing': [], u'present': ['\d{2}', 1, 2]}
),
(
{"list": [1, 2, 3]},
[1, 2, 3, 4, 5]... | unknown | codeparrot/codeparrot-clean | ||
# The Restful Matching-Engine.
# Copyright (C) 2013, 2018 Swirly Cloud Limited.
#
# 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
# License, or (at your option) any later v... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2022 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 runtime
import (
"internal/runtime/math"
"internal/runtime/sys"
"unsafe"
)
func unsafestring(ptr unsafe.Pointer, len int) {
if len < 0 {
panicun... | go | github | https://github.com/golang/go | src/runtime/unsafe.go |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
#
# This file is part of Volatility.
#
# Volatility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2024 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 || (openbsd && !mips64) || solaris
package syscall
import _ "unsafe"
// used by internal/poll
//go:linkname writev | go | github | https://github.com/golang/go | src/syscall/linkname_libc.go |
from Tools import Tools
from Grafana import Grafana
from WorkloadBase import WorkloadBase
import yaml
import logging
import datetime
import os
import json
import time
class Shaker(WorkloadBase):
def __init__(self, config):
self.logger = logging.getLogger('browbeat.Shaker')
self.config = config
... | unknown | codeparrot/codeparrot-clean | ||
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | python | github | https://github.com/apache/kafka | release/notes.py |
"""Timetabler PTF9 import functions."""
import unsync
import petl
@unsync.command()
@unsync.option('--input-file', '-i', type=unsync.Path(exists=True, dir_okay=False, readable=True, resolve_path=True), help='Timetabler PTF9 file to extract data from.', required=True)
@unsync.option('--destination', '-d', required=True... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from datetime import datetime
from collections import OrderedDict
from sqlalchemy.exc import ProgrammingError
from flask import abort, redirect, render_template, request, Response, url_for, g, flash, Markup
from coaster.utils import getbool, parse_isoformat, for_tsquery
from baseframe import c... | unknown | codeparrot/codeparrot-clean | ||
"""
SVG export test
"""
from __future__ import division, print_function, absolute_import
import pyqtgraph as pg
import csv
import os
import tempfile
app = pg.mkQApp()
def approxeq(a, b):
return (a-b) <= ((a + b) * 1e-6)
def test_CSVExporter():
tempfilename = tempfile.NamedTemporaryFile(suffix='.csv').name
... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing_extensions import Literal, Required, TypedDict
__all__ = ["InputAudioBufferClearEventParam"]
class InputAudioBufferClearEventParam(TypedDict, total=False):
"""Send this event to c... | python | github | https://github.com/openai/openai-python | src/openai/types/realtime/input_audio_buffer_clear_event_param.py |
{
"SLAVES": {
"summary": "Returns a list of the monitored replicas.",
"complexity": "O(N) where N is the number of replicas.",
"group": "sentinel",
"since": "2.8.0",
"arity": 3,
"container": "SENTINEL",
"function": "sentinelCommand",
"deprecated_since"... | json | github | https://github.com/redis/redis | src/commands/sentinel-slaves.json |
import unittest
from sqltxt.sql_tokenizer import select_stmt, parse
class SqlTokenizerTest(unittest.TestCase):
def test_parse_select_list(self):
parsed = select_stmt.parseString('select col1 from table1')
self.assertEqual(list(parsed.column_definitions), ['col1'])
parsed = select_stmt.par... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2017 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/nodeipam/ipam/timeout.go |
# Copyright 2013 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 ... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/bash
# Copyright 2020 The Cockroach Authors.
#
# Use of this software is governed by the CockroachDB Software License
# included in the /LICENSE file.
set -euo pipefail
export FILEBEAT_CONFIG_PATH=/tmp/filebeat.yml
# Download the Public Signing Key for the Beats APT repository
wget -qO - https://artifacts.el... | unknown | github | https://github.com/cockroachdb/cockroach | build/packer/setup_filebeat_on_teamcity_agent.sh |
package listeners
import (
"context"
"crypto/tls"
"net"
"os"
"strconv"
"github.com/containerd/log"
"github.com/coreos/go-systemd/v22/activation"
"github.com/docker/go-connections/sockets"
"github.com/moby/moby/v2/pkg/homedir"
"github.com/pkg/errors"
)
// Init creates new listeners for the server.
// TODO: ... | go | github | https://github.com/moby/moby | daemon/listeners/listeners_linux.go |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 14:59:24 2017
@author: Austin
"""
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from sklearn.preprocessing import PolynomialFeatures
import seaborn as sns
def loadData(file, deli... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""The output modules CLI arguments helper."""
import sys
from plaso.cli import tools
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.lib import errors
from plaso.output import manager as output_manager
class OutputModulesArgumentsHelper(interface.Argu... | unknown | codeparrot/codeparrot-clean | ||
import sys
import os
from django.test import TestCase, override_settings, Client
from django.conf import settings
from ..conf import (DatabaseUndefined, validate_database,
InaccessibleSettings, _load_py_file, load_py_settings,
load_colab_apps, load_widgets_settings)
from mock ... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
test_description='checkout from unborn branch'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
test_expect_success 'setup' '
mkdir parent &&
(
cd parent &&
git init &&
echo content >file &&
git add file &&
git commit -m base
) &&
git fetch... | unknown | github | https://github.com/git/git | t/t2015-checkout-unborn.sh |
import unittest
import mock
from pulp.server.db.model.consumer import Consumer
from pulp.server.db.model.dispatch import ScheduledCall
from pulp.server.exceptions import MissingResource, MissingValue, InvalidValue
from pulp.server.managers.factory import initialize
from pulp.server.managers.schedule.consumer import (... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
""" OpenERP core exceptions.
This module defines a few exception types. Those types are understood by the
RPC layer. Any other exception type bubbling until the RPC layer will be
treated as a 'Server error'.
If you con... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
require "active_support/duration"
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module OID # :nodoc:
class Interval < Type::Value # :nodoc:
def type
:interval
end
def cast_value(value)
case value... | ruby | github | https://github.com/rails/rails | activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/core/kernels/linalg/matrix_triangular_solve_op_impl.h |
#!/usr/bin/env python
# coding: utf8
"""
ExtendedLoginForm is used to extend normal login form in web2py with one more login method.
So user can choose the built-in login or extended login methods.
"""
from gluon import current, DIV
class ExtendedLoginForm(object):
"""
Put extended_login_form under web2py/gl... | unknown | codeparrot/codeparrot-clean | ||
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | python | github | https://github.com/apache/airflow | airflow-core/src/airflow/secrets/metastore.py |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.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_... | unknown | codeparrot/codeparrot-clean | ||
# Required by Tidelift
Coordinated Disclosure Plan: https://tidelift.com/security | unknown | github | https://github.com/mockito/mockito | SECURITY.md |
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.fe10.test.cases.generated.cases.components.resolver;
import com.int... | java | github | https://github.com/JetBrains/kotlin | analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/resolver/Fe10IdeNormalAnalysisSourceModuleResolveCallByFileTestGenerated.java |
# Copyright 2011-2014 IBM
# 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 appl... | unknown | codeparrot/codeparrot-clean | ||
"""engine.SCons.Platform.hpux
Platform-specific initialization for HP-UX systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is ... | unknown | codeparrot/codeparrot-clean | ||
import sys
import unittest
from django.conf import settings
from django.contrib.admindocs import utils
from django.contrib.admindocs.views import get_return_data_type
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test i... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
'''
This file can be placed in the simulations directory of a neuroConstruct project and
when run it will search in all subdirectories for time.dat, and if it doesn't find it,
will try running pullsim.sh, which will attempt to retrieve the saved data from a remotely
executed simulation
'''
im... | unknown | codeparrot/codeparrot-clean | ||
"""
Benchmark for SGD regression
Compares SGD regression against coordinate descent and Ridge
on synthetic data.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# License: BSD 3 clause
import numpy as np
import pylab as pl
import gc
from time import time
from sklearn.linear_model i... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.network.tls
import io.ktor.network.tls.platform.*
internal actual fun CipherSuite.isSupported(): Boolean = when (platformVersion.major) {
"1.8.0" -> platformVersion.minor... | kotlin | github | https://github.com/ktorio/ktor | ktor-network/ktor-network-tls/jvm/src/io/ktor/network/tls/CipherSuitesJvm.kt |
# frozen_string_literal: true
require "active_support"
require "minitest/autorun"
require "arel"
require_relative "support/fake_record"
Minitest::Expectation.class_eval do
def must_be_like(other)
self.class.new(target.gsub(/\s+/, " ").strip, ctx).must_equal other.gsub(/\s+/, " ").strip
end
end
module Arel
... | ruby | github | https://github.com/rails/rails | activerecord/test/cases/arel/helper.rb |
# Copyright 2011 Omniscale (http://omniscale.com)
#
# 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 | ||
# -*- coding: utf-8 -*-
# Copyright 2014 Mark Brand - c01db33f (at) gmail.com
#
# 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.... | unknown | codeparrot/codeparrot-clean | ||
"""Interface to the compiler's internal symbol tables"""
import _symtable
from _symtable import (USE, DEF_GLOBAL, DEF_NONLOCAL, DEF_LOCAL, DEF_PARAM,
DEF_IMPORT, DEF_BOUND, DEF_ANNOT, SCOPE_OFF, SCOPE_MASK, FREE,
LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL)
import weakref
__all__ = ["symtable", "SymbolTa... | unknown | codeparrot/codeparrot-clean | ||
"""An Python re-implementation of hierarchical module import.
This code is intended to be read, not executed. However, it does work
-- all you need to do to enable it is "import knee".
(The name is a pun on the klunkier predecessor of this module, "ni".)
"""
import sys, imp, __builtin__, string
# Replacement for ... | unknown | codeparrot/codeparrot-clean | ||
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "abspath.h"
#include "parse.h"
#include "dir.h"
#include "environment.h"
#include "gettext.h"
#include "pathspec.h"
#include "attr.h"
#include "read-cache.h"
#include "repository.h"
#include "setup.h"
#include "strvec.h"
#include "symlinks.h"
#i... | c | github | https://github.com/git/git | pathspec.c |
# Exit Codes Reference
This document provides a reference of exit codes returned by the etcd server.
etcd server explicitly uses three exit codes: **0** (success), **1** (general errors), and **2** (argument errors). When terminated by signals (SIGTERM/SIGINT) on Linux/Unix systems, the exit code depends on the proce... | unknown | github | https://github.com/etcd-io/etcd | Documentation/contributor-guide/exit_codes.md |
# Code borrowed from ptpython
# https://github.com/jonathanslenders/ptpython/blob/86b71a89626114b18898a0af463978bdb32eeb70/ptpython/eventloop.py
# Copyright (c) 2015, Jonathan Slenders
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided t... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
__authors__ = "Vincent Dumoulin"
__copyright__ = "Copyright 2013, Universite de Montreal"
__credits__ = ["Guillaume Desjargins", "Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
"""
This script computes both an estimate of the partition function of the provided... | unknown | codeparrot/codeparrot-clean | ||
import logging
import click
from itertools import chain
from collections import namedtuple
import asyncio
from tornado.platform.asyncio import AsyncIOMainLoop
from streamz import Stream, union, combine_latest, zip_latest
import attr
from .events import PriceUpdate
from .collectors import Collector
from .feeds import ... | unknown | codeparrot/codeparrot-clean | ||
package kotlinx.coroutines.javafx
import javafx.beans.value.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.flow.*
/**
* Creates an instance of a cold [Flow] that subscribes to the given [ObservableValue] and emits
* its values as they change. The resulting flow is confl... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | ui/kotlinx-coroutines-javafx/src/JavaFxConvert.kt |
from django.db import models
from django.core.exceptions import ValidationError
import datetime
from django.utils.timezone import now
from hashlib import sha256
from django.conf import settings
class File(models.Model):
name = models.CharField(max_length=1000)
f = models.FileField(upload_to="uploads")
def ... | unknown | codeparrot/codeparrot-clean | ||
# botUtil.py
import psycopg2, psycopg2.extensions, psycopg2.extras
import tweepy
import json
import time
import dateutil.parser
import sqlalchemy
import sys
sys.path.append("models/")
from ModelBase import SessionFactory
class topic(object):
def __init__(self,topic_json):
self.query = topic_json['query']
... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import, division, unicode_literals
from xml.dom import Node
from ..constants import namespaces, voidElements, spaceCharacters
__all__ = ["DOCUMENT", "DOCTYPE", "TEXT", "ELEMENT", "COMMENT", "ENTITY", "UNKNOWN",
"TreeWalker", "NonRecursiveTreeWalker"]
DOCUMENT = Node.DOCUMEN... | unknown | codeparrot/codeparrot-clean | ||
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'TRANSACTION ID NUMBER', 'number': '3'... | unknown | codeparrot/codeparrot-clean | ||
"""
Tests for bookmark views.
"""
import ddt
import json
from nose.plugins.attrib import attr
import urllib
from django.conf import settings
from django.core.urlresolvers import reverse
from mock import patch
from rest_framework.test import APIClient
from openedx.core.djangolib.testing.utils import skip_unless_lms
f... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Copyright 2015 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 os
import sys
import common
def main_run(args):
filter_tests = []
if args.filter_file:
filter_tests = json... | unknown | codeparrot/codeparrot-clean | ||
import { PropTypes } from 'react';
const propTypes = identity({
prop: PropTypes.bool
}); | javascript | github | https://github.com/vercel/next.js | crates/next-custom-transforms/tests/fixture/strip-page-exports/propTypes/complex/output-data.js |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import tempfile
import pytest
from django.core.management import call_command
from mock import patch
from kolibri.core.deviceadmin.tests.test_dbrestore import is_sqlite_settings
from kolibri... | unknown | codeparrot/codeparrot-clean | ||
###############################################################################
##
## Copyright (C) 2014, Tavendo GmbH and/or collaborators. All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
##
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
import socket
import multiprocessing
import random
from time import sleep
from PIL import Image
from sys import exit, argv
def runner(packet_list, target_ip, target_port):
while True:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockop... | unknown | codeparrot/codeparrot-clean | ||
"""
Use tabs for indentation.
This rule check if the each line starts with a space.
In addition, it suppresses the violation when the line contains only spaces and tabs.
== Violation ==
void Hello()
{
[SPACE][SPACE]Hello(); <== Violation. Spaces are used for indentation.
}
== Good ==
void Hello()... | 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 n... | java | github | https://github.com/apache/kafka | clients/src/main/java/org/apache/kafka/common/errors/InvalidRequiredAcksException.java |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>
from XmTestLib import *
if ENABLE_HVM_SUPPORT:
SKIP("Mem-set not supported for HVM domains")
domain = XmTestDomain()
try:
console = domain.start()
except DomainError, e:
if verbose:
... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_HTTP_SSI_FILTER_H_INCLUDED_
#define _NGX_HTTP_SSI_FILTER_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#define NGX_HTTP_SSI_MAX_PARAMS 16
#define NGX_HTTP_SSI_COMMAND_LEN 32
#define NGX_HTTP_SS... | c | github | https://github.com/nginx/nginx | src/http/modules/ngx_http_ssi_filter_module.h |
# Copyright 2010-2014 Google
# 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, so... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
Unit tests for preference APIs.
"""
import ddt
import json
from mock import patch
from django.core.urlresolvers import reverse
from django.test.testcases import TransactionTestCase
from rest_framework.test import APIClient
from student.tests.factories import UserFactory, TEST_PASSWORD
fro... | unknown | codeparrot/codeparrot-clean | ||
import { test } from '../../test';
export default test({
async test({ assert, target }) {
await Promise.resolve();
assert.htmlEqual(
target.innerHTML,
`
<p>a: 3</p>
<p>b: 2</p>
<p>c: 3</p>
<p>a: 1</p>
<p>b: 2</p>
<p>c: 3</p>
<p>a: 3</p>
<p>b: 2</p>
<p>c: 3</p>
<p>a: 1</p>
<p... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/tests/runtime-legacy/samples/await-then-destruct-default/_config.js |
-- make table, grouping all data for the same item
-- input is 2 columns (item, data)
local A
while 1 do
local l=io.read()
if l==nil then break end
local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$')
if a~=A then A=a io.write("\n",a,":") end
io.write(" ",b)
end
io.write("\n") | unknown | github | https://github.com/redis/redis | deps/lua/test/table.lua |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... | unknown | codeparrot/codeparrot-clean | ||
import ctypes
import CoreFoundation
import objc
import subprocess
import time
## from http://benden.us/journal/2014/OS-X-Power-Management-No-Sleep-Howto/
## http://alistra.ghost.io/2015/03/15/making-your-os-x-not-sleep-while-running-scripts/
def SetUpIOFramework():
# load the IOKit library
framework = ct... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
from global_test_case import GlobalTestCase as TestCase, popit_load_data
from ..user_section.forms import WriteItInstanceCreateFormPopitUrl, SimpleInstanceCreateFormPopitUrl
from django.contrib.auth.models import User
from django.conf import settings
from mock import patch
class InstanceCreateFormTestCa... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2011 Patrick Crews
#
#
# 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 Softwar... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2017 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/clusterroleaggregation/clusterroleaggregation_controller_test.go |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
httpbin.core
~~~~~~~~~~~~
This module provides the core HttpBin experience.
"""
import base64
import json
import os
import random
import time
import uuid
from flask import Flask, Response, request, render_template, redirect, jsonify as flask_jsonify, make_response, url_for
from werkzeug.... | unknown | codeparrot/codeparrot-clean | ||
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.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 License, or
# (at your option) any lat... | unknown | codeparrot/codeparrot-clean | ||
# DNS Horizontal Autoscaler
DNS Horizontal Autoscaler enables horizontal autoscaling feature for DNS service
in Kubernetes clusters. This autoscaler runs as a Deployment. It collects cluster
status from the APIServer, horizontally scales the number of DNS backends based
on demand. Autoscaling parameters could be tuned... | unknown | github | https://github.com/kubernetes/kubernetes | cluster/addons/dns-horizontal-autoscaler/README.md |
##############################################################################
# MSIBI: A package for optimizing coarse-grained force fields using multistate
# iterative Boltzmann inversion.
# Copyright (c) 2017 Vanderbilt University and the Authors
#
# Authors: Christoph Klein, Timothy C. Moore
#
# Permission is her... | unknown | codeparrot/codeparrot-clean | ||
{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v2beta1",
"metadata": {
"name": "test-v2alpha1-groupby-adhoc-vars"
},
"spec": {
"annotations": [],
"cursorSync": "",
"elements": {},
"layout": {
"kind": "RowsLayout",
"spec": {
"rows": []
}
},
"li... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.groupby-adhoc-vars.json |
import numpy as np
from sklearn.tree._utils import PytestWeightedFenwickTree
def test_cython_weighted_fenwick_tree(global_random_seed):
"""
Test Cython's weighted Fenwick tree implementation
"""
rng = np.random.default_rng(global_random_seed)
n = 100
indices = rng.permutation(n)
y = rng.n... | python | github | https://github.com/scikit-learn/scikit-learn | sklearn/tree/tests/test_fenwick.py |
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/compiler/mlir/tensorflow/utils/convert_attr.h |
# Copyright 2016 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 a... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.