code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
import time, random, threading, random
salary = 999
def threadMethod(name):
print('Thread(%s:%s) Start' % (name, threading.current_thread().name))
for index in range(999999):
randomNumber = random.random()
global salary
salary = salary + randomNumber
sal... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing_extensions import Literal
from ..._models import BaseModel
__all__ = ["InputTokenCountResponse"]
class InputTokenCountResponse(BaseModel):
input_tokens: int
object: Literal["response.input_tokens"] | python | github | https://github.com/openai/openai-python | src/openai/types/responses/input_token_count_response.py |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class R(models.Model):
is_default = models.BooleanField(default=False)
def __str__(self):
return "%s" % self.pk
def get_default_r():
ret... | unknown | codeparrot/codeparrot-clean | ||
"""OGGM tasks.
This module is simply a shortcut to the core functions
"""
from __future__ import absolute_import, division
# Entity tasks
from oggm.core.preprocessing.gis import define_glacier_region
from oggm.core.preprocessing.gis import glacier_masks
from oggm.core.preprocessing.centerlines import compute_centerli... | unknown | codeparrot/codeparrot-clean | ||
# Name: mapper_emodnet.py
# Purpose: Mapper for bathymetry data from EMODNet
# http://portal.emodnet-bathymetry.eu/
# Authors: Anton Korosov
# Licence: This file is part of NANSAT. You can redistribute it or modify
# under the terms of GNU General Public License, v.3
#... | unknown | codeparrot/codeparrot-clean | ||
import { createCookie, isCookie } from "../cookies";
import type {
SessionStorage,
SessionIdStorageStrategy,
SessionData,
} from "../sessions";
import { warnOnceAboutSigningSessionCookie, createSession } from "../sessions";
interface CookieSessionStorageOptions {
/**
* The Cookie used to store the session d... | typescript | github | https://github.com/remix-run/react-router | packages/react-router/lib/server-runtime/sessions/cookieStorage.ts |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection_created
from django.db.backends.postgresql.operations import DatabaseOperations as Postgresq... | unknown | codeparrot/codeparrot-clean | ||
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | unknown | codeparrot/codeparrot-clean | ||
import { test } from '../../test';
export default test({
error: {
code: 'element_unclosed',
message: '`<script>` was left open',
position: [32, 32]
}
}); | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/tests/compiler-errors/samples/script-unclosed/_config.js |
#!/usr/bin/env python
# coding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
"""
test_django-teryt
------------
Tests for `django-teryt` modules module.
"""
from django.utils import six
from django.test import TestCase
from django.db import models... | unknown | codeparrot/codeparrot-clean | ||
import sys
from yaku.scheduler \
import \
run_tasks
from yaku.context \
import \
get_bld, get_cfg
from yaku.conftests.fconftests \
import \
check_fcompiler, check_fortran_verbose_flag, \
check_fortran_runtime_flags, check_fortran_dummy_main, \
check_fortran_mangling... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2011-2021, Manfred Moitzi
# License: MIT License
from collections import namedtuple
from enum import Enum
from typing import (
Optional,
Dict,
List,
Tuple,
TYPE_CHECKING,
Iterable,
Callable,
Any,
Union,
)
from .const import DXFAttributeError, DXF12
import copy
if TYP... | unknown | codeparrot/codeparrot-clean | ||
# Contributing to Vapor
👋 Welcome to the Vapor team!
## Testing
Once in Xcode, select the `vapor-Package` scheme and use `CMD+U` to run the tests.
You can use the `Development` executables for testing out your code.
Don't forget to add tests for your new features.
If you are fixing a single GitHub issue in parti... | unknown | github | https://github.com/vapor/vapor | .github/contributing.md |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | unknown | codeparrot/codeparrot-clean | ||
"""
Outline Tab Serializers.
"""
from django.utils.translation import ngettext
from rest_framework import serializers
from lms.djangoapps.course_home_api.dates.v1.serializers import DateSummarySerializer
from lms.djangoapps.course_home_api.progress.v1.serializers import CertificateDataSerializer
from lms.djangoapps.c... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import os
import re
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from pip.req import parse_requirements
TEST_REQUIRES = [
'pytest',
'responses',
]
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist uploa... | unknown | codeparrot/codeparrot-clean | ||
""" Python Character Mapping Codec generated from 'CP862.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,error... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/statements/VariableStatements/usingDeclarations/awaitUsingDeclarations.1.ts] ////
//// [awaitUsingDeclarations.1.ts]
await using d1 = { async [Symbol.asyncDispose]() {} };
async function af() {
await using d3 = { async [Symbol.asyncDispose]() {} };
await null;
}
async function *... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/awaitUsingDeclarations.1(target=es5).js |
"""Test correct operation of the print function.
"""
# In 2.6, this gives us the behavior we want. In 3.0, it has
# no function, but it still must parse correctly.
from __future__ import print_function
import unittest
from test import test_support
from StringIO import StringIO
NotDefined = object()
# A dispatch ... | unknown | codeparrot/codeparrot-clean | ||
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Common codegen classes.
import operator
import re
import string
import textwrap
import functools
from WebIDL import ... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from typing_extensions import Literal
from ..._models import BaseModel
__all__ = ["ToolChoiceMcp"]
class ToolChoiceMcp(BaseModel):
"""
Use this option to force the model to call a specific tool ... | python | github | https://github.com/openai/openai-python | src/openai/types/responses/tool_choice_mcp.py |
#!/usr/bin/python
# Copyright: 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': ['preview'],
... | unknown | codeparrot/codeparrot-clean | ||
#pragma once
#include <c10/core/Allocator.h>
#include <c10/core/AllocatorConfig.h>
#include <c10/core/Stream.h>
#include <c10/core/thread_pool.h>
#include <c10/util/flat_hash_map.h>
#include <c10/util/llvmMathExtras.h>
#include <iostream>
#include <optional>
#include <deque>
#include <vector>
#include <mutex>
#includ... | c | github | https://github.com/pytorch/pytorch | aten/src/ATen/core/CachingHostAllocator.h |
'''
Created on 25.10.2010
@author: michi
'''
from ems.converter.tag import Tag,AttributeException
class ForEach(Tag):
'''
classdocs
'''
def interpret(self,xmlDict,inputReader,outputWriter):
if xmlDict['attributes'].has_key('select'):
select = xmlDict['attributes']['select']
... | unknown | codeparrot/codeparrot-clean | ||
---
---
@import "jekyll-theme-primer";
@import "main"; | unknown | github | https://github.com/google/googletest | docs/assets/css/style.scss |
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package stackeval
import (
"context"
"fmt"
"time"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/instances"
"github.com/hashicorp/terraform/inter... | go | github | https://github.com/hashicorp/terraform | internal/stacks/stackruntime/internal/stackeval/provider_instance.go |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gettext
import os
from datetime import datetime, timedelta
from importlib import import_module
from unittest import skipIf
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
"""Unittest for ipaddress module."""
import unittest
import re
import contextlib
import operator
import ipaddress
class BaseTestCase(unittest.TestCase):
# One big change in ipaddress over the original ipaddr module is
# error repo... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Seunghyun Yoo (shyoo1st@cs.ucla.edu)
"""
import bisect
import pickle
import enum
from . import selector, util, tokenizer, tree
class TokenType(enum.Enum):
VARIANT = 0
NOT_UNIQUE_INVARIANT = 1
UNIQUE_INVARIANT = 2
def expand_segment(pivots, ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import absolute_import, division, print_function
import datashape
from datashape import Record, DataShape, dshape, TimeDelta
from datashape import coretypes as ct
from datashape.predicates import iscollection, isboolean, isnumeric, isdatelike
from numpy import inf
from odo.utils import copydoc
import t... | unknown | codeparrot/codeparrot-clean | ||
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | java | github | https://github.com/apache/kafka | clients/src/main/java/org/apache/kafka/common/security/token/delegation/DelegationToken.java |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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': ['preview'],
... | unknown | codeparrot/codeparrot-clean | ||
""" path.py - An object representing a path to a file or directory.
Example:
from IPython.external.path import path
d = path('/home/guido/bin')
for f in d.files('*.py'):
f.chmod(0755)
This module requires Python 2.2 or later.
URL: http://www.jorendorff.com/articles/python/path
Author: Jason Orendorff <jaso... | unknown | codeparrot/codeparrot-clean | ||
"""
Enrollment API for creating, updating, and deleting enrollments. Also provides access to enrollment information at a
course level, such as available course modes.
"""
import importlib
import logging
from django.conf import settings
from django.core.cache import cache
from opaque_keys.edx.keys import CourseKey
fr... | unknown | codeparrot/codeparrot-clean | ||
{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v2beta1",
"metadata": {
"name": "v0alpha1.relative_time_zone_support.v42"
},
"spec": {
"annotations": [
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "g... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/conversion/testdata/output/migrated_dev_dashboards/scenarios/v0alpha1.relative_time_zone_support.v42.v2beta1.json |
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=100)
class Meta:
ordering = ('na... | unknown | codeparrot/codeparrot-clean | ||
from rdflib import URIRef, BNode, Literal
from rdflib.query import ResultSerializer
def _termString(t, namespace_manager):
if t == None:
return "-"
if namespace_manager:
if isinstance(t, URIRef):
return namespace_manager.normalizeUri(t)
elif isinstance(t, BNode):
... | unknown | codeparrot/codeparrot-clean | ||
#ifndef READ_CACHE_LL_H
#define READ_CACHE_LL_H
#include "hash.h"
#include "hashmap.h"
#include "statinfo.h"
/*
* Basic data structures for the directory cache
*/
#define CACHE_SIGNATURE 0x44495243 /* "DIRC" */
struct cache_header {
uint32_t hdr_signature;
uint32_t hdr_version;
uint32_t hdr_entries;
};
#define... | c | github | https://github.com/git/git | read-cache-ll.h |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | unknown | codeparrot/codeparrot-clean | ||
from ROOT import gDirectory, TH2F, TH1F, TFile
class Fitter2D(object):
def __init__(self, *args):
self.h2d = TH2F(*args)
def draw2D(self, *args):
self.h2d.Draw(*args)
self.hmean.Draw('psame')
def fit(self, bin, opt='0'):
hslice = self.h2d.ProjectionY("", bin, bin, "")
... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2012 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 main
import (
"fmt"
"io"
"path/filepath"
"sort"
"strings"
)
/*
* Helpers for building cmd/go and cmd/cgo.
*/
// generatedHeader is the string ... | go | github | https://github.com/golang/go | src/cmd/dist/buildgo.go |
from multiprocessing import sharedctypes
from numpy import ctypeslib
import numpy as np
def wrap_params(params):
"""
For each parameter in a list of Theano TensorSharedVariable
we substitute the memory with a sharedctype using the
multiprocessing library.
The wrapped memory can then be used by oth... | unknown | codeparrot/codeparrot-clean | ||
package command
import (
"fmt"
"github.com/moby/term"
"github.com/spf13/cobra"
)
// SetupRootCommand sets default usage, help, and error handling for the
// root command.
func SetupRootCommand(rootCmd *cobra.Command) {
cobra.AddTemplateFunc("wrappedFlagUsages", wrappedFlagUsages)
rootCmd.SetUsageTemplate(usage... | go | github | https://github.com/moby/moby | daemon/command/cobra.go |
# @vue/runtime-dom
```js
import { h, createApp } from '@vue/runtime-dom'
const RootComponent = {
render() {
return h('div', 'hello world')
},
}
createApp(RootComponent).mount('#app')
``` | unknown | github | https://github.com/vuejs/core | packages/runtime-dom/README.md |
{
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "6.0.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
... | json | github | https://github.com/microsoft/TypeScript | package.json |
/*
* Copyright (C) 2007 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | java | github | https://github.com/google/guava | android/guava-tests/test/com/google/common/collect/ForwardingQueueTest.java |
#!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | unknown | codeparrot/codeparrot-clean | ||
"""
Compatibility constants and functions. This module works on Python 1.5 to 2.5.
This module provides:
- True and False constants ;
- any() and all() function ;
- has_yield and has_slice values ;
- isinstance() with Python 2.3 behaviour ;
- reversed() and sorted() function.
True and False constants
================... | unknown | codeparrot/codeparrot-clean | ||
"""ThreatConnect API Service App"""
# third-party
import falcon
# first-party
from api_service_app import ApiServiceApp # Import default API Service Class (Required)
from tcex import TcEx
class TcExMiddleware:
"""TcEx middleware module.
Adds access to self.args, self.tcex and self.log in resource Class.
... | unknown | codeparrot/codeparrot-clean | ||
#ifndef SERVER_INFO_H
#define SERVER_INFO_H
struct repository;
/* Dumb servers support */
int update_server_info(struct repository *r, int force);
#endif /* SERVER_INFO_H */ | c | github | https://github.com/git/git | server-info.h |
# -*- coding: utf-8 -*-
#
# Cuckoo Sandbox documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are... | unknown | codeparrot/codeparrot-clean | ||
import sys, os
# Quick hack to put frontendadmin from the parent directory into pythonpath
# If this is not working correctly, uncomment these lines and put
# frontendadmin manually into pythonpath.
sys.path.append(
os.path.abspath(
os.path.normpath('%s/../' % os.path.dirname(__file__))
)
)
PROJECT_RO... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# See the "Code officiel géographique" on the INSEE website <www.insee.fr>.
DEPARTMENT_CHOICES = (
# Metropolitan departments
('01', u'01 - Ain'),
('02', u'02 - Aisne'),
('03', u'03 - Allier'),
('04', u'04 - Alpes-de-Haute-Provence'),
('05', u'05 - Hautes-Alpes'),
(... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2024 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/compiler/mlir/lite/python/interpreter_wrapper/python_utils.h |
#!/usr/bin/env python
import argparse
import os
import time
import Common
import Mif
import Parser
"""
Title: Assembler for RISC_721
Author: Connor Goldberg
"""
def main(args):
start = time.clock()
assemblyFile = args["assembly-file"]
output = args["output"]
if output == None:
programOutput = os.path.join(o... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2015 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package server_test
import (
"os"
"testing"
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvtenant"
"github.com/co... | go | github | https://github.com/cockroachdb/cockroach | pkg/server/main_test.go |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | unknown | codeparrot/codeparrot-clean | ||
"""
Parallelization utilities
"""
from functools import reduce
import multiprocessing
class Sketch(object):
@staticmethod
def initializer(cls, *args):
"""
FIXME: use of global not really nice (possible root of mysterious issue for user)
"""
global sketch_constructor
de... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright © 2012 Thomas Krug
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
"Test searchengine, coverage 99%."
from idlelib import searchengine as se
import unittest
# from test.support import requires
from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text
from tkinter import messagebox
from idlelib.idle_test.mock_tk import Var, Mbox
from idlelib.idle_test.mock_tk import Text as mo... | python | github | https://github.com/python/cpython | Lib/idlelib/idle_test/test_searchengine.py |
//// [tests/cases/compiler/accessorWithInitializer.ts] ////
//// [accessorWithInitializer.ts]
class C {
set X(v = 0) { }
static set X(v2 = 0) { }
}
//// [accessorWithInitializer.js]
"use strict";
var C = /** @class */ (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/accessorWithInitializer(target=es5).js |
#!/usr/bin/env python3
import os
from shutil import copytree, copy2
from pathlib import Path
from scripts.build_env import BuildEnv, Platform
from scripts.platform_builder import PlatformBuilder
class pugixmliOSBuilder(PlatformBuilder):
def __init__(self,
config_package: dict=None,
... | unknown | codeparrot/codeparrot-clean | ||
""" Operation handler to set the status for transformation files
"""
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Utilities import DEncode
from DIRAC.RequestManagementSystem.private.OperationHandlerBase import OperationHandlerBase
from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClie... | unknown | codeparrot/codeparrot-clean | ||
"""Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that ... | unknown | codeparrot/codeparrot-clean | ||
"""Prettyprinter by Jurjen Bos.
(I hate spammers: mail me at pietjepuk314 at the reverse of ku.oc.oohay).
All objects have a method that create a "stringPict",
that can be used in the str method for pretty printing.
Updates by Jason Gedge (email <my last name> at cs mun ca)
- terminal_string() method
- minor f... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2005, 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 ... | c | github | https://github.com/google/googletest | googletest/include/gtest/internal/gtest-string.h |
import sys
def matrixChainOrder(p):
n = len(p)-1
m = {}
s = {}
for i in xrange(1, n+1):
m[(i, i)] = 0
for l in range(2, n+1):
for i in range(1, n-l+2):
j = i+l-1
m[(i, j)] = sys.maxint
for k in range(i, j):
q = m[i, k] + m[k+1, j] + p[i-1]*p[k]*p[j]
if q < m[(i, j)]:
m[(i, j)] = q
s... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.sendmsg}.
"""
import sys
import errno
import warnings
from os import devnull, pipe, read, close, pathsep
from struct import pack
from socket import SOL_SOCKET, AF_INET, AF_INET6, socket, error
try:
from socket ... | unknown | codeparrot/codeparrot-clean | ||
package daemon
import (
"testing"
"github.com/moby/moby/api/types/container"
)
func TestToContainerdResources_Defaults(t *testing.T) {
checkResourcesAreUnset(t, toContainerdResources(container.Resources{}))
} | go | github | https://github.com/moby/moby | daemon/update_linux_test.go |
groups:
- name: test_2 copy
rules:
- record: test_2
expr: vector(2) | unknown | github | https://github.com/prometheus/prometheus | rules/fixtures/rules2_copy.yaml |
#!/usr/bin/env python
# Copyright (c) 2010 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import time
output = sys.argv[1]
persistoutput = "%s.persist" % sys.argv[1]
count = 0
try:
count = open(persistoutput, 'r').r... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Base classes for writing management commands (named commands which can
be executed through ``django-admin.py`` or ``manage.py``).
"""
import os
import sys
import warnings
from optparse import make_option, OptionParser
import django
from django.cor... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package providers
import (
"testing"
"github.com/go-test/deep"
"github.com/hashicorp/terraform/internal/addrs"
)
func TestAddressedTypesAbs(t *testing.T) {
providerAddrs := []addrs.AbsProviderConfig{
addrs.AbsProviderConfig{
Module: a... | go | github | https://github.com/hashicorp/terraform | internal/providers/addressed_types_test.go |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Knowledge base module objects
"""
from django.db import models
from treeio.core.models import Object
from django.core.urlresolvers import reverse
from django.template import defaultfilters
from unidecode... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2014 Rackspace, 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 wr... | unknown | codeparrot/codeparrot-clean | ||
# $Id: af.py 7119 2011-09-02 13:00:23Z milde $
# Author: Jannie Hofmeyr <jhsh@sun.ac.za>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for ... | unknown | codeparrot/codeparrot-clean | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* extendplan.c
* Extend core planner objects with additional private state
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* The in... | c | github | https://github.com/postgres/postgres | src/backend/optimizer/util/extendplan.c |
#!/usr/bin/python3
import sys
sys.path.append('..')
from utils import *
from random import random
class Sampler:
def __init__(self):
self.debug = False
self.min_tags = 16
self.goal_samples_per_score = 20000
self.all_stats = load_obj(booru_path("pickle_files/statistics"))
s... | unknown | codeparrot/codeparrot-clean | ||
"""Module for testing string variables."""
class TestStringVar(BaseTestCase):
def setUp(self):
BaseTestCase.setUp(self)
self.rawData = []
self.dataByKey = {}
for i in range(1, 11):
stringCol = "String %d" % i
fixedCharCol = ("Fixed Char %d" % i).ljust(40)
... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
from impyute.ops import matrix
from impyute.ops import wrapper
# pylint: disable=invalid-name, too-many-arguments, too-many-locals, too-many-branches, broad-except, len-as-condition
@wrapper.wrappers
@wrapper.checks
def moving_window(data, nindex=None, wsize=5, errors="coerce", func=np.mean,
... | unknown | codeparrot/codeparrot-clean | ||
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to plac... | php | github | https://github.com/laravel/framework | config-stubs/app.php |
import unittest
from yesaide import worker
class FakeDbSession(object):
def __init__(self):
self.has_been_committed = False
def commit(self):
self.has_been_committed = True
class FakeForeman(object):
def __init__(self):
self._dbsession = FakeDbSession()
class FakeMapping(object)... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import parse_iso8601
class NYTimesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nytimes\.com/video/(?:[^/]+/)+(?P<id>\d+)'
_TEST = {
'url': 'http://www.nytimes.com/video/opinion/100000002847155/ve... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unknown | codeparrot/codeparrot-clean | ||
//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/autoscaling/v2/zz_generated.conversion.go |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 | ||
/*
Copyright 2020 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 | cmd/kubeadm/app/util/image/image_test.go |
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | unknown | codeparrot/codeparrot-clean | ||
<?php
namespace Illuminate\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class TrustProxies
{
/**
* The trusted proxies for the application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The trusted proxies headers for the application.
*
... | php | github | https://github.com/laravel/framework | src/Illuminate/Http/Middleware/TrustProxies.php |
from __future__ import unicode_literals
import mimetypes
import posixpath
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
from django.utils import importlib
from django.utils.encoding import smart_str
from pipeline.conf import settings
def to_class(class_str):
if not cl... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.core.urlresolvers import (
NoReverseMatch, Resolver404, get_script_prefix, resolve
)
from django.db.models import Manager
from django.db.models.query import QuerySet
from ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Copyright 2008 The Closure Linter 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
#
#... | unknown | codeparrot/codeparrot-clean | ||
import os
import re
import sublime
from ..package_manager import PackageManager
class ExistingPackagesCommand():
"""
Allows listing installed packages and their current version
"""
def __init__(self):
self.manager = PackageManager()
def make_package_list(self, action=''):
"""
... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
import pandas as pd
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.feature_extraction.text import TfidfVectorizer
import spacy
from constants import PICKLE_PATH, TWEET_CSV_PATH
# python -m spacy download en
def load_arxiv_and_tweets():
arxiv = pd.read_pickle(PICKLE_PATH)
... | unknown | codeparrot/codeparrot-clean | ||
//go:build !windows
package metrics
import (
"context"
"net"
"net/http"
"os"
"sync"
"time"
"github.com/containerd/log"
gometrics "github.com/docker/go-metrics"
"github.com/moby/moby/v2/daemon/pkg/plugin"
"github.com/moby/moby/v2/pkg/plugingetter"
"github.com/moby/moby/v2/pkg/plugins"
"github.com/opencont... | go | github | https://github.com/moby/moby | daemon/internal/metrics/plugin_unix.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.