code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
// Copyright 2025 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 (
"internal/runtime/sys"
"runtime"
"testing"
"unsafe"
)
// The tests in this file are identical to list_test.go, but for the
/... | go | github | https://github.com/golang/go | src/runtime/list_manual_test.go |
from django.db import models
NULL_DISPLAY = "–"
class ChartCell(object):
head_attrs = {}
body_attrs = {}
label = ""
format = "%s"
text = ""
raw_text = ""
def __init__(self, cls, fieldname, format=None):
self.label = fieldname
try:
self.field = cls._meta.g... | unknown | codeparrot/codeparrot-clean | ||
# -*- encoding: utf-8 -*-
# pilas engine: un motor para hacer videojuegos
#
# Copyright 2010-2014 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine.actores.animacion import Animacion
import pilasengine
class NaveKids(Animacion):... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2024 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/integrations/quanto.py |
import unittest
from threading import Thread, Barrier
from unittest import TestCase
from test.support import threading_helper
NTHREAD = 10
OBJECT_COUNT = 5_000
class C:
def __init__(self, v):
self.v = v
@threading_helper.requires_working_threading()
class TestList(TestCase):
def test_racing_iter_ap... | python | github | https://github.com/python/cpython | Lib/test/test_free_threading/test_list.py |
# to test arbitrariy precision integers
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
print('%#X' % (x - x)) # print prefix
print('{:#,}'.format(x)) # print with commas
# addition
print(x + 1)
print(x + y)
print(x + xn == 0)... | unknown | codeparrot/codeparrot-clean | ||
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | java | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/http/TestHtmlQuoting.java |
#!/usr/bin/env python
import os
import sys
from lib.config import PLATFORM
from lib.util import atom_gyp, execute, rm_rf
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
CHROMIUM_DIR = os.path.join(S... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
# :markup: markdown
require "active_support"
require "active_support/test_case"
require "active_support/core_ext/hash/indifferent_access"
require "json"
module ActionCable
module Channel
class NonInferrableChannelError < ::StandardError
def initialize(name)
super "Un... | ruby | github | https://github.com/rails/rails | actioncable/lib/action_cable/channel/test_case.rb |
"""Mark specified nodes as spam.
python3 manage.py confirm_spam abc12
"""
import logging
from django.core.management.base import BaseCommand
from osf.models import Guid, Preprint
logger = logging.getLogger(__name__)
def confirm_spam(guid):
node = guid.referent
referent_type = 'preprint' if isinstance(no... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import dataclasses
import itertools
import os
from abc import ABCMeta
from collections import defaultdict
from dataclasses import dataclass
from typing ... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import annotations
import builtins
import functools
import keyword
import re
import token as T
import tokenize
import unicodedata
import _colorize
from collections import deque
from io import StringIO
from tokenize import TokenInfo as TI
from typing import Iterable, Iterator, Match, NamedTuple, Self
f... | python | github | https://github.com/python/cpython | Lib/_pyrepl/utils.py |
'''
Harvester for the Trace: Tennessee Research and Creative Exchange for the SHARE project
Example API call: http://trace.tennessee.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UtkTraceHarvester(OAIHarvester):
short_name... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2016 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/core/kernels/image/sampling_kernels.h |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#################################################
### Extracted from platform version: 2.3.2
#################################################
AOSP_PERMISSIONS = {
'android.permission.BIND_WALLPAPER': {
'permissionGroup': '',
'description':
'Allows t... | unknown | codeparrot/codeparrot-clean | ||
"""
Support for functionality to use a ZigBee device as a sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.zigbee/
"""
import logging
from binascii import hexlify
from homeassistant.components import zigbee
from homeassistant.const import T... | unknown | codeparrot/codeparrot-clean | ||
<?php declare(strict_types=1);
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Command... | php | github | https://github.com/composer/composer | src/Composer/Command/SuggestsCommand.php |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Scans build output directory for .isolated files, calculates their SHA1
hashes, stores final list in JSON document and then removes ... | unknown | codeparrot/codeparrot-clean | ||
<?php
throw new \LogicException('This file should not be autoloaded'); | php | github | https://github.com/composer/composer | tests/Composer/Test/Plugin/Fixtures/files_autoload_which_should_not_run.php |
/*
* 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/common/telemetry/internals/ClientTelemetryUtilsTest.java |
/*
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/controller/volume/protectionutil/utils_test.go |
#!/usr/bin/python
# Copyright 2003 Dave Abrahams
# Copyright 2002, 2003, 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
t = BoostBuild.Tester(translate_suffixes=0)
t.set_tree("project... | unknown | codeparrot/codeparrot-clean | ||
###
# Copyright (c) 2005, Daniel DiPaolo
# 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 condition... | unknown | codeparrot/codeparrot-clean | ||
from django.db.models import F, Value
from django.db.models.functions import Concat
from . import PostgreSQLTestCase
from .models import CharFieldModel, TextFieldModel
try:
from django.contrib.postgres.search import (
TrigramDistance,
TrigramSimilarity,
TrigramStrictWordDistance,
T... | python | github | https://github.com/django/django | tests/postgres_tests/test_trigram.py |
# Accessibility in Angular
The web is used by a wide variety of people, including those who have visual or motor impairments.
A variety of assistive technologies are available that make it much easier for these groups to interact with web-based software applications.
Also, designing an application to be more accessibl... | unknown | github | https://github.com/angular/angular | adev/src/content/best-practices/a11y.md |
# frozen_string_literal: true
require "abstract_unit"
class ApiRateLimitedController < ActionController::API
self.cache_store = ActiveSupport::Cache::MemoryStore.new
rate_limit to: 2, within: 2.seconds, only: :limited_to_two
def limited_to_two
head :ok
end
end
class ApiRateLimitingTest < ActionControlle... | ruby | github | https://github.com/rails/rails | actionpack/test/controller/api/rate_limiting_test.rb |
/* Random kit 1.3 */
/*
* Copyright (c) 2003-2005, Jean-Sebastien Roy (js@jeannot.org)
*
* The rk_random and rk_seed functions algorithms and the original design of
* the Mersenne Twister RNG:
*
* Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
* All rights reserved.
*
* Redistribution... | c | github | https://github.com/numpy/numpy | numpy/random/src/mt19937/randomkit.c |
"""
This module implements the FormRequest class which is a more covenient class
(than Request) to generate Requests based on form data.
See documentation in docs/topics/request-response.rst
"""
import urllib, urlparse
import lxml.html
from scrapy.http.request import Request
from scrapy.utils.python import unicode_to... | unknown | codeparrot/codeparrot-clean | ||
"""Unit tests for the Paver server tasks."""
import os
from unittest import TestCase
import paver.easy
from paver import tasks
from paver.easy import BuildFailure
class PaverTestCase(TestCase):
"""
Base class for Paver test cases.
"""
def setUp(self):
super(PaverTestCase, self).setUp()
... | unknown | codeparrot/codeparrot-clean | ||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@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 3 of the License, or
# (at your option) an... | unknown | codeparrot/codeparrot-clean | ||
% This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.
**Example**
```esql
FROM hosts
| WHERE CIDR_MATCH(ip1, "127.0.0.2/32", "127.0.0.3/32")
| KEEP card, host, ip0, ip1
```
| card:keyword | host:keyword | ip0:ip | ip1:ip |
| --- | --- | --- | --- |
| eth1 ... | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/query-languages/esql/_snippets/functions/examples/cidr_match.md |
package neither
var X = "neither" | go | github | https://github.com/kubernetes/kubernetes | cmd/import-boss/testdata/inverse/neither/file.go |
/*
* 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/TransactionsWithMaxInFlightOneTest.java |
# Copyright 2020 Microsoft and the Hugging Face Inc. team.
#
# 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... | python | github | https://github.com/huggingface/transformers | src/transformers/models/deberta/modeling_deberta.py |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
A script to add the results from the tagger to the database in a static fashion.
Written by Lucas Sinclair.
Kopimi.
You can use this script from the shell like this::
$ ./add_tagger_results.py
"""
# Built-in modules #
import os, inspect, marshal
# Internal modules #... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | unknown | codeparrot/codeparrot-clean | ||
import { expect, test } from 'vitest'
import { compile } from '.'
import plugin from './plugin'
const css = String.raw
test('utilities must be prefixed', async () => {
let input = css`
@theme reference prefix(tw);
@tailwind utilities;
@utility custom {
color: red;
}
`
let compiler = awai... | typescript | github | https://github.com/tailwindlabs/tailwindcss | packages/tailwindcss/src/prefix.test.ts |
# coding=utf-8
# Copyright 2014 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)
import os
import sub... | unknown | codeparrot/codeparrot-clean | ||
"""Logic for building a jar from a pyleus topology directory.
Other modules should only call build_topology_jar passing it the configurations
object. The caller function should handle PyleusError exceptions.
"""
from __future__ import absolute_import
import glob
import logging
import os
import re
import shutil
import... | unknown | codeparrot/codeparrot-clean | ||
import pytest
from spacy.tokens import Doc
@pytest.fixture
def words():
# fmt: off
return [
"\n", "It", "was", "a", "bright", "cold", "day", "in", "April", ",",
"and", "the", "clocks", "were", "striking", "thirteen", ".", "\n",
"Winston", "Smith", ",", "his", "chin", "nuzzled", "into", ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software withou... | unknown | codeparrot/codeparrot-clean | ||
/*
* 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/io/CharStreamsTest.java |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import osv, fields
from openerp.tools.safe_eval import safe_eval
class base_config_settings(osv.TransientModel):
_inherit = 'base.config.settings'
_columns = {
'auth_signup_reset_passwo... | 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/kubectl/cmd/convert/convert_test.go |
import operator
from . import libmp
from .libmp.backend import basestring
from .libmp import (
int_types, MPZ_ONE,
prec_to_dps, dps_to_prec, repr_dps,
round_floor, round_ceiling,
fzero, finf, fninf, fnan,
mpf_le, mpf_neg,
from_int, from_float, from_str, from_rational,
mpi_mid, mpi_delta, ... | unknown | codeparrot/codeparrot-clean | ||
from unittest import mock
import unittest
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import AnonymousUser
from django.contrib.auth.models import Group
from django.contrib.auth.models import Permission
from django.contrib.contenttyp... | unknown | codeparrot/codeparrot-clean | ||
A `break` statement with an argument appeared in a non-`loop` loop.
Example of erroneous code:
```compile_fail,E0571
# let mut i = 1;
# fn satisfied(n: usize) -> bool { n % 23 == 0 }
let result = while true {
if satisfied(i) {
break 2 * i; // error: `break` with value from a `while` loop
}
i += 1;... | unknown | github | https://github.com/rust-lang/rust | compiler/rustc_error_codes/src/error_codes/E0571.md |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import itertools
import io
import mmap
import operator
import os
import platform
import signal
import sys
import tempfile
import textwrap
import threading
import warnings
import weakref
from contextlib import contextmanager, suppress
from funct... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Created by Pearu Peterson, June 2003
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.testing import (assert_equal, assert_almost_equal, assert_array_equal,
assert_array_almost_equal, assert_allclose, assert_raises, TestCase... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.creation.settings;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.LinkedList;
im... | java | github | https://github.com/mockito/mockito | mockito-core/src/main/java/org/mockito/internal/creation/settings/CreationSettings.java |
"""Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | unknown | codeparrot/codeparrot-clean | ||
"""
Support for tracking the online status of a UPS.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.apcupsd/
"""
from homeassistant.components import apcupsd
from homeassistant.components.binary_sensor import BinarySensorDevice
DEPENDENCIE... | unknown | codeparrot/codeparrot-clean | ||
# Owner(s): ["module: unknown"]
import torch
from torch._C import parse_schema
from torch.testing._internal.common_utils import run_tests, TestCase
class TestFunctionSchema(TestCase):
def test_serialize_and_deserialize(self):
schemas = torch._C._jit_get_all_schemas()
# so far we have around 1700 r... | python | github | https://github.com/pytorch/pytorch | test/test_function_schema.py |
spec:
files:
- "updatecli-compose.yaml"
labels:
- ":Delivery/Tooling"
- "auto-merge-without-approval"
- "dependencies"
- ">non-issue" | unknown | github | https://github.com/elastic/elasticsearch | .github/updatecli/values.d/updatecli-compose.yml |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | unknown | codeparrot/codeparrot-clean | ||
package schemaversion
import (
"context"
"testing"
)
func TestV33DatasourceMigration(t *testing.T) {
// Create test datasource provider
dsProvider := &testDataSourceProvider{
datasources: []DataSourceInfo{
{
Default: true,
UID: "default-ds-uid",
Type: "prometheus",
APIVersion:... | go | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/schemaversion/v33_test.go |
from pymetars.metar import MetarSite
from heapq import heappush, heappop
import os
from pymetars.latlonconversions import LatLonConversions
from ftplib import FTP as __FTP__
from datetime import datetime as __datetime__
"""Create a large set of MetarSites based off the id, name, state/providence, country, lat and lon"... | unknown | codeparrot/codeparrot-clean | ||
use std::{
cell::RefCell,
cmp, fmt,
future::poll_fn,
mem,
pin::Pin,
rc::Rc,
task::{ready, Context, Poll},
};
use actix_web::{
error::PayloadError,
http::header::{self, ContentDisposition, HeaderMap},
web::{Bytes, BytesMut},
};
use derive_more::{Display, Error};
use futures_core:... | rust | github | https://github.com/actix/actix-web | actix-multipart/src/field.rs |
groups:
- name: test
interval: 1s
rules:
- alert: rule1
expr: 1 < bool 2 | unknown | github | https://github.com/prometheus/prometheus | rules/fixtures/alert_rule.yaml |
import os
import logging
import socket
import select
import threading
import logging
import logging.config
import json
import inspect
import base64
import six
from collections import defaultdict
from scruffy.plugin import Plugin
import voltron
from .plugin import APIPlugin
log = logging.getLogger('api')
version = ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Ensure that rate limiting is enabled by default. """
orm['util.RateLimitConfiguration'].objects.create(enabled... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: proxysql_query_rules
versi... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from .structures import LookupDict
_codes = {
# Informational.
100: ('continue',),
101: ('switching_protocols',),
102: ('processing',),
103: ('checkpoint',),
122: ('uri_too_long', 'request_uri_too_long'),
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/'... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts] ////
//// [task.ts]
export class Task<T> extends Promise<T> { }
//// [test.ts]
import { Task } from "./task";
class Test {
async example<T>(): Task<T> { return; }
}
//// [task.js]
"use strict";
Object.defineProperty(exports, "__esModule", { val... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/asyncImportedPromise_es5(target=es2015).js |
/* Copyright 2021 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/core/runtime_fallback/kernel/tfrt_op_kernel.h |
/* 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/PE/DelayImport.cpp |
#!/usr/bin/env python
import csv
import os
from englewood import DotDensityPlotter
INPUT_PATH = 'demo/Wards'
INPUT_LAYER = 'Wards'
DATA_PATH = 'demo/ward_data.csv'
OUTPUT_PATH = 'demo/output'
OUTPUT_LAYER = 'dots'
# Get ward data from CSV
# (we could also use data from attributes of the shapefile, a database,
# o... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2022 - 2025 R. Thomas
*
* 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... | unknown | github | https://github.com/nodejs/node | deps/LIEF/include/LIEF/ObjC/Metadata.hpp |
from __future__ import division, print_function, absolute_import
import numpy as np
def pad(data, padwidth, value=0.0):
"""
Pad an array with a specific value.
Parameters
----------
data : ndarray
Numpy array of any dimension and type.
padwidth : int or tuple
If int, it will pa... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | unknown | codeparrot/codeparrot-clean | ||
import re
import concurrent.futures
import itertools
from yajuu.extractors.anime.anime_extractor import AnimeExtractor
from yajuu.extractors.search_result import SearchResult
from yajuu.unshorteners import unshorten
class GogoAnimeIoExtractor(AnimeExtractor):
def _get_url(self):
return 'http://gogoanime.... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# 2015-09-03 Initial writeup.
# Cornelius Kölbel <cornelius@privacyidea.org>
#
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Softw... | unknown | codeparrot/codeparrot-clean | ||
from jc_types import Scope
class VMWriter:
arithmeticOperations = ["add", "sub", "and", "or", "not", "neg", "eq", "gt", "lt"]
scopeTable = { Scope.STATIC : "static",
Scope.FIELD : "dunno?",
Scope.ARG : "argument",
Scope.VAR : "local" }
def __init__... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
def save_training_data(dep_var, feature_1, feature_2, feature_3, mode):
path = './data/training/'
filename = path + str(mode) + '_train.svm'
with open(filename,'a') as f:
line = str(dep_var)
line += ' 1:' + str(feature_1)
line += ' 2:' + str(feature_2... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2006-2008 Joaquin M Lopez Munoz.
* 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)
*
* See http://www.boost.org/libs/flyweight for library home page.
*/
#ifndef BOOST_FLYWEIGHT_SET_FACTORY_FWD_HPP
... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/flyweight/set_factory_fwd.hpp |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 University of Dundee & Open Microscopy Environment.
All Rights Reserved.
Copyright 2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
pytest fixtures used as def... | 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 | ||
from contextlib import contextmanager
import os
import sys
from unittest import expectedFailure
from django.test import TestCase
from django.test.runner import DiscoverRunner
def expectedFailureIf(condition):
"""Marks a test as an expected failure if ``condition`` is met."""
if condition:
return expec... | unknown | codeparrot/codeparrot-clean | ||
'''
Author: S.T. Castle
Created: 2015-03-15
'''
#import math
import numpy as np
from scipy import ndimage
from scipy import stats
import scipy.ndimage.filters
import scipy.linalg
#import skimage.feature
import cv2
from matplotlib import pyplot as plt
def main():
'''
Run the explicit coherence enhancing filt... | unknown | codeparrot/codeparrot-clean | ||
# sql/util.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""High level utilities which build upon other modules here.
"""
from .. import exc, u... | unknown | codeparrot/codeparrot-clean | ||
package config
import (
"net/http"
"net/url"
"time"
"github.com/spf13/pflag"
"github.com/grafana/alerting/notify/historian/lokiclient"
"github.com/grafana/grafana-app-sdk/simple"
)
const (
lokiDefaultMaxQueryLength = 721 * time.Hour // 30d1h, matches the default value in Loki
lokiDefaultMaxQuerySize = 655... | go | github | https://github.com/grafana/grafana | apps/alerting/historian/pkg/app/config/config.go |
bugfixes:
- >-
``ansible-galaxy collection list`` - issue a warning when a collection's namespace and name do not match its
filepath. (https://github.com/ansible/ansible/issues/69813)
- >-
``ansible-galaxy collection list|install`` - list collections based on reference (the fqcn used to refer to them in... | unknown | github | https://github.com/ansible/ansible | changelogs/fragments/86402-galaxy-fix-metadata-foldername-mismatch.yml |
// run
// Copyright 2022 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"
"reflect"
"unsafe"
)
func main() {
var s = "abc"
sh1 := (*reflect.StringHeader)(unsafe.Pointer(&s))
ptr2 := unsafe.P... | go | github | https://github.com/golang/go | test/unsafe_string_data.go |
// Copyright Oliver Kowalke 2009.
// 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)
#ifndef BOOST_COROUTINES_ATTRIBUTES_H
#define BOOST_COROUTINES_ATTRIBUTES_H
#include <cstddef>
#include <b... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/coroutine/attributes.hpp |
import json
from collections import Counter
from os import listdir
from os.path import exists
from datetime import datetime
from db import CassandraUtils
SAIDA_PATH = "/Users/Labtime/Dropbox/Twitter/Friends.Distributions/union.mat"
FRIENDS_PATH = "/Volumes/Seagate Expansion Drive/Twitter/friends/"
STR_DATE_FORMAT =... | unknown | codeparrot/codeparrot-clean | ||
# What percent a filesystem has to be filled to be considered "full"
FULL_DISK_THRESHOLD=90
HAS_FULL_DISK=false
declare -a FULL_DISKS
# This will output the percent each filesystem is full in the following format:
# 91% /dev/root /
# 7% /dev/nvme0n1p15 /System/Volumes/Data
# 34% /dev/nvme1n1 /System/Volumes/Update
FIL... | unknown | github | https://github.com/mongodb/mongo | evergreen/full_disk_debug.sh |
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
# Copyright (C) 2010-2012 Kevin Mehall <km@kevinmehall.net>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This prog... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# 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.
... | unknown | codeparrot/codeparrot-clean | ||
"""Tests for the sampling profiler (profiling.sampling)."""
import os
from test.support import load_package_tests
def load_tests(*args):
"""Load all tests from this subpackage."""
return load_package_tests(os.path.dirname(__file__), *args) | python | github | https://github.com/python/cpython | Lib/test/test_profiling/test_sampling_profiler/__init__.py |
from django.urls import include, path
from django.views import View
def view1(request):
pass
def view2(request):
pass
class View3(View):
pass
nested = (
[
path("view1/", view1, name="view1"),
path("view3/", View3.as_view(), name="view3"),
],
"backend",
)
urlpatterns = [
... | python | github | https://github.com/django/django | tests/urlpatterns_reverse/nested_urls.py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Date
"""
from dateutil import parser
from rebulk.remodule import re
_dsep = r'[-/ \.]'
_dsep_bis = r'[-/ \.x]'
date_regexps = [
re.compile(r'%s((\d{8}))%s' % (_dsep, _dsep), re.IGNORECASE),
re.compile(r'%s((\d{6}))%s' % (_dsep, _dsep), re.IGNORECASE),
re.... | unknown | codeparrot/codeparrot-clean | ||
import json
import logging
from peewee import (SqliteDatabase, Model,
CharField
)
from os.path import exists as pexists
import datetime
import sha
DATABASE = 'lightop.sqlite'
DB_USER_VERSION = 1
database = SqliteDatabase(DATABASE, threadlocals=True)
class BaseModel(Model):
... | unknown | codeparrot/codeparrot-clean | ||
/**
* Tests that 'defaultMaxTimeMS' is applied correctly when used with tenantId.
*
* @tags: [
* requires_auth,
* requires_replication,
* # Transactions aborted upon fcv upgrade or downgrade; cluster parameters use internal txns.
* uses_transactions,
* featureFlagSecurityToken,
* requires_fcv_80,
... | javascript | github | https://github.com/mongodb/mongo | jstests/auth/default_max_time_ms_with_tenant.js |
from online_leastsq import OnlineLeastSquares
import numpy as np
import math
class LinearSystemID:
"""System identification for a system y = Ax + Bu + C with m state
variables and n inputs."""
def __init__(self,m,n):
self.m,self.n = m,n
self.coeffPattern = [None,None,None]
self.esti... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.common import Backend
from lib.core.data import conf
from lib.core.data import kb
from lib.core.dicts import DBMS_DICT
from lib.core.enums import DBMS
from lib.c... | unknown | codeparrot/codeparrot-clean | ||
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: speed-time
Short: y
Arg: <seconds>
Help: Trigger 'speed-limit' abort after this time
Category: connection timeout
Added: 4.7
Multi: single
See-also:
- speed-limit
- limit-rate
Example:
- --speed-limit 300 --speed-ti... | unknown | github | https://github.com/curl/curl | docs/cmdline-opts/speed-time.md |
## Input
```javascript
import {invoke} from 'shared-runtime';
function Component() {
let x = 2;
const fn = () => {
return {x: 'value'};
};
invoke(fn);
x = 3;
return x;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};
```
## Code
```javascript
import { invoke } from "shared... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constant-prop-colliding-identifier.expect.md |
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 Stephen Blum
## http://www.pubnub.com/
## -----------------------------------
## PubNub 3.1 Real-time Push Cloud API
## -----------------------------------
impo... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.