code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# 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 applicabl... | python | github | https://github.com/huggingface/transformers | src/transformers/models/fast_vlm/__init__.py |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unknown | codeparrot/codeparrot-clean | ||
import operator
import uuid
from unittest import mock
from django import forms
from django.core import serializers
from django.core.exceptions import ValidationError
from django.core.serializers.json import DjangoJSONEncoder
from django.db import (
DataError,
IntegrityError,
NotSupportedError,
Operatio... | python | github | https://github.com/django/django | tests/model_fields/test_jsonfield.py |
from esc import NUL
import esccmd
import escio
from escutil import AssertEQ, knownBug
from esctypes import Rect
class ChangeDynamicColorTests(object):
@knownBug(terminal="iTerm2", reason="Color reporting not implemented.", shouldTry=False)
def test_ChangeDynamicColor_Multiple(self):
"""OSC 4 ; c1 ; spec1 ; s2 ... | unknown | codeparrot/codeparrot-clean | ||
"""Wrapper class for databases."""
from abc import ABC, abstractmethod
from inspect import Traceback
import json
import logging
import os.path
import tempfile
from typing import Iterable, List, Sequence
import warnings
import time
from acton.proto.acton_pb2 import Database as DatabasePB
import astropy.io.ascii as io_... | unknown | codeparrot/codeparrot-clean | ||
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
... | 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-beans/src/main/java/org/springframework/beans/factory/aot/AotBeanProcessingException.java |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2011-2013, Regents of the University of California
# Alexander Afanasyev
#
# GNU 3.0 license, See the LICENSE file for more information
#
# Author: Alexander Afanasyev <alexander.afanasyev@ucla... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2012-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-boot | core/spring-boot/src/test/java/org/springframework/boot/info/OsInfoTests.java |
//// [tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts] ////
//// [FunctionDeclaration11_es6.ts]
function * yield() {
}
//// [FunctionDeclaration11_es6.js]
"use strict";
function* yield() {
} | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/FunctionDeclaration11_es6.js |
/** @import { Expression, PropertyDefinition } from 'estree' */
/** @import { Context } from '../types.js' */
import * as b from '#compiler/builders';
import { get_rune } from '../../../scope.js';
/**
* @param {PropertyDefinition} node
* @param {Context} context
*/
export function PropertyDefinition(node, context) ... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/src/compiler/phases/3-transform/server/visitors/PropertyDefinition.js |
# -*- 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 | ||
---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws-best-practices.html
---
# Best Practices in AWS [cloud-aws-best-practices]
This section contains some other information about designing and managing an {{es}} cluster on your own AWS infrastructure. If you would prefer to av... | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/elasticsearch-plugins/cloud-aws-best-practices.md |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
VMware Inventory Script
=======================
Retrieve information about virtual machines from a vCenter server or
standalone ESX host. When `group_by=false` (in the INI file), host systems
are also returned in addition to VMs.
This script will attempt to read conf... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package arguments
import (
"github.com/hashicorp/terraform/internal/tfdiags"
)
// Show represents the command-line arguments for the show command.
type Show struct {
// Path is the path to the state file or plan file to be displayed. If
// unsp... | go | github | https://github.com/hashicorp/terraform | internal/command/arguments/show.go |
// @validateNoCapitalizedCalls
function Foo() {
let x = Bar;
x(); // ERROR
} | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.capitalized-function-call-aliased.js |
#!/usr/bin/env python3
import argparse
import contextlib
import copy
import glob
import json
import os
import platform
import re
import shutil
import signal
import subprocess
import sys
import sysconfig
import tempfile
import time
from collections import defaultdict
from collections.abc import Sequence
from contextlib... | python | github | https://github.com/pytorch/pytorch | test/run_test.py |
# example.js
``` javascript
function getTemplate(templateName, callback) {
require(["../require.context/templates/"+templateName], function(tmpl) {
callback(tmpl());
});
}
getTemplate("a", function(a) {
console.log(a);
});
getTemplate("b", function(b) {
console.log(b);
});
```
# dist/output.js
``` javascript
/... | unknown | github | https://github.com/webpack/webpack | examples/code-splitted-require.context-amd/README.md |
# (C) 2014-2015, Matt Martz <matt@sivel.net>
# (C) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Perforce Defect Tracking Integration Project
# <http://www.ravenbrook.com/project/p4dti/>
#
# COVERAGE.PY -- COVERAGE TESTING
#
# Gareth Rees, Ravenbrook Limited, 2001-12-04
#
#
# 1. INTRODUCTION
#
# This module provides coverage testing f... | unknown | codeparrot/codeparrot-clean | ||
- Feature Name: SQL step-wise execution
- Status: in-progress
- Start Date: 2019-10-14
- Authors: andrei knz nathan
- RFC PR: [#42864](https://github.com/cockroachdb/cockroach/pull/42864)
- Cockroach Issue:
[#28842](https://github.com/cockroachdb/cockroach/issues/28842)
[#33473](https://github.com/cockroachdb/cockr... | unknown | github | https://github.com/cockroachdb/cockroach | docs/RFCS/20191014_halloween.md |
# Sarah Barden
'''Takes an ISBN code and returns a map highlighting the locations of
the Author, Plot and Publisher.'''
import folium # library for data visualization on maps
from opencage.geocoder import OpenCageGeocode # geocoding service
from key import geo_key
from time import sleep
def geocode(place):
"""... | unknown | codeparrot/codeparrot-clean | ||
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:8080']
enable_compression: false | unknown | github | https://github.com/prometheus/prometheus | config/testdata/scrape_config_disable_compression.good.yml |
lazy import test.test_import.data.lazy_imports.basic2 as basic2
import sys
mod = sys.modules[__name__]
x = mod.basic2 | python | github | https://github.com/python/cpython | Lib/test/test_import/data/lazy_imports/modules_getattr.py |
from datetime import date
import unittest
from mock import Mock
from nose.tools import assert_equal
from twilio.rest.resources import MediaList
DEFAULT = {
'DateCreated<': None,
'DateCreated>': None,
'DateCreated': None,
}
class MediaTest(unittest.TestCase):
def setUp(self):
self.resource =... | unknown | codeparrot/codeparrot-clean | ||
---
apiVersion: v1
# The repository name in registry1, excluding /ironbank/
name: "elastic/elasticsearch/elasticsearch"
# List of tags to push for the repository in registry1
# The most specific version should be the first tag and will be shown
# on ironbank.dsop.io
tags:
- "${version}"
- "latest"
# Build args passed t... | unknown | github | https://github.com/elastic/elasticsearch | distribution/docker/src/docker/iron_bank/hardening_manifest.yaml |
import json
from django.contrib.auth.models import User
from onadata.apps.api.tests.viewsets.test_abstract_viewset import\
TestAbstractViewSet
from onadata.apps.api.viewsets.organization_profile_viewset import\
OrganizationProfileViewSet
from onadata.libs.permissions import OwnerRole
class TestOrganizationPr... | unknown | codeparrot/codeparrot-clean | ||
use tokio::{
runtime::Runtime,
sync::{mpsc, oneshot},
};
use criterion::{criterion_group, criterion_main, Criterion};
fn request_reply_current_thread(c: &mut Criterion) {
let rt = tokio::runtime::Builder::new_current_thread()
.build()
.unwrap();
request_reply(c, rt);
}
fn request_rep... | rust | github | https://github.com/tokio-rs/tokio | benches/sync_mpsc_oneshot.rs |
# -*- coding: utf-8 -*-
"""
werkzeug.wsgi
~~~~~~~~~~~~~
This module implements WSGI related helpers.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import os
import posixpath
import mimetypes
from itertools import... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# encoding: utf-8
import pytest
from pytest_ringo import login, transaction_begin, transaction_rollback
class TestList:
def test_GET(self, app):
login(app, "admin", "secret")
app.get("/forms/list")
class TestRead:
# FIXME: There is currently no form in the database () <... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
from ctypes import *
class SDL_array:
def __init__(self, ptr, count, ctype):
"""Construct an array at memory location `ptr` with `count` elements
of type `ctype`.
:Parameters:
`ptr` : cty... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from datetime import datetime
from coalib.output.printers.ListLogPrinter import ListLogPrinter
from coalib.output.printers.LOG_LEVEL import LOG_LEVEL
from coalib.processes.communication.LogMessage import LogMessage
class ListLogPrinterTest(unittest.TestCase):
def test_logging(self):
uut =... | unknown | codeparrot/codeparrot-clean | ||
"""Global database feature support policy.
Provides decorators to mark tests requiring specific feature support from the
target database.
External dialect test suites should subclass SuiteRequirements
to provide specific inclusion/exlusions.
"""
from . import exclusions, config
class Requirements(object):
def ... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.server.plugins.csrf
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.utils.io.*
/**
* A configuration for the [io.kt... | kotlin | github | https://github.com/ktorio/ktor | ktor-server/ktor-server-plugins/ktor-server-csrf/common/src/io/ktor/server/plugins/csrf/CSRFConfig.kt |
- name: sharded_cluster_fixture_options
value:
executor:
fixture:
inject_catalog_metadata:
admin_db: True
- name: exclude_injected_catalog_metadata_tag
value:
exclude_with_any_tags:
- injected_catalog_metadata_incompatible | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/matrix_suites/overrides/injected_catalog_metadata.yml |
/**
* Should produce 3 scopes:
*
* a: inputs=props.a, outputs=a
* a = compute(props.a);
* b: inputs=props.b, outputs=b
* b = compute(props.b);
* return: inputs=a, b outputs=return
* return = <Foo a={a} b={b} />
*/
function Component(props) {
const a = compute(props.a);
const b = compute(props.b);
r... | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.js |
name: test-scripts-and-ci-tools
on:
push:
branches:
- main
paths:
- scripts/lumen_cli/**
- .github/workflows/tools-unit-tests.yml
pull_request:
paths:
- scripts/lumen_cli/**
- .github/workflows/tools-unit-tests.yml
concurrency:
group: ${{ github.workflow }}-${{ github.e... | unknown | github | https://github.com/pytorch/pytorch | .github/workflows/tools-unit-tests.yml |
<table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th colspan="2" halign="left">a</th>
</tr>
<tr>
<th></th>
<th>b</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td... | html | github | https://github.com/pandas-dev/pandas | pandas/tests/io/formats/data/html/index_unnamed_standard_columns_unnamed_multi.html |
/*
* Copyright (C) 2012 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-tests/test/com/google/common/collect/ImmutableRangeMapTest.java |
"""Middleware for embargoing site and courses.
IMPORTANT NOTE: This code WILL NOT WORK if you have a misconfigured proxy
server. If you are configuring embargo functionality, or if you are
experiencing mysterious problems with embargoing, please check that your
reverse proxy is setting any of the well known client IP... | unknown | codeparrot/codeparrot-clean | ||
import {
EMPTY_ARR,
PatchFlags,
ShapeFlags,
SlotFlags,
extend,
isArray,
isFunction,
isObject,
isOn,
isString,
normalizeClass,
normalizeStyle,
} from '@vue/shared'
import {
type ClassComponent,
type Component,
type ComponentInternalInstance,
type ConcreteComponent,
type Data,
isClassC... | typescript | github | https://github.com/vuejs/core | packages/runtime-core/src/vnode.ts |
/*
* 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/scheduling/config/ScheduledTask.java |
<?php
namespace Illuminate\Database\Schema;
use Illuminate\Database\Connection;
use Illuminate\Support\Collection;
class PostgresSchemaState extends SchemaState
{
/**
* Dump the database's schema into a file.
*
* @param \Illuminate\Database\Connection $connection
* @param string $path
... | php | github | https://github.com/laravel/framework | src/Illuminate/Database/Schema/PostgresSchemaState.php |
/*-------------------------------------------------------------------------
*
* gistbuild.c
* build algorithm for GiST indexes implementation.
*
* There are two different strategies:
*
* 1. Sort all input tuples, pack them into GiST leaf pages in the sorted
* order, and create downlinks and internal pages ... | c | github | https://github.com/postgres/postgres | src/backend/access/gist/gistbuild.c |
#@+leo-ver=5-thin
#@+node:2014spring.20140509071814.2435: * @file cmsimply.py
'''
Copyright © 2014 Chiaming Yen
CMSimply 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 | ||
from __future__ import unicode_literals
import datetime
import re
import sys
import warnings
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
from django.contrib.auth.models import User
from django.core import serializers
from django.core.exceptions i... | 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/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ConsumerAssignmentPoller.java |
import def, { named, __esModule } from "./module";
import * as ns from "./module";
it("should allow to import module with getters", () => {
expect(def).toBe("default");
expect(named).toBe("named");
expect(__esModule).toBe(true);
expect(ns.default).toBe("default");
expect(ns.named).toBe("named");
expect(ns.__esMo... | javascript | github | https://github.com/webpack/webpack | test/cases/cjs-tree-shaking/esModule-getter/index.js |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0005_placement_promo_uid'),
]
operations = [
migrations.AlterField(
model... | unknown | codeparrot/codeparrot-clean | ||
""" Utility for prompting users
"""
from DIRAC import S_OK, S_ERROR
from six.moves import input
def promptUser( message, choices = [], default = 'n', logger = None ):
""" Prompting users with message, choices by default are 'y', 'n'
"""
if logger is None:
from DIRAC import gLogger
logger = gLogger
if... | unknown | codeparrot/codeparrot-clean | ||
//===--- GenControl.cpp - IR Generation for Control Flow ------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... | cpp | github | https://github.com/apple/swift | lib/IRGen/GenControl.cpp |
import cStringIO
from pathod import language
from pathod.language import http, base
import tutils
def parse_request(s):
return language.parse_pathoc(s).next()
def test_make_error_response():
d = cStringIO.StringIO()
s = http.make_error_response("foo")
language.serve(s, d, {})
class TestRequest:
... | unknown | codeparrot/codeparrot-clean | ||
# ScummVM - Graphic Adventure Engine
#
# ScummVM is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT
# file distributed with this source distribution.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... | unknown | codeparrot/codeparrot-clean | ||
from nose.tools import eq_
from django.test.client import RequestFactory
from crashstats.base.tests.testbase import TestCase
from crashstats.base.helpers import (
change_query_string
)
class TestChangeURL(TestCase):
def test_root_url_no_query_string(self):
context = {}
context['request'] = R... | unknown | codeparrot/codeparrot-clean | ||
import random
import math
from math import log2
from math import ceil
def play_one_game():
inputMessage = "Please enter 2 values for range:"
rangeStart = 0
rangeEnd = 0
requestingValidInput = True
while ( requestingValidInput ):
try:
rangeStart, rangeEnd = [int(x) for x in inpu... | 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 | ||
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright © 2015 Mattia Rizzolo <mattia@mapreri.org>
# Copyright © 2015-2017 Holger Levsen <holger@layer-acht.org>
# Based on reproducible_scheduler.sh © 2014-2015 Holger Levsen <holger@layer-acht.org>
# Licensed under GPL-2
#
# Depends: python3 python3-debian
#
# Schedule... | unknown | codeparrot/codeparrot-clean | ||
// Compiler:
//
// Run-time:
// status: 0
#[cfg(target_arch = "x86_64")]
use std::arch::{asm, global_asm};
#[cfg(target_arch = "x86_64")]
global_asm!(
"
.global add_asm
add_asm:
mov rax, rdi
add rax, rsi
ret"
);
#[cfg(target_arch = "x86_64")]
extern "C" {
fn add_asm(a: i64, b: i64) -> i6... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_codegen_gcc/tests/run/asm.rs |
/*
* 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 | connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.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 | ||
#pragma once
#include <ATen/Context.h>
#include <ATen/native/transformers/attention.h>
#include <ATen/native/transformers/sdp_utils_cpp.h>
#include <ATen/native/transformers/xpu/flash_attn/utils.h>
#include <ATen/xpu/XPUContext.h>
namespace sdp {
C10_EXPORT bool is_flash_attention_available();
C10_EXPORT bool can_us... | c | github | https://github.com/pytorch/pytorch | aten/src/ATen/native/transformers/xpu/sdp_utils.h |
from error import *
from tokens import *
from events import *
from nodes import *
from loader import *
from dumper import *
__version__ = '3.09'
try:
from cyaml import *
__with_libyaml__ = True
except ImportError:
__with_libyaml__ = False
def scan(stream, Loader=Loader):
"""
Scan a YAML stream ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
***************************************************************************
PredicatePanel.py
---------------------
Date : January 2015
Copyright : (C) 2015 by Arnaud Morvan
Email : arnaud dot morvan at camptocamp dot com
Con... | unknown | codeparrot/codeparrot-clean | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 | ||
import {useState} from 'react';
function Foo() {
const [state, setState] = useState({foo: {bar: 3}});
const foo = state.foo;
foo.bar = 1;
return state;
} | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.modify-state-2.js |
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import get_cache
from django.utils.six.moves import xrange
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
'''
simple antenna tracker simulator core
'''
from aircraft import Aircraft
import util, time, math
from math import degrees, radians
from rotmat import Vector3
class Tracker(Aircraft):
'''a simple antenna tracker'''
def __init__(self,
onoff=False,
yawra... | unknown | codeparrot/codeparrot-clean | ||
use crate::de::identifier;
use crate::de::{
deserialize_seq, expr_is_missing, field_i, has_flatten, wrap_deserialize_field_with,
FieldWithAliases, Parameters, StructForm,
};
#[cfg(feature = "deserialize_in_place")]
use crate::de::{deserialize_seq_in_place, place_lifetime};
use crate::fragment::{Expr, Fragment, ... | rust | github | https://github.com/serde-rs/serde | serde_derive/src/de/struct_.rs |
#!/usr/bin/python
# Copyright: (c) 2016-2017, Hewlett Packard Enterprise Development LP
# 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 | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, 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.... | unknown | codeparrot/codeparrot-clean | ||
from pygame import Rect
from albow.resource import get_image
class ImageArray(object):
def __init__(self, image, shape):
self.image = image
self.shape = shape
if isinstance(shape, tuple):
self.nrows, self.ncols = shape
else:
self.nrows = 1
self.n... | unknown | codeparrot/codeparrot-clean | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 except in compli... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2024 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal;
import java.lang.instrument.Instrumentation;
/**
* Allows users to specify Mockito as a Java agent where the {@link Instrumentation}
* instance is stored for use by t... | java | github | https://github.com/mockito/mockito | mockito-core/src/main/java/org/mockito/internal/PremainAttach.java |
/*
* Copyright 2012-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-boot | core/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/TestConditionalOnClass.java |
# Copyright (C) 2010 Google Inc. 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 conditions and the ... | unknown | codeparrot/codeparrot-clean | ||
from combinatorics import xuniqueCombinations
class node:
def __init__(self, id):
self.id = id
self.counter = 0
self.in_ = set()
self.out = set()
def __str__(self):
return str(self.__dict__)
def key(items):
return "->".join([x.id for x in items])
class pairs_stor... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | unknown | codeparrot/codeparrot-clean | ||
DVM_PERMISSIONS_BY_PERMISSION = {
"BIND_DEVICE_ADMIN" : {
"Landroid/app/admin/DeviceAdminReceiver;" : [
("C", "ACTION_DEVICE_ADMIN_ENABLED", "Ljava/lang/String;"),
],
"Landroid/app/admin/DevicePolicyManager;" : [
("F", "getRemoveWarning", "(Landroid/content/ComponentName; Landroid/os/RemoteCallback;)"),
("F", ... | unknown | codeparrot/codeparrot-clean | ||
"""
34. Generic relations
Generic relations let an object have a foreign key to any object through a
content-type/object-id field. A ``GenericForeignKey`` field can point to any
object, be it animal, vegetable, or mineral.
The canonical example is tags (although this example implementation is *far*
from complete).
""... | unknown | codeparrot/codeparrot-clean | ||
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.postgresql.features import (
DatabaseFeatures as PsycopgDatabaseFeatures,
)
class DatabaseFeatures(BaseSpatialFeatures, PsycopgDatabaseFeatures):
supports_geography = True
supports_3d_storage = True
sup... | python | github | https://github.com/django/django | django/contrib/gis/db/backends/postgis/features.py |
from django.http import Http404
from django.shortcuts import get_object_or_404, render
from django_tables2 import RequestConfig
from .models import *
from .services import *
from .tables import *
def game_list(r):
games = tablify(get_game_list(),
GameListTable, r)
context = {'games': games}... | unknown | codeparrot/codeparrot-clean | ||
# You are given an n x n 2D matrix representing an image.
# Rotate the image by 90 degrees (clockwise).
# Note:
# You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
# Example 1:
# Given input matrix =
# [
# [1... | unknown | codeparrot/codeparrot-clean | ||
#include "jemalloc/internal/jemalloc_preamble.h"
#include "jemalloc/internal/jemalloc_internal_includes.h"
#include "jemalloc/internal/hpdata.h"
static int
hpdata_age_comp(const hpdata_t *a, const hpdata_t *b) {
uint64_t a_age = hpdata_age_get(a);
uint64_t b_age = hpdata_age_get(b);
/*
* hpdata ages are operatio... | c | github | https://github.com/redis/redis | deps/jemalloc/src/hpdata.c |
# coding=UTF8
## This file is part of VideoTester
## See https://github.com/Enchufa2/video-tester for more information
## Copyright 2011-2016 Iñaki Úcar <iucar@fedoraproject.org>
## This program is published under a GPLv3 license
import numpy as np
class YUVVideo:
'''
YUV parser.
'''
def __init__(self... | unknown | codeparrot/codeparrot-clean | ||
from mock import Mock
from ceph_deploy import install
class TestSanitizeArgs(object):
def setup(self):
self.args = Mock()
# set the default behavior we set in cli.py
self.args.default_release = False
self.args.stable = None
def test_args_release_not_specified(self):
s... | unknown | codeparrot/codeparrot-clean | ||
"""this is python equivalent of ./Wrapping/Tcl/vtktesting/backdrop.tcl
This script is used while running python tests translated from Tcl."""
import vtk
basePlane = None
baseMapper = None
base = None
backPlane = None
backMapper = None
back = None
leftPlane = None
leftMapper = None
left = None
def BuildBackdrop (mi... | unknown | codeparrot/codeparrot-clean | ||
#pragma once
#ifdef USE_XNNPACK
#include <ATen/core/ivalue.h>
#include <ATen/native/xnnpack/Common.h>
#include <ATen/Tensor.h>
namespace at::native::xnnpack {
using SerializationTypeLinearPrePack = std::tuple<
Tensor,
std::optional<Tensor>,
std::optional<Scalar>,
std::optional<Scalar>>;
using Serial... | c | github | https://github.com/pytorch/pytorch | aten/src/ATen/native/xnnpack/OpContext.h |
/*
* 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/clients/admin/AlterReplicaLogDirsOptions.java |
# 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 applica... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# 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',
'status': ['st... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2019 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/apis/apiserverinternal/doc.go |
#![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::runtime::{driver, io};
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self as std_io, Read};
use std::sync::{Arc, Weak};
use std::time::Duration;
/// Responsible for registering wakeups when an OS signal ... | rust | github | https://github.com/tokio-rs/tokio | tokio/src/runtime/signal/mod.rs |
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/// \file list_of.hpp
/// \brief Include support for list constrains for the bimap container
#ifn... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/bimap/list_of.hpp |
from pkgutil import iter_modules
import sys
def scan(package, ignore=None, handle_error=None):
"""Scan a package by importing it.
A framework can provide registration decorators: a decorator that
when used on a class or a function causes it to be registered with
the framework. Metaclasses can also be ... | unknown | codeparrot/codeparrot-clean | ||
"""colorized unittest output
taken from https://github.com/stevematney/redgreenunittests
"""
import sys
from pygments import highlight
from pygments.lexers import PythonTracebackLexer
from pygments.formatters import TerminalFormatter
import unittest
OKGREEN = '\033[92m'
SKIP = '\033[93m'
WARNING = '\033[94m'
FAIL ... | unknown | codeparrot/codeparrot-clean | ||
from django.http import HttpResponse
from django.test import RequestFactory, SimpleTestCase
from django.test.utils import override_settings
class SecurityMiddlewareTest(SimpleTestCase):
def middleware(self, *args, **kwargs):
from django.middleware.security import SecurityMiddleware
return Security... | python | github | https://github.com/django/django | tests/middleware/test_security.py |
"""
Shared methods for Index subclasses backed by ExtensionArray.
"""
from __future__ import annotations
from inspect import signature
from typing import (
TYPE_CHECKING,
TypeVar,
)
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.generic import ABCDataFrame
from pandas.core.index... | python | github | https://github.com/pandas-dev/pandas | pandas/core/indexes/extension.py |
/* Copyright (c) 2016, 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 (incl... | c | github | https://github.com/mysql/mysql-server | libservices/mysql_keyring_service.c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.