text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function
import sys
import os
if sys.version_info > (2, 7, 0):
import unittest
else:
import unittest2 as unittest
from mock import Mock
from tempfile import NamedTemporaryFile
sys.path.append(os.path.join(os.path.dirname(__file__), '../bin'))
import qds
import qds_sdk
from qds_sdk.c... | {
"content_hash": "1875b50b0772557b299d3544951f172b",
"timestamp": "",
"source": "github",
"line_count": 1297,
"max_line_length": 200,
"avg_line_length": 41.98612181958365,
"alnum_prop": 0.4742177170559718,
"repo_name": "adeshr/qds-sdk-py",
"id": "8821585e7170b1480e17bbdbd508bb360da20274",
"size": "... |
import os
import copy
import salt.config
DEFAULT_EBI_CONFIG = {
'root': '{0}/ebi'.format(os.getcwd()),
'list': False,
'grains': False,
'pillar': False
}
def ebi_config():
return copy.deepcopy(DEFAULT_EBI_CONFIG)
def ebi_minion_config():
return copy.deepcopy(salt.config.DEFAULT_MINION_OPTS)
| {
"content_hash": "e571d1a584215b93c010dc8c19dec04e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 57,
"avg_line_length": 19.875,
"alnum_prop": 0.6666666666666666,
"repo_name": "zombiemonkey/ebi",
"id": "7598a5f6acf3ec19c740704710b312a05f648bba",
"size": "339",
"binary... |
str_to_int = {
'unknown': 0,
'saccade': 1,
'fixation': 2
}
int_to_str = [
'unknown',
'saccade',
'fixation'
]
class ClassError(Exception):
pass
def convert_to_integers(stringclasses):
for s in stringclasses:
if s in str_to_int:
yield str_to_int[s]
else:
... | {
"content_hash": "8b432e28caff5b434f07773b07cb03c8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 53,
"avg_line_length": 20.5,
"alnum_prop": 0.5627177700348432,
"repo_name": "infant-cognition-tampere/gazeclassifier-py",
"id": "fa80f82278041a62d5e0b64522de2ce6160bf80b",
... |
"""Test alarm notifier."""
from aodh import notifier
class TestAlarmNotifier(notifier.AlarmNotifier):
"Test alarm notifier."""
def __init__(self, conf):
super(TestAlarmNotifier, self).__init__(conf)
self.notifications = []
def notify(self, action, alarm_id, alarm_name, severity,
... | {
"content_hash": "a3b530232b163baf31dcdc16df75628d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 33.18181818181818,
"alnum_prop": 0.44246575342465755,
"repo_name": "openstack/aodh",
"id": "0a316fd4e86b8b1e14a81011ae49a55e76f20037",
"size": "1310"... |
import unittest
from distutils.version import LooseVersion
from . import IntegrationTestCase, doxygen_version
class Example(IntegrationTestCase):
def test_cpp(self):
self.run_doxygen(index_pages=[], wildcard='*.xml')
self.assertEqual(*self.actual_expected_contents('path-prefix_2configure_8h_8cma... | {
"content_hash": "2fbb02dcf48e9a1f4bf22082979360cc",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 105,
"avg_line_length": 43.15,
"alnum_prop": 0.7068366164542295,
"repo_name": "mosra/m.css",
"id": "c6bd279c7889d1e6b94e8746be21f83764dc1058",
"size": "2093",
"binary": f... |
"""Mask schedule functions R."""
import math
import jax
import jax.numpy as jnp
def schedule(ratio, total_unknown, method="cosine"):
"""Generates a mask rate by scheduling mask functions R.
Given a ratio in [0, 1), we generate a masking ratio from (0, 1]. During
training, the input ratio is uniformly sampled; ... | {
"content_hash": "da405e49bceed56fdfb8634ac67bc8d8",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 37.23684210526316,
"alnum_prop": 0.669964664310954,
"repo_name": "google-research/maskgit",
"id": "2681fde6fe142a1a4aa3200a2b54b87f19a871ce",
"size":... |
"""
Created on Wed Jan 20 16:08:56 2016
@author: Thibault
"""
import pandas as pd
import numpy as np
# Loading the data
data_dir = '../data'
# training and validation sets
train_file = data_dir + '/blocking1114.csv'
# Opening the blocking data
TrainFile = pd.read_csv(train_file, header=None)
TrainFile.columns = ['... | {
"content_hash": "3a64368f3b3fc5861514afab91ddd9b1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 135,
"avg_line_length": 23.30666666666667,
"alnum_prop": 0.7362700228832952,
"repo_name": "PatentBlocker/Motorola_Patent_Citations",
"id": "9bbc31f90114e5b4a31b609319b5c902ec... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('phonelog', '0012_server_date_not_null'),
]
operations = [
migrations.DeleteModel(
name='OldDeviceReportEntry',
),
]
| {
"content_hash": "43896aafba64c7aab040f025640d41e6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 50,
"avg_line_length": 18.785714285714285,
"alnum_prop": 0.596958174904943,
"repo_name": "dimagi/commcare-hq",
"id": "c538bac77d1b385a46d6dbc079b60917fab073d2",
"size": "31... |
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 model 'RepositoryUser'
db.create_table('repositories_repositoryuser', (
('id', self.gf('django.db.model... | {
"content_hash": "da0bceb448c5004481970cdc4d5d3508",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 182,
"avg_line_length": 63.55294117647059,
"alnum_prop": 0.5638652350981118,
"repo_name": "stephrdev/brigitte",
"id": "bbc930727be94e68dad74bd64b2c630d712f7795",
"size": "5... |
from math import sin, cos, atan2, sqrt
from datatypes import position, distance, direction
class station:
"""An object representing a weather station."""
def __init__( self, id, city=None, state=None, country=None, latitude=None, longitude=None):
self.id = id
self.city = city
self.state = state
... | {
"content_hash": "69ef53182ddf96a11e84798d3abf4d03",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 94,
"avg_line_length": 27.875,
"alnum_prop": 0.6266816143497758,
"repo_name": "Hotpirsch/tbot",
"id": "604140ed54d1d287b9a7631632a9f859bd5c4a4c",
"size": "1022",
"binary"... |
import unittest
import numpy as np
import pints
import pints.toy as toy
from shared import StreamCapture
class TestDifferentialEvolutionMCMC(unittest.TestCase):
"""
Tests the basic methods of the differential evolution MCMC method.
"""
@classmethod
def setUpClass(cls):
""" Prepare a pro... | {
"content_hash": "249ec7bfdd688b03f80dfa131ca7c59e",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 79,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.5879854368932039,
"repo_name": "martinjrobins/hobo",
"id": "cf00ffb24efa18d33aa36d7b94f35022ec635900",
"size": "... |
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class CreatedByMixin(models.Model):
"""
Mixin to add created by fields to a model.
"""
created_date = models.DateTimeField(
auto_now_add=True, null=True, blank=True)
created_by... | {
"content_hash": "778cc52b534d285c981c9578d5361cf5",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 74,
"avg_line_length": 25.575757575757574,
"alnum_prop": 0.6481042654028436,
"repo_name": "geosoco/reddit_coding",
"id": "d8d5b20065bf31190b86384f12ed40ebdbd7a6d2",
"size":... |
import unittest
from application import server, app
import json
class ApplicationTestCase(unittest.TestCase):
def setUp(self):
server.app.config['TESTING'] = True
self.app = server.app.test_client()
headers = {'content-type': 'application/json; charset=utf-8'}
history_data = '{"t... | {
"content_hash": "774aef75dcaa6e0c197d870c3985e34f",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 96,
"avg_line_length": 41.45945945945946,
"alnum_prop": 0.6642764015645372,
"repo_name": "LandRegistry/historian-alpha",
"id": "8bd64a435a76cb85b5fbf9bfd081a25744d704b0",
"... |
from __future__ import absolute_import, division, print_function, unicode_literals
from .common import BaseTest, functional
from c7n.filters import FilterValidationError
class VpcTest(BaseTest):
@functional
def test_flow_logs(self):
factory = self.replay_flight_data(
'test_vpc_flow_logs'... | {
"content_hash": "384665481eb53d4d046a06fa0e9ea51f",
"timestamp": "",
"source": "github",
"line_count": 1068,
"max_line_length": 88,
"avg_line_length": 37.254681647940075,
"alnum_prop": 0.5050015079923595,
"repo_name": "VeritasOS/cloud-custodian",
"id": "e2edaf72885e738b370b45070ca047913ccbae65",
"... |
import logging
import xbmc
import xbmcgui
import mythbox.msg as m
import mythbox.ui.toolkit as ui
import Queue
from datetime import datetime, timedelta
from mythbox.mythtv.conn import inject_conn
from mythbox.mythtv.db import inject_db
from mythbox.mythtv.domain import RecordingSchedule, Channel
from mythbox.mythtv.en... | {
"content_hash": "a07603778f6e7408f4061ef2163970d2",
"timestamp": "",
"source": "github",
"line_count": 951,
"max_line_length": 133,
"avg_line_length": 39.83701366982124,
"alnum_prop": 0.5291804144120364,
"repo_name": "GetSomeBlocks/Score_Soccer",
"id": "63314c499582d6eb1353d90a069cdb5c72798288",
"... |
from runner.koan import *
class AboutDeletingObjects(Koan):
def test_del_can_remove_slices(self):
lottery_nums = [4, 8, 15, 16, 23, 42]
del lottery_nums[1]
del lottery_nums[2:4]
self.assertEqual([4, 15, 42], lottery_nums)
def test_del_can_remove_entire_lists(self):
lot... | {
"content_hash": "31dd4d654ca921b768b473da8922bee0",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 100,
"avg_line_length": 28.181818181818183,
"alnum_prop": 0.5181818181818182,
"repo_name": "ahartz1/python_koans",
"id": "74c52eecf18872fe121a886ca61d3058b7f830aa",
"size"... |
import numbers
from typing import Any, Union
import pandas as pd
from pandas.api.types import CategoricalDtype
from pyspark.pandas.base import column_op, IndexOpsMixin
from pyspark.pandas._typing import Dtype, IndexOpsLike, SeriesOrIndex
from pyspark.pandas.data_type_ops.base import (
DataTypeOps,
is_valid_op... | {
"content_hash": "6380148a0ef5e9c8f3c2bec5c0f5751e",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 100,
"avg_line_length": 42.745714285714286,
"alnum_prop": 0.6058418554909432,
"repo_name": "jiangxb1987/spark",
"id": "cb7794531de085fcfd5073666414b3d298a46530",
"size": "... |
from setuptools import setup
from pymba import __version__
setup(name='pymba',
version=__version__,
description="Pymba is a Python wrapper for Allied Vision's Vimba C API.",
long_description=(
"Pymba is a Python wrapper for Allied Vision's Vimba C API. It wraps the Vimba C library "
... | {
"content_hash": "ccfee4c0c28c82cf4fc21deb408e48af",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 119,
"avg_line_length": 38.283018867924525,
"alnum_prop": 0.5988171513060621,
"repo_name": "morefigs/pymba",
"id": "aed8a2da50b8aecb3eeb797f773d510a5bbaff5a",
"size": "2029... |
"""
CpuVulns - files ``/sys/devices/system/cpu/vulnerabilities/*``
==============================================================
Parser to parse the output of files ``/sys/devices/system/cpu/vulnerabilities/*``
"""
from insights import Parser
from insights import parser
from insights.specs import Specs
from insights... | {
"content_hash": "b6374015dbd51a7bb3db49d87c08b85d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 81,
"avg_line_length": 29.396551724137932,
"alnum_prop": 0.6093841642228739,
"repo_name": "RedHatInsights/insights-core",
"id": "ffee4d6d4fc4929347f8c0293595bcc7a0681bfb",
... |
import re
from bisect import bisect
from django.conf import settings
from django.db.models.related import RelatedObject
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.models.loa... | {
"content_hash": "bced90cd4429f9abdcc4f8c3b80916e8",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 122,
"avg_line_length": 41.66988416988417,
"alnum_prop": 0.5822561964327079,
"repo_name": "azurestandard/django",
"id": "7308a15c6bd12e7c4324fd13de3f214d72ec6780",
"size":... |
import unittest
from array import array
from collections import UserDict, UserList, UserString
from collections.abc import Mapping
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from robot.utils import (is_bytes, is_falsy, is_dict_like, is_list_like, is_string,
is_truthy, is_... | {
"content_hash": "4c8cfe5bb627385ee5d8ba2f485d8a58",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 86,
"avg_line_length": 34.75308641975309,
"alnum_prop": 0.5385435168738899,
"repo_name": "robotframework/robotframework",
"id": "2c19d7afa1177e299029db1d982c3794f1637c2f",
... |
"""Contrib data iterators for common data formats."""
from __future__ import absolute_import
from ..io import DataIter, DataDesc
from .. import ndarray as nd
class DataLoaderIter(DataIter):
"""Returns an iterator for ``mx.gluon.data.Dataloader`` so gluon dataloader
can be used in symbolic module.
Paramet... | {
"content_hash": "45387cdaf67d3e391135104bab39cbde",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 94,
"avg_line_length": 34.03896103896104,
"alnum_prop": 0.6001526135062953,
"repo_name": "reminisce/mxnet",
"id": "3364fcd215d198c4736ec15f0c32fbde0338c9dd",
"size": "3423"... |
import unittest
from app import hello
class TestHelloApp(unittest.TestCase):
def test_hello(self):
self.assertEqual(hello(), "Hello World!\n")
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "f233c961a9bea19a9564262f249ddc5d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 47,
"avg_line_length": 19.7,
"alnum_prop": 0.6802030456852792,
"repo_name": "GoogleCloudPlatform/gke-gitops-tutorial-cloudbuild",
"id": "93b0c68bfa4f26dd10ffe0fba30e021307674... |
import logging
# Set PYTHONPATH=$PWD
from plottools import *
(root_dir, output_file) = get_args()
# List of all run directories to be processed
rundirs = get_rundirs(root_dir)
logging.info("Found %i directories." % len(rundirs))
# List of events, each a tuple: (timestamp, START|STOP)
events = []
for rundir in run... | {
"content_hash": "5d4858755890937ff7ebe14026c0d73d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 56,
"avg_line_length": 23.119402985074625,
"alnum_prop": 0.6197546804389928,
"repo_name": "ECP-CANDLE/Database",
"id": "be3564f550b539d782bd9f246a9a187158112573",
"size": "... |
from __future__ import print_function
import os
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
class Auth:
def __init__(self, scopes, secretFile, applicationName, credentialWindowsFile = 'mydrive.json'):
self.uriScope = scopes
self.clientSecre... | {
"content_hash": "c0d134af2da5bfe2011949275aa05fdc",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 100,
"avg_line_length": 32.67567567567568,
"alnum_prop": 0.6683209263854425,
"repo_name": "Kyochi/DriveSize",
"id": "4ab65c20e3ca0c9e486a6999cc2a8be4a98b331c",
"size": "121... |
import nose
import subprocess
from stolos import api
from stolos import exceptions
from stolos import queue_backend as qb
from stolos.testing_tools import (
with_setup, inject_into_dag,
enqueue, cycle_queue, consume_queue, get_qb_status,
validate_zero_queued_task, validate_not_exists,
validate_one_fail... | {
"content_hash": "551c927ae2c242b4bfc6057ab58ac2cb",
"timestamp": "",
"source": "github",
"line_count": 755,
"max_line_length": 79,
"avg_line_length": 35.25033112582781,
"alnum_prop": 0.6710753738633802,
"repo_name": "sailthru/stolos",
"id": "5854ab04fc40e3743f509155e59a651b53df6413",
"size": "2661... |
from collections import OrderedDict
from rest_framework.serializers import CharField
from rest_framework.serializers import IntegerField
from rest_framework.serializers import ListField
from rest_framework.serializers import ModelSerializer
from rest_framework.serializers import PrimaryKeyRelatedField
from rest_framew... | {
"content_hash": "331d3ecdf413bee4d1aff94182771c2e",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 104,
"avg_line_length": 42.022935779816514,
"alnum_prop": 0.614561729068879,
"repo_name": "learningequality/kolibri",
"id": "4b31dd94e4e45f54a4c161662d056e24eb1c00b1",
"si... |
"""
Plugin system for Twisted.
@author: U{Jp Calderone<mailto:exarkun@twistedmatrix.com>}
@author: U{Glyph Lefkowitz<mailto:glyph@twistedmatrix.com>}
"""
from __future__ import generators
import os, errno
from zope.interface import Interface, providedBy
try:
import cPickle as pickle
except ImportError:
imp... | {
"content_hash": "bd13264f9539bce9208bc3f1108ee1b0",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 87,
"avg_line_length": 34.01255230125523,
"alnum_prop": 0.5816213556403002,
"repo_name": "santisiri/popego",
"id": "c867441b21cd398ca9336e9d3bbcc53956b572df",
"size": "824... |
from selenium import webdriver
from selenium.test.selenium.webdriver.common import form_handling_tests
from selenium.test.selenium.webdriver.common.webserver import SimpleWebServer
def setup_module(module):
webserver = SimpleWebServer()
webserver.start()
IeFormHandlingTests.webserver = webserver
IeFor... | {
"content_hash": "9c996aeb0a35c9c5a8f0af6ebb50c5e9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.7967032967032966,
"repo_name": "akiellor/selenium",
"id": "f3eb288a2d7106846abcb771a6e9c399f900967b",
"size": "11... |
"""
Django settings for smsgw project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | {
"content_hash": "7fa0b17cc77288fc9f15c878708fe7b4",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 71,
"avg_line_length": 23.208791208791208,
"alnum_prop": 0.7002840909090909,
"repo_name": "rafael84/sms-gw",
"id": "293f62725dd8096b0178e93146e33fb3ccb33ff9",
"size": "2112... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../'))
import mw
# -- G... | {
"content_hash": "0b60c0d35ca3f734967b5a41052a96ef",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 31.793650793650794,
"alnum_prop": 0.7061907139291064,
"repo_name": "makoshark/Mediawiki-Utilities",
"id": "08dae411878e9acdd08859e969c0f77c52f8cd43",
... |
import numpy as np
import theano
from theano import tensor as T
from theano.tensor.nnet import conv2d
from theano.tensor.signal import downsample
import glob
from PIL import Image, ImageDraw
try:
import cPickle as pickle
except:
import pickle
import sys
sys.setrecursionlimit(10000)
regularization = 0.01
convo... | {
"content_hash": "d3130ae4f5fa63b3783d74792555799c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 190,
"avg_line_length": 45.86363636363637,
"alnum_prop": 0.6204162537165511,
"repo_name": "iamshang1/Projects",
"id": "d2dd43bb3dab9be061487be9e26c01920147119b",
"size": "... |
"""Support for Lutron lights."""
from __future__ import annotations
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, ... | {
"content_hash": "b630338c4fc23cdf999b98b26266a4d1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 85,
"avg_line_length": 33.88095238095238,
"alnum_prop": 0.6553056921995783,
"repo_name": "toddeye/home-assistant",
"id": "52ff2d7843cc1f2766685ffe113d933f0aea36d1",
"size":... |
from msrest.pipeline import ClientRawResponse
from .. import models
class BoolModel(object):
"""BoolModel operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An objec model des... | {
"content_hash": "7db81538230916bedbcb79c02de46d73",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 84,
"avg_line_length": 33.342756183745585,
"alnum_prop": 0.6232513777024162,
"repo_name": "stankovski/AutoRest",
"id": "0ec9dc24c7a63aa3159888e9b0c15bd65faf3743",
"size": ... |
import _plotly_utils.basevalidators
class NticksValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="nticks", parent_name="histogram2dcontour.colorbar", **kwargs
):
super(NticksValidator, self).__init__(
plotly_name=plotly_name,
par... | {
"content_hash": "f70166ff821c42a6a930154062da42ae",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 87,
"avg_line_length": 34.46666666666667,
"alnum_prop": 0.5938104448742747,
"repo_name": "plotly/python-api",
"id": "ebeddeb66ad7a63f4468c02f5fb912c653b40ebc",
"size": "517... |
from __future__ import unicode_literals
from django.db import migrations, models
import picture.models
import picturepay.storage
class Migration(migrations.Migration):
dependencies = [
('picture', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='picture',
... | {
"content_hash": "be1378805820295fb6a9f9823e6d12f0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 142,
"avg_line_length": 29.8,
"alnum_prop": 0.6174496644295302,
"repo_name": "ZzCalvinzZ/picturepay",
"id": "70fae36b6ed36afc294953eae64b3a4742709cee",
"size": "967",
"bi... |
import socket
import sys
import struct
import time
class Modbus_TCP_Control:
def __init__( self ):
self.modbus_devices = {}
def connect_socket( self, modbus_device ):
try:
sock = modbus_device["sock"]
... | {
"content_hash": "bd6690af26e79b123b995b393e54053a",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 136,
"avg_line_length": 33.026490066225165,
"alnum_prop": 0.5592540605574494,
"repo_name": "glenn-edgar/local_controller_3",
"id": "d6b8aa03ebe67815bba81bc81bd1ffbb051516e5"... |
"""This file contains a WinRAR history Windows Registry plugin."""
import re
from plaso.containers import events
from plaso.parsers import winreg_parser
from plaso.parsers.winreg_plugins import interface
class WinRARHistoryEventData(events.EventData):
"""WinRAR history event data attribute container.
Attribute... | {
"content_hash": "b92bc2d13671e470d2964f1a523552b2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 34.14473684210526,
"alnum_prop": 0.707514450867052,
"repo_name": "joachimmetz/plaso",
"id": "d3fb5a258d41fe0cb95dc4d09b926125a4993f8f",
"size": "2619... |
from OpenGL.arrays import vbo
from OpenGL.GLES2.VERSION import GLES2_2_0
from OpenGL.GLES2.OES import mapbuffer
class Implementation( vbo.Implementation ):
"""OpenGL-based implementation of VBO interfaces"""
def __init__( self ):
for name in self.EXPORTED_NAMES:
for source in [ GLES2_2_0, m... | {
"content_hash": "eef6e349a6539d3a19489fef75c0023b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 37.75,
"alnum_prop": 0.5470198675496689,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "fb7811b122904a7fba10519297aa03213ea6aa2e",
"size": "75... |
from pyjamas import DOM
from pyjamas import Factory
from CheckBox import CheckBox
class RadioButton(CheckBox):
def __init__(self, group=None, label=None, asHTML=False, **kwargs):
if not kwargs.has_key('StyleName'):kwargs['StyleName']="gwt-RadioButton"
if label:
if asHTML:
... | {
"content_hash": "0b7dc8bc92ea68a61f774d6ffcfd5c57",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 80,
"avg_line_length": 29.863636363636363,
"alnum_prop": 0.6118721461187214,
"repo_name": "emk/pyjamas",
"id": "f8bc4df1e4e71944ae9d9e32408aabb1e2ee372b",
"size": "1316",
... |
"""
License: BSD
(c) 2005-2012 ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
"""
import unittest
from trac.perm import PermissionSystem, PermissionCache
from trac.test import EnvironmentStub, Mock
from trac.web.api import RequestDone
from trac.web.href import Href
from customfieldadmin.admin impo... | {
"content_hash": "63101829862243d2868d98a36c0a1745",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 38.72592592592593,
"alnum_prop": 0.4812547819433818,
"repo_name": "jun66j5/trac-customfieldadminplugin",
"id": "73ef29f48c50b230cb737f5596987fd8ccb9ed... |
"""
mfag module which contains the ModflowAg class.
Note that the user can access the ModflowAg class as `flopy.modflow.ModflowAg`.
Additional information for this MODFLOW package can be found at
<https://www.sciencedirect.com/science/article/pii/S1364815219305080>`_.
"""
import os
import numpy as np
... | {
"content_hash": "82671944751e7aa1bf726b0803bbc2b7",
"timestamp": "",
"source": "github",
"line_count": 980,
"max_line_length": 79,
"avg_line_length": 33.594897959183676,
"alnum_prop": 0.37192843908513806,
"repo_name": "jentjr/flopy",
"id": "786e2ec37c332da895bc230343df8b5bb3c1732f",
"size": "32923... |
"""Module houses Modin configs originated from environment variables."""
import os
import sys
from textwrap import dedent
import warnings
from packaging import version
import secrets
from pandas.util._decorators import doc # type: ignore[attr-defined]
from .pubsub import Parameter, _TYPE_PARAMS, ExactStr, ValueSour... | {
"content_hash": "2b4c60b66eb42b09c917e77cd3a0644f",
"timestamp": "",
"source": "github",
"line_count": 631,
"max_line_length": 116,
"avg_line_length": 27.251980982567353,
"alnum_prop": 0.6061874854617353,
"repo_name": "modin-project/modin",
"id": "e287bf411875a96daf1f8f383fba3c17911fe651",
"size":... |
import json
import os
import platform
import re
import subprocess
import sys
import py
import pytest
import tox
from tox._pytestplugin import ReportExpectMock
from tox.config import parseconfig
from tox.session import Session
pytest_plugins = "pytester"
def test_report_protocol(newconfig):
config = newconfig(
... | {
"content_hash": "8658174fd174e76bad0989c68a59c1d8",
"timestamp": "",
"source": "github",
"line_count": 895,
"max_line_length": 99,
"avg_line_length": 29.230167597765362,
"alnum_prop": 0.5563242995298345,
"repo_name": "Avira/tox",
"id": "ed1ebdb63aa984771758c141bddae9852d56d0fa",
"size": "26161",
... |
import sys
import os
import mxnet as mx
import numpy as np
import unittest
from mxnet.test_utils import assert_almost_equal, default_context, EnvManager
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
sys.path.insert(0, os.path.join(curr_path, '../unittest'))
from common import setup_module, ... | {
"content_hash": "690b6c5aec5a8ec1b8ccbb9b363e553d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 107,
"avg_line_length": 43.891666666666666,
"alnum_prop": 0.5897095120561989,
"repo_name": "eric-haibin-lin/mxnet",
"id": "1dddc58896439488466f4c5f5ee124706aa7673c",
"size... |
import actions as self
import shared
import xbmc
import xbmcaddon
import xbmcgui
# define ISY API actions
__act_names__ = {
'on': 'NodeOn',
'off': 'NodeOff',
'toggle': 'NodeToggle',
'faston': 'NodeFastOn',
'fastoff': 'NodeFastOff',
'bright': 'NodeBright',
'dim': 'NodeDim',
'on25': 'Node... | {
"content_hash": "cb50b4abe6b48ac549ecdcedbb233447",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 79,
"avg_line_length": 22.908256880733944,
"alnum_prop": 0.6139367240688827,
"repo_name": "automicus/XBMC-ISY-Browser",
"id": "21e0408dddcb732b2fe93e8ebb2ba023327971ff",
"... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from createprofile.models import Employee_Profile,Employer_Profile, Document, Profile_Picture, Listing, Logo
class CreateProfileFromEE(forms.ModelForm):
class Meta:
model = Employee_Profile
... | {
"content_hash": "98337488ae7ff8d67dfd9f53e583dadc",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 108,
"avg_line_length": 21.649122807017545,
"alnum_prop": 0.640194489465154,
"repo_name": "coetzeevs/chiron",
"id": "9bdd9f3f79825a22872fe608d7414df9b745388c",
"size": "123... |
import unittest
from test.test_support import requires
from Tkinter import Tk, Text
import idlelib.AutoComplete as ac
import idlelib.AutoCompleteWindow as acw
import idlelib.macosxSupport as mac
from idlelib.idle_test.mock_idle import Func
from idlelib.idle_test.mock_tk import Event
class AutoCompleteWindow:
def ... | {
"content_hash": "c24259feedf44f1cdc52f572b971dd62",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 79,
"avg_line_length": 35.17605633802817,
"alnum_prop": 0.6516516516516516,
"repo_name": "wang1352083/pythontool",
"id": "1e98590b9e4dfd98b037d7a55d9d9963035610de",
"size"... |
"""Helpers that interact with the "readelf" tool."""
import re
import subprocess
import path_util
def BuildIdFromElf(elf_path):
"""Returns the Build ID for the given binary."""
args = [path_util.GetReadElfPath(), '-n', elf_path]
stdout = subprocess.check_output(args, encoding='ascii')
match = re.search(r'Bu... | {
"content_hash": "5e933b02ead166ae64fb6827c19e0466",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 34.654545454545456,
"alnum_prop": 0.670514165792235,
"repo_name": "chromium/chromium",
"id": "f3d7cc5c8a338979ed4a8dc05f5765b1098de53b",
"size": "204... |
"""
Test handling of loading external stuff in twanager.
"""
from tiddlyweb.manage import _external_load
from tiddlyweb.config import config as global_config
config = {
'monkey': 'bar',
}
def test_load_file():
args = _external_load(['twanager', '--load', 'test/test_external_load.py', 'foobar'], g... | {
"content_hash": "383e5397382afd20bfde7b3a83fd3f23",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 104,
"avg_line_length": 31.65,
"alnum_prop": 0.6461295418641391,
"repo_name": "funkyeah/tiddlyweb",
"id": "2210ea2be047f31a3f56e4bbb1e0f5f663b39d05",
"size": "633",
"bina... |
"""
Configuration file generator for the other scripts. Useful for experiments.
"""
from __future__ import absolute_import, division, print_function
from argparse import ArgumentParser
from builtins import str as text
from itertools import product
from operator import itemgetter
import os
import json
import configobj... | {
"content_hash": "21421f94d336b3fc2ea37388b78ae552",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 80,
"avg_line_length": 38.130434782608695,
"alnum_prop": 0.5963511972633979,
"repo_name": "dlt-rilmta/emLam",
"id": "218e6e1f648c82e391c10f060f361ac2c9182569",
"size": "44... |
import sys
import wx
from gooey.gui import events
from gooey.gui.lang import i18n
from gooey.gui.pubsub import pub
class Footer(wx.Panel):
'''
Footer section used on the configuration
screen of the application
'''
def __init__(self, parent, buildSpec, **kwargs):
wx.Panel._... | {
"content_hash": "dd6dca88edc68464a9671927dd12d010",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 116,
"avg_line_length": 34.88805970149254,
"alnum_prop": 0.558716577540107,
"repo_name": "codingsnippets/Gooey",
"id": "6058b519524f14c6bb1fb756f80598c7e6e2cd49",
"size": ... |
def myblock(tw, args):
''' Draw a dotted line of length line_length. '''
try: # make sure line_length is a number
line_length = float(args[0])
except ValueError:
return
if tw.turtles.get_active_turtle().get_pen_state():
dist = 0
pen_size = tw.turtles.get_active_turtle()... | {
"content_hash": "177cf9da03e2498c50e1100fa5004cd0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 68,
"avg_line_length": 43.09090909090909,
"alnum_prop": 0.6128691983122363,
"repo_name": "walterbender/turtle3D",
"id": "098e0a4872efeb7f9e61790a1cf97c3285003b29",
"size": ... |
import os
import unittest
from __main__ import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
#
# VesselDisplay
#
class VesselDisplay(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Vessel Display"
... | {
"content_hash": "3173617f8c75d4288ce634ce7fad6bdc",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 112,
"avg_line_length": 35.97163120567376,
"alnum_prop": 0.7383675078864353,
"repo_name": "sumedhasingla/VesselView",
"id": "847569353c467f64948e371a72ecb3b85ccda11a",
"si... |
"""
Copyright (c) 2017 Muxr, http://www.eevblog.com/forum/profile/?u=105823
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, cop... | {
"content_hash": "73aba4dd8369f390aa9411e8ff7eb014",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 99,
"avg_line_length": 31.425,
"alnum_prop": 0.6117740652346858,
"repo_name": "sirmo/muxrplot",
"id": "b66c0b67a0360f020fe1de156561c3d5a734f56f",
"size": "5028",
"binary... |
import pygame
from spritesheet import SpriteSheet
from enemy import Enemy
from directions import Directions
from utils import *
class Ghost(Enemy):
"""Ghost Enemy."""
def __init__(self, width, height, x, y):
Enemy.__init__(self, width, 44, x, y)
self.dir = 'R'
self.speed = 1
# initialize sprite lists
... | {
"content_hash": "ec4c5112a3a66325873c252167b352ea",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 99,
"avg_line_length": 27.548387096774192,
"alnum_prop": 0.6885245901639344,
"repo_name": "450W16/MODACT",
"id": "836b3fd986578e0095880b96f7099086f53a97b7",
"size": "854",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import fnmatch
import os
import sys
from setuptools import find_packages, setup, Extension
from setuptools.dist import Distribution
_VERSION = '0.6.0'
REQUIRED_PACKAGES = [
'numpy >= 1.8.2',
'six >= ... | {
"content_hash": "fc3c68365c90b6750a26a073b541e0f9",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 71,
"avg_line_length": 28.261363636363637,
"alnum_prop": 0.6385203055890631,
"repo_name": "miyosuda/intro-to-dl-android",
"id": "76f714f8b282c8cf2acea5a26dc48352f9a944dc",
... |
import os
import json
import copasul
# load minimal example config
pth = os.path.dirname(os.path.abspath(__file__))
with open("{}/../minex/config/minex.json".format(pth), "r") as h:
opt = json.load(h)
# init Copasul() object
fex = copasul.Copasul()
# process data specified in config
copa = fex.process(config=opt... | {
"content_hash": "6e5097be3b36daec806a3300bff62c93",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 24.055555555555557,
"alnum_prop": 0.7043879907621247,
"repo_name": "reichelu/copasul",
"id": "7f49f0399a56573c0b8f89872b3754a0eed4038e",
"size": "433... |
"""identify somatic variants in cancer samples
https://qcmg.org/bioinformatics/tiki-index.php?page=qSNP#EXAMPLES
"""
from __future__ import print_function
import os
import shutil
from re import sub
from bcbio import utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.pipeline impor... | {
"content_hash": "88222cec890dc62c79237378b2021ed3",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 104,
"avg_line_length": 40.69098712446352,
"alnum_prop": 0.5613331927011919,
"repo_name": "chapmanb/bcbio-nextgen",
"id": "84cb45cf56be1e7af816f1fbd5e55f6747ae0897",
"size... |
"""
pyboard interface
This module provides the Pyboard class, used to communicate with and
control a MicroPython device over a communication channel. Both real
boards and emulated devices (e.g. running in QEMU) are supported.
Various communication channels are supported, including a serial
connection, telnet-style net... | {
"content_hash": "eca819765735affbece9157e836fe4b8",
"timestamp": "",
"source": "github",
"line_count": 646,
"max_line_length": 99,
"avg_line_length": 31.94736842105263,
"alnum_prop": 0.5444810543657331,
"repo_name": "pozetroninc/micropython",
"id": "de8b488368a7d6abd3d352bb109a1356715cffc5",
"size... |
__author__ = 'Adward'
"""djcode URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, ... | {
"content_hash": "0e0915e2e5aae0db40b1a31aae9557a8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 88,
"avg_line_length": 41.857142857142854,
"alnum_prop": 0.6832764505119454,
"repo_name": "yuanpengX/SE-NE",
"id": "14766f7676b9550b043994b7fc478988ea2d885a",
"size": "1465... |
from typing import List, Optional, Union, no_type_check
import importlib
from distutils.version import LooseVersion
import pkg_resources
from autosklearn.util import RE_PATTERN
def verify_packages(packages: Optional[Union[str, List[str]]]) -> None:
if not packages:
return
if isinstance(packages, st... | {
"content_hash": "aaf2cccac5008671e749dff059a3cd07",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 81,
"avg_line_length": 31.152380952380952,
"alnum_prop": 0.627331091409355,
"repo_name": "automl/auto-sklearn",
"id": "390ac351bb7fef8a6c78710337293922883aa317",
"size": "... |
"""Tests for ParameterServerStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import threading
from absl.testing import parameterized
from tensorflow.contrib.distribute.python import combinations
from tensorflow.contrib.distribute.py... | {
"content_hash": "0bd3ae87e55d664235e2fc27647cc3a0",
"timestamp": "",
"source": "github",
"line_count": 500,
"max_line_length": 80,
"avg_line_length": 40.188,
"alnum_prop": 0.6244650144321688,
"repo_name": "dancingdan/tensorflow",
"id": "353d11a5831904abd43828f1d9d4abfc61aede60",
"size": "20783",
... |
from GCBcommon import *
from UnitCommands import *
import math
# patrol relative to airbase or carrier location
def CAP(TI):
UI = TI.GetPlatformInterface()
BB = TI.GetBlackboardInterface()
iteration = TI.GetMemoryValue(1) # will return 0 first time
if (iteration == 0): # do initialization
TI... | {
"content_hash": "2533e882a90efbfca2b8677899e5b3a5",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 96,
"avg_line_length": 31.18018018018018,
"alnum_prop": 0.6266974862756429,
"repo_name": "gcblue/gcblue",
"id": "e45dcb97a2c91a6f2d17a04c73fcce5c27a7c7ef",
"size": "3462",... |
"""The tests for the MQTT light platform.
Configuration for RGB Version with brightness:
light:
platform: mqtt
name: "Office Light RGB"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
brightness_state_topic: "office/rgb1/brightness/status"
brightness_command_topic: "offic... | {
"content_hash": "dfcc9fe03003dc1b579822a6b53c0f9b",
"timestamp": "",
"source": "github",
"line_count": 878,
"max_line_length": 79,
"avg_line_length": 39.77904328018223,
"alnum_prop": 0.5986371184790701,
"repo_name": "persandstrom/home-assistant",
"id": "1245411dcc4fe5c774314393794f390a93f5fd33",
"... |
'''Example WordCountStreamletTopology'''
import sys
from heronpy.streamlet.builder import Builder
from heronpy.streamlet.runner import Runner
from heronpy.streamlet.config import Config
from heronpy.streamlet.windowconfig import WindowConfig
from heronpy.connectors.mock.arraylooper import ArrayLooper
# pylint: disabl... | {
"content_hash": "802ea02b7b7e850b45e0531eb262d37f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 99,
"avg_line_length": 35.125,
"alnum_prop": 0.6951364175563464,
"repo_name": "twitter/heron",
"id": "4f2ecd6d850f2b94f7fcd6e1cac6be386b23bc93",
"size": "1693",
"binary":... |
from openerp.tests.common import TransactionCase
class TestCreateInvoice(TransactionCase):
def setUp(self):
super(TestCreateInvoice, self).setUp()
self.Wizard = self.env['stock.invoice.onshipping']
self.customer = self.env.ref('base.res_partner_3')
product = self.env.ref('product... | {
"content_hash": "81033ed1819c471b9f5c47e740e98ee1",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 79,
"avg_line_length": 34.81818181818182,
"alnum_prop": 0.606396866840731,
"repo_name": "cristianquaglio/odoo",
"id": "c1588b0af130678eca39e04bb683ecba245faa85",
"size": "2... |
import requests
import json
from django.conf import settings
from django.core import serializers
from django.core.urlresolvers import reverse
if getattr(settings, 'HOOK_THREADING', True):
from .client import Client
client = Client()
else:
client = requests
def get_module(path):
"""
A modified du... | {
"content_hash": "90821d2e3b87296e1f45fa9c2471c0fe",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 126,
"avg_line_length": 29.883928571428573,
"alnum_prop": 0.6232446967433523,
"repo_name": "fabric-bolt/fabric-bolt",
"id": "690969e8c3a5f8b4016d7b147813a166e657a117",
"si... |
# Copyright ClusterHQ Limited. See LICENSE file for details.
"""
Tests that verify that Docker behaviour is unchanged when running through
Powerstrip.
Run these tests as so. Ensure Docker is running on /var/run/docker.sock.
$ TEST_PASSTHRU=1 trial powerstrip.test.test_passthru
"""
import os
from twisted.internet im... | {
"content_hash": "c0806de0b8ecb5467acadcc6ffd06783",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 85,
"avg_line_length": 36.88405797101449,
"alnum_prop": 0.6090373280943026,
"repo_name": "ClusterHQ/powerstrip",
"id": "c94e60958fa2877fb466129b1df9ca7e83a824a7",
"size": ... |
import atexit
import contextlib
import copy
import functools
import os
import attr
import packaging.markers
import packaging.version
import pip_shims.shims
import requests
from packaging.utils import canonicalize_name
from vistir.compat import JSONDecodeError, fs_str
from vistir.contextmanagers import cd, temp_environ... | {
"content_hash": "2d8b13ada7a56d0a784ace0fcf364da1",
"timestamp": "",
"source": "github",
"line_count": 661,
"max_line_length": 148,
"avg_line_length": 38.33131618759455,
"alnum_prop": 0.6408414571575167,
"repo_name": "kennethreitz/pipenv",
"id": "2608479a6eb2e36b3c87b6e120b434ff8ab96a52",
"size": ... |
from django_mptt_admin.admin import DjangoMpttAdmin
from django.contrib import admin
from tabbed_admin import TabbedModelAdmin
from grappelli_autocomplete_fk_edit_link import AutocompleteEditLinkAdminMixin
from reversion.admin import VersionAdmin
from billingapp.models import FinancialAccountCategory, FinancialAccoun... | {
"content_hash": "61698d646b043b23eab90a6ba6bc0a40",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 116,
"avg_line_length": 31.448979591836736,
"alnum_prop": 0.7774172615184944,
"repo_name": "bittssystem/version3",
"id": "64f25f3ca48ceeadce0c3c50c3fff99632967c9d",
"size":... |
"""
Define the base classes for the Sumatra version control abstraction layer.
:copyright: Copyright 2006-2015 by the Sumatra team, see doc/authors.txt
:license: BSD 2-clause, see LICENSE for details.
"""
from __future__ import unicode_literals
from builtins import object
import os.path
from sumatra.core import comp... | {
"content_hash": "4df7da21af1b07d2029952f353bb2083",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 105,
"avg_line_length": 30.54189944134078,
"alnum_prop": 0.6200841412109018,
"repo_name": "open-research/sumatra",
"id": "e39551fcaa8d149bdfee74fc6ba8cf38078d5cca",
"size"... |
__ALL__ = ['correctors', 'evaluators']
from music21.omr import correctors
from music21.omr import evaluators
| {
"content_hash": "9e500237ae85ca096325fe79bbd416e2",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 27.5,
"alnum_prop": 0.7545454545454545,
"repo_name": "arnavd96/Cinemiezer",
"id": "0afcb59a2ed456a8f77cc6f13e43f13ab66d6eb7",
"size": "624",
"binary... |
class OVSCookieBridge(object):
'''Bridge restricting flow operations to its own distinct cookie
This class creates a bridge derived from a bridge passed at init (which
has to inherit from OVSBridgeCookieMixin), but that has its own cookie,
registered to the underlying bridge, and that will use this coo... | {
"content_hash": "86d42a3842d341b82c576a202228aa38",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 77,
"avg_line_length": 32.15,
"alnum_prop": 0.6438569206842923,
"repo_name": "openstack/neutron",
"id": "c6ec265a0b2b9e74dbeb396517ea9e028952b808",
"size": "2564",
"binar... |
from django import template
from bibbutler_web.models.entry import entry_types
register = template.Library()
@register.simple_tag
def lb():
return '{'
@register.simple_tag
def rb():
return '}'
@register.simple_tag
def get_class_verbose_name(object):
return object._meta.verbose_name
@register.simple... | {
"content_hash": "b74f4a86834b1c9fbee9385f97755ba5",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 83,
"avg_line_length": 22.340425531914892,
"alnum_prop": 0.6980952380952381,
"repo_name": "dolonnen/bibbutler",
"id": "ae32d3a0ed6e8931968a8355e9c0935ae6a1fd3d",
"size": "1... |
import kfp
import kfp.dsl as dsl
from kfp.dsl import component, graph_component
from kfp.dsl.types import Integer, GCSPath, InconsistentTypeException
from kfp.dsl import ContainerOp, Pipeline, PipelineParam
from kfp.components.structures import ComponentSpec, InputSpec, OutputSpec
import unittest
class TestPythonCompo... | {
"content_hash": "ae02fd4f594d9a17f8855002332ddf69",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 211,
"avg_line_length": 36.40397350993378,
"alnum_prop": 0.5270147353101692,
"repo_name": "kubeflow/kfp-tekton-backend",
"id": "ffd482945c1e8b77dde7c53f05cbb26975ba32d5",
... |
""" QuerySet for PolymorphicModel
Please see README.rst or DOCS.rst or http://bserve.webhop.org/wiki/django_polymorphic
"""
from compatibility_tools import defaultdict
from django.db.models.query import QuerySet
from django.contrib.contenttypes.models import ContentType
from query_translate import translate_poly... | {
"content_hash": "38b15a0729d261e7b86d71e8201feb3a",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 139,
"avg_line_length": 47.53703703703704,
"alnum_prop": 0.6457343202181535,
"repo_name": "sdelements/django_polymorphic",
"id": "6e397f7636f6e4d9de074b52d90d2bb9acc5540a",
... |
"""
This module defines the events signaled by abinit during the execution. It also
provides a parser to extract these events form the main output file and the log file.
"""
from __future__ import unicode_literals, division, print_function
import os.path
import collections
import yaml
from monty.fnmatch import WildCa... | {
"content_hash": "66de4d2df2f47e17e8fb438c86cf2ec9",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 113,
"avg_line_length": 30.716157205240176,
"alnum_prop": 0.6091839636053454,
"repo_name": "ctoher/pymatgen",
"id": "ca50568ff945389e6b8b31e251cc3f16ea281e3c",
"size": "14... |
"""Render the category pages and feeds."""
from __future__ import unicode_literals
from nikola.plugin_categories import Taxonomy
from nikola import utils
class ClassifyCategories(Taxonomy):
"""Classify the posts by categories."""
name = "classify_categories"
classification_name = "category"
overvi... | {
"content_hash": "c7cfc45060bf2dd6aab2a6c00b712ee0",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 228,
"avg_line_length": 46.56962025316456,
"alnum_prop": 0.646371296547975,
"repo_name": "knowsuchagency/nikola",
"id": "2f157cafce32684074c732daf8479d838971b83e",
"size":... |
from abc import ABCMeta, abstractmethod
import os, math,sys, random
import numpy as np
import theano
import theano.tensor as T
from config import dataset_params
from printing import print_section, print_error
from augmenter.aerial import Creator
class DataLoader:
'''
Loads a class based on value in config.
... | {
"content_hash": "42ff2afbfe52d9572712bf4eac7b34f0",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 130,
"avg_line_length": 40.32163742690059,
"alnum_prop": 0.6128353879622915,
"repo_name": "olavvatne/CNN",
"id": "db1c25cc2086786747375b95ed98b3d40c13e5ce",
"size": "13790... |
'''Unit tests for models and their factories.'''
import mock
import unittest
from nose.tools import * # noqa (PEP8 asserts)
import pytz
import datetime
import urlparse
import itsdangerous
import random
import string
from dateutil import parser
from modularodm import Q
from modularodm.exceptions import ValidationErro... | {
"content_hash": "fd7e4b1d15b0ff3446d303ba18263825",
"timestamp": "",
"source": "github",
"line_count": 4470,
"max_line_length": 132,
"avg_line_length": 38.295525727069354,
"alnum_prop": 0.6255133455231597,
"repo_name": "GageGaskins/osf.io",
"id": "38bb41cfdd7d1207a00b7ecee6ca3871957bd95d",
"size":... |
COMMTRACK_REPORT_XMLNS = 'http://commcarehq.org/ledger/v1'
SECTION_TYPE_STOCK = 'stock'
REPORT_TYPE_BALANCE = 'balance'
REPORT_TYPE_TRANSFER = 'transfer'
VALID_REPORT_TYPES = (REPORT_TYPE_BALANCE, REPORT_TYPE_TRANSFER)
TRANSACTION_TYPE_STOCKONHAND = 'stockonhand'
TRANSACTION_TYPE_STOCKOUT = 'stockout'
TRANSACTION_TY... | {
"content_hash": "42aa7f5243fbfb149654d7addbb18f5c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 30.928571428571427,
"alnum_prop": 0.7782909930715936,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "84a02405b727336cc8b63baba850eb452f55dbbe",
"siz... |
from __future__ import absolute_import
import operator
import six
from sentry.api.serializers import serialize
from sentry.models import (Release, ReleaseCommit, Commit, CommitFileChange, Event, Group)
from sentry.api.serializers.models.commit import CommitSerializer, get_users_for_commits
from sentry.utils import me... | {
"content_hash": "d84e6cb3c7f4f3919e461cdfdfdab547",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 100,
"avg_line_length": 31.295774647887324,
"alnum_prop": 0.6360636063606361,
"repo_name": "ifduyue/sentry",
"id": "15c305075a6affcdfb7f256728c5331057bf99a0",
"size": "666... |
"""functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# and Raymond Hettinger <python at rcn.com>
# Copyright (C) 2006-2... | {
"content_hash": "bbb0fe6573638e389a578e8c1beec03a",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 88,
"avg_line_length": 38.03782505910166,
"alnum_prop": 0.5537600994406464,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "e472c22d616daef2e2c1ac391abf9269d3d8e505",
... |
from __future__ import absolute_import
from .graph import Graph
class BarGraph(Graph):
pass
# def new_series(self,*args,**kw):
# ============= EOF ====================================
| {
"content_hash": "b2cf894fc1b3ec8cd0ba855de093af6a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 56,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.49743589743589745,
"repo_name": "UManPychron/pychron",
"id": "df6af6d26a9c0021a6b504313654b4e1d0aa4ff2",
"size": "... |
import flask
from xmltodict import parse
from flask import current_app
from .cas_urls import create_cas_login_url
from .cas_urls import create_cas_logout_url
from .cas_urls import create_cas_validate_url
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
blueprint = flask.... | {
"content_hash": "58188a345ae4a6ac258d2dbb22423d97",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 104,
"avg_line_length": 36.364285714285714,
"alnum_prop": 0.6633274405814182,
"repo_name": "campenberger/Flask-CAS",
"id": "fe52af31b13baa1b67709d03bf2f87883f80255e",
"siz... |
from __future__ import absolute_import
from __future__ import division
import os
import logging
import psutil
from guild import var
from guild import util
DEFAULT_LOG_MAX_SIZE = 102400
DEFAULT_LOG_BACKUPS = 1
class ServiceError(Exception):
pass
class Running(ServiceError):
def __init__(self, name, pidfi... | {
"content_hash": "caf18044c033286d43280d4db918efb5",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 77,
"avg_line_length": 25.447852760736197,
"alnum_prop": 0.6051108968177434,
"repo_name": "guildai/guild",
"id": "a478e96cbd4f755b4bde892c1548fc1177918282",
"size": "4729"... |
from os.path import join, dirname, realpath
ROOT_PATH = dirname(realpath(__file__))
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': join(ROOT_PATH, "testtinymce.sqlite"),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
... | {
"content_hash": "76e578783680967bbca9d6b4e98336a5",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 65,
"avg_line_length": 25.59016393442623,
"alnum_prop": 0.6675208199871877,
"repo_name": "agushuley/gu-django-tinymce",
"id": "c84a5f0288f6b8e9bdb2736621e9cfa3e98a02ca",
"s... |
from django import template
from django.conf import settings
from django.template import defaultfilters
from django.utils.translation import pgettext, ugettext as _, ungettext
register = template.Library()
# A tuple of standard large number to their converters
intword_converters = (
(3, lambda number: (
u... | {
"content_hash": "d7f55bde9a258216200281b08a5d2941",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 102,
"avg_line_length": 26.65289256198347,
"alnum_prop": 0.595968992248062,
"repo_name": "meilinger/firecares",
"id": "01b39b38c42f3bfb9420518675c8d41648973bba",
"size": "... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import paramiko
import paramiko.py3compat
import os
import os.path
import sys
import errno
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_IMODE, S_IFMT
import argparse
import logging
from getpass import ... | {
"content_hash": "ea8713ec0a1d518fb6221f4a0e0fd51f",
"timestamp": "",
"source": "github",
"line_count": 806,
"max_line_length": 109,
"avg_line_length": 34.839950372208435,
"alnum_prop": 0.533528008261814,
"repo_name": "unbit/sftpclone",
"id": "c48142ce43a766eb0a02798a5f4c343e1c50f082",
"size": "281... |
import frappe
def execute():
frappe.reload_doc("core", "doctype", "system_settings", force=1)
frappe.db.set_value('System Settings', None, "password_reset_limit", 3)
| {
"content_hash": "3072366fe978957fdf71f451b8da2f16",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 72,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.711764705882353,
"repo_name": "adityahase/frappe",
"id": "188f2383e70eb0672629e53bc1daf27a60463c8a",
"size": "271"... |
from jsonrpc.proxy import JSONRPCProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = JSONRPCProxy.from_url("http://127.0.0.1:46502")
els... | {
"content_hash": "7743039ecbcb626bff231ee059051f95",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 81,
"avg_line_length": 24.265432098765434,
"alnum_prop": 0.6621724751971508,
"repo_name": "Atlascoinproject/atlascoin",
"id": "ed1c6bce5706f833c9637dc04d1aeabbd7fc984a",
"... |
"""Image utilities
Some general image utilities using PIL.
"""
import Queue
import collections
import io
import mimetypes
import os
import struct
import threading
from gi.repository import (
GLib,
GObject,
GdkPixbuf,
Gtk,
Gdk,
)
from PIL import Image, ImageFilter
mimetypes.init()
# Generating a ... | {
"content_hash": "bb85228535510422120281b2c71457ba",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 79,
"avg_line_length": 36.23516483516484,
"alnum_prop": 0.6077515618365985,
"repo_name": "jcollado/datagrid-gtk3",
"id": "4d55bff59bbf05d8d1a2c0f9f466a08d5eb2d278",
"size"... |
import os
# django imports
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# settings for django-tinymce
try:
import tinymce.settings
DEFAULT_URL_TINYMCE = tinymce.settings.JS_BASE_URL + '/'
DEFAULT_PATH_TINYMCE = tinymce.settings.JS_ROOT + '/'
except ImportError:... | {
"content_hash": "900c6784856eca72c007ded5f0b1c2b8",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 132,
"avg_line_length": 49.65151515151515,
"alnum_prop": 0.6940799511748551,
"repo_name": "buremba/django-filebrowser-admintools",
"id": "ef4175e42f6882a9280f037ec68b3362da8... |
import sys
try:
Set = set
except:
import sets
Set = sets.Set
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
import codecs, re, weakref, os, time
try:
import threading
import thread
except ImportError:
import dummy_threading as threading
import dummy_thre... | {
"content_hash": "fff6e1995c178e9d7e55994d03f04cab",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 114,
"avg_line_length": 29.87313432835821,
"alnum_prop": 0.5615788158880839,
"repo_name": "bdoms/mako",
"id": "1f9f3d42637d5106460079aa76d6ec8e97a84023",
"size": "8225",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('method', '0109_method_container'),
]
operations = [
migrations.RemoveField(
model_name='dockerimage',
name='groups_allowed',
... | {
"content_hash": "7c58ccfd02fa79b62f4396731782d924",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 44,
"avg_line_length": 22.96875,
"alnum_prop": 0.5306122448979592,
"repo_name": "cfe-lab/Kive",
"id": "2b3df14b924834322dd66032f98ad9a9d948699a",
"size": "809",
"binary":... |
from datetime import date, timedelta
from random import uniform
from numpy import ndarray
def _generator(x):
return uniform(0, 1)
class gdata(object):
def __init__(self, data):
self.data = data
def __iter__(self):
return (v for v in self.data)
def datepopulate(siz... | {
"content_hash": "7dc8bb048960452398f3a1b5832fca3a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 63,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.5524412296564195,
"repo_name": "quantmind/dynts",
"id": "d4c92148b0ac4e28242be712fafb2a11f6a3d5a4",
"size": "1106... |
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
import smtplib
# 格式化工具
def _format_addr(s):
name, addr = parseaddr(s)
return formataddr((Header(name, 'utf-8').encode(), addr))
from_addr = input('From: ')
password = i... | {
"content_hash": "1f8ddcbe60593ea24daa233517620cdd",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 61,
"avg_line_length": 25.4,
"alnum_prop": 0.6704161979752531,
"repo_name": "KrisCheng/HackerPractice",
"id": "f029f47ce29c61f3993bfd449051315d78918f3c",
"size": "1041",
... |
from google.cloud.billing import budgets_v1beta1
def sample_create_budget():
# Create a client
client = budgets_v1beta1.BudgetServiceClient()
# Initialize request argument(s)
request = budgets_v1beta1.CreateBudgetRequest(
parent="parent_value",
)
# Make the request
response = cli... | {
"content_hash": "c7704b72433adf89196fc1a83169e465",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 25.05263157894737,
"alnum_prop": 0.7226890756302521,
"repo_name": "googleapis/python-billingbudgets",
"id": "aa3fcd233178871d1da42a33fcc001d8406a9aab",... |
from geopy.distance import vincenty
def get_hot_points(data, threshold, distance):
"""get hot point"""
hot_points = []
for each in data:
count = 0
p1 = (each[-2], each[-1]) # lat, lng
for item in data:
p2 = (item[-2], item[-1])
p_dis = vincenty(p1, p2).meters... | {
"content_hash": "bcb026d6eb3891baf08aa3e493c36054",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 46,
"avg_line_length": 30.842105263157894,
"alnum_prop": 0.46075085324232085,
"repo_name": "TaiwanStat/real.taiwanstat.com",
"id": "076a5c27f3dd1ac3be48e6b847ef0eebc4059475",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.