text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Docstrings for generated ufuncs
The syntax is designed to look like the function add_newdoc is being
called from numpy.lib, but in this file add_newdoc puts the docstrings
in a dictionary. This dictionary is used in
numpy/core/code_generators/generate_umath.py to generate the docstrings
for the ufuncs in numpy.co... | {
"content_hash": "09d7a3de12f4580e655d393dfe926f17",
"timestamp": "",
"source": "github",
"line_count": 3801,
"max_line_length": 83,
"avg_line_length": 24.98921336490397,
"alnum_prop": 0.5608523540806872,
"repo_name": "tynn/numpy",
"id": "c7e5cf6002d442916484d81ed2d2606f402362cb",
"size": "94984",
... |
import unittest
import thread_cert
CHANNEL_INIT = 19
PANID_INIT = 0xface
CHANNEL_FINAL = 19
PANID_FINAL = 0xabcd
COMMISSIONER = 1
LEADER = 2
ROUTER1 = 3
ROUTER2 = 4
class Cert_9_2_09_PendingPartition(thread_cert.TestCase):
SUPPORT_NCP = False
TOPOLOGY = {
COMMISSIONER: {
'active_datas... | {
"content_hash": "17a17abc9a5e23c25e19ce55a1368ed1",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 30.977777777777778,
"alnum_prop": 0.5561932089909134,
"repo_name": "bukepo/openthread",
"id": "ba47ee7e3df8ea96c325008b7969018d7cca92ca",
"size": "5... |
import argparse
import os
import yaml
import shutil
from unittest import TestCase
from nose.tools import *
from project_generator.commands import import_command
class TestImportCommand(TestCase):
"""test import command"""
def setUp(self):
if not os.path.exists('test_workspace'):
os.make... | {
"content_hash": "91ea12192f974c63ae7722b405001563",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 88,
"avg_line_length": 31.522727272727273,
"alnum_prop": 0.6539293439077145,
"repo_name": "hwfwgrp/project_generator",
"id": "0e8b4ffb7066bd6e9051bafef92d69dbb4e203d1",
"si... |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
f... | {
"content_hash": "8531660209e8c82b4f9affdeafea467b",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 186,
"avg_line_length": 46.57364341085271,
"alnum_prop": 0.6556258322237017,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d183576a45db76ff7a6193a532a4727b41cd0049",
"... |
def log_ok_status(uri, page_description, size, time_elapsed, site, config):
import logging
from Config import LoadConfig
from Config import Settings
from Checks import Checks
def log_time_unacceptable():
logging.warning("%s (%s): took too long! (took %d seconds; acceptable time: %d seconds... | {
"content_hash": "ae572b8ef655d5a3317f1f5cc8f31bb9",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 119,
"avg_line_length": 40.94117647058823,
"alnum_prop": 0.6271551724137931,
"repo_name": "jeroanan/Gyroscope",
"id": "d88a63aac6da6b1b08d78a99056291dc3c288c61",
"size": "1... |
"""
This file is the CVXPY conic extension of the Cardinal Optimizer
"""
import numpy as np
import scipy.sparse as sp
import cvxpy.settings as s
from cvxpy.constraints import PSD, SOC
from cvxpy.reductions.solution import Solution, failure_solution
from cvxpy.reductions.solvers import utilities
from cvxpy.reductions.s... | {
"content_hash": "51c81d973e103a9f434c933230f454fa",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 100,
"avg_line_length": 35.26170798898072,
"alnum_prop": 0.525859375,
"repo_name": "merraksh/cvxpy",
"id": "a2694c8ec8f24ce2fc3fe25ca2286d13662827b0",
"size": "12800",
"... |
import csv
from datetime import datetime
from django.http import HttpResponse, HttpResponseBadRequest
from custom.apps.wisepill.models import WisePillDeviceEvent
from corehq.apps.sms.handlers.keyword import handle_structured_sms
from corehq.apps.sms.models import CommConnectCase
from corehq.apps.reminders.models import... | {
"content_hash": "300365145001bb4f177e8b89cc4d65d6",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 143,
"avg_line_length": 37.24444444444445,
"alnum_prop": 0.6431980906921241,
"repo_name": "puttarajubr/commcare-hq",
"id": "1145739cc6ce1b8ff2f75f56d518e69909d41208",
"size... |
import sys
from twisted.internet import reactor
from pysnmp.carrier.base import AbstractTransportAddress
from pysnmp.carrier.twisted.dgram.base import DgramTwistedTransport
from pysnmp.carrier import error
domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13)
class UnixTransportAddress(str, AbstractTransportA... | {
"content_hash": "4c26e8444ce962923887c3b0a2f8df07",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 67,
"avg_line_length": 30.18918918918919,
"alnum_prop": 0.702775290957923,
"repo_name": "filippog/pysnmp",
"id": "5dc84bd3dbc199c9c33a9854fd9b24238d1fc1cd",
"size": "1264",... |
import sqlite3
with sqlite3.connect("new.db") as connection:
c = connection.cursor()
#update data
c.execute("UPDATE population SET population = 9000000 WHERE city = 'New York City'")
# Delete data
c.execute("DELETE FROM population where city = 'Boston'")
print "\nNEW DATA:\n"
... | {
"content_hash": "a799e909f2e7069cace9ae4f48d2047c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 88,
"avg_line_length": 22.6,
"alnum_prop": 0.5929203539823009,
"repo_name": "joelstanner/RealPython_book2",
"id": "9397e337d4bd836718e7f2233bef4ca3f7563677",
"size": "484",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('administrador', '0006_auto_20150807_1853'),
]
operations = [
migrations.AlterField(
model_name='imagenproyecto',
name='nombr... | {
"content_hash": "efca2daf6dd3a6f7b3b334d7ced134ff",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.6139088729016786,
"repo_name": "gabrielf10/webAmpunc",
"id": "9d0f65cddee6254d9269883b290e065bb9b806c5",
"size": ... |
import sys
def input_process(in_question):
return input(in_question) if sys.version_info >= (3,0) else raw_input(in_question)
if __name__ == '__main__':
noun = input_process('Enter a noun: ')
verb = input_process('Enter a verb: ')
adjective = input_process('Enter a adjective: ')
adverb = input_pr... | {
"content_hash": "d267dc4919af0e1e7f220fd3065cd712",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 32.30769230769231,
"alnum_prop": 0.6285714285714286,
"repo_name": "kssim/efp",
"id": "7404178e348d115260c7eccc41669514b723848d",
"size": "817",
"bi... |
"""
File: secondary_chord_template.py
Purpose: Represent the definition of a secondary chord.
"""
from harmonicmodel.chord_template import ChordTemplate
from tonalmodel.diatonic_modality import DiatonicModality
from harmonicmodel.secondary_chord import SecondaryChord
from tonalmodel.modality import ModalityType
imp... | {
"content_hash": "d1b66f80ee5178daf2ef02fbd8411c34",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 113,
"avg_line_length": 40.469565217391306,
"alnum_prop": 0.6529866781263429,
"repo_name": "dpazel/music_rep",
"id": "31431e07a8adb8621a642970049cc44b951a66d6",
"size": "4... |
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.output(7, 0) | {
"content_hash": "1fa9cd4eed89e13254fdbe624ee345ce",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 24,
"avg_line_length": 22.5,
"alnum_prop": 0.7555555555555555,
"repo_name": "DanielEgan/wackcoon-device",
"id": "8f7394a39fba5fa62163d79bd72abcc95b3b20b9",
"size": "90",
"... |
"""
Cached thread pool tests
:license: Apache License 2.0
"""
# ------------------------------------------------------------------------------
# Tested module
import jsonrpclib.threadpool as threadpool
# Standard library
import threading
import time
# Tests
try:
import unittest2 as unittest
except ImportError:... | {
"content_hash": "b30403606dc2af32a498781674df03a1",
"timestamp": "",
"source": "github",
"line_count": 469,
"max_line_length": 80,
"avg_line_length": 28.64179104477612,
"alnum_prop": 0.5546787761482915,
"repo_name": "CloudI/CloudI",
"id": "312bfc6bbfd0070cad48204e4e60c5486f3633c1",
"size": "13483"... |
from oslo_context import context as oslo_context
REQUEST_CONTEXT_ENV = 'keystone.oslo_request_context'
def _prop(name):
return property(lambda x: getattr(x, name),
lambda x, y: setattr(x, name, y))
class RequestContext(oslo_context.RequestContext):
def __init__(self, **kwargs):
... | {
"content_hash": "7490638c2158cdd1b972fe4091da6446",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 36.714285714285715,
"alnum_prop": 0.6459143968871596,
"repo_name": "cernops/keystone",
"id": "7ac997a395bcb8d2a363883dde836b16ad922bc5",
"size": "208... |
import itertools
from argparse import ArgumentParser
import os
import re
import sys
import subprocess
import glob
import shutil
from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES
from sparktestsupport.shellutils import exit_from_command_with_retcode, run_cmd, rm_r, which
from sparktestsupport.toposort imp... | {
"content_hash": "a91f6d52a13b699eef4113a5a1fbe27a",
"timestamp": "",
"source": "github",
"line_count": 766,
"max_line_length": 100,
"avg_line_length": 40.65013054830287,
"alnum_prop": 0.625248892029032,
"repo_name": "maropu/spark",
"id": "c3b074533c9f88214a94d49611c2b83d5ef10443",
"size": "31947",... |
import h11
import mock
from tornado.gen import coroutine, sleep
from tornado.netutil import add_accept_handler
from tornado.testing import gen_test, bind_unused_port
from unittest import TestCase
from microproxy.context import (
HttpRequest, HttpResponse, HttpHeaders,
LayerContext, ServerContext
)
from micropr... | {
"content_hash": "1b3f2b7a8cdc125ea9f5137da5d7d03a",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 105,
"avg_line_length": 38.36006546644845,
"alnum_prop": 0.6180134823790426,
"repo_name": "mike820324/microProxy",
"id": "7332b8481483a729290fef46b0585c4f9ac1344d",
"size"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("accounts", "0007_profile_stripe_customer_id")]
operations = [migrations.DeleteModel(name="InviteEmail")]
| {
"content_hash": "0c1ed7cacd67b7e3325bb01c66ddde44",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 68,
"avg_line_length": 24.8,
"alnum_prop": 0.7459677419354839,
"repo_name": "mblayman/lcp",
"id": "782e3b24a8684d99b73701b969fee1fa20ea8243",
"size": "321",
"binary": fal... |
from djangorestframework_camel_case.render import CamelCaseJSONRenderer
from rest_framework.permissions import AllowAny
from wagtail.api.v2.endpoints import PagesAPIEndpoint as WagtailPagesAPIEndpoint
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.images.api.v2.endpoints import ImagesAPIEndpoint
from w... | {
"content_hash": "6d6bd4377960210f637888cc136ea23a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 38.11764705882353,
"alnum_prop": 0.7854938271604939,
"repo_name": "sussexstudent/falmer",
"id": "b9b154e98d100fdb9942cb81cd71b11dbd771b3a",
"size": "... |
from __future__ import unicode_literals
import sqlalchemy as sa
from tests import TestCase
from sqlalchemy_utils import batch_fetch, generic_relationship
class TestBatchFetchGenericRelationship(TestCase):
def create_models(self):
class Building(self.Base):
__tablename__ = 'building'
... | {
"content_hash": "e56a757dbea99f2f0fb3d13054b15633",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 65,
"avg_line_length": 30.386363636363637,
"alnum_prop": 0.6133133881824981,
"repo_name": "joshfriend/sqlalchemy-utils",
"id": "0748c2c96816731bfed9b11a484174e7c28ac94d",
"... |
from __future__ import unicode_literals
import boto
from nose.tools import assert_raises
import sure # noqa
from boto.exception import EC2ResponseError
from moto import mock_ec2
@mock_ec2
def test_create_vpn_connections():
conn = boto.connect_vpc('the_key', 'the_secret')
vpn_connection = conn.create_vpn_con... | {
"content_hash": "cfc48b464e5a0639cd85397b3e881f9d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 90,
"avg_line_length": 41.04347826086956,
"alnum_prop": 0.7171610169491526,
"repo_name": "silveregg/moto",
"id": "dd96e7b65de3c6021e9dd346b280b3d9124f7433",
"size": "1888",... |
from __future__ import unicode_literals
from django.db import migrations, models
import redactor.fields
class Migration(migrations.Migration):
dependencies = [
('my_profile', '0002_auto_20170205_0429'),
]
operations = [
migrations.AddField(
model_name='nmhwprofile',
... | {
"content_hash": "4e955b8115aa2eb3c36f00db75ca8bd9",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 27.620689655172413,
"alnum_prop": 0.5855181023720349,
"repo_name": "nhuntwalker/rational_whimsy",
"id": "4c97620c5def9e7b94d9953f3dc7eb3fe8ba6cce",
"... |
import eHive
import os
import subprocess
class CompressBybgzip(eHive.BaseRunnable):
"""Store the file in the DB"""
def param_defaults(self):
return {
'compression' : None
}
def run(self):
self.warning('Compressing file: %s'% self.param_required('filename'))
f... | {
"content_hash": "b156172b6a54e8407d2b2124dec51f40",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 93,
"avg_line_length": 33.170212765957444,
"alnum_prop": 0.5772931366260423,
"repo_name": "igsr/igsr_analysis",
"id": "04ca74ae444cf3c28273f5d1604f3d6491e76d4b",
"size": "1... |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
from thrift.transport import TTransport
class Error(TException):
"""
Attributes:
- message
"""
thrift_spec = (
None, # 0
... | {
"content_hash": "960ceda3d621d576d0f634407e630322",
"timestamp": "",
"source": "github",
"line_count": 1160,
"max_line_length": 173,
"avg_line_length": 39.557758620689654,
"alnum_prop": 0.5417220563558306,
"repo_name": "WPTechInnovation/worldpay-within-sdk",
"id": "e865901962c09ad0355f3014137ff0b9a0... |
"""
Proxy module tests.
"""
import pickle
import time
from threading import Timer
import pytest
from Pyro4.errors import ConnectionClosedError
import osbrain
from osbrain import Agent
from osbrain import AgentProcess
from osbrain import NameServer
from osbrain import Proxy
from osbrain import run_agent
from osbrain i... | {
"content_hash": "33b140de5438ed89ac58b7df99284c2e",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 79,
"avg_line_length": 29.900568181818183,
"alnum_prop": 0.6600475059382422,
"repo_name": "opensistemas-hub/osbrain",
"id": "22bb105e94ecb0c3be856b4fe01a3dec8a9a1c0b",
"si... |
"""This code example gets all labels ordered by name.
To create a label, run create_label.py. This feature is only available to DFP
premium solution networks.
"""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
# Import appropriate modules from the client library.
from googleads import dfp
def main(... | {
"content_hash": "892d100a6092f3e66d56f0bd95706239",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 28.846153846153847,
"alnum_prop": 0.6746666666666666,
"repo_name": "coxmediagroup/googleads-python-lib",
"id": "a4364ee06907b6c4db286a0855fcf3a84bf09c3... |
from pyspark.sql import *
# sc is an existing SparkContext.
sqlContext = SQLContext(sc)
# Load a text file and convert each line to a tuple.
lines = sc.textFile("people.txt")
parts = lines.map(lambda l: l.split(","))
people = parts.map(lambda p: (p[0], p[1].strip()))
# The schema is encoded in a string.
schemaString... | {
"content_hash": "468125adcdf8204f49bb0b71c3e08b01",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 93,
"avg_line_length": 31.79310344827586,
"alnum_prop": 0.737527114967462,
"repo_name": "javachen/learning-spark",
"id": "84b980404149fee249d786f1e9809fc5fd374ac7",
"size":... |
from django.db import migrations
"""
Move old data from 'classification1' field to new 'Classification' model
"""
def move_classification_data(apps, schema_editor):
MineralType = apps.get_model("stein", "MineralType")
Classification = apps.get_model("stein", "Classification")
for mineral in MineralType.... | {
"content_hash": "ad8476828bdef12eaa17af8970277d26",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 101,
"avg_line_length": 26.076923076923077,
"alnum_prop": 0.700589970501475,
"repo_name": "GeoMatDigital/django-geomat",
"id": "3f87eb6ac8c154b74b8ec8e40e0e0890eb6a7c26",
"... |
"""tests for libvcs svn repos."""
import os
import pathlib
import pytest
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import which
if not which("svn"):
pytestmark = pytest.mark.skip(reason="svn is not available")
def test_repo_svn(tmp_path: pathlib.Path, svn_remote):
repo_name = "... | {
"content_hash": "4e97d890d4338f02084d9ab831057d0e",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 64,
"avg_line_length": 23.066666666666666,
"alnum_prop": 0.6286127167630058,
"repo_name": "tony/libvcs",
"id": "57d9120fa44f43ee73f31c6a931d5b23667fa18a",
"size": "692",
... |
'''
--------------------------------------------------------------
Before running this Airflow module...
Install StarThinker in cloud composer ( recommended ):
From Release: pip install starthinker
From Open Source: pip install git+https://github.com/google/starthinker
Or push local code to the cloud co... | {
"content_hash": "3ee68c06712d0ddb7ce99a47fae6562a",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 200,
"avg_line_length": 47.1875,
"alnum_prop": 0.6376537369914853,
"repo_name": "google/starthinker",
"id": "48212460906a256cd071e0a748c76fac19eb003a",
"size": "6235",
"... |
import unittest
from warnings import catch_warnings
from unittest.test.testmock.support import is_instance
from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call
something = sentinel.Something
something_else = sentinel.SomethingElse
class WithTest(unittest.TestCase):
def test_with_sta... | {
"content_hash": "0d240f53f90651c675cb16f32de1aa69",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 130,
"avg_line_length": 32.98863636363637,
"alnum_prop": 0.5933517051326215,
"repo_name": "PRIMEDesigner15/PRIMEDesigner15",
"id": "0a0cfad120a5334ea1d80f6d9f8392f7ac3bd0a5"... |
from troposphere import Base64, FindInMap, GetAtt, GetAZs, Join, Output
from troposphere import Parameter, Ref, Template
import troposphere.ec2 as ec2
import troposphere.elasticloadbalancing as elb
def AddAMI(template):
template.add_mapping("RegionMap", {
"us-east-1": {"AMI": "ami-6411e20d"},
"us-... | {
"content_hash": "926f05ff38564ac5b1b58a244ef47c32",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 31.172932330827066,
"alnum_prop": 0.5429329474191992,
"repo_name": "ikben/troposphere",
"id": "5bbfa98949853d1cf86f3529c44ed2f6a789ba6b",
"size": "4... |
import warnings
import logging
from six import text_type
import six
try:
# Python 2.7+
from collections import OrderedDict
except ImportError:
# Python 2.6
from ordereddict import OrderedDict
try:
import json
except ImportError:
import simplejson as json
import requests
from requests.auth impo... | {
"content_hash": "b5978340bdef6b926e091d73f30238f9",
"timestamp": "",
"source": "github",
"line_count": 785,
"max_line_length": 134,
"avg_line_length": 41.21528662420382,
"alnum_prop": 0.5537182419484453,
"repo_name": "JeroenDeDauw/mwclient",
"id": "f93cef30faf828e6c0d4351f1b6582fea89024b7",
"size"... |
import unittest
from mongokit import Document, Connection
class DescriptorsTestCase(unittest.TestCase):
def setUp(self):
self.connection = Connection()
self.col = self.connection['test']['mongokit']
def tearDown(self):
self.connection.drop_database('test')
def test_lis... | {
"content_hash": "4174388407706df6e09795ec2d552899",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 73,
"avg_line_length": 23.85945945945946,
"alnum_prop": 0.38106026280018124,
"repo_name": "klothe/mongokit",
"id": "c72ea2277042c8dbcb7bf6b9335414b4f8dc3922",
"size": "441... |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="layout.scene.zaxis.tickformatstop",
**kwargs
):
super(TemplateitemnameValidator, self).__i... | {
"content_hash": "8cfaf17df28ad4b68a8d7287461719b2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 78,
"avg_line_length": 31.294117647058822,
"alnum_prop": 0.5977443609022557,
"repo_name": "plotly/python-api",
"id": "4cce018f8f815e9d0362bacd476625eb8a148357",
"size": "53... |
"""Wrapper script to use Pywikibot in 'directory' mode.
Run scripts using:
python pwb.py <pwb options> <name_of_script> <options>
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
Currently <pwb options> are global options.... | {
"content_hash": "aefa615b99c088e586feffb9e3f6822f",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 81,
"avg_line_length": 33.9305912596401,
"alnum_prop": 0.618304417001288,
"repo_name": "PersianWikipedia/pywikibot-core",
"id": "c1c24a957d0bfe5358eab67b932bb6bb9e1913e2",
... |
from __future__ import absolute_import, print_function, division
from petl.compat import next, integer_types, string_types, text_type
from petl.errors import ArgumentError, FieldSelectionError
from petl.util.base import Table, expr, header, Record
from petl.util.parsers import numparser
def convert(table, *args, ... | {
"content_hash": "279b324fbcea58169ad3e98bc453b857",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 80,
"avg_line_length": 30.568548387096776,
"alnum_prop": 0.48944730246669305,
"repo_name": "thatneat/petl",
"id": "b0c7a1df6d267fa04b137a3dcae3afbcb31f8db1",
"size": "1516... |
import codecs
import optparse
import struct
from xmlrpclib import ProtocolError
import jsonrpclib
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
import auxpow
class GetworkWrapper:
"""
The main server class. It sets up a JSON-RPC server and handles requests
coming in.
"""
def __init__ (s... | {
"content_hash": "3353fc45e7809eb8c73cdb73c9012f2b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 31.121495327102803,
"alnum_prop": 0.657957957957958,
"repo_name": "syscoin/syscoin",
"id": "5e30ec70f63ca865e3942956fe9a4597ca4d8aa5",
"size": "4136... |
from .ddt_tile import ddt_tile
class ddt_tile_html(ddt_tile):
def make_parameters_form_01(self,
formparameters={},
):
'''Make htmlparameters
INPUT:
OUTPUT:
'''
#defaults:
htmlid='filtermenuform1';
htmltype='form_01';
formsubmi... | {
"content_hash": "49e0540ac574bd72a3ab2b7e28a5888e",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 70,
"avg_line_length": 32.641975308641975,
"alnum_prop": 0.5283661119515886,
"repo_name": "dmccloskey/ddt_python",
"id": "ad41f3f6638c1914a6fa6cdeaa77bb8275dee5c2",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("lifestream", "0001_initial")]
operations = [
migrations.AlterField(
model_name="lifestreamitem", name="blurb", field=models.CharField(max_length=255)... | {
"content_hash": "a3d35b50c53883c3fdf55ad3addb80a6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 93,
"avg_line_length": 28.210526315789473,
"alnum_prop": 0.6194029850746269,
"repo_name": "lopopolo/hyperbola",
"id": "1daef015d05d38884c073ac83b7abd4abef08ab0",
"size": "6... |
import json
import pytest
from M2Crypto import BIO
from M2Crypto import SMIME
from M2Crypto import X509
from path import Path
from passbook.models import Barcode, BarcodeFormat, CurrencyField, Pass, StoreCard
cwd = Path(__file__).parent
wwdr_certificate = cwd / 'certificates' / 'wwdr_certificate.pem'
certificate = ... | {
"content_hash": "4608582b9549cd13dd39febf5686f576",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 127,
"avg_line_length": 36.10232558139535,
"alnum_prop": 0.6806235506312805,
"repo_name": "devartis/passbook",
"id": "386e3958926d1320e51459823e44a89a88e36642",
"size": "7... |
import sys
import types
import re
def ad_escape(s):
return re.sub(r"([^<]*)<([^>]*)>", r"\g<1>\\<\g<2>\\>", s)
if sys.version_info[0] >= 3:
# Python3 specific code
types.ClassType = type
Print = __builtins__.__dict__['print']
long = int
else:
# Python2 specific code
def Print(value, file=s... | {
"content_hash": "b053d81db5714423c9fd03c7c65daf0a",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 95,
"avg_line_length": 35.023668639053255,
"alnum_prop": 0.5357323872275722,
"repo_name": "mollstam/UnrealPy",
"id": "f16793003b937ac2f562f2091a1d6a410b0f7495",
"size": "5... |
"""
Tests for geography support in PostGIS
"""
from __future__ import unicode_literals
import os
from unittest import skipUnless
from django.contrib.gis.db.models.functions import Area, Distance
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.measure import D
from django.test import TestCase, ign... | {
"content_hash": "106a798042857ef7d0730dde6fc8b6a5",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 105,
"avg_line_length": 45.02836879432624,
"alnum_prop": 0.6490785950543393,
"repo_name": "dgladkov/django",
"id": "c314c93c5d3006af6b7e554c9d08ad1a22fdf92d",
"size": "634... |
import os, sys
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE']= 'broke.settings'
application = django.core.handlers.wsgi.WSGIHandler()
| {
"content_hash": "fe55bd216afd150d0e527e32d07813e5",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.7530120481927711,
"repo_name": "brokenseal/broke",
"id": "eb4433beb8f10e301f904e163e4f0b91137c514d",
"size": "166"... |
from plistlib import readPlist, writePlistToString
import StringIO
from boto.exception import S3ResponseError
from django.conf.urls import url, patterns
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from canvas import json
from can... | {
"content_hash": "8b8a794358cd01b86411611b98a357ed",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 96,
"avg_line_length": 32.79220779220779,
"alnum_prop": 0.72,
"repo_name": "drawquest/drawquest-web",
"id": "7cebd1d51535a571e2963a74c95b17469f1efa68",
"size": "2525",
"b... |
def minutes(dtime1, dtime2):
deltat = dtime2 - dtime1
return round(deltat.total_seconds() / 60)
| {
"content_hash": "9250b69797e670573107a6cd4377c5af",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 45,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.6635514018691588,
"repo_name": "CaseyNord/Treehouse",
"id": "25c65141bde1cc0430bd4f71f7757a34e1b074eb",
"size": "1... |
from django.shortcuts import render
def rendermarkdown_index(request):
return render(request, 'index.html', {})
| {
"content_hash": "2634c0e5fce7759fb729b056b77c2cb9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 23.6,
"alnum_prop": 0.7457627118644068,
"repo_name": "fullstackpython/blog-code-examples",
"id": "2b3ec33a027408fbd3be70a0b0dd985c136b3287",
"size": "... |
from django.db import models
from swapfield.fields import SwapIntegerField
class Team(models.Model):
name = models.CharField(max_length=30)
class Player(models.Model):
name = models.CharField(max_length=30)
team = models.ForeignKey(Team)
number = SwapIntegerField(unique_for_fields=['team'])
| {
"content_hash": "d815a5a33a0c14793dcdf179e7eb5ee9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 57,
"avg_line_length": 26,
"alnum_prop": 0.7435897435897436,
"repo_name": "SRJ9/django-swapfield",
"id": "28ce37a6e2b6942ee8fdb67eda4ebc1a987a0906",
"size": "312",
"binar... |
"""The tests for the MQTT subscription component."""
from unittest import mock
from homeassistant.components.mqtt.subscription import (
async_subscribe_topics,
async_unsubscribe_topics,
)
from homeassistant.core import callback
from tests.common import async_fire_mqtt_message
async def test_subscribe_topics... | {
"content_hash": "6de91b14a7aa8ee14e3631e0ee548a76",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 83,
"avg_line_length": 27.286486486486485,
"alnum_prop": 0.5931061806656102,
"repo_name": "robbiet480/home-assistant",
"id": "05f14107384214c324d77847ad5c2ae221cbf5ef",
"s... |
import socket
import sys
import chardet
#host = 'localhost'
host = '0.0.0.0'
port = 514
data_payload = 2048
backlog = 5
f = open("data.txt","w")
if __name__ == '__main__':
print("您好")
#creat tcp port
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#make reuse
sock.setsockopt(socket.SOL... | {
"content_hash": "6edccf3f98b65de7987402bbea842340",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 60,
"avg_line_length": 18.697674418604652,
"alnum_prop": 0.5771144278606966,
"repo_name": "lavizhao/syslistener",
"id": "8522449ad45ec0d0abfdac25df975121dd856eff",
"size": ... |
def specialRound(number, rounding):
"""A method used to round a number in the way that UsefulUtils rounds."""
temp = 0
if rounding == 0:
temp = number
else:
temp = round(number, rounding)
if temp % 1 == 0:
return int(temp)
else:
return float(temp)
def root(numbe... | {
"content_hash": "ce49fc6a252ec93a0cc92f45971d5773",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 29.901408450704224,
"alnum_prop": 0.6975977390485163,
"repo_name": "Th3Gam3rz/UsefulUtils",
"id": "f85ce18942127b7e02414f4d6c48ca6ee015a974",
"size":... |
from django.conf import settings
from django.db import models
from django.db.models import Q
from .debug import CollisionException
class MutexModelOptions(object):
def __init__(self, opts):
if opts:
for key, value in opts.__dict__.iteritems():
setattr(self, key, value)
class M... | {
"content_hash": "11fd1e5f2b9533402eed40bfd763ebfd",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 148,
"avg_line_length": 41.333333333333336,
"alnum_prop": 0.5845552297165201,
"repo_name": "pombredanne/django-mutexevent",
"id": "9b55c1a76da0f53a9032b059ec7dfff6a53fc00c",
... |
from __future__ import absolute_import
# EAI fields
EAI_ACL = 'eai:acl'
EAI_ATTRIBUTES = 'eai:attributes'
EAI_USER = 'eai:userName'
EAI_APP = 'eai:appName'
EAI_FIELD_PREFIX = 'eai:'
EAI_FIELDS = [EAI_ACL, EAI_ATTRIBUTES, EAI_USER, EAI_APP]
# elements of eai:attributes
EAI_ATTRIBUTES_OPTIONAL = 'optionalFields'
EAI_A... | {
"content_hash": "7dc639fdda295f29bab2e9ac7a7f298d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 57,
"avg_line_length": 27.46551724137931,
"alnum_prop": 0.549278091650973,
"repo_name": "pentestfail/TA-Github",
"id": "c3db2549657346a2acc29ec17fc95497adf0f4e6",
"size": "... |
import logging
import flask_login
from flask_login import current_user
from flask import flash
from wtforms import Form, PasswordField, StringField
from wtforms.validators import InputRequired
# pykerberos should be used as it verifies the KDC, the "kerberos" module does not do so
# and make it possible to spoof the K... | {
"content_hash": "4bb9aaff87b4afd527116dafa20617b7",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 90,
"avg_line_length": 29.625,
"alnum_prop": 0.6267063787540332,
"repo_name": "criccomini/airflow",
"id": "4a019eb131f56cccf92e4935c8b3fdd7ed87cbb7",
"size": "4841",
"bi... |
from healing import service
from healing import config
from healing.rpc import rpc
from healing.openstack.common import log as logging
from healing import service
from healing import context
from healing import config
from healing.rpc import rpc
from healing.actionexecutor import rpcapi
from healing.openstack.common... | {
"content_hash": "67fc46f519c8c3b95244e00f853d7d82",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 153,
"avg_line_length": 30.65909090909091,
"alnum_prop": 0.6627131208302446,
"repo_name": "lcostantino/healing-os",
"id": "43c77af3afae10225316dc3e41fee3ba110735a5",
"size"... |
from constants import *
# ------------------------------------------------------------------------------
#
class SinonException(Exception) :
"""
:param msg: Error message, indicating the cause for the exception
being raised.
:type msg: string
:param obj: Sinon object on whose activi... | {
"content_hash": "648a5cc29d1cf16b82e1f00e990e5b6d",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 80,
"avg_line_length": 28.88144329896907,
"alnum_prop": 0.4734963412457612,
"repo_name": "JensTimmerman/radical.pilot",
"id": "cf74f601d1d348b2b460d7b6ebd0e865709a2e6c",
"... |
import numpy as N
from traits.api import Float, Tuple
from traitsui.api import View, VGroup, Item
from enable.api import ColorTrait
from DisplayPlugin import DisplayPlugin
class Centroid(DisplayPlugin):
# These are the results of the calculation
_centroid = Tuple(Float(), Float())
# These control the vi... | {
"content_hash": "c612a0fe3fbca11d33413d49b2f1ff0c",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.5766843971631206,
"repo_name": "ptomato/Beams",
"id": "62596d80dae3cf76ffa4ac5583a4203ffefae442",
"size": "2256",... |
import argparse
import re
__version__ = '1.7.1'
VALIDS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-&'
def read_lines(in_file):
"""Returns a list of lines from a input markdown file."""
with open(in_file, 'r') as inf:
in_contents = inf.read().split('\n')
return in_content... | {
"content_hash": "cbf33ae8d7b540de79a7384f925a909b",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 116,
"avg_line_length": 34.58885941644562,
"alnum_prop": 0.5568251533742331,
"repo_name": "phodal/awesome-iot",
"id": "256d032ab72ea16ac47a204646f0010e5746099a",
"size": "... |
from __future__ import absolute_import
from builtins import zip
from pyglet.canvas.win32 import Win32Canvas
from .base import Config, CanvasConfig, Context
from pyglet import gl
from pyglet.gl import gl_info
from pyglet.gl import wgl
from pyglet.gl import wglext_arb
from pyglet.gl import wgl_info
from pyglet.libs.win... | {
"content_hash": "21855bf62fadaa927121a8fa68e054b2",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 97,
"avg_line_length": 38.821969696969695,
"alnum_prop": 0.6136208410576641,
"repo_name": "nicememory/pie",
"id": "8e31fce73e6f912edec75c341293ab480c809bb5",
"size": "1027... |
import argparse
from dvc.command.base import CmdBase, append_doc_link
from dvc.ui import ui
def _show_ascii(G):
from dvc.dagascii import draw
from dvc.repo.graph import get_pipelines
pipelines = get_pipelines(G)
ret = []
for pipeline in pipelines:
ret.append(draw(pipeline.nodes, pipelin... | {
"content_hash": "5b0fd559ae0330d040a3dcdde0600809",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 73,
"avg_line_length": 24.09933774834437,
"alnum_prop": 0.5927452596867271,
"repo_name": "efiop/dvc",
"id": "183e867aa50ec91e48d51134427543173a79534b",
"size": "3639",
"... |
"""
Benchmark load tests for stubs and collection
The stubs for resources in benchmark such as Regulations are retreived and it is followed by a collection get.
The batch size for the collection get (batch_size) and number of test iterations (num_iterations) are
configurable. The iterations of test allows to get ... | {
"content_hash": "a55114283e1bed867b7eec2728aa6dee",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 121,
"avg_line_length": 35.17391304347826,
"alnum_prop": 0.696168108776267,
"repo_name": "NejcZupec/ggrc-core",
"id": "31c15dbdb9fbda16272611275a2cccea1015c891",
"size": "... |
from pymatgen import *
import fnmatch
import re
import os
def pmg_converter():
rule = re.compile(fnmatch.translate('*.cif'), re.IGNORECASE) # case-insensitive glob
cif_files = [name for name in os.listdir('.') if rule.match(name)] # run in '.' : current directory
for i in cif_files:... | {
"content_hash": "1541d3b185f1d756b49bcf601b5b23a0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 111,
"avg_line_length": 28.066666666666666,
"alnum_prop": 0.6152019002375297,
"repo_name": "cwandtj/A2P2",
"id": "fb54e4ec3a584efd833140e89d754f9d4cd4f745",
"size": "421",
... |
from build.management.commands.base_build import Command as BaseBuild
from build.management.commands.build_homology_models_zip import Command as UploadModel
from django.db.models import Q
from django.conf import settings
from protein.models import Protein, ProteinConformation, ProteinAnomaly, ProteinState, ProteinSegm... | {
"content_hash": "1e9e6302a04709ccd7f435432de47e08",
"timestamp": "",
"source": "github",
"line_count": 4523,
"max_line_length": 228,
"avg_line_length": 58.795268627017464,
"alnum_prop": 0.46893367076422077,
"repo_name": "cmunk/protwis",
"id": "e529c9f83a68bbb0c1d91eb225d246de87a42f11",
"size": "26... |
import sys
import os
import nn
import numpy as np
import imageqa_test as it
import imageqa_ensemble as ie
import imageqa_render as ir
import prep
def parseInputFile(filename):
qids = []
questions = []
answers = []
caption = ''
i = 0
with open(filename) as f:
for line in f:
i... | {
"content_hash": "17a9ec38c463fa8b8c64ad2196a4dc7c",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 89,
"avg_line_length": 38.17054263565891,
"alnum_prop": 0.5351340373679935,
"repo_name": "renmengye/imageqa-public",
"id": "1d6708e50ab558a55965810fc6336b0c3b262fb9",
"siz... |
import logging
logger = logging.getLogger()
def test_p2p_ext_discovery(dev):
"""P2P device discovery with vendor specific extensions"""
addr0 = dev[0].p2p_dev_addr()
addr1 = dev[1].p2p_dev_addr()
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 1 dd050011223344"):
raise Exceptio... | {
"content_hash": "a5f6babbcb45783520f01decdb676347",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 91,
"avg_line_length": 48.44827586206897,
"alnum_prop": 0.6223013048635825,
"repo_name": "wangybgit/Chameleon",
"id": "8acdfbdff8ea00cb28afa15084b186e6d5355915",
"size": "4... |
__version__ = "0.1.0b"
import sysadmintoolkit
import subprocess
import types
import collections
global plugin_instance
plugin_instance = None
def get_plugin(logger, config):
'''
'''
global plugin_instance
if plugin_instance is None:
plugin_instance = ShellCommand(logger, config)
retur... | {
"content_hash": "7cc63ab675309f5e24f9526ef1b90a03",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 194,
"avg_line_length": 37.3046875,
"alnum_prop": 0.587434554973822,
"repo_name": "lpther/SysadminToolkit",
"id": "e3de26cf90a30c3f3d6cdee6da52b5ed35582bbf",
"size": "4775... |
from django.conf.urls import url
from . import views
app_name='main'
urlpatterns= [
url(r'^$', views.index, name='index'),
#url(r'about', views.about, name='about'),
url(r'search/', views.search, name='search'),
url(r'search/(\w*)', views.search, name='search_query'),
url(r'register/', views.regi... | {
"content_hash": "e20974551f6320385a549d5f5e4204b2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 101,
"avg_line_length": 38.93333333333333,
"alnum_prop": 0.6318493150684932,
"repo_name": "ritstudentgovernment/RateMyLandlord",
"id": "4c9efc99455188af33d5a916362dd1d66eb9b0... |
from sqlobject import *
from sqlobject.tests.dbtest import *
class EmptyClass(SQLObject):
pass
def test_empty():
if not supports('emptyTable'):
return
setupClass(EmptyClass)
e1 = EmptyClass()
e2 = EmptyClass()
assert e1 != e2
assert e1.id != e2.id
assert e1 in list(EmptyClass.... | {
"content_hash": "f83879f520477df363c6adf18bc7fd15",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 44,
"avg_line_length": 23.105263157894736,
"alnum_prop": 0.6537585421412301,
"repo_name": "Hellowlol/HTPC-Manager",
"id": "f7d94667c4639233fca084ec954f8fa48be412b8",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('glitter', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='TextTextBlock',
fields=[
('id', mo... | {
"content_hash": "5f35f96b94ddc90ace74da7b7088780e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 114,
"avg_line_length": 32.03846153846154,
"alnum_prop": 0.5510204081632653,
"repo_name": "blancltd/django-glitter",
"id": "d4db79f9a0668854166409584dbbeb53d829fc3e",
"size... |
import hashlib
import os
import socket
import sys
import base64
import time
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.syncstep import SyncStep
from synchronizers.base.ansible import run_template_ssh
from core.models import Service, Slice, ControllerSlice, ControllerUser
fro... | {
"content_hash": "f627a2da1ef65f3a61fd9093cc9bf477",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 108,
"avg_line_length": 37.632,
"alnum_prop": 0.5660076530612245,
"repo_name": "jermowery/xos",
"id": "fef8f865468c1d44a7fb2c41d709246120d7ffa1",
"size": "9408",
"binary... |
from typing import List
class Solution:
def arrayStringsAreEqualV1(self, word1: List[str], word2: List[str]) -> bool:
return "".join(word1) == "".join(word2)
def arrayStringsAreEqualV2(self, word1: List[str], word2: List[str]) -> bool:
def generator(word: List[str]):
for s in word... | {
"content_hash": "f25c7ad288bed85ad05628f923cd5be9",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 81,
"avg_line_length": 30.64516129032258,
"alnum_prop": 0.5547368421052632,
"repo_name": "l33tdaima/l33tdaima",
"id": "1766c4e0ac38ca10640cb85a1f4ad6fb92d37f14",
"size": "9... |
import unittest
import os
import random
import tensorflow.compat.v1 as tf
tf.enable_eager_execution()
import tensorflow_io
from tensorflow.compat.v1 import gfile
from google.protobuf import timestamp_pb2
from fedlearner.common import db_client
from fedlearner.common import common_pb2 as common_pb
from fedlearner.comm... | {
"content_hash": "0a16d56d3b9e290c24a7dcab9e4f5cbb",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 114,
"avg_line_length": 45.425,
"alnum_prop": 0.5538433314988076,
"repo_name": "bytedance/fedlearner",
"id": "54ed03684a52a616ede8d0a609b34ad577e95aa7",
"size": "11528",
... |
from __future__ import absolute_import
import errno
import logging
import os.path
import sys
from hadoop import conf
from hadoop import confparse
if sys.version_info[0] > 2:
open_file = open
else:
open_file = file
_SSL_SITE_PATH = None # Path to ssl-client.xml
_SSL_SITE_DICT = None ... | {
"content_hash": "843aac5320972bbd51428f4ef32f975e",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 108,
"avg_line_length": 23.672131147540984,
"alnum_prop": 0.6606648199445984,
"repo_name": "kawamon/hue",
"id": "19a434582415ba425cf4e5924059a16feb376586",
"size": "2236",
... |
"""Support for using humidifier with ecobee thermostats."""
from __future__ import annotations
from datetime import timedelta
from homeassistant.components.humidifier import (
HumidifierDeviceClass,
HumidifierEntity,
HumidifierEntityFeature,
)
from homeassistant.components.humidifier.const import (
DE... | {
"content_hash": "42f16abfac84955f8d2784cb95b17895",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 98,
"avg_line_length": 31.67924528301887,
"alnum_prop": 0.6454238634107604,
"repo_name": "toddeye/home-assistant",
"id": "230e456dc6061b8abff659a1216b8b6e8f1ab7b6",
"size"... |
import uuid
from django.test.utils import override_settings
from neutronclient.common import exceptions as neutron_exc
from openstack_dashboard import api
from openstack_dashboard import policy
from openstack_dashboard.test import helpers as test
class NeutronApiTests(test.APITestCase):
def test_network_list(s... | {
"content_hash": "4e273813605032ee2594b347b6696f89",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 79,
"avg_line_length": 40.888888888888886,
"alnum_prop": 0.6058601134215501,
"repo_name": "orbitfp7/horizon",
"id": "8de04dfb7b2ef54b084778f709414b941ec9cb87",
"size": "17... |
import os
import re
import sys
import argparse
parser = argparse.ArgumentParser(description='JS Fixups')
parser.add_argument('file', help="file to process")
args = parser.parse_args()
file = open(args.file)
text = file.read()
pat = 'HEAP32\[(?P<base>.*)+?P<offset>.*)>>?P<shift>.*)\]'
pat = 'HEAP32\[(\w*?)\+(\d*?)>>... | {
"content_hash": "73e1c40c3b038e302f213db7e73b244b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 58,
"avg_line_length": 20.178571428571427,
"alnum_prop": 0.6389380530973451,
"repo_name": "tonysan/Broadway",
"id": "e7c5ec49ad329d7485a1e30cf2e89a7e94daed95",
"size": "583... |
import re
import logging
from datetime import datetime, timedelta, date
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
from django.utils.text import Truncator
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django.core.cac... | {
"content_hash": "d92f6308affca72e4816eb9d939c7304",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 108,
"avg_line_length": 41.24528301886792,
"alnum_prop": 0.583028362305581,
"repo_name": "alonisser/Open-Knesset",
"id": "d3cba7f0482ccdbb742ce1bf1b453da2fb014b8f",
"size"... |
import codecs
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of r... | {
"content_hash": "2f71e01e91c8ef3ef55cee218ea51b98",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 86,
"avg_line_length": 35.06521739130435,
"alnum_prop": 0.5544533994626989,
"repo_name": "renzon/hotel-urbano",
"id": "c198770d483d2e6fc97363e82daa9db1fdb92017",
"size": "... |
import os
import re
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, Shell
from flask_debugtoolbar import DebugToolbarExtension
from flask_mail import Mail
from flask_apscheduler import APScheduler
from flask_bootstrap im... | {
"content_hash": "f1694b56e7f77a53aafc861bc71e7a8c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 86,
"avg_line_length": 29.634146341463413,
"alnum_prop": 0.7662551440329218,
"repo_name": "thuselem/teergrube",
"id": "e5a120d16bf8036bb3ab5b6cc697e586b687040a",
"size": "1... |
"""This module contains support classes from which schema-specific bindings
inherit, and that describe the content models of those schema."""
import logging
import pyxb
import xml.dom
import pyxb.utils.domutils as domutils
import pyxb.utils.utility as utility
import types
import pyxb.namespace
import collections
from ... | {
"content_hash": "a1490ed86496d975e4a6a57e2e26aebf",
"timestamp": "",
"source": "github",
"line_count": 2623,
"max_line_length": 203,
"avg_line_length": 43.76324818909645,
"alnum_prop": 0.6345706544938192,
"repo_name": "jonfoster/pyxb2",
"id": "5cee6838c41720a6ba43784664b409040c59c745",
"size": "11... |
"""
(c) 2012-2022 Martin Wendt; see https://github.com/mar10/pyftpsync
Licensed under the MIT license: https://www.opensource.org/licenses/mit-license.php
"""
import json
import time
from ftpsync import __version__
from ftpsync.util import (
get_option,
make_native_dict_keys,
pretty_stamp,
str_to_bool... | {
"content_hash": "106d980d5301721016cfcf3d5a08f672",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 92,
"avg_line_length": 40.81777777777778,
"alnum_prop": 0.5619555749128919,
"repo_name": "mar10/pyftpsync",
"id": "5eb130a46ea35734cd8ec09e5cd758c589abec07",
"size": "9208... |
import os
import sys
import shlex
from pkg_resources import safe_name
import pip
from pip.req.req_file import (parse_requirements, build_parser,
break_args_options)
from hashin import run_single_package
def rdeps(pkg_name):
return sorted([safe_name(pkg.project_name)
... | {
"content_hash": "5968151bfb39cb3e2eaff852b6ab90b0",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 77,
"avg_line_length": 34.19767441860465,
"alnum_prop": 0.6116967018021081,
"repo_name": "kumar303/addons-server",
"id": "3879d1363ad2398ad20fcd717fbbae1180c75012",
"size":... |
import unittest
from datetime import datetime
import six
from airflow import configuration, models
from airflow.models import TaskInstance, DAG
from airflow.contrib.operators.bigquery_operator import \
BigQueryCreateExternalTableOperator, BigQueryCreateEmptyTableOperator, \
BigQueryDeleteDatasetOperator, Big... | {
"content_hash": "4043fa4c4297466aa6057bc9f6727562",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 80,
"avg_line_length": 34.458333333333336,
"alnum_prop": 0.5577992744860943,
"repo_name": "jgao54/airflow",
"id": "84f1750bedf97710cf19839a64c0288ef8395020",
"size": "9082... |
import urllib
import settings as USettings
class UEditorEventHandler(object):
"""用来处理UEditor的事件侦听"""
def on_selectionchange(self):
return ""
def on_contentchange(self):
return ""
def render(self,editorID):
jscode="""
%(editor)s.addListener('%(event)s', f... | {
"content_hash": "6081a2e86af2b5966a59e1e24a281973",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 110,
"avg_line_length": 30.828729281767956,
"alnum_prop": 0.4754480286738351,
"repo_name": "younfor/django-fly-blog",
"id": "e1e8aa6abd2bf7ada9c1801520ba276dd86b3132",
"si... |
import decimal
from threading import local
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.utils import datetime_safe
from django.utils.importlib import import_module
class BaseDatabaseWrapper(local):
"""
Represents a database connection.
"""
ops = None
def ... | {
"content_hash": "d43fbadf0cf6554c5ffc9cdfdb70045a",
"timestamp": "",
"source": "github",
"line_count": 591,
"max_line_length": 102,
"avg_line_length": 35.8155668358714,
"alnum_prop": 0.6239901733830964,
"repo_name": "aprefontaine/TMScheduler",
"id": "f7ac44c1f2822d22434efebe387f411f04da0142",
"siz... |
from django.db import models
from django.utils import timezone
from zerver.models import Realm, UserProfile, Stream, Recipient
from zerver.lib.str_utils import ModelReprMixin
from zerver.lib.timestamp import datetime_to_UTC, floor_to_day
import datetime
from typing import Optional, Tuple, Union, Dict, Any, Text
cla... | {
"content_hash": "68c2a4635db9028c3debaff428827f71",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 102,
"avg_line_length": 30.82236842105263,
"alnum_prop": 0.6268943436499467,
"repo_name": "TigorC/zulip",
"id": "ce594a255cfc4037ae0d9a5cf35d3ecafd2cfd89",
"size": "4685",... |
import math
import os
import logging
from micropsi_core.world.world import World
from micropsi_core.world.worldadapter import WorldAdapter
from micropsi_core.world.worldobject import WorldObject
from micropsi_core.world.island import png
class Island(World):
""" mandatory: list of world adapters that are support... | {
"content_hash": "f105e1ee762210924ccfa5d5c565aef8",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 133,
"avg_line_length": 36.08379888268156,
"alnum_prop": 0.5861588481189038,
"repo_name": "ianupright/micropsi2",
"id": "a6894d9743816907e4c6cca5490ab42093c5afad",
"size":... |
from django import template
from django.contrib.humanize.templatetags.humanize import intcomma
from django.conf import settings
from django.db.models import Count, Case, When, Value, IntegerField
from midnight_catalog.models import Section
from midnight_main.services import mark_current_menus
register = template.Libr... | {
"content_hash": "5d4119d5f9144bd3625717fc9363de0a",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 142,
"avg_line_length": 32.40425531914894,
"alnum_prop": 0.6910702560735391,
"repo_name": "webadmin87/midnight",
"id": "a445386c9803a687bcedb695f3934a2babcc2cfa",
"size": "... |
"""
WSGI config for newproj project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | {
"content_hash": "6d4276e249250a19a570d2296da60c1a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 39.42857142857143,
"alnum_prop": 0.7971014492753623,
"repo_name": "Natgeoed/django-broadcasts",
"id": "148dc0924c7f208d57b265d783d024b2b61eebd3",
"si... |
__author__ = 'Neil Butcher'
import unittest
from Rota_System import Appointments
from Rota_System import Roles
class AppointmentTest(unittest.TestCase):
def setUp(self):
Roles.GlobalRoleList.add_role(Roles.Role('Baker', 'B', 10))
Roles.GlobalRoleList.add_role(Roles.Role('Steward', 'S', 9))
... | {
"content_hash": "c7cb71c07076fbdb0ca51d00c60ffed4",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 72,
"avg_line_length": 35.91509433962264,
"alnum_prop": 0.6519569214604676,
"repo_name": "ergoregion/Rota-Program",
"id": "4c6334a3a1d7427c6e22fa58e3f241314b9d0ef7",
"size... |
from .CakeModel import CakeModel
class SiteOffer(CakeModel):
def __init__(self, **kwargs):
self.param_defaults = {
'offer_id': None,
'offer_name': None,
'third_party_name': None,
'advertiser': None,
'vertical': None,
'offer_type': None,
'offer_status': None,
'hidden': None,
'offer_image... | {
"content_hash": "2c1176769efc381687f8018cbfcd3ac6",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 54,
"avg_line_length": 28.38095238095238,
"alnum_prop": 0.651565995525727,
"repo_name": "heytimj/pycake",
"id": "8a5e2e7bfe3e1e935dc10a0418f0ac94ee334824",
"size": "1788",
... |
"""
Unit tests for computing the baroclinic head
Runs MES convergence tests against a non-trivial analytical solution in a
deformed geometry.
Here P1DGxP1DG yields convergence rate ~2.0, while P2DGxP2 yields ~2.2.
In the latter case the magnitude of the error is 10x smaller.
"""
from thetis import *
from scipy import... | {
"content_hash": "c515bff6d3824746886c1ff9bca9ab2b",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 117,
"avg_line_length": 37.506024096385545,
"alnum_prop": 0.6050433665274655,
"repo_name": "tkarna/cofs",
"id": "d898e66c8a2e65c774fbc4b6b65764aacfdae849",
"size": "6226",... |
from vyked import Host, TCPService, TCPServiceClient, api, publish, request, subscribe
import asyncio
REGISTRY_HOST = '127.0.0.1'
REGISTRY_PORT = 4500
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
ACCOUNTS_HOST = '127.0.0.1'
ACCOUNTS_PORT = 4503
class AccountService(TCPService):
def __init__(self, host, port):
... | {
"content_hash": "55254321fb3fd170ea6fe16a2a5d2488",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 86,
"avg_line_length": 24.638297872340427,
"alnum_prop": 0.6511226252158895,
"repo_name": "kashifrazzaqui/vyked",
"id": "fe12a14fb05945a55927e67e7497eea8267295d4",
"size": ... |
'''
Created on Jul 19, 2010
@author: jnaous
'''
from django.core.urlresolvers import reverse
from django.test import Client
from common.tests.client import test_get_and_post_form
from django.contrib.auth.models import User
from pyquery import PyQuery as pq
try:
from setup_expedient_params import \
... | {
"content_hash": "428846da5fa6fc8ee80c6bef6ceeea83",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 78,
"avg_line_length": 29.105263157894736,
"alnum_prop": 0.566003616636528,
"repo_name": "dana-i2cat/felix",
"id": "124b2fc3d82dd615e2440e7e3799216c27309ab6",
"size": "2765... |
import clr, sys
clr.AddReference('ZyGames.Framework')
clr.AddReference('ZyGames.Framework.Game')
clr.AddReference('ZyGames.Doudizhu.Model')
from ZyGames.Doudizhu.Model import *
from ZyGames.Framework.Cache.Generic import *
from ZyGames.Framework.Game.Cache import *
class RoomLogic():
"""斗地主房间逻辑"""
d... | {
"content_hash": "fadc1a417e5aa5d2c999f66dcc509961",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 45,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.7219101123595506,
"repo_name": "wenhulove333/ScutServer",
"id": "44262410145b0a8564aa500b391ed1f8ce905689",
"size... |
import contextlib
import errno
import os
from kwapi.openstack.common import excutils
from kwapi.openstack.common.gettextutils import _ # noqa
from kwapi.openstack.common import log as logging
LOG = logging.getLogger(__name__)
_FILE_CACHE = {}
def ensure_tree(path):
"""Create a directory (and any ancestor dire... | {
"content_hash": "5f5cc9b7244b4e2451fcce91d2d5169c",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 68,
"avg_line_length": 24.934782608695652,
"alnum_prop": 0.6290322580645161,
"repo_name": "mosieurlaurin/kwapi",
"id": "22834904b1f5fdbcabe806574f916029420e242f",
"size": "... |
from __future__ import print_function, division
from sympy.core.basic import Basic
from sympy.core.singleton import S, Singleton
from sympy.core.symbol import Dummy, Symbol
from sympy.core.compatibility import (range, integer_types, with_metaclass,
is_sequence, iterable, ordered)
... | {
"content_hash": "8482ed8545429503f55fb029e727d4cd",
"timestamp": "",
"source": "github",
"line_count": 933,
"max_line_length": 80,
"avg_line_length": 28.138263665594856,
"alnum_prop": 0.5318249342932236,
"repo_name": "abloomston/sympy",
"id": "df295e09b8394c5d0217d20e41ed36c6232964d8",
"size": "26... |
from __future__ import unicode_literals
from django.db import models
from django import forms
# Create your models here.
class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField()
class Meta:
ordering = ('-timestamp')
class Blo... | {
"content_hash": "39532f2d86e091a823d8b851e88ea116",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 44,
"avg_line_length": 23.5,
"alnum_prop": 0.6950354609929078,
"repo_name": "MarsBighead/mustang",
"id": "208f03010928ce321abd8586e7767895fd34250b",
"size": "423",
"binar... |
class RtlNetlistPass():
def apply(self, hls: "HlsStreamProc", to_hw: "SsaSegmentToHwPipeline"):
pass
| {
"content_hash": "556929809e86ea262740aee731b9b750",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 75,
"avg_line_length": 28.5,
"alnum_prop": 0.6754385964912281,
"repo_name": "Nic30/hwtHls",
"id": "ac872a0cf4e6d98eeccb094eb4b7e8d3ad55f946",
"size": "116",
"binary": fals... |
import sys
import abc
from collections import Counter
import pydoop.mapreduce.api as api
import pydoop.mapreduce.pipes as pp
from pydoop.avrolib import AvroContext
class ColorPickBase(api.Mapper):
@abc.abstractmethod
def get_user(self, ctx):
"""
Get the user record. This is just to avoid wr... | {
"content_hash": "46cf52106b828e1ad9fc2d46e6b09d16",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 75,
"avg_line_length": 24.602150537634408,
"alnum_prop": 0.6433566433566433,
"repo_name": "elzaggo/pydoop",
"id": "25d5d782ce03a37b61d7157b830244cca31b2466",
"size": "2920"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.