code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
httpbin.helpers
~~~~~~~~~~~~~~~
This module provides helper functions for httpbin.
"""
import json
import base64
from hashlib import md5
from werkzeug.http import parse_authorization_header
from flask import request, make_response
try:
from urlparse import urlparse, urlunparse
excep... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/sh
test_description='ls-files tests with relative paths
This test runs git ls-files with various relative path arguments.
'
. ./test-lib.sh
test_expect_success 'prepare' '
: >never-mind-me &&
git add never-mind-me &&
mkdir top &&
(
cd top &&
mkdir sub &&
x="x xa xbc xdef xghij xklmno" &&
y=$(echo... | unknown | github | https://github.com/git/git | t/t3005-ls-files-relative.sh |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Author:
# Janusz Kozerski (https://github.com/jkozerski)
# This draws plots (of temp, humid, dp and pressure) for prevoius month.
# Plots are kept in files:
# yyyy.mm.dataName.png
import dateutil.parser
import datetime # datetime and timedelta structures
import time... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""
pycallgraph
http://pycallgraph.slowchop.com/
Copyright Gerald Kaszuba 2007
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 optio... | unknown | codeparrot/codeparrot-clean | ||
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from kitsune.sumo.models import ModelBase, LocaleField
from kitsune.sumo.urlresolvers import reverse
from kitsune.sumo.utils import auto_delete_files
class Media(ModelBase):
"""... | unknown | codeparrot/codeparrot-clean | ||
from ete2 import PhyloTree
# Reads a phylogenetic tree (using default species name encoding)
t = PhyloTree("(((Hsa_001,Ptr_001),(Cfa_001,Mms_001)),(Dme_001,Dme_002));")
# /-Hsa_001
# /--------|
# | \-Ptr_001
# /--------|
# | ... | unknown | codeparrot/codeparrot-clean | ||
A type that is not a trait was used in a trait position, such as a bound
or `impl`.
Erroneous code example:
```compile_fail,E0404
struct Foo;
struct Bar;
impl Foo for Bar {} // error: `Foo` is not a trait
fn baz<T: Foo>(t: T) {} // error: `Foo` is not a trait
```
Another erroneous code example:
```compile_fail,E04... | unknown | github | https://github.com/rust-lang/rust | compiler/rustc_error_codes/src/error_codes/E0404.md |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
import {Injectable, inject, signal, computed} from '@angular/core';
import {Events,... | typescript | github | https://github.com/angular/angular | devtools/projects/ng-devtools/src/lib/application-services/frame_manager.ts |
#!/usr/bin/env python
from __future__ import absolute_import
from email.utils import parseaddr
import functools
import htmlentitydefs
import itertools
import logging
import operator
import psycopg2
import re
from ast import literal_eval
from openerp.exceptions import ValidationError
from openerp.tools import mute_logge... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
#
# discovery.py
#
# Discover HPSDR hardware
#
# Copyright (C) 2015 by G3UKB Bob Cowdery
# 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... | unknown | codeparrot/codeparrot-clean | ||
{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v2alpha1",
"metadata": {
"name": "v5.no-op.v42"
},
"spec": {
"annotations": [
{
"kind": "AnnotationQuery",
"spec": {
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
}... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/conversion/testdata/output/migrated_dashboards_from_v0_to_v2/v2beta1.v5.no-op.v2alpha1.json |
#!/bin/bash
set -x
set -e
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "${CURRENT_BRANCH}" != "release-next" ]]; then
echo "Error: Script must be run from the 'release-next' branch."
exit 1
fi
if [[ -n $(git status --porcelain) ]]; then
echo "Error: Your git working directory is not clean. Please co... | unknown | github | https://github.com/remix-run/react-router | scripts/finish-stable-release.sh |
# 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 | ||
#!/usr/bin/env python
# File created on 07 Oct 2009.
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Greg Caporaso", "Antonio Gonzalez Pena"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "greg... | unknown | codeparrot/codeparrot-clean | ||
/*
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 agreed to in writing, ... | go | github | https://github.com/kubernetes/kubernetes | pkg/apis/resource/v1alpha3/defaults.go |
from nose.tools import *
from lust import log
from mock import patch
@patch("sys.stdout")
@patch("sys.stderr")
@patch("os.dup2")
@patch("os.fdopen")
@patch("os.closerange")
def test_setup(*calls):
log.setup("tests/test.log")
# weird but 0 is os_close, and we want to force an exception
calls[0].side_effect=... | unknown | codeparrot/codeparrot-clean | ||
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from openerp import http
# class XprPreQuoteCreationActions(http.Controller):
# @http.route('/xpr_pre_quote_creation_actions/xpr_pre_quote_creation_actions/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/xpr_pre_quote_creation_actions/xpr_... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 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 and the f... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
#
# Dicziunari-Hunspell -- Rhaeto-Romance hunspell dictionary generation
#
# Copyright (C) 2012-2013 Uli Franke (cls) et al.
#
# 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, e... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
from django.utils import six
from djblets.testing.decorators import add_fixtures
from djblets.webapi.errors import INVALID_FORM_DATA
from reviewboard.notifications.models import WebHookTarget
from reviewboard.site.models import LocalSite
from reviewboard.webapi.resources import... | unknown | codeparrot/codeparrot-clean | ||
####################################################################################################
#
# Patro - A Python library to make patterns for fashion design
# Copyright (C) 2017 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from collections import namedtuple
from unittest import TestCase
from mock import Mock, patch, MagicMock
from pyqrllib.pyqrllib import hstr2bin, bin2hstr
from qrl.cor... | unknown | codeparrot/codeparrot-clean | ||
#ifndef JEMALLOC_INTERNAL_ATOMIC_H
#define JEMALLOC_INTERNAL_ATOMIC_H
#define ATOMIC_INLINE JEMALLOC_ALWAYS_INLINE
#define JEMALLOC_U8_ATOMICS
#if defined(JEMALLOC_GCC_ATOMIC_ATOMICS)
# include "jemalloc/internal/atomic_gcc_atomic.h"
# if !defined(JEMALLOC_GCC_U8_ATOMIC_ATOMICS)
# undef JEMALLOC_U8_ATOMICS
# en... | c | github | https://github.com/redis/redis | deps/jemalloc/include/jemalloc/internal/atomic.h |
"""
tests for quantecon.models.optgrowth
@author : Spencer Lyon
@date : 2014-08-05 10:20:53
TODO: I'd really like to see why the solutions only match analytical
counter part up to 1e-2. Seems like we should be able to do better
than that.
"""
from __future__ import division
from math import log
import num... | unknown | codeparrot/codeparrot-clean | ||
import { useAuth0 } from "@auth0/auth0-react";
type CommentFormProps = {
text: string;
setText: Function;
onSubmit: (e: React.FormEvent) => Promise<void>;
};
export default function CommentForm({
text,
setText,
onSubmit,
}: CommentFormProps) {
const { isAuthenticated, logout, loginWithPopup } = useAuth0... | typescript | github | https://github.com/vercel/next.js | examples/blog-with-comment/components/comment/form.tsx |
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package terraform
import (
"fmt"
"strings"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform/internal/configs/configschema"
"github.com/hashicorp/terraform/internal/providers"
"github.com/hashicorp/terraform/internal/tfdiags"
"... | go | github | https://github.com/hashicorp/terraform | internal/builtin/providers/terraform/resource_data.go |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.misc import factorial
from scipy.lib.six.moves import xrange
__all__ = ["KroghInterpolator", "krogh_interpolate", "BarycentricInterpolator",
"barycentric_interpolate", "PiecewisePolynomial",
"piecewis... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python3
# vim: set makeprg=python3-flake8\ %
import dbus
import time
from functools import partial
import abrt_p2_testing
from abrt_p2_testing import (Problems2Service,
Problems2Session,
get_session,
get_authorized_sess... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2017 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 | ||
from collections import defaultdict
from lxml import etree, objectify
from utils import InvalidLTIConfigError
accessors = [
'title',
'description',
'launch_url',
'secure_launch_url',
'icon',
'secure_icon',
'cartridge_bundle',
'cartridge_icon',
'v... | unknown | codeparrot/codeparrot-clean | ||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | c | github | https://github.com/tensorflow/tensorflow | tensorflow/compiler/tf2xla/kernels/elu_op.h |
- debug:
msg: "Handler for {{ inventory_hostname }}" | unknown | github | https://github.com/ansible/ansible | test/integration/targets/handlers/79776-handlers.yml |
/* 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/debug/PDBChecksum.cpp |
#
# The Python Imaging Library.
# $Id: WalImageFile.py 2134 2004-10-06 08:55:20Z fredrik $
#
# WAL file handling
#
# History:
# 2003-04-23 fl created
#
# Copyright (c) 2003 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
# NOTE: This format cannot be automatically recognized,... | unknown | codeparrot/codeparrot-clean | ||
# 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.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import os
import re
import subprocess
import sys
fr... | unknown | codeparrot/codeparrot-clean | ||
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Osmo Salomaa
#
# 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 pr... | unknown | codeparrot/codeparrot-clean | ||
"""
Address device / device descriptor class
http://libvirt.org/formatdomain.html#elementsAddress
"""
from virttest.libvirt_xml import accessors, xcepts
from virttest.libvirt_xml.devices import base
class Address(base.TypedDeviceBase):
__slots__ = ('attrs',)
def __init__(self, type_name, virsh_instance=bas... | unknown | codeparrot/codeparrot-clean | ||
use std::fmt::Write;
use rustc_data_structures::intern::Interned;
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_hir::definitions::DisambiguatedDefPathData;
use rustc_middle::bug;
use rustc_middle::ty::print::{PrettyPrinter, PrintError, Printer};
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt};
struct TypeN... | rust | github | https://github.com/rust-lang/rust | compiler/rustc_const_eval/src/util/type_name.rs |
from decimal import Decimal as D
from django.test import TestCase
import mock
from apps.shipping import methods
class TestStandard(TestCase):
def setUp(self):
self.method = methods.Standard()
self.basket = mock.Mock()
def test_is_free_over_threshold(self):
self.basket.total_incl_tax... | unknown | codeparrot/codeparrot-clean | ||
import os
import torch
from torch import np
from torch.utils.data.dataset import Dataset
from sklearn.preprocessing import MultiLabelBinarizer
import skimage.io
tags = [
'blooming',
'selective_logging',
'blow_down',
'conventional_mine',
'bare_ground',
'artisinal_mine',
'primary',
'agric... | unknown | codeparrot/codeparrot-clean | ||
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Gengkun He @ahabhgk
*/
"use strict";
/** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */
// Copy from css-loader
/**
* @param {string} string string
* @returns {string} re... | javascript | github | https://github.com/webpack/webpack | lib/util/conventions.js |
#!/usr/bin/env python
import argparse # for ArgumentParser
import subprocess # for Popen
import tempfile # for NamedTemporaryFile
import os # for remove
class gnuplot(object):
output = "result.png"
script = """
set terminal png size 1024, 768
set output "{}.png"... | unknown | codeparrot/codeparrot-clean | ||
import numpy as np
import utool as ut
def get_toydata(rng):
if ut.get_argflag('--toy2'):
X_true, X, y = toydata2(rng)
else:
X_true, X, y = toydata1(rng)
return X_true, X, y
def toydata2(rng):
from sklearn.datasets import samples_generator
n_samples = 1000
n_features = 2
n_c... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... | unknown | codeparrot/codeparrot-clean | ||
r"""
Defines base classes to represent a data-misfit functions (l2-norm, etc)
These classes can be used to implement parameter estimation problems
(inversions). They automate most of the boiler plate required and provide
direct access to ready-made optimization routines and regularization.
For now, only implements an... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2018 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | unknown | codeparrot/codeparrot-clean | ||
# This build on top of test5 by adding a few libraries with their own configurations
# and overrides. The same targets are used for building and testing (base, b1, b2, both)
expected_results = {
"base": {
"desc": "override values based on labels with libs (no labels)",
"app.app1": "v_app1",
... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.contrib.gis import gdal
from django.contrib.gis.geos import GEOSGeometry, GEOSException
from django.forms.widgets import Widget
from django.template import loader
from django.utils import six
from django.utils import t... | 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 | ||
import datetime
from operator import attrgetter
from django.core.exceptions import FieldError
from django.db import models
from django.db.models.fields.related import ForeignObject
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.utils import translation
from .models import (
Arti... | unknown | codeparrot/codeparrot-clean | ||
import alembic
import os
import sqlalchemy
import sqlalchemy.pool
import logging.config
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = alembic.context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
logging... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext import get_default_currency
from frappe.model.meta import get_field_precision
def get_ordered_to_be_billed_data... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2017 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 | ||
# These replacements are out of order on purpose to test that they get sorted
# so that formatting happens correctly.
---
MainSourceFile: yes.cpp
Diagnostics:
- DiagnosticName: test-yes
DiagnosticMessage:
Message: Fix
FilePath: $(path)/yes.cpp
FileOffset: 494
Replacements:
- File... | unknown | github | https://github.com/llvm/llvm-project | clang-tools-extra/test/clang-apply-replacements/Inputs/format/yes.yaml |
#!/usr/bin/env python
import sys
import traceback
import random
try:
from sys import maxint
except ImportError:
from sys import maxsize as maxint
MY_ANT = 0
ANTS = 0
DEAD = -1
LAND = -2
FOOD = -3
WATER = -4
UNSEEN = -5
HILL = -6
PLAYER_ANT = 'abcdefghij'
HILL_ANT = string = 'ABCDEFGHIJ'
PLAYER_HILL = string ... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
/**
* Implementations of default Answers.
*/
package org.mockito.internal.stubbing.defaultanswers; | java | github | https://github.com/mockito/mockito | mockito-core/src/main/java/org/mockito/internal/stubbing/defaultanswers/package-info.java |
// WITH_STDLIB
// CLASS_ID: java.lang.annotation/Target
import java.lang.annotation.ElementType.PACKAGE
@java.lang.annotation.Target(PACKAGE)
annotation class KotlinAnno<caret>tation | kotlin | github | https://github.com/JetBrains/kotlin | analysis/analysis-api/testData/annotations/specificAnnotations/javaTargetAnnotationWithOneArgumentAsImport.kt |
# Copyright (c) 2013 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 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 | cmd/kubeadm/app/cmd/upgrade/plan.go |
import re
from livestreamer.plugin import Plugin, PluginError
from livestreamer.plugin.api import http, validate
from livestreamer.plugin.api.utils import parse_query
from livestreamer.stream import HTTPStream, HLSStream
API_KEY = "AIzaSyBDBi-4roGzWJN4du9TuDMLd_jVTcVkKz4"
API_BASE = "https://www.googleapis.com/youtub... | 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/util/concurrent/AbstractScheduledServiceTest.java |
"""
Many-to-many relationships between the same two tables
In this example, a ``Person`` can have many friends, who are also ``Person``
objects. Friendship is a symmetrical relationship - if I am your friend, you
are my friend. Here, ``friends`` is an example of a symmetrical
``ManyToManyField``.
A ``Person`` can als... | python | github | https://github.com/django/django | tests/m2m_recursive/models.py |
"""
Parser of FastTrackerII Extended Module (XM) version 1.4
Documents:
- Modplug source code (file modplug/soundlib/Load_xm.cpp)
http://sourceforge.net/projects/modplug
- Dumb source code (files include/dumb.h and src/it/readxm.c
http://dumb.sf.net/
- Documents of "XM" format on Wotsit
http://www.wotsit.org
Au... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
def remove_empty_permissions():
permissions_cache_to_be_cleared = frappe.db.sql_list("""select distinct user
from `tabWebsite Route Permission`
where ifnull... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# small_business_project documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuratio... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package storage
import (
"bytes"
"fmt"
"math"
"strings"
"testing"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage/e... | go | github | https://github.com/cockroachdb/cockroach | pkg/storage/mvcc_value_test.go |
from nutils.testing import *
import nutils.types
import inspect, pickle, itertools, ctypes, stringly, tempfile, io, os
import numpy
class apply_annotations(TestCase):
def test_without_annotations(self):
@nutils.types.apply_annotations
def f(a, b):
return a, b
a, b = f(1, 2)
self.assertEqual(a,... | unknown | codeparrot/codeparrot-clean | ||
from flask import render_template, request, json, send_from_directory
from bleach import linkify
from app import app, db
import models as m
@app.route('/')
def index():
params = {
'title': 'Hashtag Listener',
}
return render_template('index.html', **params)
@app.route('/api', methods=['POST'])
de... | unknown | codeparrot/codeparrot-clean | ||
"""Map new event context values to old top-level field values. Ensures events can be parsed by legacy parsers."""
import json
import logging
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import UsageKey
log = logging.getLogger(__name__)
CONTEXT_FIELDS_TO_INCLUDE = [
'username',
'session'... | unknown | codeparrot/codeparrot-clean | ||
global:
metric_name_validation_scheme: legacy
otlp:
translation_strategy: NoUTF8EscapingWithSuffixes | unknown | github | https://github.com/prometheus/prometheus | config/testdata/otlp_allow_utf8.incompatible.yml |
# An overview of different Series and Chunk reference types
## Used by callers of TSDB
| Location | Series access | Chunk access |
|--------------------|--------------------------------|---------------------------------------------------... | unknown | github | https://github.com/prometheus/prometheus | tsdb/docs/refs.md |
#!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2014 InfiniDB, Inc.
#
# 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; version 2 of
# the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOU... | unknown | codeparrot/codeparrot-clean | ||
"""Unit tests for django-picklefield."""
from django.test import TestCase
from django.db import models
from django.core import serializers
from picklefield.fields import PickledObjectField
class TestingModel(models.Model):
pickle_field = PickledObjectField()
compressed_pickle_field = PickledObjectField(compre... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 la... | unknown | codeparrot/codeparrot-clean | ||
# testutils.py - utility module for psycopg2 testing.
#
# Copyright (C) 2010-2011 Daniele Varrazzo <daniele.varrazzo@gmail.com>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either vers... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""Poslatsms.cz gateway can be used to sending sms to T-Mobile CZ and Vodafone CZ"""
import urllib, urllib2
import re
import cookielib
from BaseGateway import *
from data.SMS import *
class Gateway(BaseGateway):
def __init__(self, delegate):
BaseGateway.__init__(self, delegate)
#add head... | 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... | python | github | https://github.com/apache/airflow | airflow-core/src/airflow/models/asset.py |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# 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... | unknown | codeparrot/codeparrot-clean | ||
from golem.task.taskstate import TaskState
from gnr.gnrtaskstate import GNRTaskDefinition, AdvanceVerificationOptions
class RendererInfo:
def __init__(self, name, defaults, task_builder_type, dialog, dialog_customizer, renderer_options):
self.name = name
self.output_formats = []
self.scene_... | unknown | codeparrot/codeparrot-clean | ||
#
# 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
#
# Unles... | unknown | codeparrot/codeparrot-clean | ||
// 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/kubernetes/ingress.go |
# 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.
# This program is distributed in the hope that it will be useful,
# but... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, ... | java | github | https://github.com/elastic/elasticsearch | distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/BaseKeyStoreCommand.java |
package client
import (
"fmt"
"net/http"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/moby/api/types/image"
"github.com/moby/moby/api/types/system"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestDiskUsageError(t *testing.T) {
client, err := New(WithMockClient(erro... | go | github | https://github.com/moby/moby | client/system_disk_usage_test.go |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import mock
import ujson
from typing import Any
from requests.exceptions import ConnectionError
from django.test import override_settings
from zerver.models import Recipient, Message
from zerver.lib.test_classes impor... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# Copyright: (c) 2015, Google Inc. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | unknown | codeparrot/codeparrot-clean | ||
/* 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/c/experimental/grappler/grappler_internal.h |
from __future__ import absolute_import
import re
from collections import namedtuple
from ..exceptions import LocationParseError
from ..packages import six
url_attrs = ["scheme", "auth", "host", "port", "path", "query", "fragment"]
# We only want to normalize urls with an HTTP(S) scheme.
# urllib3 infers URLs withou... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
"""Generate go-jstools.py"""
import sys
import textwrap
import virtualenv
filename = 'go-jstools.py'
after_install = """\
import os, subprocess
def after_install(options, home_dir):
etc = join(home_dir, 'etc')
## TODO: this should all come from distutils
## like distutils.sysconfig.g... | unknown | codeparrot/codeparrot-clean | ||
"""
35. DB-API Shortcuts
``get_object_or_404()`` is a shortcut function to be used in view functions for
performing a ``get()`` lookup and raising a ``Http404`` exception if a
``DoesNotExist`` exception was raised during the ``get()`` call.
``get_list_or_404()`` is a shortcut function to be used in view functions for... | unknown | codeparrot/codeparrot-clean | ||
"""
Tables Extension for Python-Markdown
====================================
Added parsing of tables to Python-Markdown.
See <https://pythonhosted.org/Markdown/extensions/tables.html>
for documentation.
Original code Copyright 2009 [Waylan Limberg](http://achinghead.com)
All changes Copyright 2008-2014 The Python ... | unknown | codeparrot/codeparrot-clean | ||
import warnings
from fabric.api import prompt, env
from aik_deployment_tool.directory import LocalDirectory
from aik_deployment_tool.file import LocalFile
from aik_deployment_tool.service import LocalService
from aik_deployment_tool.operation import LocalOperation
from aik_deployment_tool.directory import RemoteDire... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | unknown | codeparrot/codeparrot-clean | ||
/*-------------------------------------------------------------------------
*
* multirangetypes.c
* I/O functions, operators, and support functions for multirange types.
*
* The stored (serialized) format of a multirange value is:
*
* 12 bytes: MultirangeType struct including varlena header, multirange
* ... | c | github | https://github.com/postgres/postgres | src/backend/utils/adt/multirangetypes.c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.