text stringlengths 4 1.02M | meta dict |
|---|---|
__author__ = 'Daniel'
from glue.models import *
from swampdragon.serializers.model_serializer import ModelSerializer
class UserSerializer(ModelSerializer):
class Meta:
model = User
publish_fields = ('id', 'username')
class LocationSerializer(ModelSerializer):
class Meta:
model = 'glu... | {
"content_hash": "a061d06bbd4794794f738126a29db653",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 68,
"avg_line_length": 18.836363636363636,
"alnum_prop": 0.6891891891891891,
"repo_name": "Valchris/tdoa",
"id": "3becd23e66f68e54168ab64893c4477e8c0d7291",
"size": "1036",... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='orders',
version='0.0.1',
description='Orders microservice',
... | {
"content_hash": "1e1d89cbf564767d1973b078f27b0177",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 71,
"avg_line_length": 29.611940298507463,
"alnum_prop": 0.5912298387096774,
"repo_name": "morganjbruce/microservices-in-action",
"id": "ce261d5e3ab0767efa4d40c7bf740a236d20a... |
import itertools, weakref
from .. colors import make
from .. util import color_list, log
class Pixels:
"""
Wrap pixels attached to a layout for easy access and
better error reporting.
"""
def __init__(self, builder):
self.builder = weakref.ref(builder)
def __getitem__(self, index):
... | {
"content_hash": "f6f0cad3e0a3601bee2df85890cbb511",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 79,
"avg_line_length": 27.565217391304348,
"alnum_prop": 0.544689800210305,
"repo_name": "ManiacalLabs/BiblioPixel",
"id": "e29ad6d2fbeff648e9dfeec68c6ba9a3f955dcec",
"size... |
from pyherc.test.bdd.features.helpers import get_character
from pyherc.test.cutesy import make, wait_
from pyherc.test.cutesy.dictionary import get_history_value
@then('time should pass for {character_name}')
def impl(context, character_name):
character = get_character(context, character_name)
old_time = get... | {
"content_hash": "11c91dd64de915244baedfaaf1bd5d5c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 59,
"avg_line_length": 30.210526315789473,
"alnum_prop": 0.7369337979094077,
"repo_name": "tuturto/pyherc",
"id": "49943a399cdd99516d7a6c81b1d6bb15d132652f",
"size": "1716"... |
''' The data in airports.json is a subset of US airports with field
elevations > 1500 meters. The query result was taken from
.. code-block:: none
http://services.nationalmap.gov/arcgis/rest/services/GlobalMap/GlobalMapWFS/MapServer/10/query
on October 15, 2015.
'''
#-------------------------------------------... | {
"content_hash": "de80e4ff4ac3dd0670b54157e963dff1",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 117,
"avg_line_length": 35,
"alnum_prop": 0.37183098591549296,
"repo_name": "timsnyder/bokeh",
"id": "2f9125f712e35142bd10cc7dcb4957e5eab550ef",
"size": "2816",
"binary":... |
from django.conf.urls.defaults import *
## reports view
urlpatterns = patterns('aquatest_reports.views',
(r'^reports$', 'reports'),
(r'^sampling_points$', 'sampling_points'),
(r'^report_testers$', 'testers'),
(r'^date_range$', 'date_range'),
(r'^create_report$', 'create_report'),
(r'^export_csv... | {
"content_hash": "3b7e92369341140a56d23aa9c3fe49f0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 26,
"alnum_prop": 0.5961538461538461,
"repo_name": "commtrack/temp-aquatest",
"id": "7b092c43f8c4cc3917e802802e62d4232f157a21",
"size": "416",
"bin... |
""" Preprocessing Module for Real-time Scan
Set of utilities for apply specified preprocessing steps to data during a
real-time run.
"""
import sys
import logging
import io
import contextlib
import zmq
import numpy as np
import nibabel as nib
from nipy.algorithms.registration import HistogramRegistration, Rigid
cl... | {
"content_hash": "4db1bc78d8814ba1dbbe77007ffa7762",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 101,
"avg_line_length": 34.18214285714286,
"alnum_prop": 0.6024448855918921,
"repo_name": "jeffmacinnes/pyneal",
"id": "6599725529a6f1884969079a76b32e9dcf0fda39",
"size": ... |
"""Access control list implementation."""
import collections
from google.appengine.ext import ndb
from components import auth
from . import impl
################################################################################
## Role inheritance.
# Predefined roles.
ROLES = [
'OWNER',
'WRITER',
'READER',
]... | {
"content_hash": "f9f8c8aaa51c1733d2712de57a0feada",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 80,
"avg_line_length": 32.68493150684932,
"alnum_prop": 0.6610435875943,
"repo_name": "nicko96/Chrome-Infra",
"id": "8b1df2e4e2932e4c15a043984573b1522987558d",
"size": "97... |
import angr
######################################
# geteuid
######################################
class geteuid(angr.SimProcedure):
# pylint: disable=arguments-differ
def run(self):
return 1000
| {
"content_hash": "c11483f9bde041f3b6907b57254675d8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 21.4,
"alnum_prop": 0.43457943925233644,
"repo_name": "angr/angr",
"id": "b04954ceb1b548b9bde9ab6e8096bbb0ce466e40",
"size": "214",
"binary": false... |
from ._event_hub_management_client import EventHubManagementClient
__all__ = ['EventHubManagementClient']
try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
| {
"content_hash": "c03586c8a8b486f71a57d4c460c289cb",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 66,
"avg_line_length": 25.875,
"alnum_prop": 0.7246376811594203,
"repo_name": "Azure/azure-sdk-for-python",
"id": "72f93dd9db6cc6ba2d73c0e5ce35138779690eba",
"size": "675",
... |
from __future__ import division, with_statement
import gzip
import bz2
import io
import gzip
import mmap
import os
import shutil
import sys
import warnings
import zipfile
try:
import StringIO
HAVE_STRINGIO = True
except ImportError:
HAVE_STRINGIO = False
import numpy as np
from ..extern.six import Bytes... | {
"content_hash": "f71b03ce240aceacc1e4464857e45564",
"timestamp": "",
"source": "github",
"line_count": 1124,
"max_line_length": 84,
"avg_line_length": 35.94128113879004,
"alnum_prop": 0.5646319124709144,
"repo_name": "spacetelescope/PyFITS",
"id": "b6d5a4e56fe57b50ce12614c1569c8a7a554829e",
"size"... |
"""Flags for the Azure Blob Storage interface."""
import gflags as flags
flags.DEFINE_string('azure_account', None,
'The name of the storage account for Azure.')
flags.DEFINE_string('azure_key', None,
'The key of the storage account for Azure.')
| {
"content_hash": "d4b876165e82bd56c193b0080632327c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 65,
"avg_line_length": 32.111111111111114,
"alnum_prop": 0.6366782006920415,
"repo_name": "xiaolihope/PerfKitBenchmarker-1.7.0",
"id": "e08850ad72fa19a2d220a171a7ed4de388b697a... |
from copy import deepcopy
from datetime import datetime
from mock import patch, Mock
from teuthology import suite
from teuthology.config import config
class TestSuiteOffline(object):
def test_name_timestamp_passed(self):
stamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
name = suite.make_run_... | {
"content_hash": "059ef08df94ad483bf24950ce8e3871c",
"timestamp": "",
"source": "github",
"line_count": 701,
"max_line_length": 80,
"avg_line_length": 36.07703281027104,
"alnum_prop": 0.4465005931198102,
"repo_name": "ivotron/teuthology",
"id": "1ef535bcd5216628a7d198124598823ae03220f4",
"size": "2... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20150703_2228'),
]
operations = [
migrations.AlterField(
model_name='element',
name='created',
... | {
"content_hash": "e38ca530d05b8a39c178a0f619af13b2",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 58,
"avg_line_length": 27.976744186046513,
"alnum_prop": 0.5461346633416458,
"repo_name": "SanaMobile/sana.protocol_builder",
"id": "69dc53f62d3784e58bbd05c21248642406ee9a30"... |
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('herders', '0011_runecraftinstance_quantity'),
]
operations = [
migrations.RemoveField(
model_name='monsterinstance',
nam... | {
"content_hash": "078e658de1faa993e184923bc2d83012",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 147,
"avg_line_length": 40.02439024390244,
"alnum_prop": 0.5548446069469836,
"repo_name": "PeteAndersen/swarfarm",
"id": "8acbff048b027b11648a63e399f633af5b6bafa8",
"size":... |
"""Auto-generated file, do not edit by hand. FI metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_FI = PhoneMetadata(id='FI', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2,5}', possible_number_pattern='\\... | {
"content_hash": "57cfe3227b5cb16a575b480b81eef1ff",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 153,
"avg_line_length": 77.5,
"alnum_prop": 0.7311827956989247,
"repo_name": "vicky2135/lucious",
"id": "b0a56318d48d160f77c9e4ce011323838da4a2d4",
"size": "930",
"binary... |
from __future__ import absolute_import
from django.core import mail
from django.contrib.auth.models import User
from sentry.models import Project, ProjectKey, Group, Event, Team, \
MessageFilterValue, MessageCountByMinute, FilterValue, PendingTeamMember
from sentry.testutils import TestCase
class ProjectTest(Tes... | {
"content_hash": "4b6d98a57bd13059d68f8f30fa390d03",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 126,
"avg_line_length": 44.49438202247191,
"alnum_prop": 0.6825757575757576,
"repo_name": "simmetria/sentry",
"id": "c4622bc0c05c3a70c1556af1a9cc682b19b97e08",
"size": "397... |
"""
createdby: Darren Zhao Xie on 9/23/2018
module: wechat auto sending msg server
next plan: 1) send self msg
2) multiple wechat login
3) news update server once a day
"""
current_version = 0.0.0.2
| {
"content_hash": "093525ed8fa4b4ee84269eb66a07bb6e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 22.3,
"alnum_prop": 0.6547085201793722,
"repo_name": "mndarren/Code-Lib",
"id": "f11e5bc09509aaff9dda3016cfda06cc5ec52a93",
"size": "223",
"binary"... |
import warnings
from nose.tools import eq_
from wsgi_intercept.httplib2_intercept import install, uninstall
import wsgi_intercept
from wsgi_intercept import test_wsgi_app
import httplib2
from paste import lint
_saved_debuglevel = None
def prudent_wsgi_app():
return lint.middleware(test_wsgi_app.create_fn())
def ... | {
"content_hash": "25b5919fefc6ac8878ba83bcec1aa04f",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 128,
"avg_line_length": 36.53703703703704,
"alnum_prop": 0.6791687785098834,
"repo_name": "Zavteq/fixofx",
"id": "45735e7621aa9a3f1b42f41540a712c6f075f5b3",
"size": "1999",... |
import json
import os
import numpy as np
from scipy import stats
from CLASSES import CLASSES_REVERSED
def count_classes(dir='data/dataset', simple_count=False):
"""
Given a directory returns a dict with all the classes found and the quantity if each class. It counts over the
.txt files.
Result:
{
... | {
"content_hash": "778062a6a8df6398c9c7f80d835af5e1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 114,
"avg_line_length": 30.346666666666668,
"alnum_prop": 0.5812829525483304,
"repo_name": "SetaSouto/license-plate-detection",
"id": "4ad34de6be9754cfffdb3e23b3536f549b49078... |
"""
Support for the DirecTV recievers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.directv/
"""
import voluptuous as vol
from homeassistant.components.media_player import (
MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO, SUPPORT_PAUSE, SUPPORT_... | {
"content_hash": "26bd0f705ee641a4277bea984acb3577",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 27.864864864864863,
"alnum_prop": 0.5957322987390883,
"repo_name": "leoc/home-assistant",
"id": "0a53ffbbed60876ecccc1c8f777a0e42a937d145",
"size": ... |
import unittest
from rocks.process import cover
class TestReadingStructures(unittest.TestCase):
"""Reading
"""
def test_when_compile_code_return_lines_pass(self):
cov = cover.check_code('/mnt/e/some_code')
data = cov.get_data()
assert data is not None
assert data.line_c... | {
"content_hash": "91a82b6cf856dd33245791a4de874f21",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 55,
"avg_line_length": 20.875,
"alnum_prop": 0.6377245508982036,
"repo_name": "jonesambrosi/rocks",
"id": "bd4ee18e95de7f900fe65a7cdda76f62a142f658",
"size": "334",
"bina... |
import numpy as np
import imageio
from PIL import Image
from skimage import color
def imread(path, mode="RGB"):
# Loads data in HxW format, then transposes to correct format
img = np.array(imageio.imread(path, pilmode=mode))
return img
def imresize(img, size, interp='bilinear'):
"""
Resizes ... | {
"content_hash": "536a0022fa845b7b4833b414aa2748fa",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 65,
"avg_line_length": 20.962264150943398,
"alnum_prop": 0.6120612061206121,
"repo_name": "titu1994/Neural-Style-Transfer",
"id": "615b7eed942dd309844c187abc997beb46603ac0",
... |
"""
sphinx.transforms
~~~~~~~~~~~~~~~~~
Docutils transforms used by Sphinx when reading documents.
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from os import path
from docutils import nodes
from docutils.utils import new_document, ... | {
"content_hash": "bda98fc6c7ecab86939208017a94c245",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 88,
"avg_line_length": 39.72982456140351,
"alnum_prop": 0.5387706438223085,
"repo_name": "WhySoGeeky/DroidPot",
"id": "681b50e0571f4179d7d123d3ad1783ce1875cb5d",
"size": "... |
import os
import pytest
from pytzdata import set_directory, tz_path, TimezoneNotFound
fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'tz')
def setup_module(module):
if 'PYTZDATA_TZDATADIR' in os.environ:
del os.environ['PYTZDATA_TZDATADIR']
set_directory()
def teardown_module... | {
"content_hash": "f486f0d660ace8cad1a97d105352a8aa",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 81,
"avg_line_length": 24.779661016949152,
"alnum_prop": 0.6538987688098495,
"repo_name": "sdispater/pytzdata",
"id": "430d2392cd27757c886a9649b754d3fdc98d02b1",
"size": "1... |
from __future__ import absolute_import
from collections import namedtuple
from inspect import isclass
from django.utils.translation import ugettext_lazy as _
__all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',)
class _LOG(object):
action_class = None
class CREATE_ADDON(_LOG):
id = 1
action_class = 'add'
... | {
"content_hash": "636dfcc670910a7c429ce960b3922a9b",
"timestamp": "",
"source": "github",
"line_count": 782,
"max_line_length": 78,
"avg_line_length": 23.558823529411764,
"alnum_prop": 0.6192802475166911,
"repo_name": "eviljeff/olympia",
"id": "6e10122a60a00e8e818e903ab05f00fd10f55513",
"size": "18... |
from gppylib.operations.backup_utils import escapeDoubleQuoteInSQLString
class RepairMissingExtraneous:
def __init__(self, catalog_table_obj, issues, pk_name):
self.catalog_table_obj = catalog_table_obj
catalog_name = self.catalog_table_obj.getTableName()
self._escaped_catalog_name = esc... | {
"content_hash": "68bd897da46ae0e6f7d65729a2ed8861",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 113,
"avg_line_length": 41.37837837837838,
"alnum_prop": 0.5525800130633572,
"repo_name": "lintzc/gpdb",
"id": "f6ea0d61dc975ed2bb92dbf70d020426ea03e993",
"size": "3084",
... |
import os
import re
import time
import unittest
from django.conf import settings
from selenium import webdriver
from selenium.common.exceptions import NoAlertPresentException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
fr... | {
"content_hash": "c79cddc300129db6c0a6cae9fafdd167",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 102,
"avg_line_length": 41.527415143603136,
"alnum_prop": 0.5749764225086451,
"repo_name": "cga-harvard/HHypermap",
"id": "34174802485aa5b624043379052efd08ed17c7de",
"size... |
import eventful
from django.conf import settings
def get_events():
"""
Docs: https://api.eventful.com/docs/events/search
Need to sort by date and then show some actual details
"""
api = eventful.API(settings.EVENTFUL_API_KEY)
return api.call('/events/search', l='Dover, NH').get('events').get('... | {
"content_hash": "a98a1193a7e23f9dafc28562352ea35c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 29.727272727272727,
"alnum_prop": 0.6819571865443425,
"repo_name": "tclancy/whiteboard",
"id": "3eb712e730c1061ab1f4c59f7cc37f82b33201ed",
"size": "3... |
import threading
import websocket
import json
import logging
logging.basicConfig()
class SocketHandler(threading.Thread):
def __init__(self, host, send_q, recv_q, debug=False, sentinel=None):
super(SocketHandler, self).__init__()
self.debug = debug
self.send_q = send_q
self.recv_q = recv_q
self._... | {
"content_hash": "a0fa870c133dd7bfdda1a27b90a3ba44",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 71,
"avg_line_length": 26.310344827586206,
"alnum_prop": 0.6009174311926605,
"repo_name": "mirobot/mirobot-py",
"id": "f2bb91c3edff047b0ea414f1592f4906bfef1c61",
"size": "1... |
import jwt
from django.utils.translation import gettext_lazy as _
from jwt import InvalidAlgorithmError, InvalidTokenError, algorithms
from .exceptions import TokenBackendError
from .utils import format_lazy
ALLOWED_ALGORITHMS = (
'HS256',
'HS384',
'HS512',
'RS256',
'RS384',
'RS512',
)
class... | {
"content_hash": "a92f0fcfaf81549bbe25f84cc3a309d8",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 113,
"avg_line_length": 35.94736842105263,
"alnum_prop": 0.6314055636896047,
"repo_name": "davesque/django-rest-framework-simplejwt",
"id": "de7128ad318ee0474ca37140f09d24403... |
import proto # type: ignore
from google.cloud.aiplatform_v1.types import accelerator_type as gca_accelerator_type
__protobuf__ = proto.module(
package="google.cloud.aiplatform.v1",
manifest={
"MachineSpec",
"DedicatedResources",
"AutomaticResources",
"BatchDedicatedResources"... | {
"content_hash": "5a6aeaf32df101f89d58e1dadf748a82",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 112,
"avg_line_length": 35.82831325301205,
"alnum_prop": 0.6291719209751997,
"repo_name": "googleapis/python-aiplatform",
"id": "23a5bb218777c51af75af42ba83e9220ef5c3fa8",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("statistics", "0010_existing_case_timings_count")]
operations = [
migrations.AlterField(model_name="dailysecondtotalcount", name="seconds", field=models.BigIntege... | {
"content_hash": "7229471244918465be20f8475b51efad",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 113,
"avg_line_length": 28,
"alnum_prop": 0.7291666666666666,
"repo_name": "rapidpro/casepro",
"id": "3d6fcb05317a307a561a8440518a86e59ef334a0",
"size": "409",
"binary": ... |
import unittest
class GpTestCase(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(GpTestCase, self).__init__(methodName)
self.patches = []
self.mock_objs = []
self.__class__.apply_patches_counter = 0
self.__class__.tear_down_counter = 0
def apply_pat... | {
"content_hash": "1dbbf1e1e45c3dd1357c7da13ca96b9a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 96,
"avg_line_length": 31.227272727272727,
"alnum_prop": 0.5749636098981077,
"repo_name": "rvs/gpdb",
"id": "ddfee30407fe010ab5efc5ba6a760fa5efe12471",
"size": "2748",
"b... |
import unittest
import json
from guitar.configurator import Configurator
class TestConfigurator(unittest.TestCase):
config_path = 'tests/test_config_json.txt'
maxDiff = None
def test_configurator(self):
with open(self.config_path, 'r') as f:
config = json.loads(f.read())
fi... | {
"content_hash": "cfc5e88e58e580128ea3e4cc43797acb",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 244,
"avg_line_length": 31.614754098360656,
"alnum_prop": 0.4366087632875292,
"repo_name": "django-stars/guitar",
"id": "0eef2d8c3ba659ff6014158eb4c551afda70df02",
"size":... |
from __future__ import unicode_literals
import copy
import os
import re
import sys
from io import BytesIO
from itertools import chain
from pprint import pformat
from django.conf import settings
from django.core import signing
from django.core.exceptions import DisallowedHost, ImproperlyConfigured
from dj... | {
"content_hash": "827fac365fedacb0fffd982d9671a5fa",
"timestamp": "",
"source": "github",
"line_count": 581,
"max_line_length": 110,
"avg_line_length": 37.63855421686747,
"alnum_prop": 0.56841046277666,
"repo_name": "diego-d5000/MisValesMd",
"id": "d28da556b24c3710ce7c5088e8e4cbb0b92f0941",
"size":... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE = [
'django.middleware.cache.UpdateCacheMiddl... | {
"content_hash": "b97f68035de5ab34d87f0776d4c003c6",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 102,
"avg_line_length": 41.07216494845361,
"alnum_prop": 0.6708082329317269,
"repo_name": "simonw/django",
"id": "9705270b59277333c5ac460ca2abc2029789bb65",
"size": "7968"... |
import time
import mock
import shutil
import tempfile
import unittest
from hashlib import md5
from six.moves import urllib
from textwrap import dedent
from swift.common import swob
from swift.common.middleware import copy
from swift.common.storage_policy import POLICIES
from swift.common.swob import Request, HTTPExcep... | {
"content_hash": "9669d7d2c6c2e276b32071be4bd05014",
"timestamp": "",
"source": "github",
"line_count": 1680,
"max_line_length": 79,
"avg_line_length": 48.963095238095235,
"alnum_prop": 0.5686863283814341,
"repo_name": "clayg/swift",
"id": "bbf74bbc1bad34125f83f679a6eea890b5f3cfbd",
"size": "82870"... |
from random import random
from tensorforce.environments import Environment
import numpy as np
import random
BOARD_HEIGHT = 6
BOARD_WIDTH = 6
BOARD_SIZE = BOARD_HEIGHT * BOARD_WIDTH
PLANE_SIZE = 8
def init_board():
hidden_board = np.zeros((BOARD_HEIGHT, BOARD_WIDTH))
# Populate the plane's position
# Fi... | {
"content_hash": "271a2664e384f485294b361e4bbee3f8",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 67,
"avg_line_length": 33.77884615384615,
"alnum_prop": 0.5881013378878451,
"repo_name": "windmaple/planestrike-tensorforce",
"id": "e745588115932902deadf96b05bec6a50e86468a... |
from dataviva import db
from dataviva.utils.auto_serialize import AutoSerialize
from dataviva.api.attrs.models import Wld, Hs, Bra
from sqlalchemy.ext.declarative import declared_attr
class BaseSecex(db.Model, AutoSerialize):
__abstract__ = True
year = db.Column(db.Integer(4), primary_key=True)
month = db.... | {
"content_hash": "ad3de5c9fc2e33354682f897131e7b85",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 28.164383561643834,
"alnum_prop": 0.6697470817120622,
"repo_name": "DataViva/dataviva-site",
"id": "1da4ad2e77709ffe3475224a368245c77d10d903",
"size"... |
import re
from bs4 import BeautifulSoup
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
import json
class BaseURLSpider(CrawlSpider):
'''
This class is responsible for crawling globe and mail articles urls
'''
name = 'BaseURL'
allowed_domains = ["www.th... | {
"content_hash": "fae184d037f435ab572c9bae339c64aa",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 104,
"avg_line_length": 38.193548387096776,
"alnum_prop": 0.5612331081081081,
"repo_name": "sfu-discourse-lab/SFU_Comment_Extractor",
"id": "5bb539aa85142f478dc6b6b5b37578a7e... |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Author(s):
George Paulos
RackHD Functional Integration Test (FIT) library
This is the main common function library for RackHD FIT tests.
'''
# Standard imports
import fit_path # NOQA: unused import
import os
import sys
import json
import subproc... | {
"content_hash": "af1549838e6a8976cde36212f779aa85",
"timestamp": "",
"source": "github",
"line_count": 1228,
"max_line_length": 125,
"avg_line_length": 39.11807817589577,
"alnum_prop": 0.5290713408414347,
"repo_name": "tannoa2/RackHD",
"id": "9c6e2bfe31f991ce189fb53fb9c9edd499b4a6ec",
"size": "480... |
import collections
import contextlib
import itertools
from django.utils.translation import ugettext_lazy as _, pgettext
from configuration.configuration import QuestionnaireQuestion, \
QuestionnaireQuestiongroup
from summary.parsers.questionnaire import QuestionnaireParser
class Technology2015Parser(Questionnai... | {
"content_hash": "290e2cf2a49af5de7590a1b279beff7c",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 96,
"avg_line_length": 43.888888888888886,
"alnum_prop": 0.5487341772151899,
"repo_name": "CDE-UNIBE/qcat",
"id": "7f5388ee47f8a136a08184b800dbd7b4be79ca98",
"size": "1106... |
import importlib
import warnings
from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from docutils import nodes
from sphinx.util.nodes import nested_parse_with_titles
def type_description(schema):
"""Return a concise type description for the given schema"""
if schema == {}:
... | {
"content_hash": "9a6d7e7b4dd618bc3f8e9ad1593d6939",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 81,
"avg_line_length": 32.33644859813084,
"alnum_prop": 0.6014450867052024,
"repo_name": "ellisonbg/altair",
"id": "958a0fec4a0a29e25caf108fe421b986e9ef8156",
"size": "346... |
from __future__ import print_function
import argparse
import glob
import os
import shutil
import subprocess
import sys
from lib.util import get_electron_branding, rm_rf, scoped_cwd
PROJECT_NAME = get_electron_branding()['project_name']
PRODUCT_NAME = get_electron_branding()['product_name']
SOURCE_ROOT = os.path.abspa... | {
"content_hash": "13334e7f3eff3614980c27b9c07979c9",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 39.016806722689076,
"alnum_prop": 0.6073659272022399,
"repo_name": "the-ress/electron",
"id": "6530265bde8982d9859b78a0ef2f7a33938ba3d2",
"size": "4... |
import theano
import lasagne
import numpy as np
import theano.tensor as T
class ModRelu(lasagne.layers.Layer):
def __init__(self, incoming, b=lasagne.init.Uniform(range=0.01), **kwargs):
super(ModRelu, self).__init__(incoming, **kwargs)
print(self.input_shape)
self.n_hidden = self.input_s... | {
"content_hash": "356cc824b286aa24ca432eb41147438b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 106,
"avg_line_length": 40.75,
"alnum_prop": 0.6288343558282209,
"repo_name": "Nehoroshiy/urnn",
"id": "212b00ad51a59bf37b5fbd14a807ad45436df330",
"size": "978",
"binary"... |
'''OpenGL extension VERSION.GL_2_1
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_VERSION_GL_2_1'
_DEPRECATED = False
GL_PIXEL_PACK_BUFFER = c... | {
"content_hash": "157d15d786e8538e99efa972340973bc",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 111,
"avg_line_length": 46.51724137931034,
"alnum_prop": 0.784037558685446,
"repo_name": "Universal-Model-Converter/UMC3.0a",
"id": "e07f468ce81693023ab8190351221d29216ed5cc"... |
import pdb
import numpy as np
import ConfigParser
import os
import logging
import pprint
import astropy.cosmology as ac
from astropy.cosmology import Planck15 as cosmo
from astropy.cosmology import Planck15, z_at_value
import astropy.units as u
#import NDpredict
from utils import string_is_true
#from astropy.cosmology ... | {
"content_hash": "c8dc76c74c608c3bbc3462de84e516f8",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 150,
"avg_line_length": 35.74129353233831,
"alnum_prop": 0.593402004454343,
"repo_name": "marcoviero/simstack",
"id": "e135ec290bc0d99ccadb47221be5e8cca7a4bc4c",
"size": "... |
"""Shapley value analysis"""
__author__ = 'thor'
from numpy import unique, concatenate, sort
import numpy as np
import pandas as pd
from collections import Counter, OrderedDict, defaultdict
import string
import random as rnd
import itertools
from scipy.misc import factorial
from ut.util.uiter import all_subsets_of, ... | {
"content_hash": "100014e3583cd2a368633889b98a7cec",
"timestamp": "",
"source": "github",
"line_count": 542,
"max_line_length": 107,
"avg_line_length": 38.108856088560884,
"alnum_prop": 0.5873638344226579,
"repo_name": "thorwhalen/ut",
"id": "26f7059e46a7ec7766a07933864665e87298aa13",
"size": "2065... |
import atexit
import fcntl
import grp
import logging as std_logging
from logging import handlers
import os
import pwd
import signal
import sys
from oslo_log import log as logging
from neutron.common import exceptions
from neutron.i18n import _LE, _LI
LOG = logging.getLogger(__name__)
DEVNULL = object()
def setuid... | {
"content_hash": "5e2c19a9fdcf33de6a191a6562cef4a5",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 77,
"avg_line_length": 30.01769911504425,
"alnum_prop": 0.5673643867924528,
"repo_name": "wenhuizhang/neutron",
"id": "670a239898b3a533d5649c4e29d0e191f7eee0ea",
"size": "... |
import re
import requests
import json
import os
import vim
class GitRepo:
config = ""
user_name = ""
repo_name = ""
simplified_issues = []
def __init__(self, config_file):
f = open(config_file, 'r')
content = f.read()
self.parse_config(content)
f.close()
def ... | {
"content_hash": "9f3d0fb746bba644f6306e7a14180a17",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 98,
"avg_line_length": 28.981308411214954,
"alnum_prop": 0.5446630119316349,
"repo_name": "at15/issue-complete",
"id": "c72ab5516ede037c6759efe6737271eca1423615",
"size": ... |
class Rec1:
"""Implementation of the application data type Rec1.
Generated by: EASy-Producer."""
intField: int
stringField: str
| {
"content_hash": "141e1771c1d5c66e340651b6641278ec",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 57,
"avg_line_length": 25,
"alnum_prop": 0.66,
"repo_name": "SSEHUB/EASyProducer",
"id": "6ec2a97fbeb2fae99518aa825f59dc6d4d086623",
"size": "150",
"binary": false,
"cop... |
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 'Questionnaire'
db.create_table('questionnaire_questionnaire', (
('id', self.gf('django.db.models... | {
"content_hash": "6a803674979162d83b131943fa8d1719",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 200,
"avg_line_length": 66.15277777777777,
"alnum_prop": 0.5892294772202393,
"repo_name": "pythonbyexample/PBE",
"id": "a9670698d172809b3e06f96eb9439a83ac973304",
"size": ... |
from nova.compute import manager as compute_manager
from nova.tests.functional.test_servers import ProviderUsageBaseTestCase
class TestServerResizeReschedule(ProviderUsageBaseTestCase):
"""Regression test for bug #1741125
During testing in the alternate host series, it was found that retries
when resizin... | {
"content_hash": "00fb1caffb11ed22a018d244dd90652b",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 75,
"avg_line_length": 42.44117647058823,
"alnum_prop": 0.6406791406791407,
"repo_name": "phenoxim/nova",
"id": "2d361e20bd21756f5c36e4854a30308a776b2a0f",
"size": "3430",
... |
import _plotly_utils.basevalidators
class AnglesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="anglesrc", parent_name="scattersmith.marker", **kwargs
):
super(AnglesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | {
"content_hash": "61fdcf1317c905306f3362dd8063a875",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 32.53846153846154,
"alnum_prop": 0.6099290780141844,
"repo_name": "plotly/plotly.py",
"id": "da1b87b65d2f7f445c4cad28cce700b853905467",
"size": "423"... |
from sdc import hstr_ext
import llvmlite.binding as ll
from llvmlite import ir as lir
from collections import namedtuple
import operator
import numba
from numba import types
from numba.core import cgutils
from numba.core import ir_utils, ir
from numba.core.ir_utils import (guard, get_definition, find_callname, require,... | {
"content_hash": "568d59d6505ff72bdd37e0fbdb0ae631",
"timestamp": "",
"source": "github",
"line_count": 675,
"max_line_length": 119,
"avg_line_length": 34.15259259259259,
"alnum_prop": 0.6374007721337787,
"repo_name": "IntelLabs/hpat",
"id": "7a4c54deadfbc8fdb871fd19482d7b1e726108b1",
"size": "2456... |
class WrapCallable(object):
"""
With python3 the unittest framework calls the __getattr__ method of the callable
with "__name__" parameter and this cases problems if the callable is something that
implements __getattr__ but doesn't expect "__name__" as a parameter there.
"""
def __init__(self, c... | {
"content_hash": "5ac43d02da39cd9351ec2b01a57c3907",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 87,
"avg_line_length": 41.18181818181818,
"alnum_prop": 0.6490066225165563,
"repo_name": "pasztorpisti/json-cfg",
"id": "e390845d4e505a7fd48d34b33208f4275a91b7a2",
"size": ... |
import sys
import os
import shlex
# 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('.'))
# --... | {
"content_hash": "f79ff4fb46b591d4e578ec4812943cb6",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 79,
"avg_line_length": 32.50359712230216,
"alnum_prop": 0.7076139884904825,
"repo_name": "2degrees/twapi-connection",
"id": "64b67604090dfd279cd275d35bfd66380403e076",
"si... |
import voodoo.gen.protocols.BaseSocket.Messages as Messages
import sys
def _retrieve_class(complete_class_name):
copy_of_complete_class_name = complete_class_name
while copy_of_complete_class_name != '' and not sys.modules.has_key(copy_of_complete_class_name):
copy_of_complete_class_name = copy_of_com... | {
"content_hash": "e7a3342a0b324b54637add519cf043cb",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 132,
"avg_line_length": 41.60377358490566,
"alnum_prop": 0.6598639455782312,
"repo_name": "ganeshgore/myremolab",
"id": "e3e3500f736b86bc030f94160f54a13756e0e79b",
"size":... |
import re
for test_string in ['555-1212', 'ILL-EGAL']:
if re.match(r'^\d{3}-\d{4}$', test_string):
print test_string, 'is a valid US local phone number'
else:
print test_string, 'rejected'
| {
"content_hash": "dc3d911378f4d06232b49c7cc07f0be4",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 61,
"avg_line_length": 35.5,
"alnum_prop": 0.6056338028169014,
"repo_name": "lizhuoli1126/MarkdownScript",
"id": "6ce9825f98c052096e753cc0725740fcca8dfb59",
"size": "272",
... |
import os
import unittest
from document import DjangoDocument
class Talk(DjangoDocument):
structure = {'topic': unicode}
class CrazyOne(DjangoDocument):
class Meta:
verbose_name = u"Crazy One"
structure = {'name': unicode}
class CrazyTwo(DjangoDocument):
class Meta:
verbose_name = ... | {
"content_hash": "06b6e7fa0af33941a8accdf8d0857d65",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 79,
"avg_line_length": 36.79417879417879,
"alnum_prop": 0.6147587297999774,
"repo_name": "peterbe/django-mongokit",
"id": "e42abfe49579afef4b0dc059ad82817573db7f35",
"size... |
import random
import string
import numpy as np
class DataProvider(object):
""""Provides a vector representation for the given ASCII string"""
def __init__(self, num_samples, max_str_len=32, alphabet=None, batch_size=32):
self.num_samples = num_samples
self.max_str_len = max_str_len # we will ge... | {
"content_hash": "cb55a60c80a7f60d83edcc3e3e3b3bc0",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 146,
"avg_line_length": 44.13793103448276,
"alnum_prop": 0.5666015625,
"repo_name": "ananthpn/tensorflow",
"id": "f50b134bb623a9c60cea3cb4c2d955661cfd7393",
"size": "5823"... |
import json
import time
import platform
import socket
import datetime
#import random # Used to generate sample data; comment out this line if real data is used
import requests
import urllib3 # Used to disable warnings about insecure SSL (optional)
# Import any special packages needed for a particular hardware platform... | {
"content_hash": "ba9fda7f459949fedd5b7dbfe72cccd7",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 193,
"avg_line_length": 47.903930131004365,
"alnum_prop": 0.5641750227894257,
"repo_name": "osisoft/OMF-Samples",
"id": "a278821e31ec13f8d57b3b9905b9c237a350eb8f",
"size":... |
import datetime
import math
import re
from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
Avg,
Case,
Count,
DateField,
DateTimeField,
DecimalField,
DurationField,
Exists,
F,
FloatField,
Int... | {
"content_hash": "ef570c7f661d837df657ac40537dae92",
"timestamp": "",
"source": "github",
"line_count": 2077,
"max_line_length": 88,
"avg_line_length": 36.68367838228214,
"alnum_prop": 0.5157365602687947,
"repo_name": "auvipy/django",
"id": "c6d73e80429dfdfa185055b4aca0e244e0a04145",
"size": "76192... |
"""An API for reversible (bijective) transformations of random variables."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
from tensorflow.contrib.distributions.python.ops.shape import _DistributionShape
from tensorflow.python.framework ... | {
"content_hash": "642c48f904eeaa5ba15e443d092fcbe9",
"timestamp": "",
"source": "github",
"line_count": 578,
"max_line_length": 80,
"avg_line_length": 33.173010380622834,
"alnum_prop": 0.6215708772295817,
"repo_name": "MostafaGazar/tensorflow",
"id": "9f69d3cb21d56eca4e49b3de7534dc773fc525fa",
"siz... |
from __future__ import absolute_import
from jsonlibconfig.yacc import parser
from jsonlibconfig.lex import hextoint
def load(f, _hextoint=False):
s = ""
for buff in f.read():
s = s + buff
return loads(s, _hextoint)
def loads(s, _hextoint=False):
hextoint(_hextoint)
return parser.parse(s... | {
"content_hash": "57c92c8959afcd4e60cb9a148165f0ad",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 38,
"avg_line_length": 20.125,
"alnum_prop": 0.6677018633540373,
"repo_name": "imZack/jsonlibconfig",
"id": "b8ff0c60239915ea1562d08a55b126b78de5bace",
"size": "322",
"bi... |
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopard, lion, mountainlion,
# mavericks, yosemite, linux, chromeos, android
#
# GPU vendors:
# amd, arm, broadcom, hisilicon, intel, imagination, nvidia, qualco... | {
"content_hash": "3f44b9016c6bd32e07b4776f2406b2ba",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 79,
"avg_line_length": 36.695238095238096,
"alnum_prop": 0.6849208409031923,
"repo_name": "TheTypoMaster/chromium-crosswalk",
"id": "fdae5abd4ecf5357bf673d8b0d07d877203235f1... |
from pypdflite import PDFCursor
def TestCursor(test_dir):
cursor1 = PDFCursor(20, 30)
cursor2 = PDFCursor(22, 50)
#print "Should be True:", cursor1 < cursor2
print ("Should be False: ", cursor1 > cursor2)
print ("Should be False: ", cursor1 == cursor2)
if __name__ == '__main__':
TestCursor()... | {
"content_hash": "7de7641245ad4069ec11a4b4836c0d3b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 51,
"avg_line_length": 24.692307692307693,
"alnum_prop": 0.632398753894081,
"repo_name": "katerina7479/pypdflite",
"id": "063e3bb717de3ee738f43d5e26dd4240e49d30e5",
"size":... |
"""
There are a number of spherical balloons spread in two-dimensional space. For
each balloon, provided input is the start and end coordinates of the horizontal
diameter. Since it's horizontal, y-coordinates don't matter and hence the
x-coordinates of start and end of the diameter suffice. Start is always smaller
than... | {
"content_hash": "3d9d2b0e105bd6216bc886177a092730",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 80,
"avg_line_length": 27.970588235294116,
"alnum_prop": 0.6219768664563617,
"repo_name": "algorhythms/LeetCode",
"id": "fee91d01388b6e79f21de9c3dec4b6798e826156",
"size": ... |
from django.http import HttpResponse
from box.models import Box
from django.shortcuts import get_object_or_404, render, redirect
from django.forms import ModelForm
from django.contrib.auth.decorators import login_required
#ModelForm to create a box
class BoxCreateForm(ModelForm):
class Meta:
model = Box
... | {
"content_hash": "73ad7b8748c53ef66b0a755da120ac68",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 94,
"avg_line_length": 30.433962264150942,
"alnum_prop": 0.6788592684438933,
"repo_name": "gallardjm/TUM_WebTech_DjangoExample",
"id": "adb1ca7024820f6de36a9b4f9d905edff907d9... |
"""Functions and classes related to optimization (weight updates)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import tensorflow as tf
def create_optimizer(loss, init_lr, num_train_steps, num_warmup_steps,
use_tpu):
... | {
"content_hash": "00ed674fda32a7cc6281bd2c9ce9c610",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 84,
"avg_line_length": 37.51592356687898,
"alnum_prop": 0.5884550084889644,
"repo_name": "FeiSun/BERT4Rec",
"id": "cbfeb960aae3fc253e73a9f72272e7d57c5b0ee1",
"size": "6505... |
import operator
import euler
from Arista import Arista
padre = dict()
ranking = dict()
def kruskal(graph):
for vertice in graph.iter_vertexes():
generar_set(vertice)
mst = set()
aristas = list(graph.iter_edges())
aristas = sorted(aristas, key=operator.attrgetter('weight'))
for arista in ari... | {
"content_hash": "46ba509d9d3ca24be5cdc0f0dbb37d76",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 87,
"avg_line_length": 29.3625,
"alnum_prop": 0.6304810557684121,
"repo_name": "GFibrizo/TPS_7529",
"id": "5c582c5ab83ae4863072e466549eeb51e1f47e26",
"size": "2349",
"bin... |
black_list = ["increment_references", "print_warnings"]
class MockGPIOMetaClass(type):
'''
This class is meant to be a meta class that is purely responsible
for incrementing reference counts and logging arguments for the
purpose of unit testing since MockGPIO will only ever be used
in an environmen... | {
"content_hash": "54bb4c0f0b286a0105faccdf7891669f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 32.54838709677419,
"alnum_prop": 0.6060455896927651,
"repo_name": "hackernight/portal",
"id": "67332972fee3a8e131e18b42417021be355da573",
"size": "20... |
import argparse
import csv
import logging
import re
import os
logger = logging.getLogger(__name__)
def main():
argparser = argparse.ArgumentParser(description=("Clean the Quora dataset "
"by removing newlines in "
... | {
"content_hash": "bcd2f139749b1be196741a59bbcbc149",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 79,
"avg_line_length": 37.916666666666664,
"alnum_prop": 0.5292307692307693,
"repo_name": "nelson-liu/paraphrase-id-tensorflow",
"id": "6ae270e6584a5450ac16ae602615bde2a660d2... |
__author__ = 'Yan'
import pandas
import sklearn.metrics
import statistics
import numpy as np
import matplotlib.pylab as plt
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
# bug fix for display forma... | {
"content_hash": "1a74b53a13887c9fc3b2c2594a056882",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 113,
"avg_line_length": 37.523809523809526,
"alnum_prop": 0.7201776649746193,
"repo_name": "yan-duarte/yan-duarte.github.io",
"id": "888d94fe0d60b5460a0d98ad24b3dae63ab1225e"... |
""" test parquet compat """
import datetime
import os
from warnings import catch_warnings
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas.util import testing as tm
from pandas.io.parquet import (
FastParquetImpl,
PyArrowImpl,
get_engine,
rea... | {
"content_hash": "238363229729ca378ec177af07d31145",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 88,
"avg_line_length": 31.54655172413793,
"alnum_prop": 0.5710772257747172,
"repo_name": "toobaz/pandas",
"id": "a04fb9fd502577bd582269c1b863c58463d0eeb9",
"size": "18297"... |
"""Crawler that sends notifications as soon as servers
on Kimsufi/OVH become available for purchase"""
import json
import sys
import os
import re
import logging
import importlib
import tornado.ioloop
import tornado.web
from tornado.httpclient import AsyncHTTPClient
from tornado.httpclient import HTTPError
from tornado... | {
"content_hash": "ea2ce8dfa41237067ee25aff103154ec",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 85,
"avg_line_length": 39.736607142857146,
"alnum_prop": 0.590720143804067,
"repo_name": "cyber01/kimsufi-crawler",
"id": "e19bc3bf03cc6189353e94f78138a1c5b48f6872",
"size... |
from build_util import *
if __name__ == "__main__":
build_project_by_name("luabind_plus_test")
| {
"content_hash": "704abb3a0d05692f3585d242f81345f1",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 43,
"avg_line_length": 24.25,
"alnum_prop": 0.6391752577319587,
"repo_name": "Napoleon314/luabind-plus",
"id": "5ed6e170d0c6acf8b61dae7fac34cfb1c49d3d63",
"size": "97",
"b... |
"""Base anchor generator.
The job of the anchor generator is to create (or load) a collection
of bounding boxes to be used as anchors.
Generated anchors are assumed to match some convolutional grid or list of grid
shapes. For example, we might want to generate anchors matching an 8x8
feature map and a 4x4 feature ma... | {
"content_hash": "f1e7cf81a41fe231ebcab291ac80c009",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 80,
"avg_line_length": 37.148148148148145,
"alnum_prop": 0.6805583250249252,
"repo_name": "cshallue/models",
"id": "f2797ef77d3e83597e18db10e5ba87f24364d8aa",
"size": "570... |
from django.core.management.base import BaseCommand, CommandParser
import sys
import os
import signal
import time
import subprocess
import argparse
from typing import Optional
class PidExists(Exception):
pass
class MissingPid(Exception):
pass
class Command(BaseCommand):
"""
The daemon process for ... | {
"content_hash": "178ed9e8b73298f40f289a174923e203",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 120,
"avg_line_length": 38.1731843575419,
"alnum_prop": 0.5837845748573102,
"repo_name": "chris104957/django-carrot",
"id": "8f91c96c2731638b4d43ff9ed6b4e4a95e3ce30e",
"si... |
import Tkinter as tk
#Learning how to use classes and Tkinter
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit', command=self.quit)
self.quitButton.grid()
... | {
"content_hash": "0f8ad93d34692da2ea01538c88c6178f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 27.055555555555557,
"alnum_prop": 0.7166324435318275,
"repo_name": "Ca2Patton/PythonStuff",
"id": "23b78e92c24f3ade388280477adde94ce37a0c38",
"size":... |
"""This module contains a wrapper class of the HFTS Grasp Sampler."""
from hfts_grasp_planner.core import HFTSSampler, HFTSNode
from sampler import SamplingResult
import logging
import numpy
class HFTSNodeDataExtractor:
def extractData(self, hierarchyInfo):
return hierarchyInfo.get_hand_config()
def... | {
"content_hash": "033f6d0badf63f5ed8ea71e1f61f79c1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 120,
"avg_line_length": 50.095238095238095,
"alnum_prop": 0.6447243346007605,
"repo_name": "kth-ros-pkg/hfts_grasp_planner",
"id": "a016f09c14b66454711eaec6ab1a14e84393f96d",... |
from collections import defaultdict
import zmq
context = zmq.Context()
server_socket = context.socket(zmq.REP)
server_socket.bind('tcp://*:6000')
class NewAddr(object):
def __init__(self, first_addr):
self.last_addr = first_addr
def __call__(self):
self.last_addr += 1
return self.la... | {
"content_hash": "39377582ead834dfa1e3ec043b5c962d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 57,
"avg_line_length": 25.795454545454547,
"alnum_prop": 0.6590308370044052,
"repo_name": "jessebmiller/JBMPub",
"id": "42fe9261ccc2845b941feff3dc6ed5d234eaa64e",
"size": "... |
"""
Provides functions to handle source code highlighting.
"""
from pygments import highlight
from pygments.lexers import get_lexer_by_name, PythonLexer
from pygments.formatters import HtmlFormatter
from pygments.styles import get_style_by_name
from pydozeoff.conf import settings
def get_style_defs(name="default"):... | {
"content_hash": "31e6b0296f2df2ded0ba91a324f986ed",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 28.775,
"alnum_prop": 0.6889661164205039,
"repo_name": "danielfm/pydozeoff",
"id": "931a43774d017077841b55da40e7dc1e7912cc31",
"size": "1174",
"bin... |
"""This module contains a cache that supports string and blob values. It supports
both because blobs are unable to encode unicode characters properly.
"""
__author__ = 'Aaron Steele'
# Standard Python imports
import logging
import json
from google.appengine.api import memcache
# Google App Engine imports
from google... | {
"content_hash": "bafd8d4e17888ee361dccaf68bfd8091",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 82,
"avg_line_length": 33.71604938271605,
"alnum_prop": 0.5924569754668619,
"repo_name": "earthenv/mapotron",
"id": "b13655acf53ff65173b4d298d5bcedd901e84b13",
"size": "273... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_admin_state_pac import TapiCommonAdminStatePac # noqa: F401,E501
from tapi_server.models.tapi_commo... | {
"content_hash": "b90cd817b362763515bb904ef543be45",
"timestamp": "",
"source": "github",
"line_count": 1212,
"max_line_length": 998,
"avg_line_length": 49.0486798679868,
"alnum_prop": 0.7306003667132067,
"repo_name": "karthik-sethuraman/Snowmass-ONFOpenTransport",
"id": "a1d095315147d5277e0504d28952... |
"""
Kernel installation task
"""
from cStringIO import StringIO
import logging
import os
import re
import shlex
import urllib2
import urlparse
from teuthology import misc as teuthology
from ..orchestra import run
from ..config import config as teuth_config
from ..exceptions import (UnsupportedPackageTypeError,
... | {
"content_hash": "960c0cb91d3dd67a19644a41afcd0d06",
"timestamp": "",
"source": "github",
"line_count": 1213,
"max_line_length": 109,
"avg_line_length": 36.723000824402305,
"alnum_prop": 0.5289707037826916,
"repo_name": "t-miyamae/teuthology",
"id": "b00bb2d4350eca88b364f0425739e1970863d2c4",
"size... |
import httplib2
import json
import datetime
import hmac
from hashlib import sha1,md5
import base64
class Mailin:
""" This is the Mailin client class
"""
def __init__(self,base_url,access_key,secret_key):
self.base_url = base_url
self.access_key = access_key
self.secret_key = secret_key
def do... | {
"content_hash": "97cb56435592b80cd96e0bf1b3a43625",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 420,
"avg_line_length": 78.46706586826348,
"alnum_prop": 0.7154304029304029,
"repo_name": "mailin-api/mailin-api-python",
"id": "9201e70584a0fb1d73ee4b0ae6d79dc6222827e8",
... |
# Copyright (c) 2015 Metaswitch Networks
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | {
"content_hash": "ab50a487435c6d56f1315f1690f5ab8f",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 79,
"avg_line_length": 38.68493150684932,
"alnum_prop": 0.5810316336166195,
"repo_name": "frostynova/calico-docker",
"id": "3dd606dc757b0bfface29ec54c75ddbacb3cc8f1",
"siz... |
import pytest
import yaml
from pathlib2 import Path
from rackattack.physical.alloc.priority import Priority, OutOfResourcesError
from rackattack.physical.alloc.freepool import FreePool
from rackattack.physical.host import Host
from rackattack.common.hosts import Hosts
from rackattack.common import globallock
DATA_PATH... | {
"content_hash": "4741790e662edc670815fffa2ddd0933",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 87,
"avg_line_length": 30.84722222222222,
"alnum_prop": 0.6915803692030617,
"repo_name": "Stratoscale/rackattack-physical",
"id": "150cbab55b450a48311440e7c30d9981762c5c79",
... |
from nose2 import session
from nose2.plugins import prof
from nose2.events import StartTestRunEvent
from nose2.tests._common import Stub, TestCase
class TestProfPlugin(TestCase):
tags = ['unit']
def setUp(self):
self.plugin = prof.Profiler(session=session.Session())
self.hotshot = prof.hotsho... | {
"content_hash": "1cafcafdc28796aa2d33b0b873a295d1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 32.62068965517241,
"alnum_prop": 0.6405919661733616,
"repo_name": "little-dude/nose2",
"id": "8455d56dd36317931d826f72648473c73e5d6d9a",
"size": "946... |
from os.path import join, split
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration, get_mathlibs
config = Configuration('random',parent_package,top_path)
def generate_libraries(ext, build_dir):
config_cmd = config.get_config_cmd()
libs =... | {
"content_hash": "be6f33bc9b1a5706fecf89154e93c4d8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 30.020408163265305,
"alnum_prop": 0.5159755268524813,
"repo_name": "houseind/robothon",
"id": "6ec65ee19be47848c877bbbf50b92dcf74356371",
"size": "14... |
from __future__ import unicode_literals
from django.db.models.signals import post_save
from django.dispatch import receiver
from dash.orgs.models import Org
from tracpro.contacts.models import DataField
@receiver(post_save, sender=Org)
def set_visible_data_fields(sender, instance, **kwargs):
"""Hook to update ... | {
"content_hash": "81f0cf0630042f9f015bffa0d89292da",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 34,
"alnum_prop": 0.7426470588235294,
"repo_name": "xkmato/tracpro",
"id": "5c17c40080aab37d0a262f0b18f7330e13021752",
"size": "544",
"binary": fal... |
'''
Integration Test for one mn host with vm ha, force shutdown and recovery, check host auto connected
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.node_operat... | {
"content_hash": "828a799b8add292032ffa160f74c47a4",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 150,
"avg_line_length": 40.4367816091954,
"alnum_prop": 0.6498010233086982,
"repo_name": "zstackio/zstack-woodpecker",
"id": "6641215a4658358e3107d91245b3677e67b1e8f6",
"si... |
import sys
import os
import platform
import shutil
import xml.etree.ElementTree
import subprocess
ICU_MIN_VERSION = "59.1"
UNICODE_VERSION = "10.0"
SESHAT_VERSION_MAJOR = 0
SESHAT_VERSION_MINOR = 1
SESHAT_VERSION_PATCH = 0
SESHAT_VERSION = "{}.{}.{}".format(
SESHAT_VERSION_MAJOR,
SESHAT_VERSION_MINOR,
SESH... | {
"content_hash": "28c8bc62163362e1de9e1825f817fc49",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 185,
"avg_line_length": 30.028985507246375,
"alnum_prop": 0.5986164736164736,
"repo_name": "hardboiled65/Seshat",
"id": "9bb2293d5e4cdd8bc670444a4709b512a638be9f",
"size":... |
import datetime
from oslo.config import cfg
from nova import compute
from nova.compute import flavors
from nova import context
from nova import db
from nova.db.sqlalchemy import api as sqa_api
from nova.db.sqlalchemy import models as sqa_models
from nova import exception
from nova.openstack.common import timeutils
fr... | {
"content_hash": "b1ddd200d5bf41111df5f7ff00316da2",
"timestamp": "",
"source": "github",
"line_count": 2471,
"max_line_length": 79,
"avg_line_length": 39.054633751517606,
"alnum_prop": 0.48432189339301995,
"repo_name": "imsplitbit/nova",
"id": "498d1d1fa3ddd48cd9e2bb2a730df7d8f56c7ef8",
"size": "9... |
import optparse
from datetime import datetime, timedelta
from base import NoseDBReporterBase
__author__ = "Ali-Akber Saifee"
__email__ = "ali@indydevs.org"
__copyright__ = "Copyright 2014, Ali-Akber Saifee"
class NoseMySQLReporter(NoseDBReporterBase):
"""
MySQL Connector. Reports the results of each test run... | {
"content_hash": "6e5a373ae500d74fed68cae37d06683e",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 113,
"avg_line_length": 42.54771784232365,
"alnum_prop": 0.5191144919055978,
"repo_name": "alisaifee/nosedbreport",
"id": "0ce357956bdfa235b539a9b15ef1ffcd0559fc34",
"size... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build rsocket'
import specs.rsocket as rsocket
def fbcode_builder_spec(builder):
return {
'depends_on': [rsocket],
}
config ... | {
"content_hash": "4171cce32b44a1d5e43da69ec58499ed",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 47,
"avg_line_length": 20.95,
"alnum_prop": 0.6968973747016707,
"repo_name": "ReactiveSocket/reactivesocket-cpp",
"id": "85018bf0521977dca38056defad8e68e66d0c58b",
"size": ... |
"""This example demonstrates how to handle policy violation errors.
To get ad groups, run get_ad_groups.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication in... | {
"content_hash": "2ca85349a3bfb3d5254b3dd1451a27e1",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 79,
"avg_line_length": 35.554455445544555,
"alnum_prop": 0.5953773322194374,
"repo_name": "coxmediagroup/googleads-python-lib",
"id": "2a5a390d3a49d4ca29c10f28302b109cd62b77... |
from tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('daf29d8d-e928-4a01-9a8c-b129603f3fc0')
def test_min_count_less... | {
"content_hash": "ebe8c655643b79bc2e14d2c5f07d9723",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 44.104166666666664,
"alnum_prop": 0.6589513462446859,
"repo_name": "cisco-openstack/tempest",
"id": "6bdf83bb69f95a8e5a5bb7cf15b56e820dd19765",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.