code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
***************************************************************************
ReliefColorsWidget.py
---------------------
Date : December 2016
Copyright : (C) 2016 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*****... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import annotations
class ModuleDocFragment(object):
DOCUMENTATION = r"""
options:
result_format:
name: Format of the task r... | python | github | https://github.com/ansible/ansible | lib/ansible/plugins/doc_fragments/result_format_callback.py |
---
applies_to:
stack:
serverless:
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html
---
# index_phrases [index-phrases]
If enabled, two-term word combinations (*shingles*) are indexed into a separate field. This allows exact phrase queries (no slop) to run more ... | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/elasticsearch/mapping-reference/index-phrases.md |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# Copyright 2016 Jakub Jursa <jakub.jursa1@gmail.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 | ||
import itertools
import collections
from sympy import S, Tuple, MatrixBase
from sympy import S, Tuple, diff, MatrixBase
from sympy.tensor.array import ImmutableDenseNDimArray
from sympy.tensor.array.ndim_array import NDimArray
def _arrayfy(a):
if isinstance(a, NDimArray):
return a
if isinstance(a, (... | unknown | codeparrot/codeparrot-clean | ||
from .fields import ObjectReferenceTypeField
class ObjectReference(object):
def compute_type(self, force=None):
if not self.type or force:
type_set = False
if self.to_workspace:
if type_set:
raise RuntimeError('Role can reference only one object... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2021 Google LLC
#
# 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 | ||
/*
* 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/io/compress/zlib/package-info.java |
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package terraform
import (
"strings"
"testing"
"github.com/hashicorp/terraform/internal/addrs"
"github.com/hashicorp/terraform/internal/configs/configschema"
"github.com/hashicorp/terraform/internal/providers"
"github.com/hashicorp/terraform... | go | github | https://github.com/hashicorp/terraform | internal/terraform/transform_import_state_test.go |
#!/usr/bin/env python
import sys, os
from distutils.core import setup
from distutils.command.install_scripts import install_scripts
version = '2.0.3'
class md_install_scripts(install_scripts):
""" Customized install_scripts. Create markdown.bat for win32. """
def run(self):
install_scripts.run(self)
... | unknown | codeparrot/codeparrot-clean | ||
import sys
sys.path += ["../"]
from mingus.containers.NoteContainer import NoteContainer
from mingus.containers.Note import Note
import unittest
class test_NoteContainers(unittest.TestCase):
def setUp(self):
self.n1 = NoteContainer()
self.n2 = NoteContainer("A")
self.n3 = NoteContainer(["A", "C", "E"])
self... | unknown | codeparrot/codeparrot-clean | ||
import cgi
import urllib, urllib2, Cookie
import cookielib
import re
import logging
from urlparse import urlparse
from django.utils import simplejson
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import... | unknown | codeparrot/codeparrot-clean | ||
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | github | https://github.com/prometheus/prometheus | discovery/discovery.go |
from django.views.decorators.cache import cache_page
from angkot.common.decorators import wapi
from angkot.geo.models import Province, City
def _province_to_dict(province):
return dict(pid=province.id,
name=province.name,
code=province.code)
def _city_to_dict(city):
data = dic... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
module ActiveJob
module Serializers
class DateTimeSerializer < TimeObjectSerializer # :nodoc:
def deserialize(hash)
DateTime.iso8601(hash["value"])
end
def klass
DateTime
end
end
end
end | ruby | github | https://github.com/rails/rails | activejob/lib/active_job/serializers/date_time_serializer.rb |
# (c) 2018 Red Hat Inc.
#
# 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 dis... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from lxmls.deep_learning.utils import (
Model,
glorot_weight_init,
index2onehot,
logsumexp
)
class NumpyLogLinear(Model):
def __init__(self, **config):
# Initialize parameters
weight_shape = (config['input_size'], config['num_classes'])
# after Xavier Gl... | unknown | codeparrot/codeparrot-clean | ||
import codecs, os
MALE = 0
FEMALE = 1
ANDROGYNOUS = 2
class Detector:
def __init__(self, fname=None):
fname = fname or os.path.join(os.path.dirname(__file__), 'data', "nam_dict.txt")
self.parse(fname)
def parse(self, fname):
self.names = {}
f = codecs.open(fname, encoding='iso... | unknown | codeparrot/codeparrot-clean | ||
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Miscellaneous functions to mask Python version differences."""
import sys
import os
import math
import binascii
if sys.version_info >= (3,0):
def compat26Str(x): return x
# Python 3 requires bytes instead of... | unknown | codeparrot/codeparrot-clean | ||
#-*- coding: UTF-8 -*-
'''
Created on 2015年6月19日
@author: joel
'''
PATH_SEPARATOR = "/"
PATH_SEPARATOR_R = "`"
def vanishSlash(jstr):
return jstr.replace(PATH_SEPARATOR,PATH_SEPARATOR_R)
def unVanishSlash(jstr):
return jstr.replace(PATH_SEPARATOR_R,PATH_SEPARATOR)
def covert2int(jstr):
try:
jstr... | unknown | codeparrot/codeparrot-clean | ||
//go:build !linux && !freebsd
package zfs
func checkRootdirFs(rootdir string) error {
return nil
}
func getMountpoint(id string) string {
return id
} | go | github | https://github.com/moby/moby | daemon/graphdriver/zfs/zfs_unsupported.go |
""" Constants for this app as well as the external API. """
class OrderStatus(object):
"""Constants representing all known order statuses. """
OPEN = 'Open'
FULFILLMENT_ERROR = 'Fulfillment Error'
COMPLETE = 'Complete'
class Messages(object):
""" Strings used to populate response messages. """
... | unknown | codeparrot/codeparrot-clean | ||
# Security Policy
## Supported Versions
Currently, we are providing security updates for the latest release in the v1.x series:
| Version | Supported |
| ------- | ------------------ |
| Latest v1.x | :white_check_mark: |
## Reporting a Vulnerability
If you believe you have found a security vulnerability... | unknown | github | https://github.com/nodejs/node | deps/uv/SECURITY.md |
"""
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of... | python | github | https://github.com/scikit-learn/scikit-learn | benchmarks/bench_glmnet.py |
{
"STRLEN": {
"summary": "Returns the length of a string value.",
"complexity": "O(1)",
"group": "string",
"since": "2.2.0",
"arity": 2,
"function": "strlenCommand",
"command_flags": [
"READONLY",
"FAST"
],
"acl_categori... | json | github | https://github.com/redis/redis | src/commands/strlen.json |
# Copyright (c) 2013 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.
"""Unittests for TestRunResults."""
import unittest
from base_test_result import BaseTestResult
from base_test_result import TestRunResults
from base_t... | unknown | codeparrot/codeparrot-clean | ||
#include "test/jemalloc_test.h"
#include "jemalloc/internal/prof_sys.h"
static const char *test_filename = "test_filename";
static bool did_prof_dump_open;
static int
prof_dump_open_file_intercept(const char *filename, int mode) {
int fd;
did_prof_dump_open = true;
/*
* Stronger than a strcmp() - verifying th... | c | github | https://github.com/redis/redis | deps/jemalloc/test/unit/prof_mdump.c |
#!/usr/bin/env python
from tests.compat import mock, unittest
from boto.ec2.connection import EC2Connection
INSTANCE_STATUS_RESPONSE = br"""<?xml version="1.0" encoding="UTF-8"?>
<DescribeInstanceStatusResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
<requestId>3be1508e-c444-4fef-89cc-0b1223c4f02fEXAMP... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""Plots model samples."""
import argparse
import numpy as np
import random
import sys
import json
from scipy.misc import imread, imsave, imresize
import os
from plat.utils import anchors_from_image, get_json_vectors, offset_from_string
from plat.canvas_layout import create_mine_canvas
import p... | unknown | codeparrot/codeparrot-clean | ||
"""unittest.TestCase for multi-statement transaction passthrough tests."""
from typing import Optional
from buildscripts.resmokelib import logging
from buildscripts.resmokelib.testing.testcases import jsrunnerfile
class MultiStmtTxnTestCase(jsrunnerfile.JSRunnerFileTestCase):
"""Test case for multi statement tra... | python | github | https://github.com/mongodb/mongo | buildscripts/resmokelib/testing/testcases/multi_stmt_txn_test.py |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#############################################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under t... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 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 ag... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2016 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package bench
import (
"context"
"fmt"
"math/rand"
"net"
"net/url"
"os/exec"
"testing"
"time"
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroa... | go | github | https://github.com/cockroachdb/cockroach | pkg/bench/pgbench_test.go |
from lamson import view, encoding, queue
from config import settings
def mail_to_you_is_bouncing(message):
reason = message.bounce.error_for_humans()
msg = view.respond(locals(), 'mail/you_bounced.msg',
From='unbounce@librelist.com',
To=message.bounce.original['to... | unknown | codeparrot/codeparrot-clean | ||
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
from django import template
register = template.Library()
class LoremNode(template.Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
try:
... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package stackruntime
import (
"context"
"encoding/json"
"fmt"
"path"
"path/filepath"
"sort"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/hcl/v2"
"github.com/zclconf/go-cty-debug/ctydebug"
"github.com... | go | github | https://github.com/hashicorp/terraform | internal/stacks/stackruntime/plan_test.go |
// SPDX-License-Identifier: GPL-2.0-or-later
/* audit_watch.c -- watching inodes
*
* Copyright 2003-2009 Red Hat, Inc.
* Copyright 2005 Hewlett-Packard Development Company, L.P.
* Copyright 2005 IBM Corporation
*/
#include <linux/file.h>
#include <linux/kernel.h>
#include <linux/audit.h>
#include <linux/kthread.h... | c | github | https://github.com/torvalds/linux | kernel/audit_watch.c |
from tkinter import * # 导入 Tkinter 库
import multiwords
root = Tk()
root.resizable(False,False)
root.title("统计对比多个词语")
#KCC基本分析组件
#该组件用于列举出包含指定词语的帖子/回帖
##插件信息定义
KCC_PLUGIN_NAME="multiwordS"
KCC_PLUGIN_DESCRIPTION="用来统计多个词语的频率并以条形统计图显示"
KCC_PLUGIN_COPYRIGHT="kanch"
##定义结束
def btnclick():
root.update()
... | unknown | codeparrot/codeparrot-clean | ||
from cwrap import BaseCClass
from ert.enkf import EnkfPrototype
from ert.util import CTime
class EnsemblePlotDataVector(BaseCClass):
TYPE_NAME = "ensemble_plot_data_vector"
_size = EnkfPrototype("int enkf_plot_tvector_size(ensemble_plot_data_vector)")
_get_value = EnkfPrototype("double enkf_plot_t... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
import six
from django.conf import settings
from django.utils.translation import ugettext as _
from sentry.utils.html import escape
from sentry.utils.imports import import_string
def iter_interfaces():
rv = {}
for name, import_path in six.iteritems(settings.SENTRY_INT... | unknown | codeparrot/codeparrot-clean | ||
from typing import cast
from langchain_core.load import dumpd, load
from langchain_core.messages import AIMessage, AIMessageChunk
from langchain_core.messages import content as types
from langchain_core.messages.ai import (
InputTokenDetails,
OutputTokenDetails,
UsageMetadata,
add_ai_message_chunks,
... | python | github | https://github.com/langchain-ai/langchain | libs/core/tests/unit_tests/messages/test_ai.py |
# Managing async data with signals using the Resources API
Now that you've learned [how to derive state with linked signals](/tutorials/signals/3-deriving-state-with-linked-signals), let's explore how to handle asynchronous data with the Resource API. The Resource API provides a powerful way to manage async operations... | unknown | github | https://github.com/angular/angular | adev/src/content/tutorials/signals/steps/4-managing-async-data-with-signals/README.md |
import os
import re
def main():
fileIN = open('eg_states.h', 'r')
line = fileIN.readline()
next_is_reg = False
count = 0
print "/* This file is autogenerated from eg_states.h - do not edit directly */"
print "/* autogenerating script is gen_eg_states.py */"
print ""
while line:
... | unknown | codeparrot/codeparrot-clean | ||
import nipy
import pandas as pd
import numpy as np
import argparse
import os
from collections import OrderedDict
import sys
sys.path.append( os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) )
from config import *
parser = argparse.ArgumentParser(description='Script to create summary of VBM ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
from mock import patch
from django.test import TestCase
from track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase):
def setUp(self):
super(TestMongoBackend, self).setUp()
self.mongo_patcher = patch('track.backends.mongodb.MongoClient')... | unknown | codeparrot/codeparrot-clean | ||
import antlr3
import testbase
import unittest
class t011lexer(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar()
def lexerClass(self, base):
class TLexer(base):
def emitErrorMessage(self, msg):
# report errors to /dev/null
pass
... | unknown | codeparrot/codeparrot-clean | ||
import torch
import numpy as np
from models import SSD300
weights_path = '../trained_models/vgg16_reducedfc.pth'
vgg_weights = torch.load(weights_path)
biases = []
weights = []
for name, torch_weights in vgg_weights.items():
print(name)
if 'bias' in name:
biases.append(torch_weights.numpy())
if 'w... | unknown | codeparrot/codeparrot-clean | ||
from datetime import datetime
from operator import attrgetter
from django.test import TestCase
from .models import (
CustomMembership, Employee, Event, Friendship, Group, Ingredient,
Invitation, Membership, Person, PersonSelfRefM2M, Recipe, RecipeIngredient,
Relationship,
)
class M2mThroughTests(TestCase... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public Licen... | unknown | codeparrot/codeparrot-clean | ||
import base64
import urllib
def xunlei_url_encode(url):
return 'thunder://'+base64.encodestring('AA'+url+'ZZ').replace('\n', '')
def xunlei_url_decode(url):
assert url.startswith('thunder://')
url = base64.decodestring(url[10:])
assert url.startswith('AA') and url.endswith('ZZ')
return url[2:-2]
def flashget_ur... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2010-2025 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.impl.base.test.cases.components.resolver
import org.jetbrains.kotli... | kotlin | github | https://github.com/JetBrains/kotlin | analysis/analysis-api-impl-base/testFixtures/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/resolver/AbstractResolveSymbolByFileTest.kt |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Commit hook for pylint """
import decimal
import os
import re
import sys
import subprocess
import collections
import ConfigParser
import json
import urllib2
ExecutionResult = collections.namedtuple('ExecutionResult',
'status, stdout, stderr')
def _execute(cmd):
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 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.
"""Runs Microsoft's RoboHornet Pro benchmark."""
import os
from telemetry import test
from telemetry.page import page_measurement
from telemetry.page i... | 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.
package sort_test
import (
"fmt"
"sort"
)
type Person struct {
Name string
Age int
}
func (p Person) String() string {
return fmt.Sprintf("%s: %d", p.N... | go | github | https://github.com/golang/go | src/sort/example_interface_test.go |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Chronos API Add Job',
# list of on... | unknown | codeparrot/codeparrot-clean | ||
// Toggles
//
// Used in conjunction with global variables to enable certain theme features.
// Vendor
@import "vendor/rfs";
// Deprecate
@import "mixins/deprecate";
// Helpers
@import "mixins/breakpoints";
@import "mixins/color-mode";
@import "mixins/color-scheme";
@import "mixins/image";
@import "mixins/resize";
@... | unknown | github | https://github.com/twbs/bootstrap | scss/_mixins.scss |
#! /usr/bin/env python
# Original code by Guido van Rossum; extensive changes by Sam Bayer,
# including code to check URL fragments.
"""Web tree checker.
This utility is handy to check a subweb of the world-wide web for
errors. A subweb is specified by giving one or more ``root URLs''; a
page belongs to the subweb ... | unknown | codeparrot/codeparrot-clean | ||
"""
Tests of disco_acm
"""
from datetime import datetime, timedelta
from unittest import TestCase
from mock import MagicMock
from disco_aws_automation import DiscoACM
from disco_aws_automation.disco_acm import (
CERT_SUMMARY_LIST_KEY,
CERT_ARN_KEY,
DOMAIN_NAME_KEY,
CERT_ALT_NAMES_KEY,
CERT_KEY,
... | unknown | codeparrot/codeparrot-clean | ||
import nltk
class DecisionTreeClassifierHelper :
""" Decorator object for DecisionTreeClassifier instances """
def __init__(self, classifier) :
self.classifier = classifier
classifier.pythoncode = self.pythoncode
classifier.pythonclasscode = self.pythonclasscode
def pythoncode(sel... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2013 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
# notice, this list of conditi... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python2.4
# Copyright 2007 John Kasunich and Jeff Epler
#
# 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 lat... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""QGIS Unit tests for postgres transaction groups.
.. note:: 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 ve... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
test_description='cherry-pick should rerere for conflicts'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
test_expect_success setup '
test_commit foo &&
test_commit foo-main foo &&
test_commit bar-main bar &&
git checkout -b dev foo &&
test_comm... | unknown | github | https://github.com/git/git | t/t3504-cherry-pick-rerere.sh |
""" Automate Commands """
from paver.easy import *
import paver.doctools
from paver.tasks import task
from pip.req import parse_requirements
from paver.setuputils import (
install_distutils_tasks
)
# -- REQUIRED-FOR: setup, sdist, ...
# NOTE: Adds a lot more python-project related tasks.
install_distutils_tasks()
... | unknown | codeparrot/codeparrot-clean | ||
"""Bisection algorithms."""
def insort_right(a, x, lo=0, hi=None):
"""Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
"""
... | unknown | codeparrot/codeparrot-clean | ||
import pytest
import random
import string
import functools
from unittest import mock
from tests.utils import async
from waterbutler.core import streams
@pytest.fixture
def blob():
return ''.join(random.sample(string.printable, 50)).encode('utf-8')
class TestMultiStream:
@async
def test_single_stream(se... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
#
# Program Parameters
#
import os
import... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2014 Mirantis 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, so... | unknown | codeparrot/codeparrot-clean | ||
//go:build !linux
package vfs
import (
"github.com/moby/go-archive/chrootarchive"
"github.com/moby/sys/user"
)
func dirCopy(srcDir, dstDir string) error {
return chrootarchive.NewArchiver(user.IdentityMapping{}).CopyWithTar(srcDir, dstDir)
} | go | github | https://github.com/moby/moby | daemon/graphdriver/vfs/copy_unsupported.go |
#! /usr/bin/python
import unittest
import sys
import os
import json
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
from nysa.ibuilder.lib import verilog_utils as vutils
TEST_MODULE_LOCATION = os.path.abspath(os.path.join(os.pa... | 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/main/java/org/springframework/jmx/export/metadata/ManagedAttribute.java |
"""Test OpenBabel executables from Python
Note: Python bindings not used
On Windows or Linux, you can run these tests at the commandline
in the build folder with:
"C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake
-R pytest -VV
You could also "chdir" into bui... | 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 | ||
"""A module containing the `_NestedSequence` protocol."""
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
if TYPE_CHECKING:
from collections.abc import Iterator
__all__ = ["_NestedSequence"]
@runtime_checkable
class _NestedSequence[T](Protocol):
"""A protocol for representing nested seque... | python | github | https://github.com/numpy/numpy | numpy/_typing/_nested_sequence.py |
#!/usr/bin/env python
#
# Copyright (C) 2013 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 you... | unknown | codeparrot/codeparrot-clean | ||
import Link from "next/link";
import Avatar from "./avatar";
import DateComponent from "./date";
import CoverImage from "./cover-image";
function PostPreview({
title,
coverImage,
date,
excerpt,
author,
slug,
}: {
title: string;
coverImage: any;
date: string;
excerpt: string;
author: any;
slug: ... | typescript | github | https://github.com/vercel/next.js | examples/cms-contentful/app/more-stories.tsx |
/*
* Copyright (C) 2016 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | java | github | https://github.com/google/guava | guava/src/com/google/common/graph/ForwardingNetwork.java |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | unknown | codeparrot/codeparrot-clean | ||
#ifndef _NPY_COMMON_TAG_H_
#define _NPY_COMMON_TAG_H_
#include "../npysort/npysort_common.h"
namespace npy {
template<typename... tags>
struct taglist {
static constexpr unsigned size = sizeof...(tags);
};
struct integral_tag {
};
struct floating_point_tag {
};
struct complex_tag {
};
struct date_tag {
};
struct... | c | github | https://github.com/numpy/numpy | numpy/_core/src/common/numpy_tag.h |
/*
* Copyright (C) 2010 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | java | github | https://github.com/google/guava | android/guava-tests/test/com/google/common/base/StringsTest.java |
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | go | github | https://github.com/etcd-io/etcd | server/etcdserver/api/v2store/store.go |
#!/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
from wtforms import ValidationError
from sqlalchemy.orm.exc import NoResultFound
class Unique(object):
"""Checks field value unicity against specified table field.
:param get_session:
A function that return a SQAlchemy Session.
:param model:
The mod... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package configs
import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/terraform/internal/experiments"
)
func TestExperimentsConfig(t *testing.T) {
// The experiment registrations are global, s... | go | github | https://github.com/hashicorp/terraform | internal/configs/experiments_test.go |
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-majo... | json | github | https://github.com/openai/openai-python | release-please-config.json |
#
# (c) 2016 Red Hat Inc.
#
# (c) 2017 Dell EMC.
#
# 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 ve... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | unknown | codeparrot/codeparrot-clean | ||
#!/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 | ||
"""
===========
gaussfitter
===========
.. codeauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com> 3/17/08
Latest version available at <http://code.google.com/p/agpy/source/browse/trunk/agpy/gaussfitter.py>
"""
import numpy
from numpy.ma import median
from numpy import pi
#from scipy import optimize,stats,pi
from scip... | unknown | codeparrot/codeparrot-clean | ||
import os
import pymongo
from bson.code import Code
from . import base
# Map-reduce functions for getting and counting the unique fields
# across documents in a collection.
map_fields = Code('''
function() {
for (var key in this) {
emit(key, 1);
}
}
''')
count_fields = Code('''
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 Google LLC
#
# 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 | ||
#!/usr/bin/env python
'''
This is a tool for that makes it easy to understand what a given KojiPkgSpec
syntax will expand to.
The main use case is making sure the packages specified in a KojiInstaller
will match the packages you intended to install.
'''
import sys, optparse
import common
from virttest import utils_k... | unknown | codeparrot/codeparrot-clean | ||
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls import patterns
from bedrock.mozorg.util import page
urlpatterns = patterns('',
page('', 'fou... | unknown | codeparrot/codeparrot-clean | ||
#include "test/jemalloc_test.h"
#ifdef _WIN32
void
thd_create(thd_t *thd, void *(*proc)(void *), void *arg) {
LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc;
*thd = CreateThread(NULL, 0, routine, arg, 0, NULL);
if (*thd == NULL) {
test_fail("Error in CreateThread()\n");
}
}
void
thd_join(thd_t th... | c | github | https://github.com/redis/redis | deps/jemalloc/test/src/thd.c |
/*
* Copyright (C) 2011 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | java | github | https://github.com/google/guava | android/guava/src/com/google/common/cache/CacheLoader.java |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Abinit Post Process Application
author: Martin Alexandre
last edited: May 2013
"""
import sys,os,time,commands
import string, math
#GUI
import gui.graph as Graph
import gui.conv as Conv
#Utility
import utility.write as Write
import utility.analysis as Analysis
try... | unknown | codeparrot/codeparrot-clean | ||
#import
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import cross_val_score
# load training data
traindata = pd.read_csv('C:/Users/sound/Desktop/Kaggle/Leaf Classfication/data/train.csv')
x_train = traindata.val... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2016-2019 Cargo-Bundle developers <https://github.com/burtonageo/cargo-bundle>
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use crate::bundle::Settings;
use crate::utils::{self, fs_utils};
use std::{
cmp::min... | rust | github | https://github.com/tauri-apps/tauri | crates/tauri-bundler/src/bundle/macos/icon.rs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.