code stringlengths 1 25.8M | language stringclasses 18
values | source stringclasses 4
values | repo stringclasses 78
values | path stringlengths 0 268 |
|---|---|---|---|---|
# -- coding: utf-8 --
import scrapy, os
from scrapy.selector import HtmlXPathSelector
from process.items import RvwUrl
import pandas as pd
#Constants
BASE_URL = 'http://www.amazon.cn'
class RvwUrlSpider(scrapy.Spider):
name = "review_urls"
allowed_domains = ["amazon.cn"]
start_urls = [BASE_URL]
def parse(self, ... | unknown | codeparrot/codeparrot-clean | ||
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: curl_url_dup
Section: 3
Source: libcurl
See-also:
- CURLOPT_CURLU (3)
- curl_url (3)
- curl_url_cleanup (3)
- curl_url_get (3)
- curl_url_set (3)
Protocol:
- All
Added-in: 7.62.0
---
# NAME
curl_url_dup - d... | unknown | github | https://github.com/curl/curl | docs/libcurl/curl_url_dup.md |
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.client.utils
import io.ktor.http.*
import io.ktor.util.*
import io.ktor.utils.io.*
private val DecompressionListAttribute: AttributeKey<MutableList<String>> = AttributeKey("D... | kotlin | github | https://github.com/ktorio/ktor | ktor-client/ktor-client-core/common/src/io/ktor/client/utils/HeadersUtils.kt |
#!/usr/bin/python2.7
# All rights to this package are hereby disclaimed and its contents
# released into the public domain by the authors.
'''Handles credentials and authorization.
This module is used by the sample scripts to handle credentials and
generating authorized clients. The module can also be run directly
to... | unknown | codeparrot/codeparrot-clean | ||
'''
Created on Aug 4, 2011
@author: sean
'''
from __future__ import print_function
from graphlab.meta.asttools.visitors import Visitor, visit_children
from graphlab.meta.asttools.visitors.symbol_visitor import get_symbols
import ast
from graphlab.meta.utils import py2op
class ConditionalSymbolVisitor(Visitor):
... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# Neos CMS documentation build configuration file, created by
# sphinx-quickstart on Wed May 20 21:31:09 2015.
#
# 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.
#
# ... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
# TODO: add tests for all machines
# TODO: add tests for new status callbacks
"""Base classes for machine types. Do not use directly."""
import serial
import threading
from plover.exception import SerialPortException
import collections
S... | unknown | codeparrot/codeparrot-clean | ||
# Generated by h2py from /usr/include/netinet/in.h
# Included from sys/cdefs.h
__GNUCLIKE_ASM = 3
__GNUCLIKE_ASM = 2
__GNUCLIKE___TYPEOF = 1
__GNUCLIKE___OFFSETOF = 1
__GNUCLIKE___SECTION = 1
__GNUCLIKE_ATTRIBUTE_MODE_DI = 1
__GNUCLIKE_CTOR_SECTION_HANDLING = 1
__GNUCLIKE_BUILTIN_CONSTANT_P = 1
__GNUCLIKE_BUILTIN_VARA... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
'''
OWASP ZSC
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/zscproject/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
import random, binascii, string
from core.compatible import version
_version = ... | unknown | codeparrot/codeparrot-clean | ||
import {identity, Stringify, useIdentity} from 'shared-runtime';
function Component(props) {
const {x, ...rest} = useIdentity(props);
const z = rest.z;
identity(z);
return <Stringify x={x} z={z} />;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{x: 'Hello', z: 'World'}],
}; | javascript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutated-spread-hook-return.js |
import {CommonModule} from '@angular/common';
import {Component} from '@angular/core';
import {RouterOutlet} from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, CommonModule],
templateUrl: './app.component.html',
})
export class AppComponent {
title = 'cli-hel... | typescript | github | https://github.com/angular/angular | integration/cli-hello-world-lazy/src/app/app.component.ts |
# Copyright 2012 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 | ||
# Python Tools for Visual Studio
# Copyright(c) Microsoft 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 a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0
#
# THIS ... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | unknown | codeparrot/codeparrot-clean | ||
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | java | github | https://github.com/apache/hadoop | hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/ops/FsOps.java |
#!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# License: MIT License (See LICENSE.md)
# Copyright (c) 2017, California Institute of Technology
# All rights reserved.
g_program_name = __file__.split('/')[-1] # = 'charge_by_bond.py'
g_date_str = '2017-10-03'
g_version_str = '0.14.0'
import sy... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/python
# (c) 2016, NetApp, Inc
#
# 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.... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
from ..Qt import QtCore, QtGui
import weakref
class Container(object):
#sigStretchChanged = QtCore.Signal() ## can't do this here; not a QObject.
def __init__(self, area):
object.__init__(self)
self.area = area
self._container = None
self._stretch = (10... | unknown | codeparrot/codeparrot-clean | ||
"""SCons.Tool.gnulink
Tool-specific initialization for the gnu linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
# Note: also necessary for building the code:
# $ pip install wheel
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
... | 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/lite/core/api/flatbuffer_conversions.h |
"""
Tests for course utils.
"""
import ddt
import mock
from django.conf import settings
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from util.course import get_link_for_about_page
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from django.core.checks import Error, Warning
from django.core.checks.model_checks import _check_lazy_references
from django.db import connection, connections, models
from django.db.models.functions import Lower
from django.db.models.signals import post_init
from django.test import SimpleTestCase, Test... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
def error(msg,code=9):
print 'Error: ' + msg
exit(code)
# Imports
try: import argparse
except: error('This version of python is not new enough. python 2.7 or newer is required.')
try: from netCDF4 import Dataset
except: error('Unable to import netCDF4 module. Check your PYTHONPATH.\n'
... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
import inspect
import logging
from . import defaults
import os
DB_PORT = 54321
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright (C) 2008 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-testlib/src/com/google/common/collect/testing/OneSizeGenerator.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... | java | github | https://github.com/apache/hadoop | hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystem.java |
# Copyright 2013 Velodyne Acoustics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | unknown | codeparrot/codeparrot-clean | ||
from textwrap import dedent
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
Series,
option_context,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import (
_parse_latex_cell_styles,
_parse_latex_css_c... | python | github | https://github.com/pandas-dev/pandas | pandas/tests/io/formats/style/test_to_latex.py |
---
title: Remix (and React Router) Streaming APIs
---
# Title
Date: 2022-07-27
Status: accepted
## Context
Remix aims to provide first-class support for React 18's streaming capabilities. Throughout the development process we went through many iterations and naming schemes around the APIs we plan to build into Re... | unknown | github | https://github.com/remix-run/react-router | decisions/0004-streaming-apis.md |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sync_test
import (
"bytes"
"internal/testenv"
"os"
"os/exec"
"strings"
. "sync"
"sync/atomic"
"testing"
)
func testWaitGroup(t *testing.T, wg1... | go | github | https://github.com/golang/go | src/sync/waitgroup_test.go |
import serial
import time
import sys
import os
"""
Used for debugging, add comport as command line argument
eg. python testServo.py COM6
Sends out direct servo commands to Johnny 5
"""
class testServo:
def __init__(self):
comPort = "/dev/tty.usbserial-A600eIiI"
try:
#comP... | 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 | clients/src/test/java/org/apache/kafka/clients/consumer/MockShareConsumerTest.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 may not... | python | github | https://github.com/apache/airflow | airflow-core/src/airflow/dag_processing/dagbag.py |
from __future__ import unicode_literals
from djblets.avatars.registry import (
AvatarServiceRegistry as DjbletsAvatarServiceRegistry)
from djblets.avatars.services import (FileUploadService,
GravatarService,
URLAvatarService)
from djblets.... | unknown | codeparrot/codeparrot-clean | ||
import logging
import umobj
from argparse import ArgumentParser, RawDescriptionHelpFormatter, \
ArgumentTypeError
epilog = ''' ACCESS_KEY - Your Access Key ID. If not supplied, will use
the value of the environment variable OBJ_ACCESS_KEY_ID.
SECRET_KEY - Your Secret Access Key. If not suppl... | unknown | codeparrot/codeparrot-clean | ||
import time
from threading import Lock
class Buffer(object):
def __init__(self):
self.__list__ = []
self.__lock__ = Lock()
self.__loading__ = False
def consume(self, source, adapter=None, chunked=False):
self.__loading__ = True
try:
for o in source:
... | unknown | codeparrot/codeparrot-clean | ||
import {Component} from '@angular/core';
import {User} from './user';
@Component({
selector: 'app-root',
template: ` <app-user /> `,
imports: [User],
})
export class App {} | typescript | github | https://github.com/angular/angular | adev/src/content/tutorials/learn-angular/steps/11-optimizing-images/answer/src/app/app.ts |
"""mServer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | unknown | codeparrot/codeparrot-clean | ||
% This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.
**Example**
```esql
ROW a=1.8
| EVAL asinh=ASINH(a)
```
| a:double | asinh:double |
| --- | --- |
| 1.8 | 1.3504407402749725 | | unknown | github | https://github.com/elastic/elasticsearch | docs/reference/query-languages/esql/_snippets/functions/examples/asinh.md |
import { useRouter } from "next/router";
import Head from "next/head";
import ErrorPage from "next/error";
import Container from "@components/container";
import MoreStories from "@components/more-stories";
import Header from "@components/header";
import PostHeader from "@components/post-header";
import PostBody from "@... | typescript | github | https://github.com/vercel/next.js | examples/cms-dotcms/pages/posts/[slug].tsx |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
from __future__ import absolute_import, unicode_literals
import sys
from . import SIGNATURE_METHODS, utils
class RequestValidator(obje... | unknown | codeparrot/codeparrot-clean | ||
import os
import zipfile
def _is_bad_zip(file):
with zipfile.ZipFile(file, 'r') as archive:
return len(archive.namelist()) > 1
def _zip_file(command):
# unzip works that way:
# unzip [-flags] file[.zip] [file(s) ...] [-x file(s) ...]
# ^ ^ files to unzip from the archiv... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""RackTablesDB.config - read the configuration for the RackTablesDB"""
import os
import logging
import ConfigParser
import traceback
class Config(object):
def __init__(self):
self.variables = dict()
self.database = dict()
self.has_been_read =... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
"""
==========================
Bipartite Graph Algorithms
==========================
"""
# Copyright (C) 2013-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx... | 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-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2004, 2006 Sean C. Gillies
# Copyright (c) 2007 STFC <http://www.stfc.ac.uk>
#
# Authors :
# Dominic Lowe <d.lowe@rl.ac.uk>
#
# Contact email: d.lowe@rl.ac.uk
# ========================... | unknown | codeparrot/codeparrot-clean | ||
/*
* 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 | core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/ExampleJsonApplication.java |
//go:build unix
package command
import (
"context"
"io"
"github.com/containerd/log"
)
func runDaemon(ctx context.Context, cli *daemonCLI) error {
return cli.start(ctx)
}
func initLogging(_, stderr io.Writer) {
log.L.Logger.SetOutput(stderr)
} | go | github | https://github.com/moby/moby | daemon/command/docker_unix.go |
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Arcee
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_... | python | github | https://github.com/langchain-ai/langchain | libs/langchain/langchain_classic/llms/arcee.py |
"""Implementation of DPLL algorithm
Further improvements: eliminate calls to pl_true, implement branching rules,
efficient unit propagation.
References:
- http://en.wikipedia.org/wiki/DPLL_algorithm
- http://bioinformatics.louisville.edu/ouyang/MingOuyangThesis.pdf
"""
from __future__ import print_function, divis... | unknown | codeparrot/codeparrot-clean | ||
# 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/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | unknown | codeparrot/codeparrot-clean | ||
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "precomp.hpp"
#include "opencv2/core/async.hpp"
#include "opencv2/core/detail/async_promise.hpp"
#include "opencv2/... | cpp | github | https://github.com/opencv/opencv | modules/core/src/async.cpp |
# 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 | ||
"""
Cocoa window cannot be destroyed programmatically, until it finishes processing a NSEvent
So we need to simulate a mouse movement in order to generate an event.
"""
from Quartz.CoreGraphics import CGEventCreateMouseEvent
from Quartz.CoreGraphics import CGEventCreate
from Quartz.CoreGraphics import CGEventGetLocati... | unknown | codeparrot/codeparrot-clean | ||
/* contrib/pageinspect/pageinspect--1.7--1.8.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION pageinspect UPDATE TO '1.8'" to load this file. \quit
--
-- heap_tuple_infomask_flags()
--
CREATE FUNCTION heap_tuple_infomask_flags(
t_infomask integer,
... | sql | github | https://github.com/postgres/postgres | contrib/pageinspect/pageinspect--1.7--1.8.sql |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
# Copyright (C) 2008 Robert Cheramy <robert@cheramy.net>
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or... | unknown | codeparrot/codeparrot-clean | ||
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | unknown | codeparrot/codeparrot-clean | ||
"""
Django settings for spameggs project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | unknown | codeparrot/codeparrot-clean | ||
//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/certificates/zz_generated.deepcopy.go |
#!/usr/bin/env python3
import collections
import configparser
import contextlib
import csv
import datetime
import itertools
import json
import locale
import logging
import queue
import shutil
import time
import dateutil.rrule
import matplotlib.dates
import matplotlib.pyplot
import pysolar
import pytz
import api
impo... | unknown | codeparrot/codeparrot-clean | ||
<!--Copyright 2022 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/es/tasks/multiple_choice.md |
import datetime
import pytest
from fittrackee import db
from fittrackee.workouts.models import Sport, Workout, WorkoutSegment
@pytest.fixture()
def sport_1_cycling() -> Sport:
sport = Sport(label='Cycling')
db.session.add(sport)
db.session.commit()
return sport
@pytest.fixture()
def sport_1_cycling_... | unknown | codeparrot/codeparrot-clean | ||
import sys
import re
import dns
import bitcoin
import dnssec
from util import StoreDict, print_error
from i18n import _
class Contacts(StoreDict):
def __init__(self, config):
StoreDict.__init__(self, config, 'contacts')
def resolve(self, k):
if bitcoin.is_address(k):
return {
... | unknown | codeparrot/codeparrot-clean | ||
# Copyright (C) 2013, Gonzalo Odiard
#
# 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 i... | unknown | codeparrot/codeparrot-clean | ||
from django.forms.models import ModelForm, inlineformset_factory
from django.test import TestCase, skipUnlessDBFeature
from .models import Child, Parent, Poem, Poet, School
class DeletionTests(TestCase):
def test_deletion(self):
PoemFormSet = inlineformset_factory(Poet, Poem, can_delete=True, fields="__a... | unknown | codeparrot/codeparrot-clean | ||
## Input
```javascript
function Component(props) {
let x = {};
// onChange should be inferred as immutable, because the value
// it captures (`x`) is frozen by the time the function is referenced
const onChange = e => {
maybeMutate(x, e.target.value);
};
if (props.cond) {
<div>{x}</div>;
}
retu... | unknown | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-captures-value-later-frozen-jsx.expect.md |
#!/usr/bin/env python3
import json
import logging
import os
import re
import sys
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
import datasets
import numpy as np
import torch
import torchaudio
from packaging import version
from torch import nn
import transformers
from tr... | unknown | codeparrot/codeparrot-clean | ||
#coding:utf-8
import sys,os
from PIL import Image,ImageDraw
import pytesseract
#二值判断,如果确认是噪声,用改点的上面一个点的灰度进行替换
#该函数也可以改成RGB判断的,具体看需求如何
def getPixel(image,x,y,G,N):
L = image.getpixel((x,y))
if L > G:
L = True
else:
L = False
nearDots = 0
if L == (image.getpixel((x - 1,y - 1)) > G):
... | unknown | codeparrot/codeparrot-clean | ||
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import invariant from 'invariant';
import {Environment} from '../HIR';
import {
BasicBlock,
GeneratedSource,
HIRFunction,
... | typescript | github | https://github.com/facebook/react | compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './acq4/analysis/modules/MapImager/SpatialCorrelatorCtrlTemplate.ui'
#
# Created: Tue Dec 24 01:49:13 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:... | unknown | codeparrot/codeparrot-clean | ||
from tests.test_integration.helpers import create_partner
from tests.test_integration.test_case import YolaServiceTestCase
class TestYolaPartners(YolaServiceTestCase):
"""Yola: Partner resource"""
@classmethod
def setUpClass(cls):
super(TestYolaPartners, cls).setUpClass()
cls.partner = cre... | unknown | codeparrot/codeparrot-clean | ||
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: capath
Arg: <dir>
Help: CA directory to verify peer against
Protocols: TLS
Category: tls
Added: 7.9.8
Multi: single
See-also:
- cacert
- dump-ca-embed
- insecure
Example:
- --capath /local/directory $URL
---
# `-... | unknown | github | https://github.com/curl/curl | docs/cmdline-opts/capath.md |
# coding=utf-8
"""Cache (dogpile) used by application."""
from __future__ import unicode_literals
import os
from datetime import timedelta
from dogpile.cache.backends.file import AbstractFileLock
from dogpile.cache.region import make_region
from dogpile.util.readwrite_lock import ReadWriteMutex
class MutexLock(Abstr... | unknown | codeparrot/codeparrot-clean | ||
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not us... | unknown | github | https://github.com/apache/airflow | dev/AIRFLOW_ERROR_GUIDE.md |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | unknown | codeparrot/codeparrot-clean | ||
/**
* @file version.h
*
* The version of the Prism library.
*/
#ifndef PRISM_VERSION_H
#define PRISM_VERSION_H
/**
* The major version of the Prism library as an int.
*/
#define PRISM_VERSION_MAJOR 1
/**
* The minor version of the Prism library as an int.
*/
#define PRISM_VERSION_MINOR 9
/**
* The patch ver... | c | github | https://github.com/ruby/ruby | prism/version.h |
"""Concrete date/time and related types.
See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
"""
import time as _time
import math as _math
def _cmp(x, y):
return 0 if x == y else 1 if x > y else -1
MINYEAR = 1
MAXYEAR = 9999
_MAXORDINAL = 3652059 # date.max.toordinal()... | unknown | codeparrot/codeparrot-clean | ||
"""Functions that read and write gzipped files.
The user of the file doesn't have to worry about the compression,
but random access is not allowed."""
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
import builtins
import io
import os
import struct
import sys
import time
import weakref
impo... | python | github | https://github.com/python/cpython | Lib/gzip.py |
#pragma once
#ifdef USE_VULKAN_API
#include <ATen/native/vulkan/ops/Common.h>
#include <ATen/native/vulkan/ops/VulkanPackedContext.h>
#include <torch/library.h>
namespace at {
namespace native {
namespace vulkan {
namespace ops {
class GruPackedContext final : virtual public VulkanPackedContext,
... | c | github | https://github.com/pytorch/pytorch | aten/src/ATen/native/vulkan/ops/Gru.h |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
const (
// vdsoArrayMax is the byte-size of a maximally sized array on this architecture.
// See cmd/compile/internal/riscv64/galign.go arch.... | go | github | https://github.com/golang/go | src/runtime/vdso_linux_riscv64.go |
from pathlib import Path
from time import process_time
from urllib.parse import urlparse
import pytest
from scrapy.http import HtmlResponse, Response
from scrapy.utils.python import to_bytes
from scrapy.utils.response import (
_remove_html_comments,
get_base_url,
get_meta_refresh,
open_in_browser,
... | python | github | https://github.com/scrapy/scrapy | tests/test_utils_response.py |
// Copyright 2023 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
package server
import (
"context"
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroa... | go | github | https://github.com/cockroachdb/cockroach | pkg/server/tenant_migration.go |
#!/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 re
from ast import literal_eval
from openerp.tools import mute_logger
# Validation Library https://pypi.python.org/pypi/validate_e... | unknown | codeparrot/codeparrot-clean | ||
/*
* Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased
import com.intellij.psi.PsiElement
imp... | kotlin | github | https://github.com/JetBrains/kotlin | analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/psiBased/KaFe10PsiDefaultPropertyGetterSymbol.kt |
"""
A direct translation of the webvtt file parsing algorithm.
See https://w3c.github.io/webvtt/#file-parsing for documentation
"""
import re
import string
SPACE_CHARACTERS = [' ', '\t', '\n', '\f', '\r']
SPACE_SPLIT_PATTERN = r"[{}]*".format(''.join(SPACE_CHARACTERS))
DIGITS = string.digits
class DictInit:
def ... | unknown | codeparrot/codeparrot-clean | ||
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | unknown | codeparrot/codeparrot-clean | ||
import unittest
from .. import parser
from ..parser import token_types
class TokenizerTest(unittest.TestCase):
def setUp(self):
self.tokenizer = parser.Tokenizer()
def tokenize(self, input_str):
rv = []
for item in self.tokenizer.tokenize(input_str):
rv.append(item)
... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
import string
import sys
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.smi import builder, view
import ipaddress
from port import Port
class Switch(object):
"""
Represents a generic HP Networking switch.
"""
def __init__(self, hostname, community="public"):
... | unknown | codeparrot/codeparrot-clean | ||
from subprocess import *
from time import sleep
from timeit import default_timer as clock
from tempfile import TemporaryFile
#from Queue import Queue
from collections import deque
from Tester import Tester
from signal import SIGTERM
import os, sys
## This class provides an interface to run commands in parallel
#
# T... | unknown | codeparrot/codeparrot-clean | ||
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 the BabelFish authors. All rights reserved.
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from . import LanguageReverseConverter, CaseInsensitiveDict
from ..exceptions im... | unknown | codeparrot/codeparrot-clean | ||
# coding=utf-8
"""InaSAFE Wizard Step Threshold."""
from collections import OrderedDict
from functools import partial
import logging
from PyQt4.QtGui import QDoubleSpinBox, QHBoxLayout, QLabel
from qgis.core import QgsRasterBandStats
from safe.utilities.i18n import tr
from safe import messaging as m
from safe.defini... | unknown | codeparrot/codeparrot-clean | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing_extensions import Literal, Required, TypedDict
from .image_file_param import ImageFileParam
__all__ = ["ImageFileContentBlockParam"]
class ImageFileContentBlockParam(TypedDict, total... | python | github | https://github.com/openai/openai-python | src/openai/types/beta/threads/image_file_content_block_param.py |
"""
Test cases for the dircache module
Nick Mathewson
"""
import unittest
from test.test_support import is_jython, run_unittest, TESTFN
import dircache, os, time, sys, tempfile
class DircacheTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
def tearDown(self):
f... | unknown | codeparrot/codeparrot-clean | ||
# python-modeled
#
# Copyright (C) 2014 Stefan Zimmermann <zimmermann.code@gmail.com>
#
# python-modeled 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 op... | unknown | codeparrot/codeparrot-clean | ||
# Copyright 2017 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion 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) a... | unknown | codeparrot/codeparrot-clean | ||
from sklearn import datasets
from sklearn.model_selection import StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils.validation import check_random_state
from stacked_generalization.lib.joblibed import JoblibedClassifier
iris = datasets.load_iris()
rng = check_random_state(0)
perm = ... | unknown | codeparrot/codeparrot-clean | ||
{
"description": "basic test coverting updating a simple map",
"include_files": [],
"ignore_fields": {}
} | json | github | https://github.com/hashicorp/terraform | testing/equivalence-tests/tests/basic_map_update/spec.json |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build ignore
/*
Input to cgo -cdefs
GOARCH=amd64 cgo -cdefs defs.go defs1.go >amd64/defs.h
*/
package runtime
/*
#include <ucontext.h>
#include <fcntl.... | go | github | https://github.com/golang/go | src/runtime/defs1_linux.go |
#include <c10/macros/Macros.h>
#include <c10/util/Float8_e4m3fnuz.h>
namespace c10 {
static_assert(
std::is_standard_layout_v<Float8_e4m3fnuz>,
"c10::Float8_e4m3fnuz must be standard layout.");
} // namespace c10 | cpp | github | https://github.com/pytorch/pytorch | c10/util/Float8_e4m3fnuz.cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.