text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
import os
#make sure the program can be executable from test file
dir_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '.'))
sys.path.append(dir_root)
from theta import theta
from edge_oper import edge_oper
from graph import connec_graph
import math as mt
import numpy as np
import copy
def M... | {
"content_hash": "df01959760b354e8857a99ebaaabaa89",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 121,
"avg_line_length": 36.02,
"alnum_prop": 0.6651860077734592,
"repo_name": "hudalao/mcmc",
"id": "811b2652af1a303cb0c43eb32766b2672f2cbd24",
"size": "1801",
"binary": ... |
from peer import *
class UIPeer(Peer):
def __init__(self, room, path=None):
Peer.__init__(self, room)
self._roomName = room
self._path = path
from credentialsConsumer import CredentialsConsumer
self._cc = CredentialsConsumer(self._newCredentials)
self._credentials =... | {
"content_hash": "a5a46114de860f849a23c6ff147e3d3f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 60,
"avg_line_length": 27.208333333333332,
"alnum_prop": 0.6094946401225115,
"repo_name": "FreshXOpenSource/wallaby-base",
"id": "2232f116ecbe1df310b2a42d2c65fa67c6322e20",
... |
import time
import colorsys
import os
import sys
import ST7735
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
ltr559 = LTR559()
except ImportError:
import ltr559
from bme280 import BME280
from subprocess import PIPE, Popen
from PIL import Image
from PIL... | {
"content_hash": "0213a4a69eb1570bb7f49cf5541c302f",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 87,
"avg_line_length": 29.36144578313253,
"alnum_prop": 0.5802215839146492,
"repo_name": "pkbullock/RaspberryPi",
"id": "355ad8b59168d39da72f27cdab16e17cedf6800a",
"size":... |
from saharaclient.api import data_sources as ds
from saharaclient.tests.unit import base
from unittest import mock
from oslo_serialization import jsonutils as json
class DataSourceTest(base.BaseTestCase):
body = {
'name': 'name',
'url': 'url',
'description': 'descr',
'data_source_... | {
"content_hash": "2102a27d750c51d70a41a1cd567b68be",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 38.08571428571429,
"alnum_prop": 0.5941485371342836,
"repo_name": "openstack/python-saharaclient",
"id": "7da69fb362932e9520644cb2d43aac43c0690955",
... |
"""Batching dataset transformations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.framework import with_shape
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import convert
from tensorflow.pyt... | {
"content_hash": "b98baa8081e16dfff04ea644cc4cc2e7",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 87,
"avg_line_length": 38.755434782608695,
"alnum_prop": 0.6706399289487216,
"repo_name": "lukeiwanski/tensorflow",
"id": "5708d47c2081976f82722018adf30523c091416a",
"size... |
import sys
import argparse
def parse_arguments():
""" parse the arguments """
p = argparse.ArgumentParser()
p.add_argument(
"--words-file",
help="file with list of words [/usr/share/dict/words]",
default="/usr/share/dict/words",
)
p.add_argument(
"--tlds-file", h... | {
"content_hash": "5d300c765f124e726cbc1c65616b2af9",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 86,
"avg_line_length": 23.257731958762886,
"alnum_prop": 0.5558510638297872,
"repo_name": "audy/domain-name-generator",
"id": "68d86c9ecb8115bb5de8f5c2639a38e927db60df",
"s... |
"""Contains the logic for `aq show service`."""
from sqlalchemy.orm import joinedload, subqueryload, undefer, contains_eager
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.aqdb.model import Service, ServiceInstance
from aquilon.worker.dbwrappers.host import hostname_to_host
fro... | {
"content_hash": "f99750d806709953ab8c3b3e35cbb23e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 91,
"avg_line_length": 48.5,
"alnum_prop": 0.6435368754956384,
"repo_name": "stdweird/aquilon",
"id": "d65e9983810fb67f70d12b0a35bb77958132553e",
"size": "3230",
"binary"... |
from unittest import skipIf
from django.contrib.gis.gdal import GDALRaster
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.encoding import iri_to_uri
from raster.formulas import RasterAlgebraParser
from .raster_testcase import RasterTestCase
class RasterAlgebraPars... | {
"content_hash": "5e933c069e4f480b2ab1424622a513ca",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 178,
"avg_line_length": 40.717948717948715,
"alnum_prop": 0.6338161209068011,
"repo_name": "PADAS/django-raster",
"id": "9523ff5a8b31355a1c47fae338cade6b29eb1fe5",
"size": ... |
"""
json序列化框架的设计:
|------------------|-----------------------------------|----------------------|
| OBJECT | CLASS | USE |
|------------------|-----------------------------------|----------------------|
| converterDict | dict | store... | {
"content_hash": "9c62474b7721506809b81b42f01ebb23",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 98,
"avg_line_length": 35.11764705882353,
"alnum_prop": 0.4296482412060301,
"repo_name": "qinggeng/ceShiGuanLiXiTong",
"id": "1bb3e541e09a232b63ef6edfd20870c97e377044",
"si... |
from django import dispatch
post_register = dispatch.Signal(providing_args=["app_label", "model"])
| {
"content_hash": "a3b9c1622538472208d74c80a01466eb",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 70,
"avg_line_length": 25.25,
"alnum_prop": 0.7524752475247525,
"repo_name": "Anaethelion/django-mapentity",
"id": "559779813bf619dcdffcd01b233fbf09cef1d938",
"size": "101",... |
from __future__ import print_function
import unittest
from doublescript import two_plus_two_equals
class TwoPlusTwoTestCase(unittest.TestCase):
def test_twoplustwo_eval(self):
with two_plus_two_equals(5):
self.assertEqual(eval("2 + 2"), 5)
# Fails if PyCode_Optimize isn't overridden, b... | {
"content_hash": "7746c4e92e3c252681a79514fa92d126",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 32.90909090909091,
"alnum_prop": 0.6892265193370166,
"repo_name": "fdintino/python-doublescript",
"id": "87d0645fbb0eedbe09fbf45f82980849833660ce",
"... |
"""Provides tools for neighbourhood generation"""
from typing import Any, Tuple, Union
import numpy as np
from numpy import ndarray
def rolling_window(
input_array: ndarray, shape: Tuple[int, int], writeable: bool = False
) -> ndarray:
"""Creates a rolling window neighbourhood of the given `shape` from the
... | {
"content_hash": "ed7781908a9375d0a452d0178206852a",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 86,
"avg_line_length": 35.8792270531401,
"alnum_prop": 0.5922983708092097,
"repo_name": "metoppv/improver",
"id": "4a5bc8bb96ec3f359918324b2e3537d6dddcbaed",
"size": "9084... |
import pytest
from mapbox.utils import normalize_geojson_featurecollection
geom = {'type': 'Point', 'coordinates': (-122, 45)}
feat = {'type': 'Feature', 'geometry': geom, 'properties': {}}
coll = {'type': 'FeatureCollection', 'features': [feat]}
coll2 = {'type': 'FeatureCollection', 'features': [feat, feat]}
def ... | {
"content_hash": "627a10dc88dbb45ef46658055e52b2ef",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 68,
"avg_line_length": 26.53030303030303,
"alnum_prop": 0.6676185037121645,
"repo_name": "ravik/mapbox-baseSDK",
"id": "35edc5e61a06c0d86b6a05ec5be7d2930ea4d7fe",
"size": "... |
import sys
pr = sys.stdout.write
class MachineTapeException(Exception):
""" Turing Exception Exception """
def __init__(self, value):
Exception.__init__(self)
self.value = value
def __str__(self):
return self.value
class TuringErrorException(Exception):
""" Turing Exception Exception """
def __str__(self)... | {
"content_hash": "d3584e25920b0bdcb672f7b0e6844fcf",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 81,
"avg_line_length": 28.141025641025642,
"alnum_prop": 0.6687927107061503,
"repo_name": "ActiveState/code",
"id": "afe511b42e41ab7b7d6c88f9da51db1f408e1ad1",
"size": "44... |
import random
from unittest import mock
import netaddr
from neutron_lib.api.definitions import l3 as l3_apidef
from neutron_lib.api.definitions import portbindings as portbindings_api
from neutron_lib.api.definitions import qos as qos_api
from neutron_lib.api.definitions import qos_fip as qos_fip_apidef
from neutron_l... | {
"content_hash": "e2328c86ae52c1267a889490a328a98a",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 79,
"avg_line_length": 44.42816901408451,
"alnum_prop": 0.5863555668272888,
"repo_name": "mahak/neutron",
"id": "71ebd2f41402cb3d17d4efc479d7ff57fc4aaded",
"size": "32150"... |
""" Pyface 'DockWindow' support.
This package implements a Pyface 'dockable' window component that allows
child windows to be reorganized within the DockWindow using drag and drop.
The component also allows multiple sub-windows to occupy the same
sub-region of the DockWindow, in which case each sub-win... | {
"content_hash": "57c510681fb96b39cff665836a7855a4",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 43.55555555555556,
"alnum_prop": 0.7576530612244898,
"repo_name": "enthought/etsproxy",
"id": "e7a7fbcc44210b17df2c3609c66b84c9c1facb58",
"size": "102... |
import os
import sys
import time
import httplib
import hmac
import json
import hashlib
import urllib
import re
import socket
host = 'api.pusherapp.com'
port = 80
app_id = None
key = None
secret = None
channel_name_re = re.compile('^[-a-zA-Z0-9_=@,.;]+$')
app_id_re = re.compile('^[0-9]+$')
def url2o... | {
"content_hash": "3b360ed6d5d3880f676977fbe3291b17",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 137,
"avg_line_length": 37.34158415841584,
"alnum_prop": 0.6185867691899775,
"repo_name": "kho0810/flaskr",
"id": "37f086a613a17a4a7b579789194277505e70a7b7",
"size": "7543... |
import unittest
from entropy_framework.registry.registry import Registry
from entropy_framework.entity.entity import Entity
from entropy_framework.registry.collection import Collection
class RegistryTestCase(unittest.TestCase):
def test_prop_registry(self):
class Formula(Entity):
pass
... | {
"content_hash": "48c0000a7a5eec3512d8b6455b3afb7d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 99,
"avg_line_length": 32.95238095238095,
"alnum_prop": 0.7052023121387283,
"repo_name": "aliskhakov/entropy-framework",
"id": "b3a375bdc3b36fa5df322824eaaf9e5f08ce3928",
"... |
from __future__ import absolute_import, division, print_function
import platform
import sys
from cryptography.hazmat.bindings.utils import build_ffi
class Binding(object):
"""
CommonCrypto API wrapper.
"""
_module_prefix = "cryptography.hazmat.bindings.commoncrypto."
_modules = [
"cf",
... | {
"content_hash": "d5138f4bf98e5e19062e7463d71b5c41",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 65,
"avg_line_length": 23.659574468085108,
"alnum_prop": 0.5665467625899281,
"repo_name": "fkolacek/FIT-VUT",
"id": "ee7378ad81a2892771a335425f606be07bdd3f61",
"size": "165... |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="ohlc.line", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
ed... | {
"content_hash": "8ce14c1e17cf31326d4889f1692d716c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 36.69230769230769,
"alnum_prop": 0.589098532494759,
"repo_name": "plotly/python-api",
"id": "345d072a3d51a04a02c1f23b6fa99a57887440c5",
"size": "477"... |
"""Logical unit for creating a single instance."""
import OpenSSL
import logging
import os
from ganeti import compat
from ganeti import constants
from ganeti import errors
from ganeti import hypervisor
from ganeti import locking
from ganeti.masterd import iallocator
from ganeti import masterd
from ganeti import netu... | {
"content_hash": "63b50cbfdf8d94fcb57736fe8b872244",
"timestamp": "",
"source": "github",
"line_count": 1593,
"max_line_length": 80,
"avg_line_length": 42.278091650973,
"alnum_prop": 0.604092117180656,
"repo_name": "leshchevds/ganeti",
"id": "4b2c6ee8bd08e01f13360a0b6df819c9af4ebd11",
"size": "6873... |
from __future__ import absolute_import, unicode_literals
from mason.base import Base
class Condition(Base):
CONDITION = None
def __init__(self, *args):
if self.CONDITION is None:
raise NotImplementedError()
if not args:
raise NotImplementedError()
self.condi... | {
"content_hash": "1398a8f4a77a4883980f4f6bccf6efe4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 98,
"avg_line_length": 22.848484848484848,
"alnum_prop": 0.5868700265251989,
"repo_name": "vail130/mason",
"id": "32eb46db59fd210f852c872a63c1ac652102f502",
"size": "1508",... |
import benchmark
from datavalidation.libraries import WRAPPERS
class BenchmarkBase(benchmark.Benchmark):
each = 10
number = 1000
valid = True
def __init__(self):
# Do not run tests using BenchmarkBase itself
super(BenchmarkBase, self).__init__(BenchmarkBase=False)
# `validator... | {
"content_hash": "5c9a1cd92c64b8d28fa5f2db3f7702ef",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 64,
"avg_line_length": 30.133333333333333,
"alnum_prop": 0.6349557522123894,
"repo_name": "lifus/data-validation-benchmark",
"id": "62e9b779d7a042103adcf5ffd8c46610d8e11035",... |
import os.path as osp
from click import group, option, Choice
from fabric.api import execute, get
from eggo import director
from eggo.util import resource_dir
# This module implements the eggo-director CLI, which is comprised of commands
# that are typically run on a user's local machine that has set some cloud-
# ... | {
"content_hash": "81ff44e09bfe45bfdcb33f04bb017c68",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 78,
"avg_line_length": 38.394557823129254,
"alnum_prop": 0.6929482636428065,
"repo_name": "bigdatagenomics/eggo",
"id": "803b7dad7602320910f717da8d2243ce2b28fab8",
"size":... |
"""
WSGI config for yj project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en//howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yj.settings")
from django.core.wsgi import ge... | {
"content_hash": "e811105fb368742e09d172af4ca38a57",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 26.857142857142858,
"alnum_prop": 0.7686170212765957,
"repo_name": "bob1b/yj",
"id": "a661c4562e07c019fb25dbcae71b4b603ebb4839",
"size": "376",
"bi... |
"""
This module implements a LEDP client. The single class exported has
a low-level, stateless method to send a single message (`send_raw`),
and high-level methods (`sed_led`, `release_led`, `reset` and `commit`).
"""
import struct
protocol_version = 1
default_port = 5021
class Client:
"""
Encodes and sends ... | {
"content_hash": "c8b8b1c477285c9d05a89b540e3e1f50",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 28.77848101265823,
"alnum_prop": 0.5882999780074775,
"repo_name": "jmendeth/led-meter",
"id": "e056c2043deeee59a4c362a1442b088608f5e2f1",
"size": "4... |
"""Base scanner skeleton."""
import abc
from google.cloud.security.common.util import log_util
# TODO: The next editor must remove this disable and correct issues.
# pylint: disable=missing-type-doc
# pylint: disable=missing-param-doc,redundant-returns-doc
LOGGER = log_util.get_logger(__name__)
class BaseScanne... | {
"content_hash": "3f39fecb8200fd5d454dd1566940580a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 68,
"avg_line_length": 24.902439024390244,
"alnum_prop": 0.6454456415279138,
"repo_name": "cschnei3/forseti-security",
"id": "5a15b28a75925fac019e34e55df5d28321846012",
"si... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['MovingAverage'] , ['Seasonal_Second'] , ['NoAR'] ); | {
"content_hash": "61e5e714b27cc55515e17d732b0a9afe",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 92,
"avg_line_length": 41.25,
"alnum_prop": 0.7212121212121212,
"repo_name": "antoinecarme/pyaf",
"id": "0131a8ba8b1fe729743ebb809624ecd05746cf5b",
"size": "165",
"binary"... |
import codecs
import os
import re
import sys
from os import path
from setuptools import find_packages, setup
# When creating the sdist, make sure the django.mo file also exists:
if "sdist" in sys.argv or "develop" in sys.argv:
os.chdir("parler")
try:
from django.core import management
managem... | {
"content_hash": "9c168c4c31e15dbf8abb374afc9a0152",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 106,
"avg_line_length": 34.05194805194805,
"alnum_prop": 0.6163234172387491,
"repo_name": "edoburu/django-parler",
"id": "ef6787c68ca46391aa9941dae9433a4648403403",
"size":... |
"""Module containing class for GCP's spark service.
Spark clusters can be created and deleted.
"""
import datetime
import json
import re
from perfkitbenchmarker import flags
from perfkitbenchmarker import providers
from perfkitbenchmarker import spark_service
from perfkitbenchmarker.providers.gcp import util
FLAGS... | {
"content_hash": "2536845adc415dc8dd2ac308644b8c26",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 78,
"avg_line_length": 34.96875,
"alnum_prop": 0.6217605004468275,
"repo_name": "xiaolihope/PerfKitBenchmarker-1.7.0",
"id": "8fff2ae1c73b78c7224e7907f466efaa60ddfc57",
"s... |
"""
Usage:
feed_checker.py CALENDAR_PATH CREDENTIALS_PATH EVENTS_OUTPUT
Arguments:
CALENDAR_PATH path to ical file
CREDENTIALS_PATH path to file with google user credentials
EVENTS_OUTPUT path to file to save upcoming events for hangout runner
"""
from icalendar import Calendar
import a... | {
"content_hash": "47a34cfa927e43f0039ac10f951965b5",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 38.51851851851852,
"alnum_prop": 0.6264423076923077,
"repo_name": "enkidulan/hangout_automated_manager",
"id": "5b4f481ccea85ddce998326b65bb8a0f5f53fd8... |
"""
Test suite for opc.pkgwriter module
"""
import pytest
from mock import call, MagicMock, Mock, patch
from docx.opc.constants import CONTENT_TYPE as CT
from docx.opc.package import Part
from docx.opc.packuri import PackURI
from docx.opc.phys_pkg import _ZipPkgWriter
from docx.opc.pkgwriter import _ContentTypesItem... | {
"content_hash": "6094b908062fa83aeabb2f494d0ca80d",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 77,
"avg_line_length": 37.3,
"alnum_prop": 0.5816283335685057,
"repo_name": "guilhermebr/python-docx",
"id": "741e66ac6f9f259bd974702c8f0801517071674b",
"size": "7106",
... |
"""Django ORM models for Social Auth"""
import base64
import six
import sys
from django.db import transaction
from django.db.utils import IntegrityError
from social.storage.base import UserMixin, AssociationMixin, NonceMixin, \
CodeMixin, BaseStorage
class DjangoUserMixin(UserMixin):
... | {
"content_hash": "d49b66f69b87bd63a3fbd52eef460343",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 93,
"avg_line_length": 34.421965317919074,
"alnum_prop": 0.6035264483627204,
"repo_name": "fearlessspider/python-social-auth",
"id": "e331656c87cf65b50473f00a9f76b8b7e72e268... |
from org.apache.qpid.proton import Proton
from org.apache.qpid.proton.amqp import Symbol
from org.apache.qpid.proton.amqp.messaging import Source, Target, \
TerminusDurability, TerminusExpiryPolicy, Received, Accepted, \
Rejected, Released, Modified
from org.apache.qpid.proton.amqp.transaction import Coordinator
fr... | {
"content_hash": "0897bd10504530c274d12ffaed98608a",
"timestamp": "",
"source": "github",
"line_count": 1080,
"max_line_length": 84,
"avg_line_length": 26.112962962962964,
"alnum_prop": 0.72707609389405,
"repo_name": "datawire/qpid-proton",
"id": "2d82bc4472212a838ffce9707ad07b481a37f0a5",
"size": ... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DataInstance.valid_from'
db.add_column('postdoc_datainstance', 'valid_from',
self.gf('django.d... | {
"content_hash": "6efee165b94cf2ec7fd6ed34764c1e69",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 175,
"avg_line_length": 59.42857142857143,
"alnum_prop": 0.5664335664335665,
"repo_name": "citizennerd/VivaCity",
"id": "65c5496b1ae2964718ae3b3e8807dc33b01b9c73",
"size": ... |
from ufo2ft.filters.decomposeTransformedComponents import (
DecomposeTransformedComponentsFilter,
)
class DecomposeTransformedComponentsFilterTest:
def test_transformed_components(self, FontClass):
ufo = FontClass()
a = ufo.newGlyph("six.lf")
a.width = 300
pen = a.getPen()
... | {
"content_hash": "eadeedc8f578ee3e381c0992e7fa06ed",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 73,
"avg_line_length": 34.44827586206897,
"alnum_prop": 0.5735735735735735,
"repo_name": "jamesgk/ufo2fdk",
"id": "9489a6a775289f480d53bee09e990c6ffcea4f3a",
"size": "1998"... |
"""Scheduled Activity views."""
import django_filters
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView, DetailView, UpdateView
from django_filters.views import FilterView
from .mixins import AJAXRedirectMixin
from ..forms import sch_activi... | {
"content_hash": "eacb2da11620a4e7be20698520ef905e",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 74,
"avg_line_length": 26.014598540145986,
"alnum_prop": 0.6430976430976431,
"repo_name": "jricardo27/holiday_planner",
"id": "94559795f3cb04bcdbb744e1a0915b0453d98ab5",
"... |
class Contact_info:
def __init__(self, firstname, middlename, lastname, nickname, title, company_name, company_address, company_home_num, company_home_phone, add_company_name,company_fax, email1, email2, email3, company_site, year_of_birth, anniversary_year, add_address, add_phone, notes):
self.firstname =... | {
"content_hash": "8d32f5df8cd23e5204bd9df5241bc1e5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 274,
"avg_line_length": 46.04347826086956,
"alnum_prop": 0.6591123701605288,
"repo_name": "ellena2905/python_training",
"id": "dc6cdab0aa6aff09cad60ad7f65a8657d1e1297e",
"s... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0012_problemassignment_done_at'),
]
operations = ... | {
"content_hash": "f81521162fdc67760658a7017edc29b0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 114,
"avg_line_length": 33.964285714285715,
"alnum_prop": 0.5846477392218717,
"repo_name": "shanzi/tchelper",
"id": "f83ef235e0e58c1e88feb0eabd0e933d309452e7",
"size": "975... |
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport
from corehq.apps.users.models import CommCareUser
from dimagi.utils.parsing import json_format_date
from pact.enums impo... | {
"content_hash": "237608e5238666800ed3ae068d2d4cc7",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 108,
"avg_line_length": 40.95495495495496,
"alnum_prop": 0.5334359876814783,
"repo_name": "qedsoftware/commcare-hq",
"id": "6946a99738aaa90c4cdf5408bca4d1e3592e07fb",
"siz... |
'''
Copyright (c) 2017 Vanessa Sochat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | {
"content_hash": "13c47fd92e66c80508a28ce7014a9bbb",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 78,
"avg_line_length": 33.61764705882353,
"alnum_prop": 0.747594050743657,
"repo_name": "vsoch/docfish",
"id": "dd0fea29a2d10a149dad2aed7feca5784c40f139",
"size": "2286",
... |
from django.db import models
from django.contrib.auth.models import Group, User, Permission
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import resolve
from django.conf import settings
from django import forms
from decorators import allow_tags
from datetime import datetime... | {
"content_hash": "468515c26e4a5e8953621fb7c9a14a6c",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 181,
"avg_line_length": 39.07674418604651,
"alnum_prop": 0.5998928762720943,
"repo_name": "glasslion/djflow",
"id": "4f26af106c16e00e8f253a74c0b59e016e9f76bc",
"size": "16... |
from __future__ import absolute_import
import os.path
from sentry.models import Activity
from sentry.services.smtp import SentrySMTPServer, STATUS
from sentry.testutils import TestCase
from sentry.utils.email import (
group_id_to_email, email_to_group_id, _CaseInsensitiveSigner,
)
fixture = open(os.path.dirname(... | {
"content_hash": "c390b793d4b43857108d498bf0300741",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 121,
"avg_line_length": 40.56,
"alnum_prop": 0.6715976331360947,
"repo_name": "mitsuhiko/sentry",
"id": "1ec8a2f8e264a81db06e1fe98566a53edbd81201",
"size": "2028",
"binar... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_vflow_table_profile
from units.modules.utils import set_module_args
from .nvos_module import TestNvosModule
class TestVflowTableProfileModule(Tes... | {
"content_hash": "6892dc178b71f7376e1c26aea950d3fa",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 110,
"avg_line_length": 43.70454545454545,
"alnum_prop": 0.6521060842433697,
"repo_name": "thaim/ansible",
"id": "d31c0f8d48ad4cbad94785d8a8f6d4669fc65820",
"size": "2058",... |
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
def __init__(self):
GenericSyntax.__init__(self)
@staticmethod
def escape(expression, qu... | {
"content_hash": "8300ca02ecf00d3b00d78ecde8a86c09",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 104,
"avg_line_length": 30.5,
"alnum_prop": 0.6154992548435171,
"repo_name": "glaudsonml/kurgan-ai",
"id": "ffd9141cb35f3dfc7e3a37beb1ab81621fc3ffb9",
"size": "694",
"bin... |
from __future__ import unicode_literals
from collections import namedtuple
from decimal import Decimal
from prices import Price
from uuid import uuid4
from django.conf import settings
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.encoding import... | {
"content_hash": "bde979022b1618fa6f392944b1fbbb28",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 89,
"avg_line_length": 34.21621621621622,
"alnum_prop": 0.6263823064770933,
"repo_name": "tfroehlich82/saleor",
"id": "ea8c6d37af0849cce963cdfcff35971bd8f51992",
"size": "... |
# Copyright 2020 Google LLC
#
# 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, s... | {
"content_hash": "fd5c844f1780a04ac47c59836459d4da",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 94,
"avg_line_length": 29.104166666666668,
"alnum_prop": 0.6639226914817467,
"repo_name": "googleapis/google-cloud-php-secret-manager",
"id": "fd9bfc18db20ddae710827325cbd1a0... |
import sys
import cv2
from ikalog.utils import *
from ikalog.scenes.scene import Scene
class GameFinish(Scene):
def reset(self):
super(GameFinish, self).reset()
self._last_event_msec = - 100 * 1000
def match_no_cache(self, context):
if self.matched_in(context, 60 * 1000, attr='_las... | {
"content_hash": "75f0a23d0783af7ba16602a82411ba70",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 86,
"avg_line_length": 26.074074074074073,
"alnum_prop": 0.5710227272727273,
"repo_name": "deathmetalland/IkaLog",
"id": "00a391999a02ebb19ded6940be1b48e9c873f7ce",
"size":... |
"""
Library to extract information from a service. Also clear the page
of service so that it is ready for next customer.
"""
__version__ = "1.0.1"
__author__ = "Sorawee Porncharoenwase"
import init
import pywikibot
import wp
from wp import lwikitable, linfo, lre
def glob():
global patclear
patclear = lre.lre... | {
"content_hash": "7269e2284b85c3487da384a57af55d3a",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 77,
"avg_line_length": 28.308641975308642,
"alnum_prop": 0.5708678587003925,
"repo_name": "nullzero/wprobot",
"id": "242def3dc13a4b66fc671b1c2b5e30ea09569285",
"size": "231... |
from vnc_api.vnc_api import *
from cfgm_common import importutils
from cfgm_common import exceptions as vnc_exc
from cfgm_common import svc_info
from agent import Agent
from config_db import ServiceApplianceSM, ServiceApplianceSetSM, \
LoadbalancerPoolSM, InstanceIpSM, VirtualMachineInterfaceSM, \
VirtualIpSM... | {
"content_hash": "3df4a0f85aa0881b966f5bad2af269a6",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 102,
"avg_line_length": 36.01670644391408,
"alnum_prop": 0.5527135378702538,
"repo_name": "vpramo/contrail-controller",
"id": "3f9850c4ea26eef30b66721db07c81300d1707d6",
"... |
import sys, os, arcgisscripting, subprocess
def check_output(command,console):
if console == True:
process = subprocess.Popen(command)
else:
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
output,error = pro... | {
"content_hash": "e34403aeeb4c9ed9ca5198da30b15280",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 130,
"avg_line_length": 30.143737166324435,
"alnum_prop": 0.6352179836512262,
"repo_name": "strummerTFIU/TFG-IsometricMaps",
"id": "8ca80a7f87e9137acad78177a00bc84280562462"... |
"""
Describes the Stream application for Django
"""
##########################################################################
## Imports
##########################################################################
from django.apps import AppConfig
######################################################################... | {
"content_hash": "7ba8c022746c49f724b9f13000e8fcc0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 29.88235294117647,
"alnum_prop": 0.2933070866141732,
"repo_name": "DistrictDataLabs/minimum-entropy",
"id": "f0f412fcd1af0ca0d20c4a6e1de03258af3c5b95",... |
from .nnet import NeuralNet
| {
"content_hash": "596842a35a31961657292325e5537dda",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.8214285714285714,
"repo_name": "rushter/MLAlgorithms",
"id": "0291fed208dbcff10a89da029a8149dd05ffe7f1",
"size": "28",
"binary":... |
"""Support for running coroutines in parallel with staggered start times."""
__all__ = 'staggered_race',
import contextlib
import typing
from . import events
from . import exceptions as exceptions_mod
from . import locks
from . import tasks
async def staggered_race(
coro_fns: typing.Iterable[typing.Callabl... | {
"content_hash": "35b86d18115a5f7b8afab9b06dd3b020",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 80,
"avg_line_length": 40.214765100671144,
"alnum_prop": 0.62283044058745,
"repo_name": "xyuanmu/XX-Net",
"id": "451a53a16f3831611b6fc9b55f9eff5468924793",
"size": "5992",... |
'''
CommentParsing
'''
##
# Import Modules
#
import re
from Library.String import GetSplitValueList
from Library.String import CleanString2
from Library.DataType import HEADER_COMMENT_NOT_STARTED
from Library.DataType import TAB_COMMENT_SPLIT
from Library.DataType import HEADER_COMMENT_LICENSE
from Li... | {
"content_hash": "c3857c90d4075b8e241d2c9308db37ce",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 118,
"avg_line_length": 35.78310502283105,
"alnum_prop": 0.5624322082562369,
"repo_name": "tianocore/buildtools-BaseTools",
"id": "5c07f34a7467e8c8947233339c5fb311d8f50ab0",... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Move content from the general field to definitions with role 'General Definition'"""
for gloss in orm.Gloss.objects.filter(ge... | {
"content_hash": "01105838c0b99f4c18803750fc1adab2",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 146,
"avg_line_length": 91.15463917525773,
"alnum_prop": 0.555530422981226,
"repo_name": "Signbank/Auslan-signbank",
"id": "351de85fc70c455f39448d6ceca42e2529f64ba2",
"siz... |
"""
This program can replay a planning output pb file via ros
"""
import os.path
import sys
import argparse
import rospy
from std_msgs.msg import String
from google.protobuf import text_format
import common.message_manager as message_manager
def seq_publisher(seq_num, period):
"""publisher"""
rospy.init_nod... | {
"content_hash": "206287264bda172ff87c481eb728f379",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 78,
"avg_line_length": 29.79032258064516,
"alnum_prop": 0.5939361126150514,
"repo_name": "wanglei828/apollo",
"id": "1f17e62897c2596ddb31971270bffc5700407668",
"size": "263... |
from __future__ import absolute_import
import datetime
import six
from django.utils import timezone
from uuid import uuid4
from sentry import tagstore
from sentry.api.endpoints.organization_releases import ReleaseSerializerWithProjects
from sentry.api.serializers import serialize
from sentry.models import (
Comm... | {
"content_hash": "186f1f6da86c9597f06f2b4a29ac8039",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 93,
"avg_line_length": 34.91777777777778,
"alnum_prop": 0.5806020492585757,
"repo_name": "gencer/sentry",
"id": "fd01523af1f42607bcd8e4ee33a145830d8f95e3",
"size": "15738"... |
from setuptools import setup
import re
import ast
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('ytfs/ytfs.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name = 'ytfs',
version = version,
description = "YouTube... | {
"content_hash": "8b77d0b46715b8d4667063c1170410ed",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 150,
"avg_line_length": 34.44736842105263,
"alnum_prop": 0.6065699006875478,
"repo_name": "nikeee/ytfs",
"id": "1df8b123cef2bead1dd78b1b4c7d2d165b936285",
"size": "1333",
... |
from social_core.backends.suse import OpenSUSEOpenId
| {
"content_hash": "b0a985cadfb6f587a56c1f6dfd61b4d5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 52,
"avg_line_length": 53,
"alnum_prop": 0.8679245283018868,
"repo_name": "IKholopov/HackUPC2017",
"id": "92ea7b558ce2c819c18a4f8cf1bdb4b7c3c990f9",
"size": "53",
"binary"... |
from setuptools import find_packages, setup
setup(
name='isic-discourse-sso',
version='1.0.0',
description='Girder plugin for a Discourse Single-Sign-On provider.',
url='https://github.com/ImageMarkup/isic-discourse-sso',
license='Apache 2.0',
packages=find_packages(exclude=['tests']),
pyth... | {
"content_hash": "93f9fd62629a8c974f33b2e9e52c5b62",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 93,
"avg_line_length": 36.84615384615385,
"alnum_prop": 0.6847599164926931,
"repo_name": "ImageMarkup/discourse_sso",
"id": "26b71da41956547628db670a76af2e9e60aafb4d",
"siz... |
from django.utils import six
from openpyxl import Workbook
from openpyxl.styles import Font
from openpyxl.writer.write_only import WriteOnlyCell
from main.utils_data_package import GenericSchema
COLUMN_HEADER_FONT = Font(bold=True)
class DefaultExporter:
def __init__(self, dataset, records=None):
self.d... | {
"content_hash": "f714babf176a39c69926cfd70631bcdc",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 96,
"avg_line_length": 30.133333333333333,
"alnum_prop": 0.5586283185840708,
"repo_name": "ropable/biosys",
"id": "d96a903e7536d40612dce27fa672080317d8b8c9",
"size": "2712"... |
"""
Pylons application test package
This package assumes the Pylons environment is already loaded, such as
when this script is imported from the `nosetests --with-pylons=test.ini`
command.
This module initializes the application via ``websetup`` (`paster
setup-app`) and provides the base testing objects.
"""
#!<Pylin... | {
"content_hash": "6e9c5a1bbf5f01c0e0f8ac6c767cc4eb",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 28.025,
"alnum_prop": 0.7154326494201606,
"repo_name": "cronuspaas/cronusagent",
"id": "7a67164cd811d9efe386d9652ca102f113f4278b",
"size": "1121",
... |
import serial
ser = serial.Serial('/dev/ptyp3', 115200, timeout=1)
# ----------------------------------------------------------------------------------------
# Function Name: main()
# Parameters: None
# Returns: None
# Description: Utilizing the serial library, writing and reading from the serial port
# --... | {
"content_hash": "6364d9a40a95b4eb7196db02f96b6851",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 90,
"avg_line_length": 32.75,
"alnum_prop": 0.4255725190839695,
"repo_name": "itsallvoodoo/home_automation",
"id": "a738f4149f298747837438fa4b9c8e4cc3e7bd1f",
"size": "681"... |
from string import Template
from datetime import date
bitcoinDir = "./";
inFile = bitcoinDir+"/share/qt/Info.plist"
outFile = "gecicoin-Qt.app/Contents/Info.plist"
version = "unknown";
fileForGrabbingVersion = bitcoinDir+"gecicoin-qt.pro"
for line in open(fileForGrabbingVersion):
lineArr = line.replace(" ... | {
"content_hash": "03977f00f5c443b4ffb657fc4cc24163",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 27.291666666666668,
"alnum_prop": 0.7099236641221374,
"repo_name": "gecicoin/gecicoin",
"id": "692478dc33d6abf67790b02ab689f6f20a4fed4d",
"size": "89... |
import unittest
import numpy as np
import random
from op_test import OpTest
def gen_match_and_neg_indices(num_prior, gt_lod, neg_lod):
if len(gt_lod) != len(neg_lod):
raise AssertionError("The input arguments are illegal.")
batch_size = len(gt_lod) - 1
match_indices = -1 * np.ones((batch_size, n... | {
"content_hash": "69c6baa3437aa300fe87cceaa3ebf9b0",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 80,
"avg_line_length": 33.55172413793103,
"alnum_prop": 0.5280575539568345,
"repo_name": "lcy-seso/Paddle",
"id": "ccb41e56c5555b8c79674449c9139ada0bc47aac",
"size": "5478... |
""" Functions and classes dealing with the version command """
from foe import get_program_name, get_version
commands = ['version', '-V', '--version']
description = 'Prints the version of the program'
def execute(parsed_args=None, *args, **kwargs):
""" Executes the version command. """
print('{program} {ver... | {
"content_hash": "3b486a5cd13c815ba30c114c7fcdcc72",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 90,
"avg_line_length": 33.5,
"alnum_prop": 0.6915422885572139,
"repo_name": "robobrobro/foe",
"id": "28e8dd131704030ba8853a710904c0936cc47934",
"size": "402",
"binary": f... |
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: os_security_group
short_description: Add/Delete security groups from a... | {
"content_hash": "7e1d16ec92d83b1d67a4b967deb696b8",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 76,
"avg_line_length": 28.146153846153847,
"alnum_prop": 0.6162886034435638,
"repo_name": "nwiizo/workspace_2017",
"id": "3ed5dfceb7a11de432a0d4fd318a50e375f4544f",
"size"... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class MempoolLimitTest(BitcoinTestFramework):
def __init__(self):
self.txouts = gen_return_txouts()
def setup_network(self):
self.nodes = []
self.nodes.append(start_node(0, self.options.tm... | {
"content_hash": "86c4c8e362ef2dbcf0ec19da8f836233",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 119,
"avg_line_length": 41.854166666666664,
"alnum_prop": 0.633648581383773,
"repo_name": "mainconceptx/DAS",
"id": "226e7b3760c67ec1e1b4485bb112369c9d2f006a",
"size": "228... |
from pyjamas import DOM
from pyjamas import Factory
from pyjamas.ui.ComplexPanel import ComplexPanel
class FlowPanel(ComplexPanel):
def __init__(self, **kwargs):
element = None
if kwargs.has_key('Element'):
element = kwargs.pop('Element')
if element is None:
element... | {
"content_hash": "e3ed9d3ba2670c7870940c9a4ae9c8d9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 69,
"avg_line_length": 27,
"alnum_prop": 0.6472663139329806,
"repo_name": "pombredanne/pyjs",
"id": "587a72258e6e737ae7d097385ec80293c3c402ae",
"size": "1227",
"binary": ... |
"""Tests for template engine.
"""
import warnings
from _common import unittest
from beets.util import functemplate
def _normexpr(expr):
"""Normalize an Expression object's parts, collapsing multiple
adjacent text blocks and removing empty text blocks. Generates a
sequence of parts.
"""
textbuf = ... | {
"content_hash": "25970761e8ef835cc3111047964b55c3",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 78,
"avg_line_length": 36.29277566539924,
"alnum_prop": 0.5858564693556836,
"repo_name": "andremiller/beets",
"id": "20c0df8f4ea6113d9e55160e2d8abdf5dedaddc2",
"size": "10... |
"""
Support for the World Air Quality Index service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.waqi/
"""
import asyncio
import logging
from datetime import timedelta
import aiohttp
import voluptuous as vol
from homeassistant.exceptions impo... | {
"content_hash": "30db865673b5dc5e6f230db419f27138",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 30.771929824561404,
"alnum_prop": 0.6033827442037248,
"repo_name": "tinloaf/home-assistant",
"id": "d6b8d278fb15d7e6e9a881af3dc109510fc2f082",
"size... |
"""
Pluggable Weighing support
"""
from nova import loadables
class WeighedObject(object):
"""Object with weight information."""
def __init__(self, obj, weight):
self.obj = obj
self.weight = weight
def __repr__(self):
return "<WeighedObject '%s': %s>" % (self.obj, self.weight)
... | {
"content_hash": "7849c9525402090b69138521dd96e78d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 31.089285714285715,
"alnum_prop": 0.6214819069500287,
"repo_name": "n0ano/gantt",
"id": "da5c93a7adbd9cd0cdb4847bce0799041f134eef",
"size": "2386",
... |
from django.test import SimpleTestCase
from corehq.apps.users.custom_data import _get_invalid_user_data_fields
from corehq.apps.users.models import CommCareUser
class RemoveUnusedFieldsTestCase(SimpleTestCase):
def test_empty(self):
user_with_no_fields = CommCareUser(user_data={})
self.assertEqu... | {
"content_hash": "de91ff4eb8fe23de334f879b06b78326",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 107,
"avg_line_length": 54.125,
"alnum_prop": 0.6458814472671286,
"repo_name": "dimagi/commcare-hq",
"id": "5654b68495a5715072fd781e7a330c3cabe99744",
"size": "1299",
"bi... |
"""
Volume driver library for NetApp 7/C-mode block storage systems.
"""
import math
import sys
import uuid
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
import six
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
from cinder.volume.drivers.neta... | {
"content_hash": "fa7aed8080b4564fd0bd498a9ce262a9",
"timestamp": "",
"source": "github",
"line_count": 807,
"max_line_length": 79,
"avg_line_length": 40.79182156133829,
"alnum_prop": 0.5616817035754428,
"repo_name": "yanheven/cinder",
"id": "27633d627f431428413a93123abd727758ad799f",
"size": "3389... |
from signal import SIGINT
from proton import Message
from system_test import TestCase
from system_test import Qdrouterd
from system_test import main_module
from system_test import TIMEOUT
from system_test import Process
from system_test import AsyncTestSender
from system_test import unittest
class ThreeRouterTest(T... | {
"content_hash": "0a8403511e7379104a2ce6faaebb3f29",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 82,
"avg_line_length": 38.9392523364486,
"alnum_prop": 0.5540621624864994,
"repo_name": "ErnieAllen/qpid-dispatch",
"id": "6dc010337b6521088a415e53078e628859a81c2f",
"size... |
from django.conf.urls import url
from . import views
urlpatterns = [
url('^statistics/$', views.statistics_view, name='manage.statistics'),
url('^errormenow/$', views.errormenow_view, name='manage.errormenow')
]
| {
"content_hash": "d3b57a296b06556f50e340dff82a1c71",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.7040358744394619,
"repo_name": "mozilla/standup",
"id": "68413d8427b1db254e89ddeb24a212533283f756",
"size": "223",
... |
import sys
import string
import socket
import select
import unittest
import threading
import time
import re
import struct
from memcacheConstants import REQ_MAGIC_BYTE, RES_MAGIC_BYTE
from memcacheConstants import REQ_PKT_FMT, RES_PKT_FMT, MIN_RECV_PACKET
from memcacheConstants import SET_PKT_FMT, DEL_PKT_FMT, INCRDECR... | {
"content_hash": "adb7df2db9cbda0834bd1e35f4f55978",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 88,
"avg_line_length": 29.893617021276597,
"alnum_prop": 0.5479240806642942,
"repo_name": "membase/moxi",
"id": "2bad0a594a0ffa96ebad435aef86142fa3826617",
"size": "8430",... |
from __future__ import annotations
import json
from unittest import mock
import boto3
import pytest
from moto import mock_glue, mock_iam
from airflow.providers.amazon.aws.hooks.glue import GlueJobHook
class TestGlueJobHook:
def setup_method(self):
self.some_aws_region = "us-west-2"
@mock_iam
@... | {
"content_hash": "e9ae47e8c30b19dbe6f4dc7253e6c9bd",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 109,
"avg_line_length": 40.95652173913044,
"alnum_prop": 0.5943281771307249,
"repo_name": "apache/airflow",
"id": "18e252a039bbf0c3378137dbec194eeaf36d9e07",
"size": "7381... |
'''
Quickstart example.
'''
import json
import twitterwebsearch
import twitterwebsearch.io
QUERY = '@shinnonoir since:2010-01-20 until:2010-02-01'
def main():
tweets = twitterwebsearch.search(QUERY)
tweets = list(tweets) # convert generator into list
print json.dumps(tweets, indent=2)
twitt... | {
"content_hash": "d7ab722fd57a6442142cd10892da4563",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 22.869565217391305,
"alnum_prop": 0.6863117870722434,
"repo_name": "ShinNoNoir/twitterwebsearch",
"id": "f8fc354b13b907cfdf8737e735a805c59f482d6c",
"... |
"""
Test zero-insensitive sum layer
"""
import os
import sys
import numpy as np
from keras.models import Sequential
from keras.layers.core import Lambda, Dense
from keras.layers.embeddings import Embedding
import keras.backend as K
from smlib.keras_model_update import KerasUtils, GlobalZSumPooling1D
# --
# Params... | {
"content_hash": "644e3b57aa376850c4f61559cb360bd6",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 71,
"avg_line_length": 23.340425531914892,
"alnum_prop": 0.6973564266180492,
"repo_name": "gophronesis/smlib",
"id": "82fb2f0cf8c9283850047852f2dac3daa9260822",
"size": "10... |
from bokeh.io import output_file, show
from bokeh.layouts import widgetbox
from bokeh.models.widgets import Button, RadioButtonGroup, Select, Slider
output_file("layout_widgets.html")
# create some widgets
slider = Slider(start=0, end=10, value=1, step=.1, title="Slider")
button_group = RadioButtonGroup(labels=["Opti... | {
"content_hash": "842f6ce20607938bdb92f620c77eca45",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 86,
"avg_line_length": 41.6,
"alnum_prop": 0.7243589743589743,
"repo_name": "percyfal/bokeh",
"id": "48d6e41493f10a8dd1627464f75645f3efb47077",
"size": "624",
"binary": f... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.simulation_parameters import Building
log = logging.getLogger(__name__)
class TestBuilding(unittest.TestCase):
def setUp(self):
self.fd, self.path = tempfile.mkstem... | {
"content_hash": "b4a596f69d1356216b06b08f919457c5",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 134,
"avg_line_length": 37.31818181818182,
"alnum_prop": 0.6735688185140073,
"repo_name": "rbuffat/pyidf",
"id": "8115d751b8086f771f7846afcef31fb7cdd6ab88",
"size": "2463",... |
from itertools import ifilter
from cinderclient.v1 import client as cinder_client
from cinderclient import exceptions as cinder_exc
from cloudferrylib.base import storage
from cloudferrylib.os.identity import keystone
from cloudferrylib.os.storage import filters as cinder_filters
from cloudferrylib.utils import filte... | {
"content_hash": "150d948263a9b9241a20a4abc164f2f4",
"timestamp": "",
"source": "github",
"line_count": 528,
"max_line_length": 79,
"avg_line_length": 40.21401515151515,
"alnum_prop": 0.5522535675599303,
"repo_name": "mgrygoriev/CloudFerry",
"id": "cd3efa35b8c866ef179a1bfbc34e20b27ce655ce",
"size":... |
import requests
from src.Directory import Directory
from src.Disk import Disk
from src.File import File
from src.YandexDiskException import YandexDiskException
class YandexDiskRestClient:
'''
Implementation of https://tech.yandex.ru/disk/poligon/
'''
_base_url = "https://cloud-api.yandex.net:443/v1... | {
"content_hash": "49fcb7cab8ff96403be7796711f3018e",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 95,
"avg_line_length": 28.12,
"alnum_prop": 0.555871661134819,
"repo_name": "Hixon10/simple-rest-yandex-disk-client",
"id": "f6e9f3c9b7a88def7e63c0274c815b14a6cbb17a",
"si... |
"""Config flow for Tellduslive."""
import asyncio
import logging
import os
import async_timeout
from tellduslive import Session, supports_local_api
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from homeassistant.util.json import load_json
from .const imp... | {
"content_hash": "d51b02f8085b11792022080bfaf93278",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 86,
"avg_line_length": 33.78481012658228,
"alnum_prop": 0.5756837766953915,
"repo_name": "adrienbrault/home-assistant",
"id": "33a02cd1f16ff0c75fc3450e3aaf93d3c30df916",
"... |
"""Test the split module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix
from scipy import stats
from scipy.misc import comb
from itertools import combinations
from sklearn.utils.fixes import combinations_with_replacement
from sklearn.u... | {
"content_hash": "ea6e7bd806674fcc2f3f4a8b0f5d1782",
"timestamp": "",
"source": "github",
"line_count": 1066,
"max_line_length": 79,
"avg_line_length": 38.54409005628518,
"alnum_prop": 0.6082311137071651,
"repo_name": "altairpearl/scikit-learn",
"id": "d28148efe6956bc9599e8b6790f8ec8016f93978",
"si... |
import argparse
import hashlib
import os
import subprocess
import sys
from typing import Iterable, List
def expand_reqs_helper(fpath: str) -> List[str]:
result = [] # type: List[str]
for line in open(fpath):
if line.strip().startswith(('#', '--hash')):
continue
dep = line.split("... | {
"content_hash": "61f075705534bd6c4a3d01d5ce09add5",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 92,
"avg_line_length": 32.57627118644068,
"alnum_prop": 0.6305931321540063,
"repo_name": "brainwane/zulip",
"id": "ddc0ada928fbbed5d96460d016cc2bbdc5b91894",
"size": "1945"... |
from __future__ import absolute_import
from __future__ import print_function
from future.utils import iteritems
from future.utils import string_types
from twisted.internet import defer
from twisted.python import log
from buildbot import config
from buildbot.process import buildstep
from buildbot.process import result... | {
"content_hash": "98834b4a2d4be6fdf4bb6c2106e4d0e5",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 97,
"avg_line_length": 39.18348623853211,
"alnum_prop": 0.5822992273472255,
"repo_name": "Alecto3-D/testable-greeter",
"id": "3685ba2c44479ed3de274b74f6abae17cae5b5cb",
"s... |
import os
import sys
import ConfigParser
import socket
import string
import threading,time,paramiko
from PyQt4 import QtGui,QtCore
from modules.uiKDAT import Ui_MainWindow
from modules.uiConnect import Ui_DialogConnect
from modules.uiDialogs import Ui_DialogLinks
from modules.uiEmail import Ui_DialogEmail... | {
"content_hash": "c459fb89da0f5504c95f56e9fcbd6f2a",
"timestamp": "",
"source": "github",
"line_count": 706,
"max_line_length": 111,
"avg_line_length": 36.67988668555241,
"alnum_prop": 0.669524250849552,
"repo_name": "GavinGL/workspace",
"id": "5cdcea44a983cb62c02d447829f8bd9d541d6e91",
"size": "26... |
""" Functions to determine resource locations from the call stack.
This type of resource location is normally requested from the constructor for
an object whose resources are relative to the module constructing the object.
"""
import sys
from os import getcwd
from os.path import dirname, exists
def resource_modul... | {
"content_hash": "e71f43532897f73e586ad708ae76a2b0",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 30.115384615384617,
"alnum_prop": 0.6040868454661558,
"repo_name": "pankajp/pyface",
"id": "6f33dafc8138f18f25ed7fe087024977d80545a2",
"size": "2130"... |
"""
@author Daniel "MaTachi" Jonsson
@copyright Daniel "MaTachi" Jonsson
@license MIT License
"""
from concurrent import futures
import configparser
from optparse import OptionParser
import os
from dunhamftp import DunhamFtp
class MyOptionParser(OptionParser):
def format_epilog(self, formatter):
return se... | {
"content_hash": "a1c194c59f7fd03a3fc3770267511c2f",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 35.86708860759494,
"alnum_prop": 0.5733192165166755,
"repo_name": "matachi/backup-site",
"id": "9d4fedbb086766657d74ba493daf97d3db6b6f8c",
"size": "... |
"""
Do not write over 120 columns per a line.
This rule doesn't recognize tabs. It only think each character as 1 column.
== Violation ==
int HEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO = 1;
<== Violation. Too long
== Good ==
int ... | {
"content_hash": "1abc6096493d39f7344e23676f696702",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 152,
"avg_line_length": 27.339622641509433,
"alnum_prop": 0.5859213250517599,
"repo_name": "codingpoets/tigl",
"id": "e92414129b634d7c5b96125706305f1c8bad100b",
"size": "14... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Entry',
fields=[
('id', models.AutoField(auto_created=True, primary_key... | {
"content_hash": "8a19f1c052309ca6f09bea5ea384e8ab",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 114,
"avg_line_length": 29.576923076923077,
"alnum_prop": 0.5331599479843954,
"repo_name": "hwayne/safehouse",
"id": "cff607c464659ea4abea55b28fd74fc7dd949465",
"size": "79... |
from __future__ import print_function
import os
import re
import signal
import subprocess
import sys
import threading
import time
from ..local.android import (
android_driver, CommandFailedException, TimeoutException)
from ..local import utils
from ..objects import output
BASE_DIR = os.path.normpath(
os.pat... | {
"content_hash": "22639a29f3ef401009c81a9f7d5e338f",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 80,
"avg_line_length": 29.058441558441558,
"alnum_prop": 0.6369832402234636,
"repo_name": "enclose-io/compiler",
"id": "b68252c1396c35ebd784ac3ff7338805b59761c7",
"size": ... |
import json
from wptserve.utils import isomorphic_decode
def main(request, response):
if b"origin" in request.GET:
response.headers.set(b"Access-Control-Allow-Origin", request.GET[b"origin"])
elif b"origins" in request.GET:
for origin in request.GET[b"origins"].split(b','):
respons... | {
"content_hash": "acb86c1e6707f8065c169a4988beaa99",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 88,
"avg_line_length": 34.88461538461539,
"alnum_prop": 0.6780595369349504,
"repo_name": "ric2b/Vivaldi-browser",
"id": "32c11a0c39baa465f3214c37e9a63fa35a3a3862",
"size": ... |
import os
from surface_io import open_geom, save_binary_stl
def convert():
ivdir = os.path.join(os.getcwd(), r"INVENTOR")
stldir = os.path.join(os.getcwd(), r"STL_BINARY")
if os.path.isdir(ivdir):
if not os.path.exists(stldir):
os.mkdir(stldir)
for iv in os.listdir(ivdir):
srf = open_geom(os.pat... | {
"content_hash": "5868d96fdddbe4217e4419510d3b1415",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 84,
"avg_line_length": 30.529411764705884,
"alnum_prop": 0.6473988439306358,
"repo_name": "pombredanne/metamorphosys-desktop",
"id": "2b98ebf0e87f5a8aeb30f7f158e8da4f1d35a836... |
import functools
import logging
import click
_ctx = click.get_current_context
LOGGER_KEY = __name__ + '.logger'
DEFAULT_LEVEL = logging.INFO
def _meta():
return _ctx().meta.setdefault(LOGGER_KEY, {})
class ColorFormatter(logging.Formatter):
colors = {
'error': dict(fg='red'),
'exception':... | {
"content_hash": "cb95a03ef49ed2525f35c7e00ebf012e",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 24.314606741573034,
"alnum_prop": 0.583641404805915,
"repo_name": "pombredanne/click-log",
"id": "562e4bb6bfc344f6b881cfd12566a65cca2a00fe",
"size": ... |
from bitstampy import api
import time
# Incrementally call all non-private API endpoints
# Ticker
print('Ticker %s' % api.ticker())
time.sleep(1.1)
# Order Book
book = api.order_book()
book['bids'] = book['bids'][:5]
book['asks'] = book['asks'][:5]
print('Order book %s' % book)
time.sleep(1.1)
# Transactions
print(... | {
"content_hash": "d5d7afbb56d994afcac8fa3802f1fc6a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 20.73913043478261,
"alnum_prop": 0.6813417190775681,
"repo_name": "unwitting/bitstampy",
"id": "965fd1bb9f63e26aed6f1793df1f38f2b24197cb",
"size": "4... |
import httplib2
from flask import url_for, session, redirect, request, render_template, json
from oauth2client import client
from app import app
from utils import crossdomain, getcachedthreads, rendercollection, getcontext, getmessages
from app import cache
@app.route('/', methods=['GET'])
def index():
return red... | {
"content_hash": "6e9326ba4645148ff3c80e21cd1e3d1c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 95,
"avg_line_length": 37.12,
"alnum_prop": 0.6918103448275862,
"repo_name": "calcutec/piemail",
"id": "f7e3841589d38a8c294b77051bde95340547afce",
"size": "2784",
"binary... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.