code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
"""
HypermediaHttpServer extends the BaseHttpRequestHandler class in BaseHttpServer to create a dictionary driven interface
to http requesters and response handlers that allows the processing of requests in the order of path, content format, and method.
Requests and their associated responses are exposed in a dictiona... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SubProcess import SubProcess
import sys
from portage.cache.mappings import slot_dict_class
import portage
portage.proxy.lazyimport.lazyimport(globals(),
'portage.package.ebuild._metadata_invalid:eap... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
File Name: proxy.py
Description: 自动从大象代理获得代理IP
Author: Dexter Chen
Date:2017-09-16
-------------------------------------------------
"""
import os
import requests
import utilities as ut
import config
def r... | unknown | codeparrot/codeparrot-clean | ||
# strings
assert 'a'.__class__ == str
assert isinstance('a',str)
hello = "This is a rather long string containing\n\
several lines of text just as you would do in C.\n\
Note that whitespace at the beginning of the line is\
significant."
hello = """\
Usage: thingy [OPTIONS]
-h Display... | unknown | codeparrot/codeparrot-clean | ||
# 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 in the hope that ... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* EUC_CN <--> UTF8
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/backend/utils/mb/conversion_procs/utf8_an... | c | github | https://github.com/postgres/postgres | src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c |
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
import os
from typing import Any, cast
import httpx
import pytest
from respx import MockRouter
import openai._legacy_response as _legacy_response
from openai import OpenAI, AsyncOpenAI
from tests... | python | github | https://github.com/openai/openai-python | tests/api_resources/containers/files/test_content.py |
from __future__ import unicode_literals
import sys
import inspect
from collections import Mapping
from future.utils import PY3, exec_
if PY3:
import builtins
def apply(f, *args, **kw):
return f(*args, **kw)
from past.builtins import str as oldstr
def chr(i):
"""
Return a byt... | unknown | codeparrot/codeparrot-clean | ||
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import unified_timestamp
class CtsNewsIE(InfoExtractor):
IE_DESC = '華視新聞'
_VALID_URL = r'https?://news\.cts\.com\.tw/[a-z]+/[a-z]+/\d+/(?P<id>\d+)\.html'
_TESTS = [{
'url': 'http://news.cts.com.t... | unknown | codeparrot/codeparrot-clean | ||
"""
A basic long term trend strategy applied separately to several
securities.
1. S&P 500 index closes above its 200 day moving average
2. The stock closes above its upper band, buy
3. S&P 500 index closes below its 200 day moving average
4. The stock closes below its lower band, sell your long position.
"""
import ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | unknown | codeparrot/codeparrot-clean | ||
import io
import os
import json
DIALECT_FILE_PATH = os.path.join(
os.path.dirname(__file__),
'gherkin-languages.json')
with io.open(DIALECT_FILE_PATH, 'r', encoding='utf-8') as file:
DIALECTS = json.load(file)
class Dialect(object):
@classmethod
def for_name(cls, name):
return cls(DIALEC... | unknown | codeparrot/codeparrot-clean | ||
import math
import sys
def sd_calc(data):
n = len(data)
if n <= 1:
return 0.0
mean, sd = avg_calc(data), 0.0
for el in data:
sd += (float(el) - mean)**2
sd = math.sqrt(sd / float(n-1))
return sd
def avg_calc(ls):
n, mean = len(ls), 0.0
if n <= 1:
return ls[0]
... | unknown | mbpp | ||
{
"name": "@prometheus-io/app",
"version": "0.300.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@prometheus-io/app",
"version": "0.300.1",
"dependencies": {
"@codemirror/autocomplete": "^6.18.6",
"@codemirror/commands": "^6.8.1",
"@codem... | json | github | https://github.com/prometheus/prometheus | web/ui/react-app/package-lock.json |
'use strict';
const path = require('path');
const { spawn, fork } = require('node:child_process');
const CLI = require('./_cli.js');
const { styleText } = require('node:util');
const cli = new CLI(`usage: ./node run.js [options] [--] <category> ...
Run each benchmark in the <category> directory a single time, more ... | javascript | github | https://github.com/nodejs/node | benchmark/run.js |
#-*- coding: ISO-8859-1 -*-
# pysqlite2/test/transactions.py: tests transactions
#
# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
#... | unknown | codeparrot/codeparrot-clean | ||
### Overrides for some suites with RotateExecutionControlParams hook ###
- name: replica_sets_reconfig_hooks_with_dynamic_execution_control
value:
executor:
hooks:
- class: RunDBCheckInBackground
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
... | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/matrix_suites/overrides/execution_control_params.yml |
"""
Tests for select_related()
``select_related()`` follows all relationships and pre-caches any foreign key
values so that complex trees can be fetched in a single query. However, this
isn't always a good idea, so the ``depth`` argument control how many "levels"
the select-related behavior will traverse.
"""
from dj... | python | github | https://github.com/django/django | tests/select_related/models.py |
test_kind: fsm_workload_test
selector:
roots:
- jstests/concurrency/fsm_workloads/**/*.js
- src/mongo/db/modules/*/jstests/concurrency/fsm_workloads/*.js
exclude_files:
##
# Disabled due to MongoDB restrictions and/or workload restrictions
##
exclude_with_any_tags:
- requires_standalone
... | unknown | github | https://github.com/mongodb/mongo | buildscripts/resmokeconfig/suites/concurrency_replication_maintenance.yml |
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... | java | github | https://github.com/elastic/elasticsearch | client/rest/src/test/java/org/elasticsearch/client/documentation/RestClientDocumentation.java |
#! /usr/bin/env python
"""Basic tests for os.popen()
Particularly useful for platforms that fake popen.
"""
import unittest
from test import support
import os, sys
# Test that command-lines get down as we expect.
# To do this we execute:
# python -c "import sys;print(sys.argv)" {rest_of_commandline}
# This resu... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import sys
import matplotlib.pyplot as plt
sys.path.append("../")
from controller.Controller_Result_Experiment import ControllerScreenResultExperiment
from Window import Main, Gtk, GdkPixbuf
controller = ControllerScreenResultExperiment()
class WindowResultExperiment:
... | unknown | codeparrot/codeparrot-clean | ||
#! /usr/bin/env python
# encoding: utf-8
"""
Waf 1.6
Try to detect if the project directory was relocated, and if it was,
change the node representing the project directory. Just call:
waf configure build
Note that if the project directory name changes, the signatures for the tasks using
files in that directory wi... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
"""
The NetAppCollector collects metric from a NetApp installation using the
NetApp Manageability SDK. This allows access to many metrics not available
via SNMP.
For this to work you'll the SDK available on the system.
This module has been developed using v5.0 of the SDK.
As of writing the SDK can be f... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
from flask import Blueprint, render_template, redirect, request
from flask_login import current_user, login_user
import usecase
web_views = Blueprint('user_web_views', __name__, template_folder='templates')
@web_views.route('/admin')
def admin():
values = {}
if not current_user.is_authenticat... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python2.7
#
# Copyright (C) 2014 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program ... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import logging
import os
import time
from os import listdir
from os.path import join
from threading import Thread, Lock
from select import select
from Queue import Queue, Empty
import openerp
import openerp.addons.hw_proxy.controllers.main as hw_proxy
from openerp import http
from openerp.http ... | unknown | codeparrot/codeparrot-clean | ||
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.editing_module import EditingDescriptor
from xmodule.x_module import XModule
from xmodule.xml_module import XmlDescriptor
from xblock.fields import Scope, Integer, String
from .fields import Date
from .util.duedate import get... | unknown | codeparrot/codeparrot-clean | ||
# miscellaneous functions
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import numpy as _np
import psyutils as _pu
import itertools as it
import pandas as pd
def fixation_cross():
"""Return a 256 square numpy array containing a rendering of the
fixation cross recommended in Thaler et... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# 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.
"""Utility functions for Windows builds.
These functions are executed via gyp-win-tool when using the ninja generator.
"""
import os
impor... | unknown | codeparrot/codeparrot-clean | ||
//// [tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleWithSameNameAndCommonRoot.ts] ////
//// [class.ts]
namespace X.Y {
export class Point {
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
x: number;
y: number;
}
}
... | javascript | github | https://github.com/microsoft/TypeScript | tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js |
- Feature Name: Streaming Replication Between Clusters
- Status: in-progress
- Start Date: 2020-11-19
- Authors: BulkIO Team
- RFC PR: 56932
- Cockroach Issue: #57433
# Streaming Replication Between Clusters (aka Physical Cluster Replication - PCR)
## Summary
This document describes a mechanism for **replicating cha... | unknown | github | https://github.com/cockroachdb/cockroach | docs/RFCS/20201119_streaming_cluster_to_cluster.md |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | unknown | codeparrot/codeparrot-clean | ||
A lifetime didn't match what was expected.
Erroneous code example:
```compile_fail,E0623
struct Foo<'a, 'b, T>(std::marker::PhantomData<(&'a (), &'b (), T)>)
where
T: Convert<'a, 'b>;
trait Convert<'a, 'b>: Sized {
fn cast(&'a self) -> &'b Self;
}
impl<'long: 'short, 'short, T> Convert<'long, 'short> for T {... | unknown | github | https://github.com/rust-lang/rust | compiler/rustc_error_codes/src/error_codes/E0623.md |
"""Camera support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging
import requests
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv
f... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
import os, sys
if len(sys.argv) < 3:
print('This tool shows very different file sizes')
print('Usage: {0} <newdir> <olddir> [threshold_in_%]'.format(sys.argv[0]))
sys.exit(0)
new_path = sys.argv[1]
old_path = sys.argv[2]
threshold = (int(sys.argv[3]) if len(sys.argv) > 3 else 10) / 100.0 + 1
m... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
function Component({item, cond}) {
const [prevItem, setPrevItem] = useState(item);
const [state, setState] = useState(0);
useMemo(() => {
if (cond) {
setPrevItem(item);
setState(0);
}
}, [cond, key, init]);
return state;
}
```
## Error
```
Found 2 errors:
Erro... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-conditional-setState-in-useMemo.expect.md |
"""Copyright 2008 Orbitz WorldWide
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... | unknown | codeparrot/codeparrot-clean | ||
"""
WSGI config for auth_example project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* pg_ndistinct.c
* pg_ndistinct data type support.
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/backend/u... | c | github | https://github.com/postgres/postgres | src/backend/utils/adt/pg_ndistinct.c |
#! /usr/bin/env python
"""A Python debugger."""
# (See pdb.doc for documentation.)
import sys
import linecache
import cmd
import bdb
from repr import Repr
import os
import re
import pprint
import traceback
class Restart(Exception):
"""Causes a debugger to be restarted for the debugged python program."""
pas... | unknown | codeparrot/codeparrot-clean | ||
See [Testing](../contributing/core/testing.md) for more information on how you can run/write/debug tests for Next.js. | unknown | github | https://github.com/vercel/next.js | test/readme.md |
import collections
import datetime
import re
import savory_pie
class ValidationError(Exception):
def __init__(self, resource, errors):
self.resource = resource
self.errors = errors
def validate(ctx, key, resource, source_dict):
"""
Descend through a resource, including its fields and any r... | unknown | codeparrot/codeparrot-clean | ||
from collections.abc import Callable, Iterable, Iterator, Mapping
from itertools import islice, tee, zip_longest
from django.utils.functional import Promise
__all__ = [
"BaseChoiceIterator",
"BlankChoiceIterator",
"CallableChoiceIterator",
"flatten_choices",
"normalize_choices",
]
class BaseChoic... | python | github | https://github.com/django/django | django/utils/choices.py |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os, random
import queue
# In[2]:
def hierachy_generator(k, size):
index = 0
hierachy_dict = {}
sub_ordinates_dict = {}
employees = []
root = 'e'+str(index)
index+=1
employees.append(root)
hierachy_dict[root] = []
sub_ordinates... | unknown | codeparrot/codeparrot-clean | ||
- name: test none
set_fact:
none_var: "{{ yaml_none }}"
none_var_direct: "{{ None }}"
- assert:
that:
- none_var is sameas none
- none_var|type_debug == "NoneType"
- none_var_direct is sameas none
- none_var_direct|type_debug == "NoneType" | unknown | github | https://github.com/ansible/ansible | test/integration/targets/jinja2_native_types/test_none.yml |
from __future__ import absolute_import
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from .models import City
class GeoFeedTest(TestCase):
urls = 'django.contrib.gis.tests.geoapp.urls'
def setUp(self):
Sit... | 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 | ||
// stub module to test header files' C++ compatibility
extern "C" {
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_event_connect.h>
#include <ngx_event_pipe.h>
#include <ngx_http.h>
#include <ngx_mail.h>
#include <ngx_mail_pop3_module.h>
#include <ngx_mail_imap_m... | cpp | github | https://github.com/nginx/nginx | src/misc/ngx_cpp_test_module.cpp |
#!/usr/bin/python
import binascii
import hashlib
import os
import re
import shutil
import subprocess
import sys
import tempfile
import unittest
TOR = "./src/or/tor"
TOP_SRCDIR = "."
if len(sys.argv) > 1:
TOR = sys.argv[1]
del sys.argv[1]
if len(sys.argv) > 1:
TOP_SRCDIR = sys.argv[1]
del sys.argv[1]... | unknown | codeparrot/codeparrot-clean | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | unknown | codeparrot/codeparrot-clean | ||
# -- Project information -----------------------------------------------------
project = "Supysonic"
author = "Alban Féron"
copyright = "2013-2021, " + author
version = "0.6.3"
release = "0.6.3"
# -- General configuration ---------------------------------------------------
extensions = []
templates_path = []
source... | unknown | codeparrot/codeparrot-clean | ||
from django.middleware.csrf import get_token
from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils.safestring import SafeString
def csrf_input(request):
return format_html(
'<input type="hidden" name="csrfmiddlewaretoken" value="{}">',
get_token(reques... | python | github | https://github.com/django/django | django/template/backends/utils.py |
// Copyright IBM Corp. 2016, 2025
// SPDX-License-Identifier: MPL-2.0
package api
import (
"net/http"
"net/url"
"testing"
)
func TestBuildSamplePolicy(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
req *OutputPolicyError
expected string
err error
}{
{
"happy path",... | go | github | https://github.com/hashicorp/vault | api/output_policy_test.go |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | unknown | codeparrot/codeparrot-clean | ||
"""
View logic for handling course messages.
"""
from datetime import datetime
from babel.dates import format_date, format_timedelta
from django.contrib import auth
from django.template.loader import render_to_string
from django.utils.http import urlquote_plus
from django.utils.translation import get_language, to_loc... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import sys
import pkg_resources
from datetime import datetime
from tempfile import NamedTemporaryFile
import petl as etl
from petl.io.xlsx import fromxlsx, toxlsx
from petl.test.helpers import ieq
try:
# noinspection PyUnres... | 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... | typescript | github | https://github.com/apache/airflow | airflow-core/src/airflow/ui/src/utils/query.ts |
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/common.h>
#include <spdlog/details/null_mutex.h>
#include <spdlog/sinks/base_sink.h>
#ifdef _WIN32
#include <spdlog/details/udp_client-windows.h>... | c | github | https://github.com/nodejs/node | deps/LIEF/third-party/spdlog/include/spdlog/sinks/udp_sink.h |
# Copyright (C) 2010, 2012 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 an... | unknown | codeparrot/codeparrot-clean | ||
"""
Something to Feature Class using ArcGIS tools
"""
import arcpy
"""
Array to Feature Class
"""
def geomArray_to_fc(array, output, GEOM_TYPE, EPSG, overwrite=True, fields=None):
"""
Convert a array as
array = [
{
"FID" : 0,
"OTHER_FIELDS" : value
"GEOM" : [(x1... | unknown | codeparrot/codeparrot-clean | ||
# 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.
"""This parser turns the heap_dump output into a |NativeHeap| object."""
import json
from memory_inspector.core import native_heap
from memory_inspector.co... | unknown | codeparrot/codeparrot-clean | ||
from sqlviewer.glimpse.services import save_imported_model
from sqlviewer.integration.mysqlwb import import_model
__author__ = 'Stefan Martinov <stefan.martinov@gmail.com>'
import os
import time
from threading import Thread # This is the right package name
from django.core.management.base import BaseCommand, Comman... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2013 Cloudbase Solutions SRL
# 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 r... | unknown | codeparrot/codeparrot-clean | ||
# frozen_string_literal: true
require "action_view/helpers/tag_helper"
require "active_support/html_safe_translation"
module ActionView
module Helpers # :nodoc:
# = Action View Translation \Helpers
module TranslationHelper
extend ActiveSupport::Concern
include TagHelper
# Specify whether... | ruby | github | https://github.com/rails/rails | actionview/lib/action_view/helpers/translation_helper.rb |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | unknown | codeparrot/codeparrot-clean | ||
'''
A linear regression learning algorithm example using TensorFlow library.
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
import tensorflow as tf
import numpy
import matplotlib.pyplot as plt
rng = numpy.random
# Parameters
learning_rate = 0.01
training_epochs = 2000
displ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
""" ir.py - parse c declarations
(c) 2002, 2003, 2004, 2005 Simon Burton <simon@arrowtheory.com>
Released under GNU LGPL license.
version 0.xx
"""
import sys
#import cPickle as pickle
import pickle
#from lexer import Lexer
from parse_core import Symbols #, Parser
import node as node_module
im... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""Import the given python module(s) and report error(s) encountered."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
def main():
"""
Main program function used to isolate globals from imported code.
Changes to globals in imported modules on ... | unknown | codeparrot/codeparrot-clean | ||
import unittest, test.test_support
import colorsys
def frange(start, stop, step):
while start <= stop:
yield start
start += step
class ColorsysTest(unittest.TestCase):
def assertTripleEqual(self, tr1, tr2):
self.assertEqual(len(tr1), 3)
self.assertEqual(len(tr2), 3)
se... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.moves.urllib.parse import quote_plus
import logging
import re
from requests.exceptions import RequestException
from flexget import plugi... | unknown | codeparrot/codeparrot-clean | ||
#
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
# 2007-09-10 fl new selection engine
# 2007-09-12 fl fix... | python | github | https://github.com/python/cpython | Lib/xml/etree/ElementPath.py |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,sys,re,tempfile
from waflib import Utils,Task,Logs,Options,Errors
from waflib.Logs import debug,warn
from waflib.TaskGen import after_method,feature
from waflib.Configure import conf
from w... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2014 TrilioData, Inc
# Copyright (c) 2015 EMC Corporation
# 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
# ... | unknown | codeparrot/codeparrot-clean | ||
//===--- SILValue.h - Value base class for SIL ------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... | c | github | https://github.com/apple/swift | include/swift/SIL/SILValue.h |
# coding: utf-8
from django.conf.urls import patterns, url
from app.floorMap import views
urlpatterns = patterns(
'',
# Floor map page
url(r'^$', views.FloorMapIndex.as_view(), name='index'),
# Settings page
url(r'^settings$', views.SettingsUpdate.as_view(), name='settings'),
# Forms for r... | unknown | codeparrot/codeparrot-clean | ||
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#ifndef BOOST_FT_COMPONENTS_HPP_INCLUDED
#define BOOST_FT_CO... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/function_types/components.hpp |
//go:build windows
/*
Copyright 2022 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 ag... | go | github | https://github.com/kubernetes/kubernetes | cmd/kubeadm/app/apis/kubeadm/validation/util_windows.go |
from single import Single
from pair import Pair
from multi import Multi
from egfrd import EGFRDSimulator
from gillespie import GillespieSimulator
import _gfrd
# get methods return an iterator, dump methods return a string.
__all__ = [
'get_species',
'dump_species',
'get_species_names',
'dump_species_na... | 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\Form;
/**
* Entry point of the Form component.
*
*... | php | github | https://github.com/symfony/symfony | src/Symfony/Component/Form/Forms.php |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
##########################################################################
#
# Copyright 2009 VMware, Inc.
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and ass... | unknown | codeparrot/codeparrot-clean | ||
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
from os import listdir
from os.path import isfile, isdir
from collections import Iterable
from kafka import SimpleProducer, KafkaClient
from argparse import ArgumentParser
def read_all(files, max_lines=None):
if not isinstance(files, Iterable):files = [files]
read_lines =0
for f in f... | unknown | codeparrot/codeparrot-clean | ||
import collections
import datetime
import functools
import importlib
import inspect
import io
import linecache
import os
from os.path import normcase
import _pickle
import re
import shutil
import sys
import types
import unicodedata
import unittest
import unittest.mock
try:
from concurrent.futures import ThreadPool... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Darren Worrall <darren@iweb.co.uk>
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 So... | unknown | codeparrot/codeparrot-clean | ||
import math
import numpy as np
import numpy.ma as ma
import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.artist import kwdocd
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker import Formatter, Locat... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
# # Deep MNIST
# #### Construct a deep convolutional MNIST classifier
# #### from https://www.tensorflow.org/versions/r0.9/tutorials/mnist/pros/index.html
# ## Load MNIST Data
# In[2]:
from tensorflow.examples.tutorials.mnist import input_data
# In[3]:
# Load training, validation, and testing se... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2015 Taiga Agile LLC <support@taiga.io>
#
# 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 Free Software Foundation, either version 3 of th... | unknown | codeparrot/codeparrot-clean | ||
# 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.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class IntlHiRuPage(page_module.Page):
def __init__(s... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: 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):
# Removing unique constraint on 'Project', fields ['slug']
db.delete_unique('sentry_project', ['slug'])
... | unknown | codeparrot/codeparrot-clean | ||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/qcom,qcs8300-gcc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Technologies, Inc. Global Clock & Reset Controller on QCS8300
maintainers:
- Taniya Das <quic_tdas@quicinc.co... | unknown | github | https://github.com/torvalds/linux | Documentation/devicetree/bindings/clock/qcom,qcs8300-gcc.yaml |
/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | java | github | https://github.com/spring-projects/spring-boot | buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java |
# 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 applica... | unknown | codeparrot/codeparrot-clean | ||
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
# Notarize a generated node-<version>.pkg file as an Apple requirement for installation on macOS Catalina and later, as validated by Gatekeeper.
# Uses notarytool and requires Xcode >= 13.0.
pkgid="$1"
if [ -z "$pkgid" ]; then
echo "Usage: $0 <pkgid>"
exit 1
fi
# shellcheck disable=SC2154
if [ -z "$NO... | unknown | github | https://github.com/nodejs/node | tools/osx-notarize.sh |
{
"name": "my-vend/my-app",
"license": "MIT"
} | json | github | https://github.com/composer/composer | tests/Composer/Test/Config/Fixtures/composer-empty.json |
/*
* Copyright (c) 2009-Present, Redis Ltd.
* All rights reserved.
*
* Licensed under your choice of (a) the Redis Source Available License 2.0
* (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
* GNU Affero General Public License v3 (AGPLv3).
*/
#include "server.h"
#include "util.h"
/*-... | c | github | https://github.com/redis/redis | src/t_list.c |
# -*- coding: utf-8 -*-
from jsonview.decorators import json_view
from project import settings
import resource
import validator
@json_view
def get_list(request):
"""List data"""
if settings.ENV == 'production':
try:
data, code, items = resource.get_list(request)
except:
... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.