code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
#include "redismodule.h"
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <unistd.h>
#define UNUSED(V) ((void) V)
#define LIST_SIZE 1024
/* The FSL (Fixed-Size List) data type is a low-budget imitation of the
* native Redis list, in order to test list-like commands implemented
* by a module.
... | c | github | https://github.com/redis/redis | tests/modules/blockonkeys.c |
"""Exception classes raised by urllib.
The base exception class is URLError, which inherits from OSError. It
doesn't define any behavior of its own, but is the base class for all
exceptions defined in this package.
HTTPError is an exception class that is also a valid HTTP response
instance. It behaves this way beca... | python | github | https://github.com/python/cpython | Lib/urllib/error.py |
from django.conf.urls import patterns
urlpatterns = patterns('crits.raw_data.views',
(r'^details/(?P<_id>\w+)/$', 'raw_data_details'),
(r'^details_by_link/(?P<link>.+)/$', 'details_by_link'),
(r'^get_inline_comments/(?P<_id>\w+)/$', 'get_inline_comments'),
(r'^get_versions/(?P<_id>\w+)/$', 'get_raw_dat... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python3
#
# Copyright 2018 Red Hat, Inc.
#
# Authors:
# Paolo Bonzini <pbonzini@redhat.com>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
from collections import OrderedDict
import json
from django.contrib.auth.models import U... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# Copyright 2015 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 appli... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 10:35:23 2015
@author: Anton O Lindhal
"""
import numpy as np
import lmfit
from . progress import update_progress
_2pi = 2 * np.pi
_gauss_fwhm_factor = 2 * np.sqrt(2 * np.log(2))
def gaussian(x, amplitude, center, sigma):
return amplitude * np.exp(-(x-center)**2... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2011-2012 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 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/lic... | unknown | codeparrot/codeparrot-clean | ||
"""Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... | unknown | codeparrot/codeparrot-clean | ||
import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template.base import TemplateDoesNotExist
from django.template.loaders.filesystem import Loader as FilesystemLoader
from django.template.loaders.app_directories import Loader as AppDirectoriesLoader
from... | unknown | codeparrot/codeparrot-clean | ||
{
"event1": [
{
"type": "function",
"name": "var_dump",
"priority": 255
},
{
"type": "closure",
"priority": -1
}
],
"event2": [
{
"type": "object",
"name": "Symfony\\Bundle\\FrameworkB... | json | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.json |
#!/usr/bin/python
# coding: utf-8 -*-
#
# (c) 2018, Adrien Fleury <fleu42@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 = {'status': ['preview'],
... | unknown | codeparrot/codeparrot-clean | ||
import gensim
import logging
import sys
# logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
def book_to_sentences(filename):
with open(filename, 'rb') as infile:
sentences = []
sentence = []
for line in infile.readlines():
clean_line... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
... | unknown | codeparrot/codeparrot-clean | ||
import os
import sys
import ast
import gensim
import json
from gensim import utils
import multiprocessing
from gensim.models import Word2Vec
import logging
import argparse
logger = logging.getLogger(__name__)
import redis
data_obj = redis.Redis("localhost", port=6379, db=10) # 2, 9 (smaller), 10 (larger)
class Con... | unknown | codeparrot/codeparrot-clean | ||
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.CharField(ma... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# one_neuron_with_noise.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the L... | unknown | codeparrot/codeparrot-clean | ||
//! Basic types for managing and implementing lints.
//!
//! See <https://rustc-dev-guide.rust-lang.org/diagnostics.html> for an
//! overview of how lints are implemented.
use std::cell::Cell;
use std::slice;
use rustc_ast::BindingMode;
use rustc_ast::util::parser::ExprPrecedence;
use rustc_data_structures::fx::FxInd... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_lint/src/context.rs |
"""
Support for Homematic devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/homematic/
"""
import os
import time
import logging
from datetime import timedelta
from functools import partial
import voluptuous as vol
import homeassistant.helpers.co... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/internalModules/moduleDeclarations/asiPreventsParsingAsNamespace04.ts] ////
//// [asiPreventsParsingAsNamespace04.ts]
let module = 10;
module in {}
//// [asiPreventsParsingAsNamespace04.js]
"use strict";
let module = 10;
module in {}; | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/asiPreventsParsingAsNamespace04.js |
{
"name": "big-module-with-flag",
"sideEffects": false
} | json | github | https://github.com/webpack/webpack | examples/side-effects/node_modules/big-module-with-flag/package.json |
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"next-translate": "2.5.3",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"next-translate-plugin": "2.5.3"
}
} | json | github | https://github.com/vercel/next.js | examples/with-next-translate/package.json |
{
"type": "function",
"name": "method",
"class": "Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass"
} | json | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.json |
#encoding=utf8
from django.db import models
from django.conf import settings
from django.utils.dateformat import format
from django.core.exceptions import ObjectDoesNotExist
import logging, json, time, copy
import ldap
from ldap import modlist
from datetime import datetime
from pprint import pprint as pp
from fum.com... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | java | github | https://github.com/spring-projects/spring-framework | spring-context/src/test/java/org/springframework/resilience/ReactiveRetryInterceptorTests.java |
# Copyright (c) 2013 Spotify AB
#
# 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 | ||
"""
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
"""
from __future__ import absolute_import
import os
import sys
from pip.compat import WINDOWS, expanduser
from pip._vendor.six import PY2, text_type
def user_cache_dir(appname):
r"""
Return full path to th... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
import sys
if sys.version_info < (3, 0):
sys.stdout.write("Sorry, Python 3 og higher required\n")
sys.exit(1)
import argparse, pandas
from math import fabs
parser = argparse.ArgumentParser(description='Numerically compare two CSV files')
parser.add_argument('--tol', default=0.02, type=... | unknown | codeparrot/codeparrot-clean | ||
import React from 'react'
export default function Layout({ children }) {
return (
<html>
<head>
<title>My App</title>
</head>
<body>{children}</body>
</html>
)
} | javascript | github | https://github.com/vercel/next.js | bench/basic-app/app/layout.js |
"""
The Axis class display an axis on a graph
The axis contains a line with configurable style, possible arrows, and a title
.. attribute:: line_style
The LineStyle with which the axis line is drawn
.. attribute:: title
The string to be displayed alongside the axis
.. attribute::... | unknown | codeparrot/codeparrot-clean | ||
name: Junie
run-name: Junie run ${{ inputs.run_id }}
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
inputs:
run_id:
description: "id of workflow process"
required: true
workflow_params:
description: "stringified params"
required: true
jo... | unknown | github | https://github.com/ktorio/ktor | .github/workflows/junie.yml |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo;
use Doctrine\Common\Collect... | php | github | https://github.com/symfony/symfony | src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php |
### Minor changes to the library {#minor_library_changes} | unknown | github | https://github.com/golang/go | doc/initial/6-stdlib/99-minor/0-heading.md |
import ujson as json
import requests
import os
import re
from tinydb import where
from driver import Driver
class Session():
def __init__(self, config, round_obj, stype, sid="", filename=None):
self.config = config
self.round_obj = round_obj
self.stype = stype
self.sid = sid
... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import print_function
import sys
import cv2
import os
import numpy as np
import cPickle as pickle
import timeit
import time
from argparse import ArgumentParser
import chainer
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils, Link, Chain, ChainList
import ch... | unknown | codeparrot/codeparrot-clean | ||
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# 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 ... | unknown | codeparrot/codeparrot-clean | ||
{
"html": {
"type": "Fragment",
"start": 0,
"end": 117,
"children": [
{
"type": "Element",
"start": 0,
"end": 117,
"name": "textarea",
"attributes": [],
"children": [
{
"start": 10,
"end": 50,
"type": "Text",
"raw": "\n\t<p>not actu </textar ally an eleme... | json | github | https://github.com/sveltejs/svelte | packages/svelte/tests/parser-legacy/samples/textarea-end-tag/output.json |
use std::sync::Arc;
use thin_vec::thin_vec;
use crate::LoweringContext;
impl<'a, 'hir> LoweringContext<'a, 'hir> {
/// Lowered contracts are guarded with the `contract_checks` compiler flag,
/// i.e. the flag turns into a boolean guard in the lowered HIR. The reason
/// for not eliminating the contract c... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_ast_lowering/src/contract.rs |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 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 applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/core/tpu/kernels/compiled_subgraph.h |
# Copyright (c) 2012 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 collections
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
import gyp.common
import gyp.easy_xml as easy_xml
i... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from scrapy.spiders import Spider
from scrapy.utils.url import url_is_from_any_domain, url_is_from_spider, canonicalize_url
__doctests__ = ['scrapy.utils.url']
class UrlUtilsTest(unittest.TestCase):
def test_url_is_from_any_domain(self):
url = 'http://www.wheele-bin-art.co.uk/get/product... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://pythonhosted.org/setuptools/easy_install.html
"""
from... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | unknown | codeparrot/codeparrot-clean | ||
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2014,2015, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. ... | unknown | codeparrot/codeparrot-clean | ||
import TestsUtils
// This benchmark aims to measure heapSort path of stdlib sorting function.
// Datasets in this benchmark are influenced by stdlib partition function,
// therefore if stdlib partition implementation changes we should correct these
// datasets or disable/skip this benchmark
public let benchmarks = [
... | swift | github | https://github.com/apple/swift | benchmark/single-source/SortIntPyramids.swift |
import pickle
import datetime
import os.path as path
default_date_format = '%Y/%m/%d'
class DatedFilesReader:
"""To only be used in a with block. This class will read a file up to
the current date and will store progress information into a specified
checkpoint file."""
def __init__(self, checkpoint_fi... | unknown | codeparrot/codeparrot-clean | ||
#ifndef NPY_SIMD
#error "Not a standalone header, use simd/simd.h instead"
#endif
#ifndef _NPY_SIMD_AVX512_MASKOP_H
#define _NPY_SIMD_AVX512_MASKOP_H
/**
* Implements conditional addition and subtraction.
* e.g. npyv_ifadd_f32(m, a, b, c) -> m ? a + b : c
* e.g. npyv_ifsub_f32(m, a, b, c) -> m ? a - b : c
*/
... | c | github | https://github.com/numpy/numpy | numpy/_core/src/common/simd/avx512/maskop.h |
// Copyright The Prometheus 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 w... | go | github | https://github.com/prometheus/prometheus | discovery/hetzner/hcloud_test.go |
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use crate::{
helpers::{
framework::{infer_from_package_json as infer_framework, Framework},
npm::PackageManager,
prompts, resolve_tauri_path, template,
},
Versi... | rust | github | https://github.com/tauri-apps/tauri | crates/tauri-cli/src/init.rs |
import argparse
import functools
import importlib
import os
import torch
import torch.distributed as dist
import torch.nn as nn
from torch._dynamo.testing import reduce_to_scalar_loss
from torch.distributed.algorithms._checkpoint.checkpoint_wrapper import (
apply_activation_checkpointing,
checkpoint_wrapper,
... | python | github | https://github.com/pytorch/pytorch | benchmarks/dynamo/dist_util.py |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
import frappe
import unittest
from frappe.utils import get_datetime
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
class TestScheduledJobType(unittest.TestCase):
def setUp(self):
fr... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python2
import os
import sys
import shutil
from datetime import datetime
import time
from optparse import OptionParser, OptionGroup
import logging
import fnmatch
import yaml
import wok
from wok.page import Page, Author
from wok import renderers
from wok import util
from wok.dev_server import dev_server
im... | 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 u... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
class BeforeEnqueueError < StandardError; end
class RetriesJob < ActiveJob::Base
attr_accessor :raise_before_enqueue
# The job fails in before_enqueue the first time it retries itself.
before_perform do
self.raise_before_enqueue = true
end
# The job fails once to enqueue/... | ruby | github | https://github.com/rails/rails | activejob/test/jobs/retries_job.rb |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'UserProfile.name'
db.alter_column('auth_userprofile', 'name', self.gf('django.db.models.fields.C... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
import sys
import os
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for Boto ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# encoding: utf-8
"""Class to spin up a headless browser to handle Moodle interaction
"""
from mechanize import Browser, CookieJar
from bs4 import BeautifulSoup
from moodlefuse.exception import throws_moodlefuse_error
from moodlefuse.moodle.emulator.emulator import Emulator
from moodlefuse.mood... | unknown | codeparrot/codeparrot-clean | ||
# vim: ts=4:sw=4:expandtab
# -*- coding: UTF-8 -*-
# BleachBit
# Copyright (C) 2008-2015 Andrew Ziem
# http://bleachbit.sourceforge.net
#
# 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 ... | 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 | ||
"""A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.
Don't import directly from third-party code; use the `locale` module instead!
"""
import sys
import _locale
if sys.platform.startswith("win"):
def getpreferredencoding(do_setlocale=... | unknown | codeparrot/codeparrot-clean | ||
from coalib.bearlib.aspects import Taste, aspectclass
from coalib.bearlib.aspects.base import aspectbase
import pytest
@pytest.fixture
def RootAspect():
"""
An exclusive Root aspectclass for unit tests.
"""
class RootAspect(aspectbase, metaclass=aspectclass):
parent = None
_tastes = {... | unknown | codeparrot/codeparrot-clean | ||
import os
import string
from pydispatch import dispatcher
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Generate Agent',
'Author': ['@harmj0y'],
'Description': ("Generates an agent code instance for a spe... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python3
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context ... | unknown | codeparrot/codeparrot-clean | ||
import json
from django.contrib.postgres import lookups
from django.contrib.postgres.forms import SimpleArrayField
from django.contrib.postgres.validators import ArrayMaxLengthValidator
from django.core import checks, exceptions
from django.db.models import Field, IntegerField, Transform
from django.db.models.lookups ... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) 2011 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/reflect/TypesTest.java |
#***************************************************************************
#* *
#* Copyright (c) 2014 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | unknown | codeparrot/codeparrot-clean | ||
package kotlinx.coroutines.flow
import kotlinx.coroutines.testing.*
import kotlinx.coroutines.*
import org.junit.*
class SafeCollectorMemoryLeakTest : TestBase() {
// custom List.forEach impl to avoid using iterator (FieldWalker cannot scan it)
private inline fun <T> List<T>.listForEach(action: (T) -> Unit) {... | kotlin | github | https://github.com/Kotlin/kotlinx.coroutines | kotlinx-coroutines-core/jvm/test/flow/SafeCollectorMemoryLeakTest.kt |
# Copyright (c) 2011 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 ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014, 2015 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
import os
import re
import pp... | 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 | ||
# frozen_string_literal: true
module ActionView
module Helpers
module Tags # :nodoc:
class NumberField < TextField # :nodoc:
def render
options = @options.stringify_keys
if range = options.delete("in") || options.delete("within")
options.update("min" => range.min, "... | ruby | github | https://github.com/rails/rails | actionview/lib/action_view/helpers/tags/number_field.rb |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file make_qml_dbus_cpp.py
# @brief Generator of QML to QDbus C++ part
#
# This file is a part of HMI D-Bus layer.
#
# Copyright (c) 2014, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, ... | unknown | codeparrot/codeparrot-clean | ||
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\ExpressionLanguage;
/**
* @author Fabien Potencier <... | php | github | https://github.com/symfony/symfony | src/Symfony/Component/ExpressionLanguage/ExpressionFunctionProviderInterface.php |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Authors: Peter Eastman, Robert McGibbon
# Contributors: Kyle A. Beaucha... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
// @enableTreatFunctionDepsAsConditional
function Component(props) {
function getLength() {
return props.bar.length;
}
return props.bar && getLength();
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{bar: null}],
};
```
## Code
```javascript
import { c as _c } f... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr–conditional-access.expect.md |
from django.db import models
from djorm_pgarray.fields import ArrayField
from .base import OCDBase, LinkBase, OCDIDField, RelatedBase
from .people_orgs import Organization, Person
from .jurisdiction import LegislativeSession
from .bill import Bill
from .. import common
class VoteEvent(OCDBase):
id = OCDIDField(oc... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# This file is part of the OpenMV project.
#
# Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
# Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
#
# This work is licensed under the MIT license, see the file LICENSE for details.
#
# pygame + sockets util that re... | unknown | codeparrot/codeparrot-clean | ||
"""
from: http://adventofcode.com/2017/day/5
--- Day 5: A Maze of Twisty Trampolines, All Alike ---
An urgent interrupt arrives from the CPU: it's trapped in a maze of jump instructions, and it would
like assistance from any programs with spare cycles to help find the exit.
The message includes a list of the offsets f... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
'''
Python WebSocket library with support for "wss://" encryption.
Copyright 2011 Joel Martin
Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
Supports following protocol versions:
- http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07
- http://tools.ietf.org/html/dr... | unknown | codeparrot/codeparrot-clean | ||
import data_utils
import numpy as np
PATH = '../data/twitter/'
class Twitter(object):
def __init__(self, path=PATH):
# data
metadata, idx_q, idx_a = data_utils.load_data('../data/')
# get dictionaries
i2w = metadata['idx2w']
w2i = metadata['w2idx']
# num of examp... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct... | unknown | codeparrot/codeparrot-clean | ||
//go:build linux
/*
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 agre... | go | github | https://github.com/kubernetes/kubernetes | pkg/volume/volume_linux_test.go |
#!/usr/bin/env python
#
# run msvs compiler with /showincludes and generate make dependencies
#
from optparse import OptionParser, BadOptionError
from os.path import basename, splitext
from subprocess import Popen, PIPE, STDOUT
from sys import argv
# an options parser that will pass-through unrecognized options
class... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1.1, s, t 2.1, s, t 3.1, s, q"
tags = "Label, color, text"
import cocos
... | unknown | codeparrot/codeparrot-clean | ||
"""
this is a sample shows twc-naive-bayes train and test
"""
import math
import pickle
import sys,os
sys.path.append(os.path.join(os.getcwd(), '../'))
from pymining.math.matrix import Matrix
from pymining.math.text2matrix import Text2Matrix
from pymining.nlp.segmenter import Segmenter
from pymining.common.global_inf... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
from __future__ import annotations
DOCUMENTATION = """
---
module: subdir_module
short_description: A module in multiple subdirectories
description:
- A module in multiple subdirectories
author:
- Ansible Core Team
version_added: 1.0.0
options: {}
"""
EXAMPLES = """
"""
RETURN = """
"""
fr... | python | github | https://github.com/ansible/ansible | test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/database/database_type/subdir_module.py |
/*
* 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/EnumHashBiMapTest.java |
#
#
# Copyright (C) 2014 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | unknown | codeparrot/codeparrot-clean | ||
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: BUSL-1.1
package pki
import (
"fmt"
"time"
)
type ACMEIdentifierType string
const (
ACMEDNSIdentifier ACMEIdentifierType = "dns"
ACMEIPIdentifier ACMEIdentifierType = "ip"
)
type ACMEIdentifier struct {
Type ACMEIdentifierType `json:"type... | go | github | https://github.com/hashicorp/vault | builtin/logical/pki/acme_authorizations.go |
// Package syslog provides the logdriver for forwarding server logs to syslog endpoints.
package syslog
import (
"crypto/tls"
"errors"
"fmt"
"net"
"net/url"
"os"
"strconv"
"strings"
"time"
syslog "github.com/RackSec/srslog"
"github.com/docker/go-connections/tlsconfig"
"github.com/moby/moby/v2/daemon/logge... | go | github | https://github.com/moby/moby | daemon/logger/syslog/syslog.go |
import { test } from '../../test';
export default test({
// This test verifies that completely static select with rich option content
// hydrates correctly and the content is preserved
snapshot(target) {
const select = target.querySelector('select');
const options = target.querySelectorAll('option');
return ... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/tests/hydration/samples/option-rich-content-static/_config.js |
/*
Copyright (c) 2001, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (includ... | c | github | https://github.com/mysql/mysql-server | include/my_bitmap.h |
"""
Read temperature information from Eddystone beacons.
Your beacons must be configured to transmit UID (for identification) and TLM
(for temperature) frames.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eddystone_temperature/
"""
import loggi... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be... | c | github | https://github.com/opencv/opencv | 3rdparty/libwebp/src/dsp/ssim.c |
cisco_881 = {
'device_type': 'cisco_ios',
'ip': '10.10.10.227',
'username': 'test1',
'password': 'password',
'secret': 'secret',
'verbose': False,
}
cisco_asa = {
'device_type': 'cisco_asa',
'ip': '10.10.10.226',
'username': 'admin',
'password': 'password',
'secret': 'se... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2013 Google Inc. All Rights Reserved.
"""Tests for utils.py."""
import unittest
from protorpc import messages
from . import utils
class UtilsTests(unittest.TestCase):
"""Comprehensive test for the endpoints_proto_datastore.utils module."""
def testIsSubclass(self):
"""Tests the utils.IsSubclas... | unknown | codeparrot/codeparrot-clean | ||
import tkinter
from porcupine import get_main_window
from porcupine.plugins.urls import find_urls
def test_find_urls_basic():
text = tkinter.Text(get_main_window())
urls = [
'https://github.com/Akuli/porcupine/',
'http://example.com/',
'http://example.com/comma,stuff',
]
for ur... | unknown | codeparrot/codeparrot-clean | ||
'''
Structure definitions for the OSX MachO binary format.
'''
import struct
import vstruct
from vstruct.defs.macho.fat import *
from vstruct.defs.macho.const import *
from vstruct.defs.macho.stabs import *
from vstruct.defs.macho.loader import *
class mach_o(vstruct.VStruct):
def __init__(self):
vstruct... | unknown | codeparrot/codeparrot-clean | ||
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\RoutingConditionS... | php | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/RoutingConditionServiceBundle/Service/ManuallyTaggedService.php |
from itoc import itoc
from ctoi import ctoi
from stoi import stoi
def _whitespace(c):
i = ctoi(c)
if i < 0x21 or i > 0x7e:
return True
return False
def _scan_line(line,c):
for i in range(len(line)):
if line[i] == c or line[i] == '\n':
break
return i
def _parse_line(lin... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.