text stringlengths 4 1.02M | meta dict |
|---|---|
"""
test_scrape_rsc
~~~~~~~~~~~~~~~
Test scraping documents from the Royal Society of Chemistry.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import unittest
from chemdataextractor.scrape.pub.r... | {
"content_hash": "b9fa3da6291060fd3dc840677f6fe7ca",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 363,
"avg_line_length": 53.083333333333336,
"alnum_prop": 0.7515698587127159,
"repo_name": "mcs07/ChemDataExtractor",
"id": "796de310a75f526e41667aebaaf1d0ce91eff727",
"siz... |
from .apiresource import ListableAPIResource
from .apiresource import DeletableAPIResource
from .apiresource import UpdateableAPIResource
from .apiresource import CreateableAPIResource
from .solveobject import convert_to_solve_object
class Group(CreateableAPIResource, ListableAPIResource,
UpdateableAPIRes... | {
"content_hash": "e0ce26d99c8728d60fd374862e220d92",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 38.43333333333333,
"alnum_prop": 0.6001734605377277,
"repo_name": "solvebio/solvebio-python",
"id": "6c065a58d7a261a73cd43367b1d31c468cb79deb",
"size... |
from __future__ import print_function
import os
import os.path as op
import numpy as np
import warnings
from shutil import copyfile
from scipy import sparse
from nose.tools import assert_true, assert_raises
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_allcl... | {
"content_hash": "716e17efe77d8cd6e1ee5ae0c3030c54",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 79,
"avg_line_length": 38.21857923497268,
"alnum_prop": 0.6103803259937088,
"repo_name": "effigies/mne-python",
"id": "53eba072870e29727b5db084dfbfa0119148fe8c",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('website', '0017_auto_20160908_1115'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "4f5bdd1d6c725584139ba68550f74505",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 160,
"avg_line_length": 45.813559322033896,
"alnum_prop": 0.5804661487236404,
"repo_name": "HackSoftware/hackconf.bg",
"id": "49b8227d1e5153cf07988dc495410a74f7d53497",
"si... |
import RPi.GPIO as GPIO
import time
# INITIALIZE THE GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(11,GPIO.OUT)
# TURN ON RELAY 1
GPIO.output(11,0)
# CLEAN UP GPIO
# GPIO.cleanup()
| {
"content_hash": "79af93a59ef342a0cea518b8dd238e7f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 23,
"avg_line_length": 13.533333333333333,
"alnum_prop": 0.7339901477832512,
"repo_name": "CamoFPV/Relay-Website-with-Raspberry-Pi",
"id": "952b056ef6856678b522e3d4982ff0e19a... |
#!/usr/bin/env python
"""
"""
import time
import iotUtils
#import RPi.GPIO as GPIO
import paho.mqtt.client as mqtt
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("MQTT_LISTENER: Connected with result code " + str(rc))
... | {
"content_hash": "6e5311c0c21b958b02d31808327fdc26",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 114,
"avg_line_length": 31.989247311827956,
"alnum_prop": 0.5801680672268907,
"repo_name": "wso2-incubator/device-cloud-agents",
"id": "e36d0eee79548091c7cc7d4882949b4e5e3857... |
from fusesoc.capi2.generator import Generator
class MacroGenerator(Generator):
def run(self):
assert self.config["filename"]
self.add_files([self.config["filename"]], file_type="systemVerilogSource")
if __name__ == "__main__":
g = MacroGenerator()
g.run()
g.write()
| {
"content_hash": "57f4f9461218683c07626c6c885a6733",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 23.23076923076923,
"alnum_prop": 0.6423841059602649,
"repo_name": "lowRISC/fusesoc",
"id": "82d660e8421fb097863ae708e40a9e56482eb2e7",
"size": "444",... |
import datetime
import logging
import re
import time
import flask
from docker_registry.core import compat
from docker_registry.core import exceptions
json = compat.json
from . import storage
from . import toolkit
from .app import app
from .lib import mirroring
from .lib import signals
store = storage.load()
logger... | {
"content_hash": "6aadd10bfd584bf251ca1b5971b7af35",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 135,
"avg_line_length": 38.12686567164179,
"alnum_prop": 0.6585437463300059,
"repo_name": "liggitt/docker-registry",
"id": "fe65caa8c7598ff12642fdbdc09b986fbfdf34a0",
"siz... |
db_database = "WebLabTests" | {
"content_hash": "aa1e8419be22f162ed1fc196db5ff54d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 27,
"alnum_prop": 0.7777777777777778,
"repo_name": "ganeshgore/myremolab",
"id": "d9b58d46e0c176a645ed5a2da426d815bd910c3d",
"size": "27",
"binary":... |
from __future__ import absolute_import
from .align import Aligner
from .english import Tokenizer
__all__ = ['Aligner', 'Tokenizer']
| {
"content_hash": "05a2d882d460cf9ce39f7db096701aaf",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.7238805970149254,
"repo_name": "nryant/twokenize_py",
"id": "d4c8d38dd48d51ca2cdd25e9e3e781040d315a79",
"size": "1... |
import json
import logging
import requests
import sys
import time
from uuid import uuid4
from pyethereum import abi
from serpent import get_prefix, decode_datalist
from utils import unhex
logger = logging.getLogger(__name__)
def abi_data(fun_name, sig, data):
types = []
prefix = get_prefix(fun_name, sig)
... | {
"content_hash": "12ec9f53375644435162cd4a990c81fb",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 110,
"avg_line_length": 28.174657534246574,
"alnum_prop": 0.5295976662209797,
"repo_name": "ethers/pyepm",
"id": "f43ca7c226d1dbcd59ded71d41cd422d47cdc582",
"size": "8401"... |
"""
Support for Tellstick Net/Telstick Live.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.tellduslive/
"""
import logging
from homeassistant.components.tellduslive import TelldusLiveEntity
from homeassistant.const import TEMP_CELSIUS
_LOGGER ... | {
"content_hash": "788cec2f9d0a66079d95e781811d5959",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 77,
"avg_line_length": 29.678260869565218,
"alnum_prop": 0.6185174333430999,
"repo_name": "Duoxilian/home-assistant",
"id": "9bebbe6e3dc8b1f38eae3b71cae9ba58e11b6d11",
"si... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from google.protobuf import text_format as _text_format
from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
# Needed to trigger the call to _set_call_cpp_shape_fn.
from tensorfl... | {
"content_hash": "5d635981591196c33057ef860f0a450c",
"timestamp": "",
"source": "github",
"line_count": 1285,
"max_line_length": 244,
"avg_line_length": 36.55097276264591,
"alnum_prop": 0.6379875660023846,
"repo_name": "ryfeus/lambda-packs",
"id": "e647ea93b38cb04820a3c4bcbbe8da802a845178",
"size":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('wagtailredirects', '0004_set_unique_on_path_and_site'),
]
operations = [
migrations.AlterModelOptions(
name='redirect',
opti... | {
"content_hash": "adc14f68216081cc4b58fa77df22f8bb",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 220,
"avg_line_length": 37.142857142857146,
"alnum_prop": 0.6,
"repo_name": "inonit/wagtail",
"id": "8f457cc9d8b0070a333a207dd7cd6e0b86ede7ea",
"size": "1584",
"binary": ... |
"""SCons.Debug
Code for debugging SCons internal things. Not everything here is
guaranteed to work all the way back to Python 1.5.2, and shouldn't be
needed by most users.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge... | {
"content_hash": "ba9e1ead60292a4ff20d7c881bcf254d",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 89,
"avg_line_length": 30.52314814814815,
"alnum_prop": 0.6071591081450023,
"repo_name": "rwatson/chromium-capsicum",
"id": "2ffdbadc8a62681a1dc5e716afcfd0f72f76f166",
"si... |
"""
The main QuerySet implementation. This provides the public API for the ORM.
"""
from collections import deque, OrderedDict
import copy
import sys
import warnings
from django.conf import settings
from django.core import exceptions
from django.db import (connections, router, transaction, IntegrityError,
DJANGO_... | {
"content_hash": "51bf2ab3d35ee114dad3bc7ca55bb992",
"timestamp": "",
"source": "github",
"line_count": 1959,
"max_line_length": 109,
"avg_line_length": 40.28637059724349,
"alnum_prop": 0.5876762838788155,
"repo_name": "PolicyStat/django",
"id": "a7474bbc45b935e67a405aab37dde76118d11937",
"size": "... |
import re
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
NEW_LINES = re.compile(r"\r|\n")
class CreateKeypair(forms.SelfHandlingForm):
name = f... | {
"content_hash": "b5d27969e178ac9b3ea5d74714fe9f79",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 37.04347826086956,
"alnum_prop": 0.5586854460093896,
"repo_name": "99cloud/keystone_register",
"id": "dfab3f6c09f6bf2661b45c2f282c49ce296a9161",
"siz... |
import os
import re
import sys
import tempfile
import textwrap
import fixtures
import mock
import pkg_resources
import six
import testscenarios
from testtools import matchers
from pbr import git
from pbr import packaging
from pbr.tests import base
class TestRepo(fixtures.Fixture):
"""A git repo for testing with... | {
"content_hash": "91cc522efbbf4979819d2af280efb119",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 79,
"avg_line_length": 37.56041666666667,
"alnum_prop": 0.5861112651838705,
"repo_name": "dhruvsrivastava/OJ",
"id": "9e56fd8c4de6e0422f517b76ffd5f039bf43286f",
"size": "1... |
import os
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def make_conv_bn_relu(in_channels, out_channels, kernel_size=3, stride=1, padding=1, groups=1):
return [
nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, stride=stride,... | {
"content_hash": "fc4e39e44d57a1860692c034f1c98464",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 129,
"avg_line_length": 29.655172413793103,
"alnum_prop": 0.5694352159468439,
"repo_name": "chicm/carvana",
"id": "d166d4e01d0a5fb667e77956a5e98dd0f515a813",
"size": "6020... |
from math import fabs, sqrt
import numpy as np
from . import optExceptions
def norm(V):
return np.linalg.norm(V)
### Linear algebra routines.
def absMax(V):
return max(abs(elem) for elem in V)
def absMin(V):
return min(abs(elem) for elem in V)
def rms(V):
return np.sqrt(np.mean(V**2))
def si... | {
"content_hash": "207d623f752ce3fe18a285a8584f363e",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 85,
"avg_line_length": 24.578512396694215,
"alnum_prop": 0.6116341627437795,
"repo_name": "dsirianni/psi4numpy",
"id": "6ef21303c1d3d9e336c630da2b12ffe43895a30b",
"size": ... |
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, cdist, squareform
from skbio.diversity import alpha_diversity
from skbio.diversity import beta_diversity
from omicexperiment.transforms.transform import Transform
from omicexperiment.transforms.general import RarefactionFunction
class A... | {
"content_hash": "902dd7f3f1735a101cb4fdbe7c277229",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 152,
"avg_line_length": 44.94444444444444,
"alnum_prop": 0.6143386897404203,
"repo_name": "bassio/omicexperiment",
"id": "61b4da34d068ba9339e3960319130f38ca9e36d8",
"size"... |
"""This example deletes custom targeting values for a given custom targeting
key. To determine which custom targeting keys and values exist, run
get_all_custom_targeting_keys_and_values.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script,... | {
"content_hash": "065e3f62088f72bac278b54b78cbe21f",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 33.63793103448276,
"alnum_prop": 0.6796514607893388,
"repo_name": "lociii/googleads-python-lib",
"id": "4c45728c3261f233b67ab6cee3ce31610867a2d6",
"s... |
import pytest
from events.models import Keyword
from .utils import get
from .utils import versioned_reverse as reverse
def get_list(api_client, version='v1', data=None):
list_url = reverse('keyword-list', version=version)
return get(api_client, list_url, data=data)
def get_detail(api_client, detail_pk, ve... | {
"content_hash": "b611bdb3804ea10df4d9485b4f2e1f3e",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 108,
"avg_line_length": 37.42424242424242,
"alnum_prop": 0.6767206477732793,
"repo_name": "City-of-Helsinki/linkedevents",
"id": "75a4a6bb3efe88a7551ff2113a8a861f38798c4c",
... |
from django.db.models.signals import ModelSignal
# Behaves like Djangos normal pre-/post_save signals signals with the
# added arguments ``target`` and ``position`` that matches those of
# ``move_to``.
# If the signal is called from ``save`` it'll not be pass position.
node_moved = ModelSignal(providing_args=[
'i... | {
"content_hash": "eb691a469ba8c5769c801f2c573ef3ae",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.7071823204419889,
"repo_name": "matthiask/django-mptt",
"id": "c2a9144dbe2c661f3a009ab347954d84cb3ab747",
"size":... |
from PIL import Image, ImageOps
sprite_data = []
for i in range(1, 5):
frame = Image.open('images/leap%d.png' % i)
frame = frame.convert('RGB')
frame = ImageOps.invert(frame)
frame = frame.convert('1')
sprite_data.append(frame.tostring())
f = open('build/leap.bin', 'w')
f.write(''.join(sprite_data))
f.close
| {
"content_hash": "957978e0e872f8e2aee7e74bc26197f8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 44,
"avg_line_length": 22.642857142857142,
"alnum_prop": 0.6719242902208202,
"repo_name": "gasman/kisskill",
"id": "43164c8bc60db90c8dba5e809eb6419590ab3784",
"size": "317"... |
import re
import Gaffer
import GafferUI
from Qt import QtCore
from Qt import QtGui
class NameWidget( GafferUI.TextWidget ) :
def __init__( self, graphComponent, **kw ) :
GafferUI.TextWidget.__init__( self, **kw )
self._qtWidget().setValidator( _Validator( self._qtWidget() ) )
self.__graphComponent = None
... | {
"content_hash": "affe8c50812f3617cd4c1f12caf3f308",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 122,
"avg_line_length": 27.2972972972973,
"alnum_prop": 0.6945544554455445,
"repo_name": "ivanimanishi/gaffer",
"id": "509ef851bca6e588e5c01d8c51ecd373e0507387",
"size": "3... |
import sys
sys.path.append("..") # Adds higher directory to python modules path.
import unittest, math
from Laminate import Laminate
class LaminateTestCase(unittest.TestCase):
"""
test cases for Laminate class
"""
laminate = None
def setUp(self):
kerf = 5.0/64 # usu. 1/8" for mos... | {
"content_hash": "edee83151c9947b3ded419e422eda122",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 99,
"avg_line_length": 34.72509960159363,
"alnum_prop": 0.6195502524093621,
"repo_name": "dsnutter/Symmetric",
"id": "9038fbf876d3d51ef7382e2009490662d16ac1f8",
"size": "8... |
from __future__ import unicode_literals
from django.conf.urls import url
from mezzanine.accounts import views
from mezzanine.conf import settings
ACCOUNT_URL = getattr(settings, "ACCOUNT_URL", "/accounts/")
SIGNUP_URL = getattr(settings, "SIGNUP_URL",
"/%s/signup/" % ACCOUNT_URL.strip("/"))
SIG... | {
"content_hash": "1b7287ed0339f89d168cd8ad1a24299c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 77,
"avg_line_length": 44.51851851851852,
"alnum_prop": 0.5744592346089851,
"repo_name": "sjdines/mezzanine",
"id": "b08e26598811ccf0b4d2a0b0e6d56e17bd8e9f8b",
"size": "240... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('maps', '0001_initial'),
('auth', '0008_alter_user_username_max_length')... | {
"content_hash": "05942e79aa50c353b5be0dd4dc4c2c8f",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 143,
"avg_line_length": 45.04109589041096,
"alnum_prop": 0.565389294403893,
"repo_name": "pcecconi/mapground",
"id": "d0e5d295569f160836060dd023b1313d68d93b61",
"size": "33... |
"""Define tests for the Elexa Guardian config flow."""
from aioguardian.errors import GuardianError
from homeassistant import data_entry_flow
from homeassistant.components.guardian import CONF_UID, DOMAIN
from homeassistant.components.guardian.config_flow import (
async_get_pin_from_discovery_hostname,
async_g... | {
"content_hash": "55a5ede76e070b93db652e2ff50415e6",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 85,
"avg_line_length": 34.90780141843972,
"alnum_prop": 0.6505485574969525,
"repo_name": "soldag/home-assistant",
"id": "db0cf877d37b55d17d2832a0629495e164c119eb",
"size":... |
from holmes.validators.base import Validator
from holmes.utils import _
class RequiredMetaTagsValidator(Validator):
@classmethod
def get_violation_definitions(cls):
return {
'absent.meta.tags': {
'title': _('Required Meta Tags were not found'),
'description... | {
"content_hash": "65757b8306395430d1393df5d9d7aabe",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 31.52,
"alnum_prop": 0.524746192893401,
"repo_name": "holmes-app/holmes-api",
"id": "35bf6afe0f42112ebcc12b0e804184bd31b98171",
"size": "1619",
"bi... |
from __future__ import absolute_import
from rest_framework import permissions
from rest_framework.serializers import ModelSerializer, ValidationError
from rest_framework.viewsets import ModelViewSet
from rest_framework.fields import IntegerField
from push_notifications.models import APNSDevice, GCMDevice
from push_no... | {
"content_hash": "222529a426030667bd171db869b60979",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 90,
"avg_line_length": 28.891156462585034,
"alnum_prop": 0.7466446903696727,
"repo_name": "fsto/django-push-notifications",
"id": "e5a8c5de887306f07f4b6fe0d4ea30e9c09e56dd",... |
import numpy as np
import sys
import MDAnalysis
psf = sys.argv[1]
traj = sys.argv[2]
# SUBROUTINES:
# MAIN PROGRAM:
buf = 100
deltaWrite = 10.0
delta_t = 0.002
box_dim = 28.40 # xyz file does not hold this info (even though it does); for NPT, the dcd file will contain this info; must comment out this line
... | {
"content_hash": "1d521e607daba0b0ed5cb55e671bb68b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 154,
"avg_line_length": 22.56338028169014,
"alnum_prop": 0.6803995006242197,
"repo_name": "rbdavid/MolecDynamics",
"id": "3df40028fbdacf578b4ce23de452b4fa166176d3",
"size":... |
import itertools
import threading
import queue
import collections
import time
__all__ = ['TSCounter', 'TSCounterBasedEvent', 'TSCounterMonitor']
class TSCounter(object):
def __init__(self):
self._cnt = itertools.count()
self._ref = itertools.count()
self._iter_cnt = iter(self._cnt)
... | {
"content_hash": "31aa78d63da14671ae5875c6c2f9d36c",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 113,
"avg_line_length": 29.316176470588236,
"alnum_prop": 0.5673438675696012,
"repo_name": "vacancy/TensorArtist",
"id": "a6d02035fe39ee6c28c06b0a6a1542131cda6840",
"size"... |
"""Generates GEN_JNI.java (or N.java) and helper for manual JNI registration.
Creates a header file with two static functions: RegisterMainDexNatives() and
RegisterNonMainDexNatives(). Together, these will use manual JNI registration
to register all native methods that exist within an application."""
import argparse
... | {
"content_hash": "96bfdf62f8dfcb2acf04c8fea03888fa",
"timestamp": "",
"source": "github",
"line_count": 962,
"max_line_length": 80,
"avg_line_length": 34.45218295218295,
"alnum_prop": 0.6563075159158797,
"repo_name": "nwjs/chromium.src",
"id": "cacd9745d63fb4260dc7aa8dc2c431e5fc9eb76b",
"size": "33... |
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from __future__ import unicode_literals
from ..collection_base import CollectionPageBase
fro... | {
"content_hash": "3cd2844dd363b038e5de712e34278725",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 151,
"avg_line_length": 31.323529411764707,
"alnum_prop": 0.6347417840375587,
"repo_name": "OneDrive/onedrive-sdk-python",
"id": "3f201277ab3d34228f89d7890700625677456500",
... |
__author__ = "chenghao"
from bottle import request
import util
def get_user_id():
"""
获取user_id
:return:
"""
cookie_id = request.get_cookie(util.BLOG_COOKIE)
dogpile_session = util.GetDogpile()[1]
result = dogpile_session.get(cookie_id)
if result:
user_id = result.get("rid")
else:
user_id = None
return... | {
"content_hash": "4312a829921ac4e1f08f84a1a7030074",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 49,
"avg_line_length": 17.31578947368421,
"alnum_prop": 0.6778115501519757,
"repo_name": "chenghao/blog",
"id": "0a653e73678597351d542ea152737eb29a6be3a9",
"size": "348",
... |
import unittest
from unittest import mock
from airflow.providers.google.cloud.transfers.bigquery_to_mssql import BigQueryToMsSqlOperator
TASK_ID = 'test-bq-create-table-operator'
TEST_PROJECT_ID = 'test-project'
TEST_DATASET = 'test-dataset'
TEST_TABLE_ID = 'test-table-id'
TEST_DAG_ID = 'test-bigquery-operators'
cl... | {
"content_hash": "df9603aff51c812509034c8042aaa53e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 94,
"avg_line_length": 35.205882352941174,
"alnum_prop": 0.6432748538011696,
"repo_name": "apache/incubator-airflow",
"id": "01a54bbb678859cae6a2ecfb7724b53b2a567c7b",
"siz... |
"""
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant extra space.
For example,
Given the following binary tree,
1
/ \
2 3
/ \ \
4 5 ... | {
"content_hash": "90921c1fa08ea835ddfad0eb4e53bc2e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 89,
"avg_line_length": 26.43548387096774,
"alnum_prop": 0.561928004881025,
"repo_name": "yuzhangcmu/Python-Study",
"id": "bfbf2d9084bc16fac4b0988ca0b9f62983fc9edd",
"size":... |
"""Copyright 2008 Python Software Foundation, Ian Bicking, and Google."""
import mimetools
import StringIO
import sys
CONTINUE = 100
SWITCHING_PROTOCOLS = 101
PROCESSING = 102
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE_INFORMATION = 203
NO_CONTENT = 204
RESET_CONTENT = 205
PARTIAL_CONTENT = 206
MULTI_S... | {
"content_hash": "800594e05ddad6a76e73e61c44202d4e",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 87,
"avg_line_length": 22.497512437810947,
"alnum_prop": 0.6637549756744803,
"repo_name": "tungvx/deploy",
"id": "8e64160b38753846368456848660f3515f589df5",
"size": "9649"... |
import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import security_groups_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestSecurityGroupsClient(base.BaseServiceTest):
FAKE_SECURITY_GROUP_INFO = [{
"... | {
"content_hash": "2ee7cc93857e3cf59fe195e31b8347cc",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 78,
"avg_line_length": 40.35353535353536,
"alnum_prop": 0.653566958698373,
"repo_name": "openstack/tempest",
"id": "7bbf20e9341dcb54829d7d16dd8b7dcc563d65e0",
"size": "4626... |
"""
Created on Fri Mar 24 01:10:00 2017
@author: root
"""# -*- coding: utf-8 -*-
"""
Created on Sat Dec 20 14:03:06 2014
@author: holmes
"""
import numpy as np
import caffe
import sys
import scipy.io as io
import glob
import os
import shutil
import cv2
import pickle
from PIL import Image
def get_name(image_path):
... | {
"content_hash": "01761f7b614782c765268d85d877bfe1",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 156,
"avg_line_length": 27.235294117647058,
"alnum_prop": 0.5993520518358532,
"repo_name": "cs-chan/Deep-Plant",
"id": "f36cde0fc0355d64e900c6b923b6c321c3db7127",
"size": ... |
import os
import shlex
import pytest
import pyperclip
from mitmproxy import exceptions
from mitmproxy.addons import export # heh
from mitmproxy.test import tflow
from mitmproxy.test import tutils
from mitmproxy.test import taddons
from unittest import mock
@pytest.fixture
def get_request():
return tflow.tflow(... | {
"content_hash": "0e67617c3390a1a857f0234b985b46b9",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 104,
"avg_line_length": 33.43560606060606,
"alnum_prop": 0.6273932253313697,
"repo_name": "vhaupert/mitmproxy",
"id": "b0e5e47e973041bda3d25dc6423ef1743393f45e",
"size": "... |
"""Tests pycits wrapper for muscle."""
import os
import shutil
from pycits import muscle
from pycits.tools import NotExecutableError
from nose.tools import nottest, assert_equal, with_setup
# INPUT DATA
INDIR = os.path.join("tests", "test_data")
OUTDIR = os.path.join("tests", "test_out", "muscle")
INFILE = os.path.... | {
"content_hash": "66d53d813cb9ae8ec8e537096aaad156",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 76,
"avg_line_length": 26.972972972972972,
"alnum_prop": 0.6342685370741483,
"repo_name": "widdowquinn/THAPBI-pycits",
"id": "1c0bc5f8a2a7093e45251ae65ed46142ff2b9d2b",
"si... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
def h2o_H2OFrame_substring():
"""
Python API test: h2o.frame.H2OFrame.substring(start_index, end_index=None)
Copied from pyunit_sub_gsub.py
"""
frame = h2o.import_file(path=pyu... | {
"content_hash": "254b5a80495fd6d6d742876acb5111e7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 80,
"avg_line_length": 29.05,
"alnum_prop": 0.6746987951807228,
"repo_name": "michalkurka/h2o-3",
"id": "144f71bfebe5418fbf4ad3dc67b069316805c0fa",
"size": "581",
"binary... |
from unittest import TestCase, main
from tempfile import mkstemp
from os import close, remove
from os.path import exists
from qiita_core.util import qiita_test_checker
from qiita_ware.dispatchable import (
create_sample_template, update_sample_template, delete_sample_template,
update_prep_template, delete_arti... | {
"content_hash": "d459a597f879256b20ff1ad17dd5434a",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 40.257425742574256,
"alnum_prop": 0.5723069355632071,
"repo_name": "squirrelo/qiita",
"id": "33fc870aeb37bd9f2d276e4d8e1f41e552d1eed9",
"size": "441... |
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import StartDialog
app = QApplication(sys.argv)
app.setApplicationName("Word Tester")
if not QFile.exist("users.dat"):
pass
dialog = StartDialog.StartDialog()
if dialog.exec_():
pass
app.exec_()
| {
"content_hash": "606a6969657ecfc8b0376043889273e4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 37,
"avg_line_length": 15.166666666666666,
"alnum_prop": 0.7252747252747253,
"repo_name": "michaupl/wordtester",
"id": "27001af197b21d938e59872c95c9eccb3f9c4ed3",
"size": "... |
from examples.logUtil import configureLogger
from jiradb.database import JIRADB
from examples.argumentParser import getArguments
if __name__ == "__main__":
configureLogger('loadDatabase')
args = getArguments()
jiradb = JIRADB(**args)
jiradb.populate(args['projects'], args['startdate'], args['enddate']... | {
"content_hash": "8f3728f23aa87e45183f45abc9600e65",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 32.2,
"alnum_prop": 0.7236024844720497,
"repo_name": "benmishkanian/ASF-JIRA-mine",
"id": "40e6b9fac3634c15c691a8e02e753bde0a5e0612",
"size": "322",
... |
import time
import pytest
from selenium.common.exceptions import InvalidElementStateException
from selenium.common.exceptions import InvalidSelectorException
from selenium.common.exceptions import StaleElementReferenceException
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions im... | {
"content_hash": "4aac23464edaff73c56e55dca5a0e913",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 147,
"avg_line_length": 44.91740412979351,
"alnum_prop": 0.7187889932356998,
"repo_name": "titusfortner/selenium",
"id": "82adbab05e1630e3db100103a517823bd5755251",
"size"... |
"""Tests for fft operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
from absl.testing import parameterized
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.core.protobuf impo... | {
"content_hash": "efc7ebd0709a1f1103b3516ba249ab35",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 78,
"avg_line_length": 39.77379095163806,
"alnum_prop": 0.6017650519709747,
"repo_name": "arborh/tensorflow",
"id": "6045f5c468e52268f3152bdfd46b889dc93e1b39",
"size": "26... |
"""Graphviz's dot language parser.
The dotparser parses graphviz files in dot and dot files and transforms them
into a class representation defined by pydot.
The module needs pyparsing (tested with version 1.2.2) and pydot
Author: Michael Krause <michael@krause-software.de>
Fixes by: Ero Carrera <ero@dkbza.org>
"""
... | {
"content_hash": "49cb8c756dfbb9ee3a43325040824d98",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 104,
"avg_line_length": 28.8,
"alnum_prop": 0.5274532710280374,
"repo_name": "cleemesser/pydot",
"id": "546985e53456cd755b807b2fe9869d715002f640",
"size": "15434",
"bina... |
""" Python 'utf-8-sig' Codec
This work similar to UTF-8 with the following changes:
* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the
first three bytes.
* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these
bytes will be skipped.
"""
import codecs
### Codec APIs
... | {
"content_hash": "71321066c9dfaba87677ed2fc35da84e",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 31.64,
"alnum_prop": 0.6261061946902655,
"repo_name": "MalloyPower/parsing-python",
"id": "f05f6b88db26eda0c18eaade3b0b78d97a75ac7e",
"size": "3164"... |
import asyncio
import pykemon
loop = asyncio.get_event_loop()
print(loop.run_until_complete(pykemon.get(pokemon='bulbasaur')))
| {
"content_hash": "761c067fb4093bb745b3c1c7d2e3127a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 64,
"avg_line_length": 31.75,
"alnum_prop": 0.7874015748031497,
"repo_name": "Armored-Dragon/goldmine",
"id": "004a29900edbe384659af41a787887733a8c9735",
"size": "127",
"b... |
class Constant(int):
def __new__(cls, s, i):
obj = super(Constant, cls).__new__(cls, i)
return obj
| {
"content_hash": "9a92afb217daca33d96d38b301fea2ba",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 50,
"avg_line_length": 29.75,
"alnum_prop": 0.5210084033613446,
"repo_name": "pwndbg/pwndbg",
"id": "5db1047138c276d75beea936f490da42792f1369",
"size": "119",
"binary": fa... |
from geowatchutil.client.base import GeoWatchClientTopic
import boto3
class GeoWatchClientKinesis(GeoWatchClientTopic):
def check_topic_exists(self, topic, timeout=5, verbose=True):
exists = False
try:
self._client.describe_stream(StreamName=(self.topic_prefix + topic))
... | {
"content_hash": "eee14ff8329b111d61ab669c3ece580f",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 109,
"avg_line_length": 32.806451612903224,
"alnum_prop": 0.5870206489675516,
"repo_name": "geowatch/geowatch-util",
"id": "bd26cb2a27926f353b2398be3b9fb1178e8878c0",
"size... |
import json
from datetime import timedelta, datetime
import pytest
from Crypto.PublicKey import RSA
from jwkest.jwk import RSAKey
from jwkest.jws import JWS
from cmservice.consent import Consent
from cmservice.consent_manager import ConsentManager, InvalidConsentRequestError
from cmservice.database import ConsentRequ... | {
"content_hash": "845ebb42d773e825d838d1e8602953d3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 110,
"avg_line_length": 44.44444444444444,
"alnum_prop": 0.6772222222222222,
"repo_name": "its-dirg/CMservice",
"id": "cc7921a5a44951b0c3d446602a907423df0ac2f6",
"size": "3... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('map', '0001_initial'),
('accounts', '0005_auto_20141115_1507'),
]
operations = [
migrations.RemoveField(
model_name='user',
... | {
"content_hash": "87c4d194752ed4e2e3aa5d86906a6010",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 61,
"avg_line_length": 24.890625,
"alnum_prop": 0.48148148148148145,
"repo_name": "aaronsnig501/foreign-guides",
"id": "0d12843fd952822b918301e23860ce143166ef35",
"size": "... |
import os
import sys
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('/Users/Jaseibert/Dev/QualtricsAPI/'))
# -- Project information -----------------------------------------------------
project = 'QualtricsAPI'
copyright = '2019, Jeremy A. Seibert'
author = 'Jeremy A. Seibert'
# The full version, includ... | {
"content_hash": "03d94d8e3eaf80a81ccd022a7aec28dd",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 81,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.6538860103626943,
"repo_name": "Jaseibert/QualtricsAPI",
"id": "529d8bf092ad9cec1fe5e980a27033f510ed14c5",
"size"... |
import os
import datetime
import unittest
from django.test import TestCase
from data_aggregator import utilities
from django.utils import timezone
from pytz import timezone as tz
class TestUtilities(TestCase):
def test_set_gcs_base_path(self):
utilities.set_gcs_base_path("2021-summer", 1)
self.as... | {
"content_hash": "56a2f217e1b23fac0ccf4db053474b20",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 72,
"avg_line_length": 38.5625,
"alnum_prop": 0.5475418692598595,
"repo_name": "uw-it-aca/canvas-analytics",
"id": "7f26a80b8f5b497b20b23492a0d034bbfc72b9f2",
"size": "749... |
from __future__ import print_function
import logging
import click
from cargoport.utils import yield_packages, get_url
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger()
@click.command()
@click.argument('galaxy_package_file')
@click.argument('id')
@click.option('--version')
def main(galaxy_package_file... | {
"content_hash": "f4508eb666f6dc6355db8db4d496a61a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 27.642857142857142,
"alnum_prop": 0.6214470284237726,
"repo_name": "erasche/community-package-cache",
"id": "6b89c9b1ba8bbf9ca6336920a8fb4fd4d42dfcc7",... |
import os
from sgfs.commands.utils import parse_spec
from sgfs import SGFS
def default_sort_key(publish):
return publish['sg_version'], publish['created_at']
def parse_as_publish(sgfs, input_, publish_types=None, search_for_publish=True, filters=(), fields=(), sort_key=None):
"""Given input from a user, fi... | {
"content_hash": "b2cb5df8afc0961b108dd006b2239601",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 120,
"avg_line_length": 36.623711340206185,
"alnum_prop": 0.5964813511611541,
"repo_name": "westernx/sgpublish",
"id": "87bcd4f7c2dbdc16bb453f87bc6ff78e6b4bca41",
"size": ... |
import abc
import contextlib
import six
INGRESS_DIRECTION = 'ingress'
EGRESS_DIRECTION = 'egress'
@six.add_metaclass(abc.ABCMeta)
class FirewallDriver(object):
"""Firewall Driver base class.
Defines methods that any driver providing security groups
and provider firewall functionality should implement.... | {
"content_hash": "70a53ccfdcf5f58d3aa7b861d80e325a",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 73,
"avg_line_length": 28.35251798561151,
"alnum_prop": 0.6422227860948998,
"repo_name": "cisco-openstack/neutron",
"id": "afb0f18f59e0d1949caf09e176a67c1ddf8c3ef7",
"size... |
import matplotlib.pyplot as plt
import numpy as np
def load(filename):
# Load and store a 3 value file.
# Multipurpose beyond ('samples, values errors')
# I know I'm bad.
samples = []
values = []
errors = []
with open(filename, 'r') as f:
lines = list(f)
f.close()
... | {
"content_hash": "55293dfadd0369f9deacf803d4d95c0a",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 81,
"avg_line_length": 30.05263157894737,
"alnum_prop": 0.6199649737302977,
"repo_name": "lemming52/white_knight",
"id": "2a412027785d424517f803b446266c9393c8a876",
"size":... |
from django.conf import settings
def crud_context(request):
return {
'base_template': settings.BASE_TEMPLATE,
'include_crud_assets': getattr(settings, 'INCLUDE_CRUD_ASSETS', True)
}
| {
"content_hash": "f19f9095087a51d2656f9a2682f56e8a",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 77,
"avg_line_length": 26,
"alnum_prop": 0.6730769230769231,
"repo_name": "samuelcolvin/django-crud",
"id": "3c79be5057280dd1c3ad17b7b2a2484de8c7e0d9",
"size": "208",
"bin... |
"""
Initialize the QDarkStyleSheet module when used with python.
This modules provides a function to transparently load the stylesheets
with the correct rc file.
"""
import logging
import platform
__version__ = "1.12"
def _logger():
return logging.getLogger('qdarkstyle')
def load_stylesheet(pyside=True):
... | {
"content_hash": "2f4c43e911d7876314ed351178624de6",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 82,
"avg_line_length": 27.24175824175824,
"alnum_prop": 0.5877369907220653,
"repo_name": "GregoryBetz/DarkSilk",
"id": "26541465f994e900c63b13585ab63bcce6416f05",
"size": "... |
import sys
from setuptools import setup, find_packages
if sys.version > '3':
requires = [
'django >= 1.8.9'
]
else:
requires = [
'enum34 >= 1.1.2',
'django >= 1.8.9',
]
try:
long_description = open('README.md').read()
except:
long_description = ''
setup(
name=... | {
"content_hash": "fe46e7eafffde15e3b29ee850467e3b2",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 55,
"avg_line_length": 26.325581395348838,
"alnum_prop": 0.5459363957597173,
"repo_name": "YuelianINC/django_render",
"id": "9b87661d7d137b869f485ae65818d5fdac2f78f5",
"siz... |
from uuid import uuid1
import operator
from flask import Flask
from flask.ext.loopback import FlaskLoopback
from sentinels import NOTHING
from urlobject import URLObject as URL
import pytest
from backslash import Backslash
from backslash.api_object import APIObject
from backslash.lazy_query import LazyQuery
from back... | {
"content_hash": "377e98ef38b8f5be6028b1c1bf07f99c",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 87,
"avg_line_length": 24.971830985915492,
"alnum_prop": 0.673716864072194,
"repo_name": "yotamr/backslash-python",
"id": "f6fb18abe4b6afd816efa40aa07564a9e69c693f",
"size... |
from slicc.util import PairContainer, Location
class AST(PairContainer):
def __init__(self, slicc, pairs=None):
self.slicc = slicc
self.location = Location(slicc.current_file, slicc.lexer.lineno)
self.pairs = {}
if pairs:
self.pairs.update(getattr(pairs, "pairs", pairs))... | {
"content_hash": "b24df3277325e2be4ecf0c9b16b1718a",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 26.6,
"alnum_prop": 0.5883458646616542,
"repo_name": "liangwang/m5",
"id": "8f0d06171d992fc201d0257d3fb8f78518ccf827",
"size": "2667",
"binary": fa... |
from .development import *
# CSRF configuration
# https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-CSRF_TRUSTED_ORIGINS
# https://www.gitpod.io/docs/environment-variables/#default-environment-variables
CSRF_TRUSTED_ORIGINS = [
os.environ.get("GITPOD_WORKSPACE_URL").replace("https://", "https://8000... | {
"content_hash": "3ef079b68a8195825a4d11a5210d9abd",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 86,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.7423312883435583,
"repo_name": "cdubz/babybuddy",
"id": "174c80f7067de9c4a7d78ae6291a614472cdd6fc",
"size": "326",
... |
"""
Component for controlling Pandora stations through the pianobar client.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/media_player.pandora/
"""
import logging
import re
import os
import signal
from datetime import timedelta
import shutil
from homeass... | {
"content_hash": "ee2d972e15d503bb0448bb04077a01fe",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 79,
"avg_line_length": 35.47540983606557,
"alnum_prop": 0.5810998151571165,
"repo_name": "oandrew/home-assistant",
"id": "c97b20ee4bd03bcd5d36e49ed6c06b4d265e0c15",
"size"... |
import re
import SourceModel.SM_Constants as SMCONSTS
class SM_Element:
def __init__(self, text):
self.resourceText = text
def getUsedVariables(self):
compiledRE = re.compile(SMCONSTS.VAR1_REGEX)
varList = []
varList.extend(self.extrasStripVar1(compiledRE.findall(self.resourceT... | {
"content_hash": "0a5984dcec04c151318ce707f993a11b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 34.870370370370374,
"alnum_prop": 0.654275092936803,
"repo_name": "tushartushar/Puppeteer",
"id": "2164e7ca6a0efecad782b745e52b3e8a3259ab09",
"size":... |
import os
import socket
import gzip
from gppylib.commands.base import Command, REMOTE, WorkerPool, CommandResult
from gppylib.db import dbconn
from gppylib.test.behave_utils.utils import getRows, validate_parse_email_file
from gppylib.gparray import GpArray
from gppylib.operations.unix import CheckFile
from gppylib.tes... | {
"content_hash": "1ab8df9df3dc3dced184651ce8f0c977",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 218,
"avg_line_length": 45.71491228070175,
"alnum_prop": 0.6308644344238703,
"repo_name": "CraigHarris/gpdb",
"id": "21f9800f32aa069ccd7a66bba935de551296a6b1",
"size": "20... |
"""Copyright 2014 Cyrus Dasadia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | {
"content_hash": "e56e5bd838d5a28c96c4c4815b82b23e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 106,
"avg_line_length": 42.403225806451616,
"alnum_prop": 0.6371243818942564,
"repo_name": "CitoEngine/cito_engine",
"id": "4198e5919fc2275dd2fab7d398166210fb173a8b",
"size... |
from networkx.algorithms.shortest_paths.generic import *
from networkx.algorithms.shortest_paths.unweighted import *
from networkx.algorithms.shortest_paths.weighted import *
from networkx.algorithms.shortest_paths.astar import *
from networkx.algorithms.shortest_paths.dense import *
| {
"content_hash": "2cf20bba62c5cad317de1ea73ba13425",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 59,
"avg_line_length": 57,
"alnum_prop": 0.8421052631578947,
"repo_name": "sserrot/champion_relationships",
"id": "eb0d91cecc902f6390cb8309c017cb1558f7753f",
"size": "285",
... |
import logging
from socketIO_client import BaseNamespace
from socketIO_client import SocketIO
class MyNamespace(BaseNamespace):
def on_connect(self):
print("on_connect.")
def on_reconnect(self):
print("on_reconnect.")
def on_disconnect(self):
print("on_disconnect.")
def on... | {
"content_hash": "a127e89cf62feed8e549360099b6f4e9",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 60,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.6567741935483871,
"repo_name": "chenpota/python",
"id": "7e81631a9cc734e70d5cfeb5988653ae6b63926b",
"size": "799"... |
from unittest import TestCase
from gensim.models import Word2Vec
from .text_processor import TextProcessor
from .test_data import word2vec
class TextProcessorTest(TestCase):
def testProcessing(self):
text_processor = TextProcessor("english", [["turn", "on"], ["turn", "off"]],
... | {
"content_hash": "61d7899792005fbc1cdb8df684805864",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 120,
"avg_line_length": 61.44444444444444,
"alnum_prop": 0.5867992766726944,
"repo_name": "b09dan/universities_sentiment",
"id": "3585adfdf2f92c6129d2c7f5d844fcf9950e2b73",
... |
import os
import sys
import pytest
from falcon import Request
from falcon import RequestOptions
from falcon import Response
from falcon import ResponseOptions
from falcon.routing import DefaultRouter
from falcon.status_codes import HTTP_200
from falcon.testing import TestClient
from falcon.testing import create_enviro... | {
"content_hash": "216c86f784a3ab4a89459e738d51a3d9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 76,
"avg_line_length": 22.977011494252874,
"alnum_prop": 0.6703351675837919,
"repo_name": "p1c2u/openapi-core",
"id": "93a0f7f26df284c9a9f078f7e29ab6e0579ec134",
"size": "1... |
import os
import sys
# Below as a helper for namespaces.
# Looks like a horrible hack.
dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.append(dir)
import json
import requests
import scraperwiki
from utilities.prompt_format import item
from utilities.store_records import StoreRecords
d... | {
"content_hash": "0a74b0d706741de9871c3d57b9ff9c62",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 145,
"avg_line_length": 25.660714285714285,
"alnum_prop": 0.6715379262352122,
"repo_name": "luiscape/hdxscraper-sidih-api",
"id": "df3a924b04d7997e91bfb4f0cef7ca141ac9629c",
... |
from django.core.management.base import BaseCommand
from swiftwind.billing_cycle.models import BillingCycle
class Command(BaseCommand):
help = 'Populate billing cycles'
def handle(self, *args, **options):
BillingCycle.populate()
| {
"content_hash": "e5531f9f826d9f2d0a502ce43677079a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 55,
"avg_line_length": 24.9,
"alnum_prop": 0.7469879518072289,
"repo_name": "adamcharnock/swiftwind",
"id": "39f7fc2b61e7c1cdd5ef0897fe3724b057cf3592",
"size": "249",
"bi... |
from distutils.core import setup
setup(name='Django-Performance-Middleware',
version='1.0',
description='A tool to track down slowness in your django app',
install_requires=['Django==1.4'],
)
| {
"content_hash": "eee0eb4d4b4463265c6352667f0e0a2f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 69,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.6759259259259259,
"repo_name": "vegitron/django-performance-middleware",
"id": "a72fc7057e2003910899773bf0c58adbae4a... |
import logging as logger
import threading
import time
from django.db import connection
from django.db import connections
from django.db import transaction
from django.db.utils import OperationalError
from kolibri.core.sqlite.utils import repair_sqlite_db
logging = logger.getLogger(__name__)
class AsyncNotification... | {
"content_hash": "83fec090520801fd0fea5c21c6d87180",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 97,
"avg_line_length": 29.3302752293578,
"alnum_prop": 0.59430716296528,
"repo_name": "mrpau/kolibri",
"id": "8aae697375352b455341209b9654d7a2573d246b",
"size": "3197",
... |
"""
Management class for Storage-related functions (attach, detach, etc).
"""
from oslo.config import cfg
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import vim
from nova.virt.vmwareapi import vim_util
from nova.... | {
"content_hash": "9c98573179c3551b5867a271663476aa",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 79,
"avg_line_length": 48.863436123348016,
"alnum_prop": 0.5527407140281284,
"repo_name": "sacharya/nova",
"id": "6810407c1b8be61f9f91408aaed180b0bc865cc4",
"size": "22901... |
"""
Tests for the sklearn_api
"""
__authors__ = "Alexandre Lacoste"
__copyright__ = "Copyright 2013, Universite Laval"
__credits__ = ["Alexandre Lacoste","Ian Goodfellow", "David Warde-Farley", "Pascal Lamblin" ]
__license__ = "3-clause BSD"
__maintainer__ = "Alexandre Lacoste"
from pylearn2.train import Train
fro... | {
"content_hash": "f504ef3f437dabb43998be12a6e6661b",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 124,
"avg_line_length": 31.55108359133127,
"alnum_prop": 0.4943577666568541,
"repo_name": "bmilde/deepschmatzing",
"id": "f08483437d122bca5d031337bc94be27e847ba35",
"size"... |
"""Angle potentials."""
from hoomd.md import _md
from hoomd.md.force import Force
from hoomd.data.typeparam import TypeParameter
from hoomd.data.parameterdicts import TypeParameterDict
import hoomd
class Angle(Force):
"""Constructs the angular bond potential.
Note:
:py:class:`Angle` is the base clas... | {
"content_hash": "883c480ea17c9bab670ff2980ce81291",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 80,
"avg_line_length": 33.76724137931034,
"alnum_prop": 0.6178197600204238,
"repo_name": "joaander/hoomd-blue",
"id": "b55bcd493d3eb55e73ec1cb67deacb7c37f2bf70",
"size": "... |
import atexit
import logging
import os
import signal
import subprocess
import sys
import threading
import time
from .paths import Paths
from devil import base_error
from devil.android import apk_helper
from devil.android import device_errors
from devil.android import device_utils
from pylib import constants
# Tags ... | {
"content_hash": "cf210273276c87bc0eb65e9bd96ff720",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 80,
"avg_line_length": 38.1,
"alnum_prop": 0.5954255718035245,
"repo_name": "Bysmyyr/chromium-crosswalk",
"id": "54e293d8ffec15a6a4518122c1300ffa08b30f71",
"size": "10945"... |
import unittest
import azure.mgmt.web
from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer
AZURE_LOCATION = 'eastus'
class MgmtWebSiteTest(AzureMgmtTestCase):
def setUp(self):
super(MgmtWebSiteTest, self).setUp()
self.mgmt_client = self.create_mgmt_client(
... | {
"content_hash": "b5f86843901229ea571f06b49302e438",
"timestamp": "",
"source": "github",
"line_count": 886,
"max_line_length": 241,
"avg_line_length": 47.45372460496614,
"alnum_prop": 0.42455522785653127,
"repo_name": "Azure/azure-sdk-for-python",
"id": "dba6044007033867131768f3a0d90a8415583fe3",
... |
"""A git-command for integrating reviews on Rietveld."""
from distutils.version import LooseVersion
import glob
import json
import logging
import optparse
import os
import Queue
import re
import stat
import sys
import textwrap
import threading
import urllib2
import urlparse
import webbrowser
try:
import readline #... | {
"content_hash": "540c1e58d5022955ff563a338be9e826",
"timestamp": "",
"source": "github",
"line_count": 2672,
"max_line_length": 80,
"avg_line_length": 35.4622005988024,
"alnum_prop": 0.6344256239776265,
"repo_name": "smikes/depot_tools",
"id": "75b479664c1989ef053c8d283177e59985f897fe",
"size": "9... |
from PySide import QtCore, QtGui
from .ui import lineup_ui
from data import champions
from models.match import Lineup
import supervisor
class LineupW(QtGui.QWidget, lineup_ui.Ui_Form):
def __init__(self, parent=None):
super(LineupW, self).__init__(parent)
self.ui = lineup_ui.Ui_Form()
se... | {
"content_hash": "9db28fc4f8f8c7dbbf33646ce0ce8219",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 38.08510638297872,
"alnum_prop": 0.6307262569832403,
"repo_name": "mvy/reddit_live_lcs",
"id": "e3cea56dc5d4250db4a1d26e9927dd8031802af3",
"size": "1... |
import threading
import pytest
def test_shell_sync(device):
result = device.shell("dumpsys")
assert "dumpsys window sessions" in result
def test_shell_async(device):
result = bytearray()
def callback(conn):
while True:
data = conn.read(1024)
if not data:
... | {
"content_hash": "2ccce6941899fb64f6c8801938ffe33c",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 26.26923076923077,
"alnum_prop": 0.6432406051732552,
"repo_name": "Swind/pure-python-adb",
"id": "69d53ad5dbfada0ad31d8bcbd403999dd3904a42",
"size": ... |
import urllib2, config, db, json, os
#解析ip管理页面结果
def httpget():
req = urllib2.Request(config.hportal_ips + config.ip + "&mine=1")
try:
response = urllib2.urlopen(req)
data = response.read()
print data
print data.index(config.ip)
print data.index("creator")
print ... | {
"content_hash": "8846253d6d02efc978b0e97e26627b07",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 113,
"avg_line_length": 36.694736842105264,
"alnum_prop": 0.49483648881239245,
"repo_name": "miaolujing/python_script",
"id": "b8453aa81e5131d1002a462c6ec20cd783e0595d",
"s... |
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
KAFKA_HOSTS = 'localhost:9092'
KAFKA_TOPIC_PREFIX = 'demo'
KAFKA_CONN_TIMEOUT = 5
KAFKA_APPID_TOPICS = False
PLUGIN_DIR = "plugins/"
PLUGINS = {
'plugins.info_monitor.InfoMonitor': 100,
'plugins.stop_monitor.StopMonitor': 200,
'plugins.expire_monitor.ExpireMonito... | {
"content_hash": "aa830ef303c6051a03df90a4a7f37d45",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 54,
"avg_line_length": 21.88095238095238,
"alnum_prop": 0.6877040261153428,
"repo_name": "quixey/scrapy-cluster",
"id": "af202c777d07c4fbbdfa4f02d6cf870d04a1203c",
"size": ... |
"""Utilities"""
from time import sleep
from functools import partial
from socket import AF_INET, SOCK_STREAM, socket
def anyof(obj, *types):
return any(map(partial(isinstance, obj), types))
def parse_bind(s, default_port=1338):
# XXX: We ignore the protocol for now
if "://" in s:
protocol, s =... | {
"content_hash": "e25ff10d6c394c3006e3ae6b81fee9b2",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 22.03125,
"alnum_prop": 0.6056737588652482,
"repo_name": "apnarm/autodock",
"id": "638428e0681942ae8a9bf01c882866e0565c6380",
"size": "821",
"binar... |
"""
Taxi simulator
==============
Driving a taxi from the console::
>>> from taxi_sim import taxi_process
>>> taxi = taxi_process(ident=13, trips=2, start_time=0)
>>> next(taxi)
Event(time=0, proc=13, action='leave garage')
>>> taxi.send(_.time + 7)
Event(time=7, proc=13, action='pick up passe... | {
"content_hash": "90ac2d8bc4ff281793db8bda2fb2cc8b",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 76,
"avg_line_length": 39.351485148514854,
"alnum_prop": 0.6066171845515159,
"repo_name": "dcbdmb/example-code",
"id": "705418aca1b7ed52d08dcb7772b5d0fac0805d7e",
"size": ... |
import os
import sys
import time
import signal
import click
import json
@click.group()
def cli():
pass
@cli.command()
@click.option('-m', type=str)
def stdio(m):
print(m)
@cli.command()
@click.option('-m', type=str)
@click.option('-p', default='/mnt/girder_worker/data/output_pipe', type=click.File('w'))
d... | {
"content_hash": "b460242a488b697af563a8d5e0ce0423",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 88,
"avg_line_length": 18.28723404255319,
"alnum_prop": 0.627108784176847,
"repo_name": "girder/girder_worker",
"id": "c636bb068016dc18b8bb82ccfd71e2d3e8b64401",
"size": "1... |
import unittest
from unittest import mock
from google.api_core.exceptions import AlreadyExists
from google.cloud.vision_v1.types import Product, ProductSet, ReferenceImage
from airflow.providers.google.cloud.operators.vision import (
CloudVisionAddProductToProductSetOperator,
CloudVisionCreateProductOperator,... | {
"content_hash": "8d5aaa538016536adb88ba7149bdba32",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 108,
"avg_line_length": 39.39148073022312,
"alnum_prop": 0.6403192584963955,
"repo_name": "airbnb/airflow",
"id": "2ca8d9ae70b89ded93ec51f6f96474ac4ccfb529",
"size": "2020... |
""" Joblib is a set of tools to provide **lightweight pipelining in
Python**. In particular, joblib offers:
1. transparent disk-caching of the output values and lazy re-evaluation
(memoize pattern)
2. easy simple parallel computing
3. logging and tracing of the execution
Joblib is optimized to be **fast*... | {
"content_hash": "03b400a45cd5144412a2b058974b10f5",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 87,
"avg_line_length": 37.90677966101695,
"alnum_prop": 0.635814889336016,
"repo_name": "DailyActie/Surrogate-Model",
"id": "57337a1154bfb5aa4ab0679777aacf118236ec78",
"si... |
from typing import List
from google.appengine.ext import ndb
from pyre_extensions import safe_cast
from backend.common.consts.model_type import ModelType
from backend.common.consts.notification_type import NotificationType
from backend.common.consts.notification_type import (
RENDER_NAMES as NOTIFICATION_RENDER_N... | {
"content_hash": "89483f4af29bb76e3b0e0ec8093959f4",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 115,
"avg_line_length": 41.197916666666664,
"alnum_prop": 0.6627054361567636,
"repo_name": "the-blue-alliance/the-blue-alliance",
"id": "56cb5d15a016ffc699ce9756213760c12095f... |
import os
import sys
import docker
import docker.errors
from pycalico.ipam import IPAMClient
from pycalico.datastore import ETCD_AUTHORITY_ENV
from utils import DOCKER_VERSION
from utils import print_paragraph
from utils import validate_hostname_port
# If an ETCD_AUTHORITY is specified in the environment variables, ... | {
"content_hash": "216348378fc97de754de083a26a89afb",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 33.53846153846154,
"alnum_prop": 0.6811926605504587,
"repo_name": "fasaxc/calicoctl",
"id": "ca2a1027db19d79d033f4e43de4f518c01a2116b",
"size": "1455... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
__doc__ = """Module for Visual C/C++ detection and configuration.
"""
import SCons.compat
import os
import platform
from string import digits as string_digits
import SCons.Warnings
import common
debug = common.debug
import sdk
get_installed_sdks = sdk... | {
"content_hash": "f4fc562abab6ac5c04eb30f5490b8277",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 141,
"avg_line_length": 35.589622641509436,
"alnum_prop": 0.6065606361829026,
"repo_name": "azatoth/scons",
"id": "f67c01bb44cb6f499b3209eebfced7f9e66be315",
"size": "1653... |
import sys
import os
import subprocess
from workflow import Workflow, MATCH_SUBSTRING
from workflow.background import run_in_background
import script_refresh
__author__ = 'zhouqi'
WF = Workflow(update_settings={
'github_slug': 'bitwolaiye/alfred-script',
'version': open(os.path.join(os.path.dirname(__file__... | {
"content_hash": "93c6be1f1c6059a5d8ddec6f5941d0e6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 28.04225352112676,
"alnum_prop": 0.6137619286790558,
"repo_name": "bitwolaiye/alfred-script",
"id": "8ffcd571392631481ce6a7b95ce788e307cc5e54",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.