code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
#!/usr/bin/env python3
# Copyright 2014 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.
"""Generate a spatial analysis against an arbitrary library.
To use, build the 'binary_size_tool' target. Then run this tool, passing
... | unknown | codeparrot/codeparrot-clean | ||
#
# The Python Imaging Library.
# $Id$
#
# MSP file handling
#
# This is the format used by the Paint program in Windows 1 and 2.
#
# History:
# 95-09-05 fl Created
# 97-01-03 fl Read/write MSP images
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1995-97.
#
# See the README fi... | unknown | codeparrot/codeparrot-clean | ||
from urllib2 import urlopen
import requests
import sys
import random
import json
import time
green = '\033[01;32m'
red = '\033[01;31m'
native = '\033[m'
my_ip=0
def check_website_access():
sys.stdout.write("Checking if website accessible to the Internet......")
r = requests.get('http://'+my_ip)
if r.statu... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""
@file route_departOffset.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 11.09.2009
@version $Id: route_departOffset.py 11671 2012-01-07 20:14:30Z behrisch $
Applies a given offset to the given route's departure time
SUMO, Simulation of Urban MObility; see http://sumo.sou... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para videos externos de videobam
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import... | unknown | codeparrot/codeparrot-clean | ||
import logging
import operator
from datetime import datetime
from itertools import chain
from django.conf import settings
from django.core.exceptions import FieldError
from django.db.backends.ddl_references import (
Columns,
Expressions,
ForeignKeyName,
IndexName,
Statement,
Table,
)
from djang... | python | github | https://github.com/django/django | django/db/backends/base/schema.py |
# -*- coding: utf-8 -*-
"""
Parse, stream, create, sign and verify Bitcoin transactions as Tx structures.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# daemon/version/__init__.py
# Part of python-daemon, an implementation of PEP 3143.
#
# Copyright © 2008–2009 Ben Finney <ben+python@benfinney.id.au>
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the Python Software Foundation License, version ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# James Laska (jlaska@redhat.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',
'status': ['previ... | unknown | codeparrot/codeparrot-clean | ||
# Author: Idan Gutman
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 o... | 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 | ||
/** @import { SpreadElement } from 'estree' */
/** @import { Context } from '../types' */
/**
* @param {SpreadElement} node
* @param {Context} context
*/
export function SpreadElement(node, context) {
if (context.state.expression) {
// treat e.g. `[...x]` the same as `[...x.values()]`
context.state.expression.... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/src/compiler/phases/2-analyze/visitors/SpreadElement.js |
# From Python Cookbook. Recipe 1.23 - Encoding Unicode Data for XML and HTML.
# Problem: Want to encode Unicode text for output in HTML, or some other XML
# application, using a limited but popular encoding such as ASCII or latin-1
def encode_for_xml(unicode_data, encoding='ascii'):
return unicode_data.encode(enc... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/bash
# Golden tests are currently incompatible with Bazel Remote Execution
unset GOLDEN_TEST_CONFIG_PATH
is_ppc64le() {
local -r arch="$(uname -m)"
[[ "${arch}" == "ppc64le" || "${arch}" == "ppc64" || "${arch}" == "ppc" ]] && return 0 || return 1
}
is_s390x() {
local -r arch="$(uname -m)"
[[ "... | unknown | github | https://github.com/mongodb/mongo | bazel/test_wrapper.sh |
/* Copyright 2022 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/jit/tf_to_hlo_compiler.h |
# (c) 2016 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 | ||
# -*- coding: utf-8 -*-
import multiscanner
def test_valid_reports_string():
reportlist = [([('file', 'result')], {'Name': 'Test', 'Type': 'Test'})]
r = multiscanner.parse_reports(reportlist, python=False)
assert r == '{"file":{"Test":"result"}}'
def test_valid_reports_python():
reportlist = [([('file... | unknown | codeparrot/codeparrot-clean | ||
# Useful unit conversions
def secsToDays(s):
'''Assume s is time in seconds and a positive integer or float.
Return time in days'''
days = s / (60 * 60 * 24)
return days
def daysToSecs(d):
'''Assume d is time in days and a positive integer or float.
Return time in seconds'''
secs = (60 * 6... | 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.
*/
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBu... | php | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Notifier/bundles.php |
<div ngTabs>
<div ngTabList selectionMode="follow" selectedTab="movie">
<div ngTab value="movie">Movie</div>
<div ngTab value="theatres">Cast</div>
<div ngTab value="showtimes">Reviews</div>
</div>
<div class="sliding-window">
<div ngTabPanel [preserveContent]="true" value="movie">
<ng-temp... | html | github | https://github.com/angular/angular | adev/src/content/examples/aria/tabs/src/selection-follows-focus/app/app.html |
name: Find inactive TSC voting members
on:
schedule:
# Run every Tuesday 12:05 AM UTC.
- cron: 5 0 * * 2
workflow_dispatch:
env:
NODE_VERSION: lts/*
permissions:
contents: read
jobs:
find:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-slim
steps:
- name: Checkout the r... | unknown | github | https://github.com/nodejs/node | .github/workflows/find-inactive-tsc.yml |
#ifndef DATE_TIME_TIME_CLOCK_HPP___
#define DATE_TIME_TIME_CLOCK_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Autho... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/date_time/time_clock.hpp |
<div ngToolbar class="material-toolbar" aria-label="Text Formatting Tools">
<div class="group">
<button
ngToolbarWidget
value="undo"
type="button"
aria-label="undo"
class="material-symbols-outlined"
translate="no"
>
undo
</button>
<button
ngToolbarWidge... | html | github | https://github.com/angular/angular | adev/src/content/examples/aria/toolbar/src/basic/material/app/app.html |
"""Middleware for account-related functionality."""
from __future__ import unicode_literals
import pytz
from django.conf import settings
from django.contrib import auth
from django.utils import timezone
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.accounts.backends import X509Backend
from... | unknown | codeparrot/codeparrot-clean | ||
# Shell library to run git-daemon in tests. Ends the test early if
# GIT_TEST_GIT_DAEMON is not set.
#
# Usage:
#
# . ./test-lib.sh
# . "$TEST_DIRECTORY"/lib-git-daemon.sh
# start_git_daemon
#
# test_expect_success '...' '
# ...
# '
#
# test_expect_success ...
#
# test_done
if ! test_bool_env GIT_TEST_GIT_DAEMON tru... | unknown | github | https://github.com/git/git | t/lib-git-daemon.sh |
#!/usr/bin/env python
"""Get data about the lengths of the annotated sequences"""
import sys, argparse, gzip, re, os, inspect
from seqtools.format.gpd import GPDStream
def main(args):
inf = None
if re.search('\.gz',args.best_gpd):
inf = gzip.open(args.best_gpd)
else:
inf = open(args.best_gpd)
gs = GP... | unknown | codeparrot/codeparrot-clean | ||
# stdlib
import tempfile
import time
# project
from tests.checks.common import AgentCheckTest, Fixtures
class NagiosTestCase(AgentCheckTest):
CHECK_NAME = 'nagios'
NAGIOS_TEST_LOG = Fixtures.file('nagios.log')
NAGIOS_TEST_HOST = Fixtures.file('host-perfdata')
NAGIOS_TEST_SVC = Fixtures.file('service-p... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU L... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
Admin site configuration for third party authentication
"""
from config_models.admin import KeyedConfigurationModelAdmin
from django import forms
from django.contrib import admin
from django.urls import reverse
from django.db import DatabaseError, transaction
from django.utils.translation im... | unknown | codeparrot/codeparrot-clean | ||
# (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
DOCUMENTATION = """
name: varnames
author: Ansible Core Team
version_added: "2.8"
short_description: Lookup matching variable names
description:... | python | github | https://github.com/ansible/ansible | lib/ansible/plugins/lookup/varnames.py |
from msg_handler import db, logger
from sqlalchemy.orm import backref
from sqlalchemy import event
import datetime
# Create user model.
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
first_name = db.Column(db.String(100))
last_name = db.Column(db.String(100))
email = db.Column(db.S... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015, Pinterest, 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 writ... | unknown | codeparrot/codeparrot-clean | ||
# Migrating to 3.0.0
- The return type for `ServiceRequest::app_data::<T>()` was changed from returning a `Data<T>` to simply a `T`. To access a `Data<T>` use `ServiceRequest::app_data::<Data<T>>()`.
- Cookie handling has been offloaded to the `cookie` crate:
- `USERINFO_ENCODE_SET` is no longer exposed. Percent-en... | unknown | github | https://github.com/actix/actix-web | actix-web/MIGRATION-3.0.md |
#!/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 | ||
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 ... | 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/models/log.py |
# (c) 2013-2016, Michael DeHaan <michael.dehaan@gmail.com>
# Stephen Fromm <sfromm@gmail.com>
# Brian Coca <briancoca+dev@gmail.com>
# Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under t... | unknown | codeparrot/codeparrot-clean | ||
import olsr_1d_utils
def solveLinearRegression(X, Y):
(a, b) = olsr_1d_utils.calculateCoefficients(X, Y)
Yhat = olsr_1d_utils.calculateYhat(a, b, X)
olsr_1d_utils.plotDataAndPrediction(X,Y,Yhat)
r2 = olsr_1d_utils.calculateRSquared(Y, Yhat)
print("a:", a, "b:", b)
print("the r-squared is:", ... | 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/ha/ActiveStandbyElector.java |
"""Command-line support for Coverage."""
import optparse, os, sys, time, traceback
from coverage.backward import sorted # pylint: disable=W0622
from coverage.execfile import run_python_file, run_python_module
from coverage.misc import CoverageException, ExceptionDuringRun, NoSource
from coverage.debug ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
import zipfile
import numpy as np
from six.moves import urllib
from six.moves import xrange
import tensorflow as tf
# Step 1: Download the data.
url = 'h... | unknown | codeparrot/codeparrot-clean | ||
{
"name": "serve",
"command": "ng serve [project]",
"shortDescription": "Builds and serves your application, rebuilding on file changes.",
"aliases": [
"dev",
"s"
],
"deprecated": false,
"options": [
{
"name": "allowed-hosts",
"type": "boolean",
"description": "The hosts that... | json | github | https://github.com/angular/angular | adev/src/content/cli/serve.json |
import os
import shutil
import sys
import tempfile
try:
from twisted.trial.unittest import TestCase
except ImportError:
from unittest import TestCase
from wok import renderers
from wok.engine import Engine
DefaultRenderers = {}
def setUpModule():
for renderer in renderers.all:
DefaultRenderers.u... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- 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 absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | unknown | codeparrot/codeparrot-clean | ||
from rope.base import evaluate
from rope.base import exceptions
from rope.base import libutils
from rope.base import pynames
from rope.base import taskhandle
from rope.base import utils
from rope.base import worder
from rope.base.change import ChangeSet, ChangeContents
from rope.refactor import sourceutils, occurrences... | unknown | codeparrot/codeparrot-clean | ||
"""Sensor from an SQL Query."""
import datetime
import decimal
import logging
import sqlalchemy
from sqlalchemy.orm import scoped_session, sessionmaker
import voluptuous as vol
from homeassistant.components.recorder import CONF_DB_URL, DEFAULT_DB_FILE, DEFAULT_URL
from homeassistant.components.sensor import PLATFORM_... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package replacefile
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
// AtomicWriteFile uses a temporary file along with this package's AtomicRename
// function in order to provide a replacement for ioutil.WriteFile that
// writes the given f... | go | github | https://github.com/hashicorp/terraform | internal/replacefile/writefile.go |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Matt Wright <matt@nobien.net>
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007 CAMP
# Copyright (C) 2007-2008 CAMd
# Please see the accompanying LICENSE file for further information.
"""This module defines a PAW-class.
The central object that glues everything together!"""
import numpy as np
from ase.units import Bohr, Hartree
from ase.dft imp... | unknown | codeparrot/codeparrot-clean | ||
---
apiVersion: v1
kind: Namespace
metadata:
name: jaeger
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jaeger-agent
namespace: jaeger
labels:
app: jaeger-agent
spec:
replicas: 1
selector:
matchLabels:
app: jaeger-agent
template:
metadata:
labels:
app: jaeger-age... | unknown | github | https://github.com/grafana/grafana | apps/iam/local/yamls/jaeger.yaml |
#!/usr/bin/env python
from __future__ import print_function
import sys, gym, time
#
# Test yourself as a learning agent! Pass environment name as a command-line argument, for example:
#
# python keyboard_agent.py SpaceInvadersNoFrameskip-v4
#
env = gym.make('SpaceInvaders-v0' if len(sys.argv)<2 else sys.argv[1])
if... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
from plasTeX import Command, Environment
from plasTeX.Base import textbf, textit, textsl, textrm, textsf
from plasTeX.Base import List, label, newcommand, newenvironment
from plasTeX.Base import renewcommand, renewenvironment
from plasTeX.Base import itemize, enumerate_, description
from plasTeX.... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2018 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... | go | github | https://github.com/tensorflow/tensorflow | tensorflow/go/attrs_test.go |
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wger W... | unknown | codeparrot/codeparrot-clean | ||
{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v2alpha1",
"metadata": {
"name": "test-v2alpha1-complete",
"labels": {
"category": "test"
},
"annotations": {
"description": "Complete example of v2alpha1 dashboard features"
}
},
"spec": {
"annotations": [
{... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.complete.json |
# Copyright 2015 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 | ||
from test import support
from test.test_json import PyTest, CTest
class JSONTestObject:
pass
class TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
try:
self.dumps(x)
except ValueError as exc:
self.assertEqual(exc.__notes__, ["when seriali... | python | github | https://github.com/python/cpython | Lib/test/test_json/test_recursion.py |
# (C) 2013, Markus Wildi, markus.wildi@bluewin.ch
#
# 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, or (at your option)
# any later version.
#
# This program is distr... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2017-09-08 10:00:22
# Project: drzj
from pyspider.libs.base_handler import *
from pymongo import MongoClient
import json
# db.spider_drzj_image.find({'speciesName':'阿修罗'})
# db.runCommand({"distinct":"spider_drzj_image", "key":"speciesName"})
# db.spider_dr... | unknown | codeparrot/codeparrot-clean | ||
import datetime
from unittest import TestCase
from pymysql._compat import PY2
from pymysql import converters
__all__ = ["TestConverter"]
class TestConverter(TestCase):
def test_escape_string(self):
self.assertEqual(
converters.escape_string(u"foo\nbar"),
u"foo\\nbar"
)
... | unknown | codeparrot/codeparrot-clean | ||
import * as ts from "../../../_namespaces/ts.js";
import { extractTest } from "./helpers.js";
function testExtractRangeFailed(caption: string, s: string, expectedErrors: readonly string[]) {
return it(caption, () => {
const t = extractTest(s);
const file = ts.createSourceFile("a.ts", t.source, ts.S... | typescript | github | https://github.com/microsoft/TypeScript | src/testRunner/unittests/services/extract/ranges.ts |
#!/usr/bin/env python
# Copyright (C) 2015 The Android Open Source Project
#
# 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 b... | unknown | codeparrot/codeparrot-clean | ||
str1 = "あ" * 1024 + "い" # not single byte optimizable
str2 = "い"
100_000.times { str1.index(str2) } | ruby | github | https://github.com/ruby/ruby | benchmark/string_index.rb |
from sympy.mpmath import *
def test_approximation():
mp.dps = 15
f = lambda x: cos(2-2*x)/x
p, err = chebyfit(f, [2, 4], 8, error=True)
assert err < 1e-5
for i in range(10):
x = 2 + i/5.
assert abs(polyval(p, x) - f(x)) < err
def test_limits():
mp.dps = 15
assert limit(lamb... | unknown | codeparrot/codeparrot-clean | ||
import httplib
import functools
from modularodm.exceptions import NoResultsFound
from modularodm.storage.base import KeyExistsException
from framework.auth.decorators import must_be_signed
from framework.exceptions import HTTPError
from website.models import User
from website.models import Node
from website.addons.o... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | python | github | https://github.com/tensorflow/tensorflow | tensorflow/compiler/tests/fifo_queue_test.py |
#!/usr/bin/env bash
set -eux
export ANSIBLE_GATHERING=explicit
ansible-playbook test_includes.yml -i ../../inventory "$@"
ansible-playbook inherit_notify.yml "$@"
echo "EXPECTED ERROR: Ensure we fail if using 'include' to include a playbook."
set +e
result="$(ansible-playbook -i ../../inventory include_on_playbook... | unknown | github | https://github.com/ansible/ansible | test/integration/targets/includes/runme.sh |
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# This file incorporates work covered by the following license noti... | unknown | codeparrot/codeparrot-clean | ||
import os
import warnings
from pathlib import Path
import pytest
from scrapy.utils.misc import set_environ
from scrapy.utils.project import data_path, get_project_settings
@pytest.fixture
def proj_path(tmp_path):
prev_dir = Path.cwd()
project_dir = tmp_path
try:
os.chdir(project_dir)
Pat... | python | github | https://github.com/scrapy/scrapy | tests/test_utils_project.py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FIXME: This doesn't really provide a means for people to ask for
# the service and release the service. The problem this
# causes is that the selector has no simple means of shutting
# down when no one is using it.
#
# Copyright 2010 British Broadca... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class WizCreateFic... | unknown | codeparrot/codeparrot-clean | ||
---
title: useLocation
---
# useLocation
<!--
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
Thank you for helping improve our documentation!
This file is auto-generated from the JSDoc comments in the source
code, so please edit the JSDoc comments in the file below and this
file will be re-generated once those changes are merged.
https://... | unknown | github | https://github.com/remix-run/react-router | docs/api/hooks/useLocation.md |
global:
extra_scrape_metrics: false
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:8080'] | unknown | github | https://github.com/prometheus/prometheus | config/testdata/global_disable_extra_scrape_metrics.good.yml |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | unknown | github | https://github.com/huggingface/transformers | docs/source/en/model_doc/kosmos2_5.md |
/* Copyright (c) 2007, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including... | c | github | https://github.com/mysql/mysql-server | include/lf_types.h |
import lldb
import re
import testutils as test
def runScenario(assembly, debugger, target):
process = target.GetProcess()
res = lldb.SBCommandReturnObject()
ci = debugger.GetCommandInterpreter()
# Run debugger, wait until libcoreclr is loaded,
# set breakpoint at Test.Main and stop there
test.... | unknown | codeparrot/codeparrot-clean | ||
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | unknown | codeparrot/codeparrot-clean | ||
import * as React from "react";
import * as ReactDOM from "react-dom/client";
import App from "./app";
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>,
); | typescript | github | https://github.com/remix-run/react-router | examples/error-boundaries/src/main.tsx |
import decimal
import json
import re
from django.core import serializers
from django.core.serializers.base import DeserializationError
from django.db import models
from django.test import TestCase, TransactionTestCase
from django.test.utils import isolate_apps
from .models import Score
from .tests import SerializersT... | python | github | https://github.com/django/django | tests/serializers/test_jsonl.py |
/*
* 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 | android/guava/src/com/google/common/graph/NetworkBuilder.java |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Afterburn <https://github.com/afterburn>
# (c) 2013, Aaron Bull Schaefer <aaron@elasticdog.com>
# (c) 2015, Jonathan Lestrelin <jonathan.lestrelin@gmail.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __futu... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: UTF-8 -*
import os
from app import create_app, db
from app.models import User, Role, Permission, Coupon, SecKill, Datemark
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('ATH_CONFIG') or 'default')
manager = Manag... | unknown | codeparrot/codeparrot-clean | ||
function foo() {
let x = 1;
let y = 2;
if (y === 2) {
x = 3;
}
if (y === 3) {
x = 5;
}
y = x;
}
export const FIXTURE_ENTRYPOINT = {
fn: foo,
params: [],
isComponent: false,
}; | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-complex-multiple-if.js |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Manage your Nagios on-call roster with Google apps.
Usage:
googios --help
googios setup
googios <roster> current [start end name email phone] [--echo]
googios <roster> query [--start=<start> --end=<end> | --at=<at>] [--echo]
googios <roster> repor... | unknown | codeparrot/codeparrot-clean | ||
from numpy import meshgrid, ndarray, array_equal, allclose, array, sqrt, zeros, asarray, where, ones
from test_utils import LocalTestCase
from thunder.extraction.source import Source, SourceModel
class TestSourceConstruction(LocalTestCase):
def test_source(self):
"""
(SourceConstruction) create
... | unknown | codeparrot/codeparrot-clean | ||
from django.forms.widgets import Textarea
from django.template import loader, Context
from django.templatetags.static import static
from django.utils import translation
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
# Creating a template context that c... | unknown | codeparrot/codeparrot-clean | ||
from typing import Dict, Type
from mlagents.trainers.exception import UnityTrainerException
from mlagents.trainers.settings import RewardSignalSettings, RewardSignalType
from mlagents.trainers.torch.components.reward_providers.base_reward_provider import (
BaseRewardProvider,
)
from mlagents.trainers.torch.compon... | unknown | codeparrot/codeparrot-clean | ||
(function(QUnit) {
var view;
QUnit.module('Backbone.View', {
beforeEach: function() {
$('#qunit-fixture').append(
'<div id="testElement"><h1>Test</h1></div>'
);
view = new Backbone.View({
id: 'test-view',
className: 'test-view',
other: 'non-special-option'
... | javascript | github | https://github.com/lodash/lodash | vendor/backbone/test/view.js |
// Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package cli
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
"github.com/cockro... | go | github | https://github.com/cockroachdb/cockroach | pkg/cli/debug_send_kv_batch_test.go |
"""Test that sys.modules is used properly by import."""
from .. import util
from . import util as import_util
import sys
from types import MethodType
import unittest
class UseCache(unittest.TestCase):
"""When it comes to sys.modules, import prefers it over anything else.
Once a name has been resolved, sys.mo... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import, unicode_literals
from django.template import engines
from django.template.loader import render_to_string
from django.test import TestCase
from wagtail import __version__
from wagtail.tests.testapp.blocks import SectionBlock
from wagtail.wagtailcore import blocks
from wagtail.wa... | unknown | codeparrot/codeparrot-clean | ||
import pytest
from httpie.compat import is_windows
from httpie.output.streams import BINARY_SUPPRESSED_NOTICE
from utils import http, TestEnvironment
from fixtures import BIN_FILE_CONTENT, BIN_FILE_PATH
class TestStream:
# GET because httpbin 500s with binary POST body.
@pytest.mark.skipif(is_windows,
... | unknown | codeparrot/codeparrot-clean | ||
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | java | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestWrapper.java |
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :resque
Resque.inline = true | ruby | github | https://github.com/rails/rails | activejob/test/adapters/resque.rb |
{
// The version of the config file format. Do not change, unless
// you know what you are doing.
"version": 1,
// The name of the project being benchmarked
"project": "numpy",
// The project's homepage
"project_url": "https://numpy.org",
// The URL or local path of the source code r... | json | github | https://github.com/numpy/numpy | benchmarks/asv.conf.json |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.