code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
from flask import Flask
def create_app():
return Flask("app")
def create_app2(foo, bar):
return Flask("_".join(["app2", foo, bar]))
def no_app():
pass | python | github | https://github.com/pallets/flask | tests/test_apps/cliapp/factory.py |
/* 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/lite/c/c_api_opaque.h |
from flask import Flask
app = Flask(__name__)
from js_example import views # noqa: E402, F401 | python | github | https://github.com/pallets/flask | examples/javascript/js_example/__init__.py |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_M_R_RET_CUST_LEVEL_CHANGE').setMaster(sys.argv[2])
sc = SparkContext(conf = c... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | unknown | codeparrot/codeparrot-clean | ||
"""
Integer field classes:
- UInt8, UInt16, UInt24, UInt32, UInt64: unsigned integer of 8, 16, 32, 64 bits ;
- Int8, Int16, Int24, Int32, Int64: signed integer of 8, 16, 32, 64 bits.
"""
from hachoir_core.field import Bits, FieldError
class GenericInteger(Bits):
"""
Generic integer class used to generate othe... | unknown | codeparrot/codeparrot-clean | ||
import { test } from '../../test';
export default test({
error: {
code: 'each_item_invalid_assignment',
message:
'Cannot reassign or bind to each block argument in runes mode. Use the array and index variables instead (e.g. `array[i] = value` instead of `entry = value`, or `bind:value={array[i]}` instead of `b... | javascript | github | https://github.com/sveltejs/svelte | packages/svelte/tests/compiler-errors/samples/runes-invalid-each-binding-this/_config.js |
"""
This module defines export functions for decision trees.
"""
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
from collections.abc import Iterable
from io import StringIO
from numbers import Integral
import numpy as np
from sklearn.base import is_classifier
from sklearn.tree import... | python | github | https://github.com/scikit-learn/scikit-learn | sklearn/tree/_export.py |
import random
adjectives = [
"abandoned",
"aching",
"advanced",
"ample",
"artistic",
"back",
"best",
"bold",
"brief",
"clear",
"cold",
"complicated",
"cooked",
"crazy",
"crushing",
"damp",
"dear",
"definite",
"dependable",
"diligent",
... | python | github | https://github.com/langchain-ai/langchain | libs/langchain/langchain_classic/smith/evaluation/name_generation.py |
# Copyright 2009-2014 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster 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 version 3 of the License, or (at your option) any
# later ... | unknown | codeparrot/codeparrot-clean | ||
from pants.base.build_environment import get_scm
from pants.base.payload import Payload
from pants.base.payload_field import PrimitiveField
from pants.build_graph.target import Target
class DockerTargetBase(Target):
def __init__(self, address=None, payload=None, image_name=None, image_tag=None, **kwargs):
payloa... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version... | unknown | codeparrot/codeparrot-clean | ||
# $Id: cs.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: Marek Blaha <mb@dat.cz>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for each l... | unknown | codeparrot/codeparrot-clean | ||
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
import pandas as pd
from bokeh.plotting import figure, show, output_server
from bokeh.sampledata import periodic_table
elements = periodic_table.elements
elements = elements[elements["atomic number"] <= 82]
elements = elements[~p... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2011 The Chromium OS Authors.
#
# SPDX-License-Identifier: GPL-2.0+
#
"""Terminal utilities
This module handles terminal interaction including ANSI color codes.
"""
import os
import sys
# Selection of when we want our output to be colored
COLOR_IF_TERMINAL, COLOR_ALWAYS, COLOR_NEVER = range(3)
# In... | unknown | codeparrot/codeparrot-clean | ||
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import numpy as np
from menpo.base import MenpoMissingDependencyError
class Menpo3dMissingError(MenpoMissingDependencyError):
r"""
Exception that is thrown when an attempt is made to import a 3D
visualis... | unknown | codeparrot/codeparrot-clean | ||
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class rsyslog(test.test):
"""
Autotest module for testing basic functionality
of rsyslog
@author Robert Paulsen, rpaulsen@us.ibm.com
"""
version = 1
nfail = 0
... | unknown | codeparrot/codeparrot-clean | ||
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | 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-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java |
"Base Cache class."
from __future__ import unicode_literals
import time
import warnings
from django.core.exceptions import DjangoRuntimeWarning, ImproperlyConfigured
from django.utils.module_loading import import_string
class InvalidCacheBackendError(ImproperlyConfigured):
pass
class CacheKeyWarning(DjangoRunti... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""Generic feature selection mixin"""
# Authors: G. Varoquaux, A. Gramfort, L. Buitinck, J. Nothman
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
from warnings import warn
import numpy as np
from scipy.sparse import issparse, csc_matrix
from ..base import TransformerMixin
f... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestGeneratorsGeometric():
def test_random_geometric_graph(self):
G=nx.random_geometric_graph(50,0.25)
assert_equal(len(G),50)
def test_geographical_threshold_graph(self):
G=nx.geographical_threshold_graph(50,10... | unknown | codeparrot/codeparrot-clean | ||
from bpy import context
CONTEXT = {
0: {
'title': "Error Message",
'icon': 'CANCEL'
},
1: {
'title': "Warning Message",
'icon': 'ERROR' # I prefer this icon for warnings
},
2: {
'title': "Message",
'icon': 'NONE'
},
3: {
'title': "Ques... | unknown | codeparrot/codeparrot-clean | ||
import multiprocessing
import os
import platform
import queue
import subprocess
from itertools import chain
from coalib.collecting import Dependencies
from coalib.collecting.Collectors import collect_files
from coalib.misc.StringConverter import StringConverter
from coalib.output.printers.LOG_LEVEL import LOG_LEVEL
fr... | unknown | codeparrot/codeparrot-clean | ||
"""
Testing some internals of the template processing. These are *not* examples to be copied in user code.
"""
from __future__ import unicode_literals
from unittest import TestCase
from django.template import Library, TemplateSyntaxError
from django.template.base import (
TOKEN_BLOCK, FilterExpression, Parser, To... | unknown | codeparrot/codeparrot-clean | ||
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | unknown | codeparrot/codeparrot-clean | ||
"""
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | unknown | codeparrot/codeparrot-clean | ||
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | unknown | github | https://github.com/huggingface/transformers | docs/source/en/model_doc/clap.md |
#!/usr/bin/env python
import warnings
import re
import subprocess
import types
import yaml
import pandas as pd
import numpy as np
import rosbag
import rospy
from roslib.message import get_message_class
def bag_to_dataframe(bag_name, include=None, exclude=None, parse_header=False, seconds=False):
'''
Read in... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2013 Apple 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... | unknown | codeparrot/codeparrot-clean | ||
- Feature Name: Log-Driven Closed Timestamps
- Status: implemented
- Start Date: 2020-11-13
- Authors: Andrei Matei, Nathan VanBenschoten
- RFC PR: [56675](https://github.com/cockroachdb/cockroach/pull/56675)
- Cockroach Issue: None
# Summary
This RFC discusses changing the way in which closed timestamps are publishe... | unknown | github | https://github.com/cockroachdb/cockroach | docs/RFCS/20191108_closed_timestamps_v2.md |
from __future__ import print_function
import types
import warnings
import sys
import traceback
import pickle
from copy import deepcopy
import numpy as np
from scipy import sparse
import struct
from sklearn.externals.six.moves import zip
from sklearn.externals.joblib import hash, Memory
from sklearn.utils.testing imp... | unknown | codeparrot/codeparrot-clean | ||
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_f
# For compatibil... | ruby | github | https://github.com/rails/rails | actionmailbox/test/dummy/config/application.rb |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Richard Isaacson <richard.c.isaacson@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 = {'meta... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# 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. Redistrib... | unknown | codeparrot/codeparrot-clean | ||
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"type": "dashb... | json | github | https://github.com/grafana/grafana | apps/dashboard/pkg/migration/testdata/output/latest_version/v5.no-op.v42.json |
"""
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.http import HttpResponseNotAllowed
from django.middleware.http import ConditionalGetMiddleware
from django.utils.cache import get_conditional_response
from django.utils.decorators imp... | unknown | codeparrot/codeparrot-clean | ||
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import warnings
import numpy as np
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import DummySpecies, Element, Species
from pymatgen.core.lattice import L... | unknown | codeparrot/codeparrot-clean | ||
import sys
from collections import deque
from django.utils.datastructures import SortedDict
from django.db import models
from south import exceptions
class SortedSet(SortedDict):
def __init__(self, data=tuple()):
self.extend(data)
def __str__(self):
return "SortedSet(%s)" % list(self)
d... | unknown | codeparrot/codeparrot-clean | ||
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package pluginshared
import (
"io"
)
type CustomPluginClient interface {
Execute(args []string, stdout, stderr io.Writer) int
} | go | github | https://github.com/hashicorp/terraform | internal/pluginshared/interface.go |
from __future__ import unicode_literals
import re
from bisect import bisect
import warnings
from django.conf import settings
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.mode... | unknown | codeparrot/codeparrot-clean | ||
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: curl_slist_free_all
Section: 3
Source: libcurl
See-also:
- curl_slist_append (3)
Protocol:
- All
Added-in: 7.1
---
# NAME
curl_slist_free_all - free an entire curl_slist list
# SYNOPSIS
~~~c
#include <curl/curl.h... | unknown | github | https://github.com/curl/curl | docs/libcurl/curl_slist_free_all.md |
# 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 | ||
from mi.instrument.wetlabs.fluorometer.flort_d.driver import NEWLINE
SAMPLE_MNU_RESPONSE = "Ser BBFL2W-993" + NEWLINE + \
"Ver Triplet5.20" + NEWLINE + \
"Ave 1" + NEWLINE + \
"Pkt 0" + NEWLINE + \
"M1d 0" + NEWLINE + \
... | unknown | codeparrot/codeparrot-clean | ||
import os, sys, json, asyncio
def send_json(data):
print(json.dumps(data))
sys.stdout.flush()
def init(id, loop):
send_json({'deskchan-plugin-id': id})
asyncio.ensure_future(message_receiver(loop))
def subscribe(tag, callback=None):
global tag_handlers
if callback is not None:
l = tag... | 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-support/src/main/java/org/springframework/cache/jcache/interceptor/DefaultCacheMethodDetails.java |
"""
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
Note:
The given integer is guaranteed to fit within the range of a 32-bit signed integer.
You could assume no leading zero bit in the integer’s binary representation.
Example 1:
Input:... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
# 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 | ||
import PostPreview from "./post-preview";
export default function MoreStories({ posts }) {
return (
<section>
<h2 className="mb-8 text-6xl md:text-7xl font-bold tracking-tighter leading-tight">
More Stories
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 md:gap-x-16 lg:gap-x-32 ga... | javascript | github | https://github.com/vercel/next.js | examples/cms-ghost/components/more-stories.js |
#ifndef BOOST_CORE_REF_HPP
#define BOOST_CORE_REF_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/core/addressof.hpp>
#include <boost/core/enable_if.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
//
// ref.hpp - ref/cref, useful helper functions
//
// Copyright ... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/core/ref.hpp |
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0... | go | github | https://github.com/kubernetes/kubernetes | pkg/apis/apiserverinternal/v1alpha1/zz_generated.defaults.go |
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package statemgr
import (
"context"
"github.com/hashicorp/terraform/internal/schemarepo"
"github.com/hashicorp/terraform/internal/states"
)
// LockDisabled implements State and Locker but disables state locking.
// If State doesn't support loc... | go | github | https://github.com/hashicorp/terraform | internal/states/statemgr/lock.go |
// RUN: echo "^std::.*$" > %t.allow-list.txt
// RUN: clang-change-namespace -old_namespace "na::nb" -new_namespace "x::y" --file_pattern ".*" --allowed_file %t.allow-list.txt %s -- | sed 's,// CHECK.*,,' | FileCheck %s
#include "Inputs/fake-std.h"
// CHECK: namespace x {
// CHECK-NEXT: namespace y {
namespace na {
na... | cpp | github | https://github.com/llvm/llvm-project | clang-tools-extra/test/clang-change-namespace/allow-list.cpp |
#ifndef BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_archive.hpp:
// (C) Copyright 2002... | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/archive/basic_xml_archive.hpp |
#!/usr/bin/env python
'''
It can save the contents of the file to the mysql database.
'''
import os
import random
import MySQLdb
#import string
f = open(os.getcwd()+'\\2','w')
for x in range(200):
words = [chr(a) for a in range(65,91)]+[chr(a) for a in range(97,122)]+[str(a) for a in range(0,11)]
# It is equal to... | unknown | codeparrot/codeparrot-clean | ||
#
# Author: Gregory Fleischer (gfleischer@gmail.com)
#
# Copyright (c) 2011 RAFT Team
#
# This file is part of RAFT.
#
# RAFT 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... | unknown | codeparrot/codeparrot-clean | ||
from thorpy._utils.images import load_image
from thorpy._utils.interpolation import get_y
from pygame import surfarray
import math, pygame
from PyWorld2D.rendering.tilers.roundtiler import RoundTiler
class BeachTiler(RoundTiler):
def get_round(self, radius, background):
w,h = self.c.get_size()
sur... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import unicode_literals
import errno
import io
import hashlib
import json
import os.path
import re
import types
import sys
import youtube_dl.extractor
from youtube_dl import YoutubeDL
from youtube_dl.utils import (
compat_str,
preferredencoding,
write_string,
)
def get_params(override=Non... | unknown | codeparrot/codeparrot-clean | ||
"""
Provides functionality to notify people.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/notify/
"""
from functools import partial
import logging
import os
import voluptuous as vol
import homeassistant.bootstrap as bootstrap
from homeassistant.conf... | unknown | codeparrot/codeparrot-clean | ||
"""Implement device conditions for binary sensor."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.device_automation.const import CONF_IS_OFF, CONF_IS_ON
from homeassistant.const import ATTR_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FOR, CONF_TYPE
from homeassistant.core import Ho... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Genera... | unknown | codeparrot/codeparrot-clean | ||
# Support
## How to file issues and get help
This project uses GitHub issues to track bugs and feature requests. Please search the [existing issues](https://github.com/microsoft/TypeScript/issues) before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.
For help ... | unknown | github | https://github.com/microsoft/TypeScript | SUPPORT.md |
#ifndef SPARSE_INDEX_H__
#define SPARSE_INDEX_H__
/*
* If performing an operation where the index is supposed to expand to a
* full index, then disable the advice message by setting this global to
* zero.
*/
extern int give_advice_on_expansion;
struct index_state;
#define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
int is_... | c | github | https://github.com/git/git | sparse-index.h |
---
navigation_title: "LIMIT"
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-commands.html#esql-limit
---
# {{esql}} `LIMIT` command [esql-limit]
:::{include} ../_snippets/commands/layout/limit.md
::: | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/query-languages/esql/commands/limit.md |
# Authors: Yannick Croissant <yannick.croissant@gmail.com>
# adaur <adaur.underground@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'StewardProject.date_started'
db.add_column(u'steward_stewardproject', 'date_started',
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import lcddriver
import time
mylcd = lcddriver.lcd()
def find_sensors(basedir):
return [x for x in os.listdir(basedir) if x.startswith('28')]
def read_temp(sensor):
with open(sensor + '/w1_slave', "r") as f:
data = f.readlines()
if da... | unknown | codeparrot/codeparrot-clean | ||
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.management.utils import get_command_line_option
from django.test.runner import get_max_test_processes
from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
class Command(BaseCommand):
he... | python | github | https://github.com/django/django | django/core/management/commands/test.py |
# Description: Shows how to use value transformers
# Category: preprocessing
# Classes: TransformValue, Continuous2Discrete, Discrete2Continuous, MapIntValue
# Uses:
# Referenced:
import orange
print
def printExample(ex):
for val in ex:
print "%16s: %s" % (val.variable.name, val)
data = orange.Exa... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | 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\Bridge\Monolog\Formatter;
use Monolog\Formatter\FormatterInterf... | php | github | https://github.com/symfony/symfony | src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php |
<?php
namespace Illuminate\Database\Console;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Events\DatabaseBusy;
use Illuminate\Support\Collection;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'db:monitor')]
class Monit... | php | github | https://github.com/laravel/framework | src/Illuminate/Database/Console/MonitorCommand.php |
import sqlalchemy as sa
from meta import Base
from pylons.controllers.util import abort
from payment import Payment
from meta import Session
class PaymentReceived(Base):
"""Stores details of payments as returned by the payment gateway
"""
__tablename__ = 'payment_received'
id = sa.Column(sa.types.... | unknown | codeparrot/codeparrot-clean | ||
"""
Acceptance tests for Home Page (My Courses / My Libraries).
"""
from bok_choy.web_app_test import WebAppTest
from opaque_keys.edx.locator import LibraryLocator
from ...fixtures import PROGRAMS_STUB_URL
from ...fixtures.config import ConfigModelFixture
from ...fixtures.programs import ProgramsFixture
from ...pages.... | unknown | codeparrot/codeparrot-clean | ||
import math
def viterbi(dict_tag, dict_word, obs, states, start_p, trans_p, emit_p):
V = [{}]
path = ['']
epsilon = 0.00000000000000000001
# Initialize base cases (t == 0)
# Actually it will already be <s>
max_v = -1.0 / epsilon / 1000
for y in states:
temp_emit = emit_p[dict_tag[... | 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\DependencyInjection\Loader\Configurator;
use Symfony\... | php | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Resources/config/validator_debug.php |
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
# 열심히 번역 중입니다. 조금 이따 만나요! | unknown | github | https://github.com/huggingface/transformers | docs/source/ko/in_translation.md |
#!/usr/bin/python
# Copyright (c) 2012 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.
"""Diagnose some common system configuration problems on Linux, and
suggest fixes."""
import os
import subprocess
import sys
all_chec... | unknown | codeparrot/codeparrot-clean | ||
/************************************************
digest.h - header file for ruby digest modules
$Author$
created at: Fri May 25 08:54:56 JST 2001
Copyright (C) 2001-2006 Akinori MUSHA
$RoughId: digest.h,v 1.3 2001/07/13 15:38:27 knu Exp $
$Id$
************************************************/
#includ... | c | github | https://github.com/ruby/ruby | ext/digest/digest.h |
# walk directories and repair single digit months to 2 digit
def get_month( fn ):
return fn.split( '.' )[ 0 ].split( '_' )[ -2 ]
def get_year( fn ):
return fn.split( '.' )[ 0 ].split( '_' )[ -1 ]
def fix_month( fn ):
lookup = {'1':'01','2':'02','3':'03','4':'04',\
'5':'05','6':'06','7':'07','8':'08','9':'09',\... | 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\Secrets;
use PHPUnit\Framework\Att... | php | github | https://github.com/symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php |
from portality.dao import DomainObject
from portality.models import Account
class EditorGroup(DomainObject):
__type__ = "editor_group"
@classmethod
def group_exists_by_name(cls, name):
q = EditorGroupQuery(name)
res = cls.query(q=q.query())
ids = [hit.get("_source", {}).get("id") f... | unknown | codeparrot/codeparrot-clean | ||
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | java | github | https://github.com/apache/kafka | connect/runtime/src/main/java/org/apache/kafka/connect/cli/ConnectStandalone.java |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = b"\
\x00\x00\x11\x43\
\x00\
\x00\x5f\xaa\x78\x9c\xc5\x1c\xdb\x72\xdb\xb6\xf2\x5d\x5f\x81\x3a\
\x2f\x49\x8e\x9... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2005-2009 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/container_hash/hash_fwd.hpp> | unknown | github | https://github.com/mysql/mysql-server | extra/boost/boost_1_87_0/boost/functional/hash_fwd.hpp |
try:
from __pypy__ import identity_dict as idict
except ImportError:
idict = None
from UserDict import DictMixin
class IdentityDictPurePython(object, DictMixin):
__slots__ = "_dict _keys".split()
def __init__(self):
self._dict = {}
self._keys = {} # id(obj) -> obj
def __getitem__... | unknown | codeparrot/codeparrot-clean | ||
#### This error code is internal to the compiler and will not be emitted with normal Rust code.
#### Note: this error code is no longer emitted by the compiler.
This error code shows the variance of a type's generic parameters.
Erroneous code example:
```compile_fail
// NOTE: this feature is perma-unstable and shoul... | unknown | github | https://github.com/rust-lang/rust | compiler/rustc_error_codes/src/error_codes/E0208.md |
from browser import document as doc
from browser import window, html, markdown
import highlight
import time
def run(ev):
# run the code in the elt after the button
ix = ev.target.parent.children.index(ev.target)
elt = ev.target.parent.children[ix+1]
exec(elt.text)
elt.focus()
def load(url,target... | unknown | codeparrot/codeparrot-clean | ||
from __future__ import print_function
from pprint import pprint
import httplib2
from apiclient import discovery
from google.oauth2 import service_account
from googleapiclient import _auth
from models.member import Member
from models.card import Card
from models.exceptions.MissingCardError import MissingCardError
de... | unknown | codeparrot/codeparrot-clean | ||
// Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package sql_test
import (
"context"
gosql "database/sql"
"fmt"
"math/rand"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/cockroachdb/cockroach/pkg/base"
... | go | github | https://github.com/cockroachdb/cockroach | pkg/sql/mvcc_backfiller_test.go |
# frozen_string_literal: true
module ActiveRecord
module Encryption
class AutoFilteredParameters
def initialize(app)
@app = app
@attributes_by_class = Concurrent::Map.new
@collecting = true
install_collecting_hook
end
def enable
apply_collected_attribut... | ruby | github | https://github.com/rails/rails | activerecord/lib/active_record/encryption/auto_filtered_parameters.rb |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
class Channel9IE(InfoExtractor):
'''
Common extractor for channel9.msdn.com.
The type of provided URL (video or playlist) is determined according to
meta Search.PageType from web pa... | 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 ... | java | github | https://github.com/spring-projects/spring-framework | framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcservlet/mvclocaleresolverinterceptor/WebConfiguration.java |
/*!
* 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/components/ui/ButtonGroupToggle.tsx |
## 1. Recap ##
import pandas as pd
import matplotlib.pyplot as plt
unrate = pd.read_csv('unrate.csv')
unrate['DATE'] = pd.to_datetime(unrate['DATE'])
plt.plot(unrate['DATE'].head(12),unrate['VALUE'].head(12))
plt.xticks(rotation=90)
plt.xlabel('Month')
plt.ylabel('Unemployment Rate')
plt.title('Monthly Unemployment T... | unknown | codeparrot/codeparrot-clean | ||
# Copyright: (c) 2018, Pluribus Networks
# 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
import json
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn... | unknown | codeparrot/codeparrot-clean | ||
use std::{convert::Infallible, io, time::Duration};
use actix_http::{header::HeaderValue, HttpService, Request, Response, StatusCode};
use actix_server::Server;
use tracing::info;
#[actix_rt::main]
async fn main() -> io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
... | rust | github | https://github.com/actix/actix-web | actix-http/examples/hello-world.rs |
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for twisted SSL support.
"""
from twisted.trial import unittest
from twisted.internet import protocol, reactor, interfaces, defer
from twisted.protocols import basic
from twisted.python import util
from twisted.python.reflect ... | unknown | codeparrot/codeparrot-clean | ||
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | unknown | codeparrot/codeparrot-clean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.