code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
import sys
from ctypes.util import find_library
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import (Database,
DatabaseWrapper as SQLiteDatabaseWrapper,
DatabaseFeatures as SQLiteDatabaseFeatures, SQLiteCursorWrapper)
from django.... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module represents a direct implementation of `section 3.4`_ of the spec.
Terminology:
* Client: software interfacing with an OAuth API
* Server: the API provider
* Resource Owner: the user who is granting authoriza... | unknown | codeparrot/codeparrot-clean | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.utils import NumpyRNGContext
from astropy.visualization.interval import (ManualInterval,
MinMaxInterval,
PercentileInter... | unknown | codeparrot/codeparrot-clean | ||
/* contrib/seg/seg--1.2--1.3.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION seg UPDATE TO '1.3'" to load this file. \quit
--
-- Get rid of unnecessary compress and decompress support functions.
--
-- To be allowed to drop the opclass entry for a support fun... | sql | github | https://github.com/postgres/postgres | contrib/seg/seg--1.2--1.3.sql |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' implementation for svn.
"""
# Copyright (C) 2003, 2004 Chris Larson
# Copyright (C) 2004 Marcin Juszkiewicz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <ngx_md5.h>
typedef struct {
ngx_http_complex_value_t *variable;
ngx_http_complex_value_t *md5;
ngx_str_t secret;
} ngx_http_secure_link_conf_t;
... | c | github | https://github.com/nginx/nginx | src/http/modules/ngx_http_secure_link_module.c |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 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 ver... | unknown | codeparrot/codeparrot-clean | ||
import json
import subprocess
from optparse import OptionParser
def parse_arguments():
parser = OptionParser(
prog="openstack_get_cluster_nodes",
version="0",
usage="%prog [options]")
parser.add_option(
"-k", "--key_file", type="string", default="swarm_key_1.pem",
help=... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.sparse.sparsetools import cs_graph_components as _cs_graph_components
from scipy.sparse.csr import csr_matrix
from scipy.sparse.base import isspmatrix
_msg0 = 'x must be a symmetric square matrix!'
_msg1 = _msg0 + '(has s... | unknown | codeparrot/codeparrot-clean | ||
@testable import Vapor
import VaporTestUtils
import XCTVapor
import enum NIOHTTP1.HTTPParserError
import XCTest
import AsyncHTTPClient
import NIOEmbedded
import NIOCore
import NIOConcurrencyHelpers
import class NIOPosix.ClientBootstrap
final class PipelineTests: XCTestCase {
var app: Application!
override fun... | swift | github | https://github.com/vapor/vapor | Tests/VaporTests/PipelineTests.swift |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2012 Varnish Software AS
#
# 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
... | unknown | codeparrot/codeparrot-clean | ||
"""
=================================================
Orthogonal distance regression (:mod:`scipy.odr`)
=================================================
.. currentmodule:: scipy.odr
Package Content
===============
.. autosummary::
:toctree: generated/
Data -- The data to fit.
RealData -- Dat... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python -u
import glob, os, string, sys, thread, time
# import difflib
import libxml2
###
#
# This is a "Work in Progress" attempt at a python script to run the
# various regression tests. The rationale for this is that it should be
# possible to run this on most major platforms, including those (such as
# ... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2017 - 2025 R. Thomas
* Copyright 2017 - 2025 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless req... | cpp | github | https://github.com/nodejs/node | deps/LIEF/src/ELF/SymbolVersionRequirement.cpp |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | unknown | codeparrot/codeparrot-clean | ||
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | go | github | https://github.com/kubernetes/kubernetes | pkg/apis/events/doc.go |
from south.db import db
from django.db import models
from cmsplugin_filer_teaser.models import *
from cmsplugin_filer_utils.migration import rename_tables_new_to_old
class Migration:
cms_plugin_table_mapping = (
# (old_name, new_name),
('cmsplugin_filerteaser', 'cmsplugin_filer_teaser_filerteaser'... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""'Mobile phones, devices' part of product categories dictionary.
Must hold subcategories of 'Mobile phones, devices'
category in the form of python dictionary data type.
"""
mobile_phones_devices = {('mobile phones, PDAs', 'мобильные телефоны, устройства'): {
('apple', 'apple'): {
... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""Tests of Beautiful Soup as a whole."""
import logging
import unittest
import sys
from bs4 import (
BeautifulSoup,
BeautifulStoneSoup,
)
from bs4.element import (
CharsetMetaAttributeValue,
ContentMetaAttributeValue,
SoupStrainer,
NamespacedAttribute,
)
import bs4.... | unknown | codeparrot/codeparrot-clean | ||
:host,
label {
display: inline-flex;
gap: 0.5em;
align-items: center;
}
.docs-label {
font-size: 0.875rem;
font-style: normal;
font-weight: 500;
line-height: 160%; // 1.4rem
letter-spacing: -0.00875rem;
color: var(--quaternary-contrast);
}
.docs-toggle {
position: relative;
display: inline-block... | unknown | github | https://github.com/angular/angular | adev/shared-docs/components/slide-toggle/slide-toggle.component.scss |
# Copyright (c) Jeroen Van Steirteghem
# See LICENSE
import twunnel.proxy_server
def setDefaultConfiguration(configuration, keys):
twunnel.proxy_server.setDefaultConfiguration(configuration, keys)
if "REMOTE_PROXY_SERVER" in keys:
configuration.setdefault("REMOTE_PROXY_SERVER", {})
configurat... | unknown | codeparrot/codeparrot-clean | ||
import ts from "dedent";
import * as Path from "pathe";
import * as Pathe from "pathe/utils";
import * as Babel from "../vite/babel";
import type { Context } from "./context";
import * as Params from "./params";
import * as Route from "./route";
import type { RouteManifestEntry } from "../config/routes";
export type ... | typescript | github | https://github.com/remix-run/react-router | packages/react-router-dev/typegen/generate.ts |
from test import support
import unittest
import builtins
import rlcompleter
class CompleteMe:
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
class TestRlcompleter(unittest.TestCase):
def setUp(self):
self.stdcompleter = rlcompleter.Completer()
self.completer = rlcomp... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing_extensions import Literal
from .response import Response
from ..._models import BaseModel
__all__ = ["ResponseInProgressEvent"]
class ResponseInProgressEvent(BaseModel):
"""Emitted when the response is in progress.... | python | github | https://github.com/openai/openai-python | src/openai/types/responses/response_in_progress_event.py |
# -*- coding: utf-8 -*-
#!/usr/bin/python
"""Test of line navigation output of Firefox on bugzilla's advanced
search page.
"""
from macaroon.playback import *
import utils
sequence = MacroSequence()
########################################################################
# We wait for the focus to be on a blank Fir... | unknown | codeparrot/codeparrot-clean | ||
# ******************************************************************************
# Copyright 2017-2020 Intel Corporation
#
# 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.apa... | unknown | codeparrot/codeparrot-clean | ||
# Nessi Network Simulator
#
# Authors: Juergen Ehrensberger; IICT HEIG-VD
# Creation: February 2005
#
# Copyright (c) 2003-2007 Juergen Ehrensberger
#
# This file is part of Nessi.
#
# Nessi is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | unknown | codeparrot/codeparrot-clean | ||
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobile... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
test_description='Basic fetch/push functionality.
This test checks the following functionality:
* command-line syntax
* refspecs
* fast-forward detection, and overriding it
* configuration
* hooks
* --porcelain output format
* hiderefs
* reflogs
* URL validation
'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main... | unknown | github | https://github.com/git/git | t/t5516-fetch-push.sh |
import newrelic.agent
from treeherder.etl.common import make_request
from .artifactbuilders import (BuildbotJobArtifactBuilder,
BuildbotLogViewArtifactBuilder,
BuildbotPerformanceDataArtifactBuilder)
# Max log size in bytes we will download (prior to deco... | unknown | codeparrot/codeparrot-clean | ||
#include "BenchmarkHeader.h" | cpp | github | https://github.com/llvm/llvm-project | clang-tools-extra/clangd/test/Inputs/BenchmarkSource.cpp |
"""Custom Middleware."""
# Standard
import time
import logging
from threading import local
# Cust object
_appt_thread_local = local()
LOG = logging.getLogger(__name__)
class MiddlwareBase(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
... | unknown | codeparrot/codeparrot-clean | ||
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"type": "dashb... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/testdata/output/single_version/v13.minimal_graph_config.v13.json |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | 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/oncrpc/XDR.java |
//go:build windows
package libnetwork
import "context"
func (r *Resolver) setupNAT(context.Context) error {
return nil
} | go | github | https://github.com/moby/moby | daemon/libnetwork/resolver_windows.go |
# Copyright (c) 2025 Baidu, Inc. and HuggingFace Inc. 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 ... | python | github | https://github.com/huggingface/transformers | src/transformers/models/ernie4_5/modular_ernie4_5.py |
"""Support for the Twitch stream status."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
ATTR_GAME = 'game'
ATTR_TITLE = '... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import Optional
from typing_extensions import Literal, Required, TypedDict
__all__ = ["ResponseInputFileContentParam"]
class ResponseInputFileContentParam(TypedDict, total=False):
... | python | github | https://github.com/openai/openai-python | src/openai/types/responses/response_input_file_content_param.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
# d... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# (c) 2017, NetApp, 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.... | unknown | codeparrot/codeparrot-clean | ||
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | unknown | codeparrot/codeparrot-clean | ||
"""
Django development settings.
"""
from base import *
import os
# --- Debug Settings ---
DEBUG = TEMPLATE_DEBUG = True
# --- /Debug Settings ---
# --- Email Configuration ---
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# --- /... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#Dan Blankenberg
import sys, os
assert sys.version_info[:2] >= ( 2, 4 )
def __main__():
base_dir = os.path.join( os.getcwd(), "bacteria" )
try:
base_dir = sys.argv[1]
except:
print "using default base_dir:", base_dir
loc_out = os.path.join( base_dir, "seq.loc" )... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import errno
from collections import deque
from threading import Lock
from jinja2._compat import text_type, string_types, impl... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.junit;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.mockito.internal.stubbing.answers.DoesNoth... | java | github | https://github.com/mockito/mockito | mockito-core/src/test/java/org/mockito/internal/junit/UnusedStubbingsTest.java |
"""Tests for return_direct tool graph structure."""
from langchain_core.tools import tool
from syrupy.assertion import SnapshotAssertion
from langchain.agents.factory import create_agent
from tests.unit_tests.agents.model import FakeToolCallingModel
def test_agent_graph_without_return_direct_tools(snapshot: Snapshot... | python | github | https://github.com/langchain-ai/langchain | libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py |
from unittest import TestCase, main
from os.path import join
from os import remove, rename
from moi.group import get_id_from_user
from moi import ctx_default
from qiita_core.util import qiita_test_checker
from qiita_db.analysis import Analysis
from qiita_db.job import Job
from qiita_db.util import get_db_files_base_d... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from numpy.testing import *
class TestBuiltin(TestCase):
def test_run(self):
"""Only test hash runs at all."""
for t in [np.int, np.float, np.complex, np.int32, np.str, np.object,
np.unicode]:
dt = np.dtype(t)
hash(dt)
class TestRecord(Tes... | unknown | codeparrot/codeparrot-clean | ||
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 b... | 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/crypto/CryptoStreamUtils.java |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
from odoo.tools import populate, pycompat
class TestPopulateModel(models.Model):
_name = 'test.populate'
_description = 'Test Populate'
name = fields.Char(default='Foo'... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.junitrunner;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockitoutil.JUnitR... | java | github | https://github.com/mockito/mockito | mockito-core/src/test/java/org/mockitousage/junitrunner/StubbingWarningsJUnitRunnerTest.java |
#!/usr/bin/env bash
set -e
# Expected to be in api directory
cd "$(dirname "${BASH_SOURCE[0]}")/.."
echo "Validating swagger.yaml..."
yamllint -f parsable -c validate/yamllint.yaml swagger.yaml
if out=$(swagger validate swagger.yaml); then
echo "Validation done! ${out}"
else
echo "${out}" >&2
false
fi | unknown | github | https://github.com/moby/moby | api/scripts/validate-swagger.sh |
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 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... | go | github | https://github.com/kubernetes/kubernetes | pkg/apis/node/v1alpha1/zz_generated.validations.go |
# -*- coding: utf-8 -*-
"""
***************************************************************************
sieve.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************************... | unknown | codeparrot/codeparrot-clean | ||
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | java | github | https://github.com/apache/kafka | clients/src/test/java/org/apache/kafka/clients/MetadataTest.java |
#!/usr/bin/env python
from shogun import StreamingVwFile
from shogun import StreamingVwCacheFile
from shogun import T_SVMLIGHT
from shogun import StreamingVwFeatures
from shogun import VowpalWabbit
parameter_list=[['../data/fm_train_sparsereal.dat']]
def streaming_vw_createcache (fname):
# First creates a binary cac... | unknown | codeparrot/codeparrot-clean | ||
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... | unknown | codeparrot/codeparrot-clean | ||
# (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 | ||
# stdlib
import unittest
# 3p
from nose.plugins.attrib import attr
# project
from checks import AgentCheck
from tests.checks.common import load_check
@attr(requires='ssh')
class SshTestCase(unittest.TestCase):
def test_ssh(self):
config = {
'instances': [{
'host': 'io.smashth... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
from unittest import TestCase
import test_mocks as mocks
from descriptor_tools.decorators import ForcedSet, SecretSet, Binding
from descriptor_tools.set_attrs import *
prefix = "_"
postfix = "_attr"
testString = "aString"
class Mangle_Name_Test(TestCase):
def test_defaults(self):
self.ass... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
# Copyright (c) 2008-11 Qtrac Ltd. All rights reserved.
# This program or module 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) an... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime_test
import (
"testing"
)
var res int64
var ures uint64
// TODO: This test probably should be in a different place.
func TestFloatTruncatio... | go | github | https://github.com/golang/go | src/runtime/conv_wasm_test.go |
class Param(object):
mapping = {}
def __init__(self, node):
if node.tag != 'param':
raise ValueError('expected <param>, got <%s>' % node.tag)
self.name = node.attrib['name']
try:
descnode = node.find('description')
self.description = '' if descnode is... | unknown | codeparrot/codeparrot-clean | ||
# DS18x20 temperature sensor driver for MicroPython.
# MIT license; Copyright (c) 2016 Damien P. George
from micropython import const
_CONVERT = const(0x44)
_RD_SCRATCH = const(0xBE)
_WR_SCRATCH = const(0x4E)
class DS18X20:
def __init__(self, onewire):
self.ow = onewire
self.buf = bytearray(9)
... | unknown | codeparrot/codeparrot-clean | ||
# 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 t... | unknown | codeparrot/codeparrot-clean | ||
#pragma once
#include <ATen/core/Tensor.h>
namespace at::native::mobile {
Tensor allocate_padded_contiguous_if_needed(
const Tensor& input,
c10::MemoryFormat memory_format);
// TODO: Remove this function when at::native::empty() is modified to accept a
// custom memory allocator.
at::Tensor empty_with_tail... | c | github | https://github.com/pytorch/pytorch | aten/src/ATen/native/utils/Factory.h |
#!/usr/bin/env python3
import json
from pathlib import Path
from os import getenv
from sys import argv
if len(argv) != 2:
print("JSON info files script requires ouput file as argument")
exit(1)
output_path = Path(argv[1])
assert getenv("WORK_DIR"), "$WORK_DIR required"
work_dir = Path(getenv("WORK_DIR"))
... | unknown | codeparrot/codeparrot-clean | ||
from tests.api import auth_for
from tests.data import users
def test_delete_user_as_user(client, test_user):
res = client.delete(
"/users/{id}".format(id=test_user.id), headers=auth_for(test_user)
)
assert res.status_code == 403
def test_delete_user_as_admin(client, test_user, test_admin):
res... | unknown | codeparrot/codeparrot-clean | ||
import random
import sys
import Pyro4
from Pyro4.util import SerializerBase
from workitem import Workitem
# For 'workitem.Workitem' we register a deserialization hook to be able to get these back from Pyro
SerializerBase.register_dict_to_class("workitem.Workitem", Workitem.from_dict)
NUMBER_OF_ITEMS = 40
def main():... | unknown | codeparrot/codeparrot-clean | ||
/*global DateTimeShortcuts, SelectFilter*/
/**
* Django admin inlines
*
* Based on jQuery Formset 1.1
* @author Stanislaus Madueke (stan DOT madueke AT gmail DOT com)
* @requires jQuery 1.2.6 or later
*
* Copyright (c) 2009, Stanislaus Madueke
* All rights reserved.
*
* Spiced up with Code from Zain Memon's G... | javascript | github | https://github.com/django/django | django/contrib/admin/static/admin/js/inlines.js |
import json
import Queue as queue
import socket
import select
import threading
import time
import sys
from processor import Session, Dispatcher
from utils import print_log, logger
READ_ONLY = select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR
READ_WRITE = READ_ONLY | select.POLLOUT
TIMEOUT = 100
import... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/python
#-*- coding: utf-8 -*-
import unittest
import os
import sys
try:
import version
except:
from . import version
sys.path.append(os.path.join(os.getenv("PINGUINO_LIB"), "qtgui", "resources"))
try:
from qtgui.pinguino_core.pinguino import Pinguino, AllBoards
from qtgui.pinguino_core.pi... | unknown | codeparrot/codeparrot-clean | ||
<p class="datetime">
<label {% if widget.attrs.id %}for="{{ widget.subwidgets.0.attrs.id }}"{% endif %}>{{ date_label }}</label> {% with widget=widget.subwidgets.0 %}{% include widget.template_name %}{% endwith %}<br>
<label {% if widget.attrs.id %}for="{{ widget.subwidgets.1.attrs.id }}"{% endif %}>{{ time_label }... | html | github | https://github.com/django/django | django/contrib/admin/templates/admin/widgets/split_datetime.html |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2014 Benjamin Peterson
#
# 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 with... | unknown | codeparrot/codeparrot-clean | ||
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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 distributed i... | unknown | codeparrot/codeparrot-clean | ||
# 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
# d... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
import bpy
from bpy.props import FloatProperty, EnumProperty, BoolProperty, IntProperty, StringProperty
from mathutils import Vector, Matrix
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, zip_long_repeat, ensure_nesting_level, describe_data_shape... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
CONFIG_NAME = ".clang_complete"
def readConfiguration():
try:
f = open(CONFIG_NAME, "r")
except IOError:
return []
result = []
for line in f.readlines():
strippedLine = line.strip()
if strippedLine:
result.append(strippedLine)
f... | unknown | codeparrot/codeparrot-clean | ||
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from xml.dom import minidom
from django.test import TestCase
from django.template import Template, Context
from django.conf import settings
from django.utils.unittest import skipIf
from billing import get_integration
@sk... | unknown | codeparrot/codeparrot-clean | ||
from .. import dataformat
from struct import Struct, unpack_from
from .. import util
from ..util import dbg, zstr
class UnitCommand(dataformat.Exportable):
name_struct = "unit_command"
name_struct_file = "unit"
struct_description = "a command a single unit may recieve by script or human."
dat... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/bash
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
git_output=$(git diff --ignore-submodules --name-only HEAD)
if [ -z "$git_output" ];
then
echo "✔ working directory is clean"
else
echo "✘ found diff:"
echo "$git... | unknown | github | https://github.com/tauri-apps/tauri | .scripts/ci/has-diff.sh |
/*
Copyright 2016 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/kubelet/cm/cgroup_manager_linux.go |
"""
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import byref, c_double, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.base import... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2021 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/storage/wal/version_test.go |
"""log model admin."""
from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.log_mgr.models import MakahikiLog
from apps.admin.admin import challenge_designer_site, challenge_manager_site, develop... | unknown | codeparrot/codeparrot-clean | ||
import pywintypes
import struct
import win32event, win32api
import os
import win32com.directsound.directsound as ds
def wav_header_pack(wfx, datasize):
return struct.pack('<4sl4s4slhhllhh4sl', 'RIFF', 36 + datasize,
'WAVE', 'fmt ', 16,
wfx.wFormatTag, wfx.nChannels, wf... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
import {identity} from 'shared-runtime';
function Component(statusName) {
// status is local, text is a scope declaration
const {status, text} = foo(statusName);
// color is local, font is a scope declaration
const {color, font} = getStyles(status);
// bg is a declaration
const bg =... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md |
# Copyright (C) 2013 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 | ||
// Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | go | github | https://github.com/etcd-io/etcd | tests/integration/clientv3/connectivity/dial_test.go |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections imp... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.base.payload import Payload
from pants.base.payload_field import PrimitiveField
from pants.build_graph.target import Target
class NodeTest(Target):
"""Javascript tests run ... | 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/fs/statistics/IOStatisticsAggregator.java |
# -*- coding: utf-8 -*-
import struct
import os
import logging
class InvalidFileError(Exception):
pass
class UnsupportedVersionError(Exception):
pass
class FileStream:
def __init__(self, path, file_obj, pmx_header):
self.__path = path
self.__file_obj = file_obj
self.__header = pmx_... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (C) 2009-2010 Nicolas P. Rougier
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#---------------... | unknown | codeparrot/codeparrot-clean | ||
from datetime import date, datetime, timedelta
import tempfile
import zipfile
import os
import os.path
import shutil
from django.apps import apps
from django.db import models
from django.db import transaction
from django import db
from django.core import serializers
from django.utils.translation import ugettext_lazy a... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in ... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.