text stringlengths 4 1.02M | meta dict |
|---|---|
import pickle
import gzip
import re
import random
import string
import fractions
import os
import itertools
import bisect
import numpy as np
import pint
import simpleeval
class UnsupportedDimensionsError(Exception):
'''
Raised when comparator doesn't support the entered dimensions.
'''
def __init__(sel... | {
"content_hash": "67077c5127dfffbc98cd24976a0e8431",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 79,
"avg_line_length": 40.35,
"alnum_prop": 0.5055762081784386,
"repo_name": "mpetroff/nugacious",
"id": "d5497c4fb296fe505b0a01fa3e576a477b83bfa2",
"size": "17076",
"bi... |
"""Handler for cron update requests made from persistent-cal."""
__author__ = 'daniel.j.hermes@gmail.com (Daniel Hermes)'
# General libraries
import datetime
# App engine specific libraries
import webapp2
# App specific libraries
from google_api_utils import InitCredentials
from handler_utils import ExtendedHandl... | {
"content_hash": "08043267a9708b75cd860faea40db1b8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 75,
"avg_line_length": 29.63888888888889,
"alnum_prop": 0.6982193064667291,
"repo_name": "dhermes/persistent-cal",
"id": "ab084359a8b8f08a7f756868bc553814cd85a6e2",
"size":... |
from fabric.api import *
import os, os.path
import fabric.contrib.project as project
PROD = 'eugen@eugenkiss.com:223'
DEST_PATH = '/var/www/loopgotowhile/'
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
DEPLOY_PATH = os.path.join(ROOT_PATH, 'deploy')
TEST_PATH = os.path.join(ROOT_PATH, 'test')
NGINX_CONF_PATH ... | {
"content_hash": "552f42b186317b82061a7cf6174f32d4",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 112,
"avg_line_length": 37.8,
"alnum_prop": 0.6202233980011758,
"repo_name": "eugenkiss/loopgotowhile-site",
"id": "c40b5fe07355a406d088560db067b2188cac3c01",
"size": "3402... |
"""Support for Orvibo S20 Wifi Smart Switches."""
import logging
from orvibo.s20 import S20, S20Exception, discover
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import (
CONF_DISCOVERY,
CONF_HOST,
CONF_MAC,
CONF_NAME,
C... | {
"content_hash": "0b928b134ce5f64c66e3626cba462d82",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 81,
"avg_line_length": 26.772727272727273,
"alnum_prop": 0.5806451612903226,
"repo_name": "Teagan42/home-assistant",
"id": "75a95e053ae166c9087b4d92a588e3333b031feb",
"siz... |
"""
Maximum likelihood covariance estimator.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
# avoid division truncation
from __future__ import division
import warnin... | {
"content_hash": "998a789ae8d42988a8e2a39d3afb0362",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 79,
"avg_line_length": 32.07368421052632,
"alnum_prop": 0.6132808226671043,
"repo_name": "abhishekkrthakur/scikit-learn",
"id": "a594cb687b11af21a5a58deb250d2fd382974b60",
... |
"""Tests for tensorflow.python.training.saver.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import functools
import math
import os
import random
import shutil
import sys
import tempfile
import time
import traceback
import numpy a... | {
"content_hash": "0dcfc3432efa98db6c00769089ae9f15",
"timestamp": "",
"source": "github",
"line_count": 3149,
"max_line_length": 82,
"avg_line_length": 41.86884725309622,
"alnum_prop": 0.6461678486101103,
"repo_name": "dendisuhubdy/tensorflow",
"id": "f1991093e0b519da7448809e759a1cd5c57b80d9",
"siz... |
"""Create the Initial Data fixture from SQL statements.
The :file:`claims/SQL` directory contains the SQL required to populate
the database.
This is used to create the :file:`claims/fixtures/initial_data.json` file.
"""
import logging
import sys
import os.path
from django.core.management import call_comma... | {
"content_hash": "dcbec5cbaf9795415166cadc700aaf3d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 32.041666666666664,
"alnum_prop": 0.6723016905071522,
"repo_name": "jdavisp3/TigerShark",
"id": "75923b99ac683fc36399d49fe1424490b5dac7b4",
"size": "... |
"""
Find intermediate evalutation results in assert statements through builtin AST.
This should replace oldinterpret.py eventually.
"""
import sys
import ast
import py
from _pytest.assertion import util
from _pytest.assertion.reinterpret import BuiltinAssertionError
if sys.platform.startswith("java") and sys.versio... | {
"content_hash": "a810fc9d35a0253995c2405a7ab99b06",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 85,
"avg_line_length": 36.909909909909906,
"alnum_prop": 0.5517044992270768,
"repo_name": "npinto/pytest",
"id": "de03eaf8b0351aff1e798e1b8a2f3932ed52bddc",
"size": "12291... |
from test.test_funs import count_words_at_url
from rq import Queue, use_connection
from utils.worker import redis_connection
def submit_work(executor, args, queue="default"):
use_connection(redis_connection)
q = Queue(queue)
result = q.enqueue(executor, args)
return result
| {
"content_hash": "8e83ed874e3c1a19ca88eeb647aeae26",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 49,
"avg_line_length": 24.5,
"alnum_prop": 0.7380952380952381,
"repo_name": "LoopSun/linux-client",
"id": "01731b4d75ad6066260a9045b62f06dd345d63fa",
"size": "311",
"bina... |
import os
from django.conf import settings
from django.contrib.auth import models
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.core.urlresolvers import reverse
from django.db.models import get_mo... | {
"content_hash": "be5a712260cec56dcd2172af7ac8c10d",
"timestamp": "",
"source": "github",
"line_count": 728,
"max_line_length": 107,
"avg_line_length": 46.71016483516483,
"alnum_prop": 0.5907954712542273,
"repo_name": "rvanlaar/easy-transifex",
"id": "2e8038af5b00376557bfffadfd2390a4b495b4ac",
"siz... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from moocng.courses.models import Course
class Category(models.Model):
name = models.CharField(
verbose_name=_(u'Name'), max_length=200,blank=False, null=False)
slug = models.SlugField(
verbose_name=_(u'Slug... | {
"content_hash": "97f745a4ac23f74087bac351d3128031",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 36.81818181818182,
"alnum_prop": 0.6559670781893004,
"repo_name": "OpenMOOC/moocng",
"id": "dfb8f372f97036ae54cfc83a3bbc1487e72e44c8",
"size": "1215"... |
import os
for module in os.listdir(os.path.dirname(__file__)):
if module == '__init__.py' or module[-3:] != '.py':
continue
__import__(module[:-3], locals(), globals())
del module
del os
| {
"content_hash": "a8a391c46aed59298d2ad6ad0fc23920",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6051282051282051,
"repo_name": "scommab/can-opener",
"id": "e9ed46da036efa4cf6b876d4fbf3d3ccd099db70",
"size": "24... |
import uuid
from datetime import datetime
from framework.sessions import session, create_session, Session
from modularodm import Q
from framework import bcrypt
from framework.auth import signals
from framework.auth.exceptions import DuplicateEmailError
from .core import User, Auth
from .core import get_user
__all__... | {
"content_hash": "50d4fc108be9c9eca41f610be47f79fc",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 102,
"avg_line_length": 29.59223300970874,
"alnum_prop": 0.651246719160105,
"repo_name": "zamattiac/osf.io",
"id": "b5c36b566b3cd3aac52606c8ef4effe96fbfe90c",
"size": "307... |
"""
Unittests for graph.algorithms.sorting
"""
import unittest
import pygraph.classes
from pygraph.algorithms.sorting import topological_sorting
from pygraph.algorithms.searching import depth_first_search
from sys import getrecursionlimit
import testlib
class test_topological_sorting(unittest.TestCase):
def te... | {
"content_hash": "dd0b52821937c6a102285a4ae3fc12a3",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 59,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.5449466734382935,
"repo_name": "wdv4758h/ZipPy",
"id": "24bedbcf06372204cbd69b887fd3a4902bdf7672",
"size": "3085"... |
"""
Window functions used e.g. for FFTs
"""
import numpy as np
__all__ = ["WindowFunctor", "create_window",
"create_and_apply_window"]
# Predefined windows
def create_window(size, window_id="blackman", param=None):
"""
Create a new window numpy array
param is only used for some windows.
w... | {
"content_hash": "1f6669c5f5f4890f26169fd00ff36cdd",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 100,
"avg_line_length": 29.07079646017699,
"alnum_prop": 0.5863013698630137,
"repo_name": "ulikoehler/UliEngineering",
"id": "ea34fce4b24f6ebc9242e828bb73152cd2aa4eef",
"s... |
from msrest.serialization import Model
class VirtualMachineSize(Model):
"""Describes the properties of a VM size.
:param name: The name of the virtual machine size.
:type name: str
:param number_of_cores: The number of cores supported by the virtual
machine size.
:type number_of_cores: int
... | {
"content_hash": "9c84fae4ca5cb839ebfb2bb850a2e891",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 43.54761904761905,
"alnum_prop": 0.63039912520503,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "0fef3efd6c8ea6f1cbdd3b2eb966230ef071e22e",
"si... |
"""Tiles should be held by players in the game and are worth points.
Tiles can be one of three types: Tower, Tea or Palace. Palace tiles are
awarded for building the largest of a building color. Tower tiles are
awarded for building a building connected to a wall from a tower. Tea tiles
are awarded for claiming pu... | {
"content_hash": "be706b9e7752547d0953dc80bc172900",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 78,
"avg_line_length": 31.08080808080808,
"alnum_prop": 0.650633734156646,
"repo_name": "nicholas-maltbie/Medina",
"id": "629869da69fa1a2a4d2267c9bfe609624dc53673",
"size":... |
"""
test_sanity_codec.py
sanity test for CodecService and CodecServiceProvider
"""
import unittest
try:
from ydk.models.ydktest.ydktest_sanity import Runner, Native, YdkEnumTest
from ydk.models.ydktest.openconfig_routing_policy import RoutingPolicy
from ydk.models.ydktest.oc_pattern import OcA
from yd... | {
"content_hash": "28bbdb36287c82bb4e3e4be4456417c4",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 245,
"avg_line_length": 34.391465677179966,
"alnum_prop": 0.6171440901979824,
"repo_name": "CiscoDevNet/ydk-gen",
"id": "85f7e5c64ae9fec95665ed5e9b5e5156d31a69c7",
"size":... |
import attr
import pytest
from platform_alarms import (
get_human_message,
guess_cloudwatch_log_group,
guess_cloudwatch_search_terms,
is_critical_error,
simplify_message,
)
@attr.s
class Alarm:
name = attr.ib()
@pytest.mark.parametrize(
"alarm_name, expected_log_group_name",
[
... | {
"content_hash": "14fae866d77f31509c5f123a42e8a3dc",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 297,
"avg_line_length": 44.390625,
"alnum_prop": 0.6151589815792561,
"repo_name": "wellcometrust/platform-api",
"id": "923a24607f402cae5d2b1fc817a7e348b28215df",
"size": "... |
import os
# try/except added for compatibility with python < 3.8
try:
from unittest import mock
from unittest.mock import AsyncMock # pragma: NO COVER
except ImportError: # pragma: NO COVER
import mock
import math
from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template
fro... | {
"content_hash": "9710c75cc1666064e322f94bc1395bf1",
"timestamp": "",
"source": "github",
"line_count": 1732,
"max_line_length": 123,
"avg_line_length": 36.67147806004619,
"alnum_prop": 0.6435330236951902,
"repo_name": "googleapis/python-texttospeech",
"id": "96807af675bf4f6180e4dfbf8dcc24a8ab5f2c54"... |
from osgeo import ogr
import os, sys
from math import floor
class ShapeDataError(Exception):
"""
Error for wrong geometry type when loading shapefiles
"""
pass
def load_points(shapefile):
"""
Returns a list of coordinate from points in an input shapefile.
Required Argument(s):
-... | {
"content_hash": "de710a99fd95e5d8441239c93e00c5a5",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 173,
"avg_line_length": 29.32450331125828,
"alnum_prop": 0.6797651309846432,
"repo_name": "jkeifer/pyHytemporal",
"id": "631ef694344a55cf80bed642b2db9d86c0413153",
"size":... |
"""
Revision ID: 0382_nhs_letter_branding_id
Revises: 0381_letter_branding_to_org
Create Date: 2022-11-15 07:57:49.060820
"""
import os
from alembic import op
revision = '0382_nhs_letter_branding_id'
down_revision = '0381_letter_branding_to_org'
environment = os.environ["NOTIFY_ENVIRONMENT"]
def upgrade():
i... | {
"content_hash": "5babc29a2fbd647079a3f405f173cfe5",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 89,
"avg_line_length": 22.32894736842105,
"alnum_prop": 0.47200942840306426,
"repo_name": "alphagov/notifications-api",
"id": "3d58109a57fb60e147f04a5499d42c0655fdf76b",
"s... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/dungeon/corellian_corvette/shared_corvette_search_rebel_destroy_03.iff"
result.attribute_template_id = -1
result.stfName("frn_n","frn_storage_drums")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ... | {
"content_hash": "d95f0aae65bb99a876626277ee1158dd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 107,
"avg_line_length": 26.23076923076923,
"alnum_prop": 0.7126099706744868,
"repo_name": "obi-two/Rebelion",
"id": "16d325ba08cce99ba07cd4ed6c446e9adbe0d94d",
"size": "486... |
"""Attack on CountSketch and median estimator."""
import math
import numpy as np
from numpy.random import default_rng
class CountsketchMedianAttack:
"""Attack on the classic CountSketch."""
def __init__(self,
num_of_rounds=100,
nof_repetitions=10,
nof_sim_keys=11,
... | {
"content_hash": "9a0c4795b337881b976f5830d28a9be4",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 80,
"avg_line_length": 37.90780141843972,
"alnum_prop": 0.5698783910196445,
"repo_name": "google-research/google-research",
"id": "fc88839d8445cc24828084f086e0de9d681ce89a",... |
''' *** '''
# start app
from app import app
PORT = app.config['PORT']
DEBUG = app.config['DEBUG']
app.run(host='0.0.0.0', port=PORT, debug=DEBUG)
| {
"content_hash": "a5d5b106937c5211ef131b443cbf4070",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 16.555555555555557,
"alnum_prop": 0.6174496644295302,
"repo_name": "greenglobal/face-recognition-demo",
"id": "d674efb349a1c81c5779494ec9c9ebf1124269af"... |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | {
"content_hash": "bc1785aaef413023725801b87f2ffb48",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 199,
"avg_line_length": 43.888888888888886,
"alnum_prop": 0.5866813428728673,
"repo_name": "plaid/plaid-python",
"id": "5d0cf964373e9b44dd8c046408457d44fe226ffa",
"size": ... |
import webob.exc
from nova.api.openstack import api_version_request
from nova.api.openstack.compute.schemas import services
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova... | {
"content_hash": "e1a0ace367bb72bdcf0c4f79cb596e15",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 77,
"avg_line_length": 34.345971563981045,
"alnum_prop": 0.5631295708569063,
"repo_name": "HybridF5/nova",
"id": "0c21442dd1c0031e73ef832b7777d68b7e1764c0",
"size": "7849"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('competicion', '0003_auto_20150825_1042'),
]
operations = [
migrations.AlterModelOptions(
name='clasificacion',
options={'ver... | {
"content_hash": "cf7703b11e44ae192db6b5200a95b02b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 96,
"avg_line_length": 29.967741935483872,
"alnum_prop": 0.5758880516684607,
"repo_name": "lendoly/djangoF1",
"id": "f48f9d463570dd4a3b7ad4dcc872e0cefda94b3e",
"size": "953... |
from urllib.parse import urlparse
from django.conf import settings
from django.utils.encoding import force_str
from wagtail.core.models import Page, Site
from wagtail.core.utils import resolve_model_string
class BadRequestError(Exception):
pass
def get_base_url(request=None):
base_url = getattr(settings, ... | {
"content_hash": "014b353a0b25497acce6608623a728c8",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 125,
"avg_line_length": 32.668103448275865,
"alnum_prop": 0.5739543475392532,
"repo_name": "gasman/wagtail",
"id": "92a1f739ef6672b49e7642122a25e3e9150b0f61",
"size": "757... |
from __future__ import unicode_literals, absolute_import
from unittest import TestCase
from django import template
from django.utils.translation import ugettext_lazy as _
from pymorphy.py3k import PY3
from .templatetags.pymorphy_tags import inflect, plural, inflect_marked
class PymorphyDjangoTestCase(TestCase):
d... | {
"content_hash": "08685b74975598d902aeff09c14b331b",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 98,
"avg_line_length": 42.142857142857146,
"alnum_prop": 0.6467043314500942,
"repo_name": "kmike/pymorphy",
"id": "6b2e43497c2c13ca841db0bb71e653a1209a19a7",
"size": "6524... |
from __future__ import absolute_import
import mock
from kombu import Exchange, Queue
from st2common.transport import consumers
from st2common.util.greenpooldispatch import BufferedDispatcher
from st2tests.base import DbTestCase
from tests.unit.base import FakeModelDB
FAKE_XCHG = Exchange("st2.tests", type="topic")
F... | {
"content_hash": "19f869b8e1e9af2bd19754f6641c1778",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 85,
"avg_line_length": 35.568,
"alnum_prop": 0.7091767881241565,
"repo_name": "Plexxi/st2",
"id": "463eb0def4b3aa5d97d8a537d116d58ef52d7fcf",
"size": "5074",
"binary": f... |
from usergrid import Usergrid
__author__ = 'ApigeeCorporation'
def main():
Usergrid.init(org_id='jwest1',
app_id='sandbox')
response = Usergrid.DELETE('pets', 'max')
if not response.ok:
print 'Failed to delete max: %s' % response
exit()
response = Usergrid.DELETE('... | {
"content_hash": "1e953061b6da6247e0e778cf17aa6454",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 60,
"avg_line_length": 23.470588235294116,
"alnum_prop": 0.5129490392648287,
"repo_name": "jwest-apigee/usergrid-python",
"id": "a829736f9e3c8024db4d2084b4d0378b51784a3f",
... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/clothing/shared_jewelry_setting.iff"
result.attribute_template_id = -1
result.stfName("craft_clothing_ingredients_n","jewelry_setting")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####... | {
"content_hash": "9585eb44ccb72be603f096a2f5303014",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 25.923076923076923,
"alnum_prop": 0.7181008902077152,
"repo_name": "anhstudios/swganh",
"id": "6c4b973e8b26127187e80e483c64d46538f5f4a5",
"size": "48... |
"""
WSGI config for pastit project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | {
"content_hash": "ed7d3d39592503b27e18d22c9ecf9df9",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 35.67567567567568,
"alnum_prop": 0.7833333333333333,
"repo_name": "spezifanta/Paste-It",
"id": "241ad558ee90abc659b63f98117f4deceef593b3",
"size": "1... |
"""Offer numeric state listening automation rules."""
import logging
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import (
CONF_ABOVE,
CONF_ATTRIBUTE,
CONF_BELOW,
CONF_ENTITY_ID,
CONF_FOR,
CONF_PLATFORM,
CONF_VALUE_TEMPLATE,
)
from homeassistant.co... | {
"content_hash": "23763ac2f88a6440f9ad0846eb146bd4",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 128,
"avg_line_length": 31.412429378531073,
"alnum_prop": 0.5339928057553956,
"repo_name": "balloob/home-assistant",
"id": "a6e3b33ae97298bb1d58eb3a3e738e93ba3d56c2",
"siz... |
class WebPayError(Exception):
"""Base class for errors related to webpay library.
"""
def __init__(self, message, status, error_info):
Exception.__init__(self, message)
self.status = status
self.error_info = error_info
class ApiConnectionError(WebPayError):
"""Error raised w... | {
"content_hash": "b8f9e7bd65b512b2b63e416836b6596d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 28.535211267605632,
"alnum_prop": 0.6253701875616979,
"repo_name": "yamaneko1212/webpay-python",
"id": "79ee961d46dbf3e9bf0417355341abac5d33a3cd",
"s... |
from django.contrib import admin
from models import ModelGroup
from forms import ModelGroupForm
class ModelGroupAdmin(admin.ModelAdmin):
form = ModelGroupForm
admin.site.register(ModelGroup, ModelGroupAdmin)
| {
"content_hash": "a7c67947b8afa62763371f82cb7d58cc",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 48,
"avg_line_length": 23.88888888888889,
"alnum_prop": 0.827906976744186,
"repo_name": "spookylukey/django-autocomplete-light",
"id": "d8a8274206f08aa2c53d0e5f15fd35c3785fdf3... |
""" Sahana Eden Guided Tour Model
@copyright: 2009-2013 (c) Sahana Software Foundation
@license: MIT
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, i... | {
"content_hash": "a29061a782919331486c0d8a741fec82",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 93,
"avg_line_length": 45.15483870967742,
"alnum_prop": 0.42553698147354385,
"repo_name": "sahildua2305/eden",
"id": "0ac0e5726104061361d009b1ab71c45691f663b8",
"size": "2... |
import qpid
import sys
import os
from qpid.util import connect
from qpid.connection import Connection
from qpid.datatypes import Message, RangedSet, uuid4
from qpid.queue import Empty
from math import fabs
def getApplicationHeaders(msg):
for h in msg.headers:
if hasattr(h, 'application_headers'): return ge... | {
"content_hash": "463a2b6713eb541f3d02e7cc95566fa7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 86,
"avg_line_length": 20.742424242424242,
"alnum_prop": 0.6888239590942293,
"repo_name": "gregerts/debian-qpid-cpp",
"id": "d5a2c16c01ec0dc7cef5b3df453b80857b3a95a4",
"siz... |
from functools import wraps
import json
import base64
from urllib import unquote_plus
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.client import AccessTokenRefreshError
from oauth2client.django_orm import Storage
from oauth2client import xsrfutil
from django.http import HttpResponseRedirect
fr... | {
"content_hash": "1f589d639b72afbe9361896852f5c1a0",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 108,
"avg_line_length": 40.93859649122807,
"alnum_prop": 0.5731733447610885,
"repo_name": "Fl0r14n/django_googleapi",
"id": "94c8204f40635327148fae42b0c8ab2605319386",
"si... |
def run_command(command, project):
pass | {
"content_hash": "ccff35d10e229dd568e98c3bd5d45246",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 34,
"avg_line_length": 21.5,
"alnum_prop": 0.7209302325581395,
"repo_name": "pebbie/BIBINT",
"id": "856f5abea922a4a5790edfae6fae0884a3986704",
"size": "43",
"binary": fals... |
import sys
from ssssg.config import options
from ssssg.commands import run_ssssg, build_index
def help_text():
return """usage:
To index the site:
python ssssg.py index /path/to/site
To run the site:
python ssssg.py run site"""
if __name__ == "__main__":
args = sys.argv[1:]
i... | {
"content_hash": "a384fc9797c38122ac5fd7b116ca6533",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 49,
"avg_line_length": 20.884615384615383,
"alnum_prop": 0.56353591160221,
"repo_name": "emehrkay/ssssg",
"id": "754afc7db53b15f8848c8993d9fcc12b807de79e",
"size": "543",
... |
from splinter import Browser
from easygui import *
from sys import exit
from time import sleep
from re import sub
from os import path, makedirs
# Recursive function that does the actual scrapping
# @type flag: bool
# @rtype: None
def scrapper_recursion(flag):
if chrome.is_element_present_by_xpath(
"/... | {
"content_hash": "627b7b3d0deaeb95e7d49c675eea308b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 116,
"avg_line_length": 44.3716814159292,
"alnum_prop": 0.5765855604307938,
"repo_name": "harish0507/GMapsScrapper",
"id": "ff410d44985c210fab5bccfc5a21ea75551aca0d",
"siz... |
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
... | {
"content_hash": "2924c795b3be4c4e3a331eb081a3d6ca",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 129,
"avg_line_length": 26.393939393939394,
"alnum_prop": 0.6934557979334098,
"repo_name": "dehuinet/mosquitto",
"id": "1ace1c3d95bb4adcb0e025e662264b3dbccf7ab8",
"size": "... |
import sys
import os
import path_utils
def writecontents(filename, contents):
with open(filename, "w") as f:
f.write(contents)
def readcontents(filename):
contents = ""
with open(filename, "r") as f:
contents = f.read()
return contents
def prjrename_validate(target_dir, project_name,... | {
"content_hash": "84ba91d7eda1e69cb5a7969bad76474d",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 145,
"avg_line_length": 47.36283185840708,
"alnum_prop": 0.695440956651719,
"repo_name": "mvendra/mvtools",
"id": "1e2dd23a505218118cbe91192061f3c6936a8b7f",
"size": "1072... |
import numpy as np
import pandas as pd
import time
import re
import xgboost as xgb
from xgboost.callback import _get_callback_context
def leaf_cnts(bst):
dump = bst.get_dump()
return([tree.count('leaf') for tree in dump])
def get_leaf_values(tree_str):
# To find 'leaf=0.123\n'
prog=re.compile(r"(?<=le... | {
"content_hash": "69266725355157c7428f40cf7821a338",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 105,
"avg_line_length": 41.115606936416185,
"alnum_prop": 0.590186981583017,
"repo_name": "tks0123456789/XGB_experiments",
"id": "ffd5b72b20afd0595a57ae75bab7d55bdf6faa7e",
... |
from django.shortcuts import render
from django.template import RequestContext
from esperancanordeste.context_processors import enterprise_proc
from esperancanordeste.newsletter.forms import SubscribeForm
def subscribe(request):
context = {}
if request.method == 'POST':
form = SubscribeForm(request... | {
"content_hash": "01e852acf4df53681e20c897f6f95620",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 30.6,
"alnum_prop": 0.6,
"repo_name": "klebercode/esperancanordeste",
"id": "95d18409eb9e4a7f80362483691d768592d3d015",
"size": "781",
"binary": fa... |
"""Visual Studio Code-related test steps."""
# vim: set fileencoding=utf-8
#
# (C) Copyright 2019 Pavel Tisnovsky
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at... | {
"content_hash": "1d3c3066400d1b50cec71e955877a6d1",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 92,
"avg_line_length": 36.33877551020408,
"alnum_prop": 0.7266090081994834,
"repo_name": "tisnik/fabric8-analytics-common",
"id": "cd0d5a0596665831881be5b870bf2566781826a2",... |
from absl import app
from iree.tf.support import tf_test_utils
from iree.tf.support import tf_utils
import numpy as np
import tensorflow.compat.v2 as tf
HIDDEN_1_DIM = 256
HIDDEN_2_DIM = 256
INPUT_DIM = 728 # 28 * 28
CLASSES = 10
class DynamicMlpReluModule(tf.Module):
def __init__(self,
hidden_1_d... | {
"content_hash": "b7541037e3628bb775415a82fed341eb",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 30.78082191780822,
"alnum_prop": 0.616822429906542,
"repo_name": "google/iree",
"id": "e049c9e47c2fba927fec741e43ac63a859879d91",
"size": "2653",
"... |
import csv
import fcntl
import json
from os.path import exists, join
from pathlib import Path
from sys import argv
input_folder, output_folder = argv[1:]
variables = json.load(open(join(input_folder, 'variables.dictionary'), 'rt'))
datasets_folder = Path('datasets')
datasets_folder.mkdir(exist_ok=True)
table_path =... | {
"content_hash": "99b68380eb475e422b2749601b34eb60",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 26.78723404255319,
"alnum_prop": 0.6679904686258936,
"repo_name": "crosscompute/crosscompute-examples",
"id": "c7715d97bd364a7e14293119c17447de931f8b46... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values
# Splitting the dataset into the Training set and Test set
"""from sklearn.cross_validation import train_test_spli... | {
"content_hash": "9bad97ee97b79131b82f0f9749291678",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 95,
"avg_line_length": 33.23684210526316,
"alnum_prop": 0.7347585114806018,
"repo_name": "leofdecarvalho/MachineLearning",
"id": "fce58b1fe283a6d96886e7ebc71c1c40effe525f",
... |
ο»Ώ# coding=utf-8
from plugins.utils import get_used_plugins_by
def get_widget_data():
""" Π€ΡΠ½ΠΊΡΠΈΡ, Π²ΠΎΠ·Π²ΡΠ°ΡΠ°ΡΡΠ°Ρ ΡΠ»ΠΎΠ²Π°ΡΡ Ρ ΠΎΠ±ΡΠ΅ΠΊΡΠ°ΠΌΠΈ ΡΠ΅ΡΠ΅Π²ΡΡ
ΡΡΡΡΠΎΠΉΡΡΠ². """
return get_used_plugins_by(package='plugins.system_ip_online')
| {
"content_hash": "699ecb8353f4ea751b0c5f4ce5459dd7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 72,
"avg_line_length": 28.5,
"alnum_prop": 0.7280701754385965,
"repo_name": "sug4rok/Servus",
"id": "618d394105eeeffdbdaad6f8322585c90af5d71b",
"size": "282",
"binary": fa... |
import heapq
import sys
from collections import deque
class DataStructures:
def __init__(self):
self.clean()
def add_to_stack(self, item):
self.stack.append(item)
def remove_from_stack(self):
return self.stack.pop()
def add_to_queue(self, item):
self.queue.append(ite... | {
"content_hash": "0a5b5c236ce932699b281bee6404b3ba",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 27.512820512820515,
"alnum_prop": 0.5852749301025163,
"repo_name": "deniscostadsc/playground",
"id": "e09853c3e2de58241aa27c6c604d0e3ef584e3bd",
"siz... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_noble_human_male_03.iff"
result.attribute_template_id = 9
result.stfName("npc_name","human_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "b3bfccbce45618045b516a097fc8db76",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 23.615384615384617,
"alnum_prop": 0.6938110749185668,
"repo_name": "anhstudios/swganh",
"id": "f933e59505b84c0873e2f80db0c34e570e9dd61b",
"size": "45... |
from __future__ import print_function
from matplotlib.collections import PatchCollection,LineCollection
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import matplotlib.pyplot as plt
import numpy as np
from .. import utils
def plot_linestring(ls,**kwargs):
ax=kwargs.pop('ax',plt.gca())
... | {
"content_hash": "9588abf29923b32a4b093cb6fa9786e0",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 82,
"avg_line_length": 34.019417475728154,
"alnum_prop": 0.6543949771689498,
"repo_name": "rustychris/stompy",
"id": "08f9e678c3ea4786a666a01c75fdeef2f3013c54",
"size": "3... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('coding', '0001_initial'),
]
... | {
"content_hash": "11519ec387fd65502da81d982c4d7bbb",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 124,
"avg_line_length": 31.857142857142858,
"alnum_prop": 0.6468609865470852,
"repo_name": "geosoco/reddit_coding",
"id": "2c986deb5559d1b8089d49db00fe2cb227045bf4",
"size"... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/dna/shared_dna_template_zucca_boar.iff"
result.attribute_template_id = -1
result.stfName("craft_dna_components_n","dna_template_zucca_boar")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ... | {
"content_hash": "18bd705853e36f1d91c6bfdb38f16189",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.7105263157894737,
"repo_name": "anhstudios/swganh",
"id": "6e6baed3a11b9cd6147272d92316f35a4f409691",
"size": "48... |
from __future__ import print_function
import Pyro4
import Pyro4.constants
class CustomDaemon(Pyro4.Daemon):
def clientDisconnect(self, conn):
# If required, you *can* override this to do custom resource freeing.
# But this is not needed if your resource objects have a proper 'close' method;
... | {
"content_hash": "f7f0fc29ab79303af8587307c308b590",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 105,
"avg_line_length": 35.8,
"alnum_prop": 0.664804469273743,
"repo_name": "irmen/Pyro4",
"id": "d5aba54c3748fdef720e26cfb29318452d39bca5",
"size": "1969",
"binary": fal... |
from functools import update_wrapper
from datetime import datetime, timedelta
import cgi
from tempfile import TemporaryFile
from .exceptions import HTTPException, BadRequest
from .utils import cached_property
from .datastructures import MultiDict, FileUpload, FormsDict, WSGIHeaders
from ._compat import (PY2, to_bytes, ... | {
"content_hash": "ff453152ea28cfa4fc61441a8fb7662c",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 102,
"avg_line_length": 34.71559633027523,
"alnum_prop": 0.5720401691331924,
"repo_name": "zeaphoo/flagon",
"id": "cbccbfa40f517321143baba2e3199b63b069a8a3",
"size": "1894... |
from django.db.models import F
from taggit.models import Tag
from tempo.events import models
from . import language
from . import query_models
def execute(q):
parsed_query = language.query.parseString(q)
return STATEMENT_MAPPING[parsed_query['statement']](parsed_query)
def run_select(parsed_query):
q... | {
"content_hash": "0faa735e11a40227b162bcd1dbee5d5a",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 81,
"avg_line_length": 22.65,
"alnum_prop": 0.6169977924944813,
"repo_name": "EliotBerriot/tempo",
"id": "09868cb67c378492a80887c1bf2770f98033c92d",
"size": "906",
"binar... |
import os
from .. import base
from girder.utility import config
class CustomRootTestCase(base.TestCase):
def setUp(self):
pluginRoot = os.path.join(os.path.dirname(os.path.dirname(__file__)),
'test_plugins')
conf = config.getConfig()
conf['plugins'] = {'... | {
"content_hash": "9b610efbbce8b23059f94181b5f45417",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 36.07575757575758,
"alnum_prop": 0.6144477110457791,
"repo_name": "jcfr/girder",
"id": "f9d6fcc66610ce1e6c4c1b7a6a53cf9a96295225",
"size": "3175",
... |
"""
Program: conserved_darkened_genes.py
Author: Josh Goodman
Description:
This script started as a first pass attempt at trying to answer a question posed
by Dr. Arash Bashirullah of the University of Wisconsin. Dr. Bashirullah wanted
to know the following: Of all the Dmel genes, which ones do we know very little
ab... | {
"content_hash": "46ccc4616359dec90e5c99ca913ae249",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 217,
"avg_line_length": 44.24761904761905,
"alnum_prop": 0.6726216099870856,
"repo_name": "FlyBase/chado",
"id": "9b74cfdaade557e3be07f1d0904f9f93e752b29a",
"size": "9314"... |
import logging
import struct
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet
class SimpleSw... | {
"content_hash": "5c97f1ade1d617a2027c3869230960df",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 74,
"avg_line_length": 34.083333333333336,
"alnum_prop": 0.6214343928280358,
"repo_name": "citrix-openstack/build-ryu",
"id": "18f874c5c05a6c6df66a9c02aa7b04e9d040ad0c",
"s... |
class SearchNode:
def __init__(self, action, state, parent):
self.state = state
self.action = action
self.parent = parent
def path(self):
if self.parent == None:
return [(self.action, self.state)]
else:
return self.parent.path() + [(self.action, se... | {
"content_hash": "65edfb8ddfaf9d6338e52076f6ba078b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 67,
"avg_line_length": 32.256410256410255,
"alnum_prop": 0.5437201907790143,
"repo_name": "Thuva4/Algorithms_Example",
"id": "9223efcefc3728b8857f4d44ed5e9d747bd04040",
"si... |
import re
import string
from bottle import abort, get, response, run, static_file, template
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters.html import HtmlFormatter
from pygments.util import ClassNotFound
__author__ = "Nigel Small <nigel@nigelsmall.name>"
__copyr... | {
"content_hash": "45e0a4907fb229956d55eaa279d82408",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 237,
"avg_line_length": 31.3890625,
"alnum_prop": 0.4788690328040221,
"repo_name": "nigelsmall/syntaq",
"id": "4501914136d73d55b576a02dc090e22fa49752e0",
"size": "20726",
... |
import sys, 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('.'))
# Get the project root ... | {
"content_hash": "90ce62b776dadc2bc287cbb1b084e36c",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 80,
"avg_line_length": 32.077235772357724,
"alnum_prop": 0.7044734507666962,
"repo_name": "aequitas/stats",
"id": "6c437c06e87fce0d7476b32e7c29ce9db82d266e",
"size": "8334... |
import steel
import unittest
class NameAwareOrderedDictTests(unittest.TestCase):
def setUp(self):
self.d = steel.NameAwareOrderedDict()
def test_ignore_object(self):
# Objects without a set_name() method should be ignored
self.d['example'] = object()
self.assertFalse(hasattr(s... | {
"content_hash": "981b5ab6347d3756086ab71d65d547a8",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 73,
"avg_line_length": 29.25581395348837,
"alnum_prop": 0.6049284578696343,
"repo_name": "gulopine/steel-experiment",
"id": "528ee6b1474a8c3dd4f81c07e7567696fcca31f0",
"siz... |
from telemetry import value as value_module
class SkipValue(value_module.Value):
def __init__(self, page, reason, description=None):
"""A value representing a skipped page.
Args:
page: The skipped page object.
reason: The string reason the page was skipped.
"""
super(SkipValue, self)._... | {
"content_hash": "f12845d879e1cb9f23d334bf09d68f66",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 25.450704225352112,
"alnum_prop": 0.6452684006640841,
"repo_name": "catapult-project/catapult-csm",
"id": "571de28915c6b31a006d0f2bedd802f0ce06ae77",
... |
"""
Copyright (2010-2014) INCUBAID BVBA
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... | {
"content_hash": "47fdcb145881c35f4689a5f3ef370a10",
"timestamp": "",
"source": "github",
"line_count": 937,
"max_line_length": 123,
"avg_line_length": 29.937033084311633,
"alnum_prop": 0.6039000392142883,
"repo_name": "tcpcloud/openvstorage",
"id": "b03b7ee42982a03d5bf215ba74b3eab75e71441f",
"size... |
def greetings(msg):
print(msg+"!!!!!");
| {
"content_hash": "14d6804763fe79595ca84ac753f5f2c2",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 23,
"avg_line_length": 22,
"alnum_prop": 0.5227272727272727,
"repo_name": "PetarZDuric/cs3240-labdemo",
"id": "24860c3e8fe9d888468f86ad75387e048875a3b3",
"size": "98",
"bi... |
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from meregistro.shortcuts import my_render
from apps.seguridad.decorators import login_required, credential_required
from apps.seguridad.models import Ambito, Rol
from apps.registro.models import Establecimiento, EstadoEstablecimi... | {
"content_hash": "6305660c373ee7b4f4b0db59ed648c96",
"timestamp": "",
"source": "github",
"line_count": 658,
"max_line_length": 163,
"avg_line_length": 39.61854103343465,
"alnum_prop": 0.6675361540527063,
"repo_name": "MERegistro/meregistro",
"id": "8b2b2b515c119c478b854be4367ee6bc2ae7bc4b",
"size"... |
from msrest.serialization import Model
class EventContent(Model):
"""The content of the event request message.
:param id: The event ID.
:type id: str
:param timestamp: The time at which the event occurred.
:type timestamp: datetime
:param action: The action that encompasses the provided event... | {
"content_hash": "8162ab806cda4c5986c35f158fe378bb",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 113,
"avg_line_length": 40.93478260869565,
"alnum_prop": 0.6399362719065321,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "46a3ce6bc5dbf2bab32063b9c5c4df25b77c134f",
"si... |
from __future__ import (absolute_import, unicode_literals)
import concurrent.futures
import imp
import importlib
import logging
import os
import threading
from datetime import datetime
from fval.external.six import iteritems, text_type
from fval.utils import get_relative_path
class Counter(object):
def __init__... | {
"content_hash": "20be0923fcaa0697e2841311e7c7f3e0",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 112,
"avg_line_length": 40.65680473372781,
"alnum_prop": 0.5447533110173192,
"repo_name": "jonhadfield/fval",
"id": "d959edcd0c598a19a30ac432f354b09e3b3bb386",
"size": "68... |
from datetime import datetime
import sys
import subprocess
from libs.common.Variable_Manager import *
from libs.utility.BDD import *
from libs.common import State_Manager as SM
from libs.utility import LogMod
from libs.utility import DateMod
def Check_Partner(backupHost):
#DEBUG
now = datetime.now()
cursor.exec... | {
"content_hash": "311b55c806c2b6deab964439c0d1d283",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 78,
"avg_line_length": 20.883116883116884,
"alnum_prop": 0.6442786069651741,
"repo_name": "RootKitDev/Athena",
"id": "4447c8ab1ff8d48ec3ac0546e891bb33d62bef34",
"size": "18... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.logic import LogicManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-logic
# USAGE
python get_schemas_by_integration_account_name.py
Before run the sample, please set the values of the client ID, tena... | {
"content_hash": "13659700157ed3dcb76a69b8d54acb33",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 137,
"avg_line_length": 34,
"alnum_prop": 0.7326989619377162,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c23b8f2dea6d547ec77f08a41906d629a21d95fd",
"size": "1624",
... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
from ivf.batch.batch import DatasetBatch
from ivf.io_util.image import loadNormal
from ivf.cv.image import to32F, luminance, setAlpha
from ivf.np.norm import normalizeVector
from ivf.core.sha... | {
"content_hash": "85e7925c59270249fef59b85cf1ff243",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 89,
"avg_line_length": 32.81333333333333,
"alnum_prop": 0.6542056074766355,
"repo_name": "tody411/ImageViewerFramework",
"id": "93e2adddc152b4f9d4d26e9359cacd48817ccac4",
"... |
import logging as lg
class Paper(object):
"""
Wrapper base class for a paper.
"""
def __init__(self, bd):
"""
Constructor.
@param [in] bd BibTeX entry dictionary.
"""
## The ID.
self.__id = bd['ID']
## The title.
self.__title = None
... | {
"content_hash": "e8e2ca725e3880061b320932e9919c3d",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 80,
"avg_line_length": 27.793478260869566,
"alnum_prop": 0.4704732107938991,
"repo_name": "CERNatschool/public-doc-index",
"id": "f6f1bdf4937d08a72131b15bf57477af21e198bf",
... |
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 'UserStatus'
db.create_table(u'profiles_userstatus', (
(u'id', self.gf('django.db.models.fields.AutoField... | {
"content_hash": "bfd7d7e9813f67a3182736125ca09141",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 199,
"avg_line_length": 81.81159420289855,
"alnum_prop": 0.5601417183348095,
"repo_name": "chirilo/remo",
"id": "bf4c9954c41178669c42fa1470be2180d7d27f83",
"size": "11314"... |
from kapal.algo import *
from kapal.world import *
from kapal.state import *
import kapal.tools
import time
# TODO: walk through example with comments
# TODO: post this example on wiki as a tutorial
n = 50 # width/height of world
c = kapal.tools.rand_cost_map(n, n, min_val=1, max_val=3, flip=True)
w = World2d(c,... | {
"content_hash": "6e4b025e6e6f31b20abbfd72ca4fb8a2",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 28.818181818181817,
"alnum_prop": 0.7066246056782335,
"repo_name": "elben/kapal",
"id": "baa9c24c709efe50a8f04eb22a11cb123883b70b",
"size": "634",
... |
import io
import json
import numpy as np
import pytest
import pyarrow as pa
from pyarrow.fs import LocalFileSystem, SubTreeFileSystem
from pyarrow.tests.parquet.common import (
parametrize_legacy_dataset, parametrize_legacy_dataset_not_supported)
from pyarrow.util import guid
try:
import pyarrow.parquet as p... | {
"content_hash": "301d457baf706ccd098f6397a5e95475",
"timestamp": "",
"source": "github",
"line_count": 690,
"max_line_length": 79,
"avg_line_length": 34.98840579710145,
"alnum_prop": 0.6159390274210919,
"repo_name": "kou/arrow",
"id": "3bc204c978a00974c305a5567c79ba1a2f1a4b44",
"size": "24928",
... |
from collections import deque
from itertools import takewhile, imap
from operator import itemgetter
from util import primes
print deque(
imap(itemgetter(1),
takewhile(lambda (i, v): i < 10001, enumerate(primes()))),
maxlen=1).pop()
| {
"content_hash": "d100dfef460b9e2c011a52b328c6bf1e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 67,
"avg_line_length": 22.90909090909091,
"alnum_prop": 0.7103174603174603,
"repo_name": "jcdenton/project-euler",
"id": "b88ea356f06499edfa5c41a07e4d998ab023aff1",
"size":... |
import redis
import threading
from twisted.internet import reactor
import logging
import time
class RedisCommand(object):
def __init__(self,index,func,params,ctx,finish):
self.__index =index
self.__func = func
self.__params = params
self.__finish = finish
self.__ctx = ctx
... | {
"content_hash": "8b5ea5952880a338c258078d218270b5",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 111,
"avg_line_length": 29.122093023255815,
"alnum_prop": 0.517069275304452,
"repo_name": "xiexiangwei/xGame",
"id": "497fd94aecfea5a53b2dd36999f92803502d22fc",
"size": "5... |
import json
import os
import shutil
import tempfile
import time
import zipfile
import multiprocessing
import contextlib
from unittest import mock
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.files.uploadedfile import Simple... | {
"content_hash": "84ed1c2c5baa14b6081e7e8e141c7488",
"timestamp": "",
"source": "github",
"line_count": 1319,
"max_line_length": 88,
"avg_line_length": 37.19636087945413,
"alnum_prop": 0.5985487750193632,
"repo_name": "mozilla/olympia",
"id": "686b4e6f53a830aecb0f57e6afb638f6e0ce8103",
"size": "490... |
from snmpsim.error import SnmpsimError
from snmpsim.grammar import abstract
class AbstractRecord(object):
grammar = abstract.AbstractGrammar()
ext = ''
def evaluate_oid(self, oid):
raise SnmpsimError(
'Method not implemented at '
'%s' % self.__class__.__name__)
def ev... | {
"content_hash": "d374be5b1023ba7af8a18352b6ced957",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 57,
"avg_line_length": 29,
"alnum_prop": 0.5517241379310345,
"repo_name": "etingof/snmpsim",
"id": "3c5f8f7ba2e99e8a8dd165d8cddfc7ff01479dd5",
"size": "1348",
"binary": f... |
"""Samyro learner parameters."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from samyro import read, model
class Trainer(object):
"""A training regime."""
def __init__(self, model_instance, sampler, batch_size, reuse):
assert isinstan... | {
"content_hash": "4492e6b0835cf8e148931c8ef603928b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 70,
"avg_line_length": 39.46341463414634,
"alnum_prop": 0.5784919653893696,
"repo_name": "jkahn/samyro",
"id": "c01071e91851fe575585f636c0334ade1437e5db",
"size": "1618",
... |
"""
Unit tests for some APIs with conditional logic in adb_wrapper.py
"""
import unittest
from devil import devil_env
from devil.android import device_errors
from devil.android.sdk import adb_wrapper
with devil_env.SysPath(devil_env.PYMOCK_PATH):
import mock # pylint: disable=import-error
class AdbWrapperTest(u... | {
"content_hash": "9037710273fa343cbcf461af1d275797",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 35.96969696969697,
"alnum_prop": 0.7080876158382476,
"repo_name": "endlessm/chromium-browser",
"id": "f30ab152de3daedda16864e5100bb7cd8e9e46a7",
"siz... |
from django.conf.urls import include, url
from rest_framework.routers import SimpleRouter
from api import views
from api.views import FacebookLogin
router = SimpleRouter()
# users route
router.register(r'users', views.UserViewSet)
# tourpoint route
router.register(r'tourpoints', views.TourPointViewSet)
router.regist... | {
"content_hash": "fe46beffea9c7874c95c8e99cd157590",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 30.75,
"alnum_prop": 0.6883468834688347,
"repo_name": "johnnywell/snowman",
"id": "d5ab349b86ed39b3b28184bee14623c38b800837",
"size": "738",
"binar... |
from .scale import scale
from copy import deepcopy
import brewer2mpl
def _number_to_palette(ctype, n):
n -= 1
palettes = sorted(brewer2mpl.COLOR_MAPS[ctype].keys())
if n < len(palettes):
return palettes[n]
def _handle_shorthand(text):
abbrevs = {
"seq": "Sequential",
"qual": "... | {
"content_hash": "fc3868db68efafe3fe5690e4e90794b4",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 28.186666666666667,
"alnum_prop": 0.5666982024597919,
"repo_name": "mizzao/ggplot",
"id": "6f34d4d34ae8cec84c1047f4b991e94b84da04d8",
"size": "2114",... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import logging
from bmc.bmc_spec import BMCSpec, InvarStatus
from . import sal_op_parser
from . import pwa2salconverter as pwa2sal
import fileops as fops
import utils as U
import err
logger = log... | {
"content_hash": "d796d318d6f3f862e3b2901a526fd34a",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 92,
"avg_line_length": 31.023346303501945,
"alnum_prop": 0.5133575818387056,
"repo_name": "zutshi/S3CAMR",
"id": "82f3ebccc7ae13d8741a5ac970359d1208d2a2e1",
"size": "7973"... |
import os
import time
import sys
import argparse
import serial.tools.list_ports
from colorama import init as coloramaInit
from colorama import Fore, Back
from lib import pyCham
cham = pyCham()
def showBanner(showFooter = False):
print "βββββββ βββ βββ ββββββββββ βββ ββββββ ββββ ββββ"
print "ββββββββββββ βββββ... | {
"content_hash": "b65faf5abf18af799b9e82c71552ca47",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 109,
"avg_line_length": 28.20703125,
"alnum_prop": 0.5934081152194987,
"repo_name": "sch3m4/pycham",
"id": "07c1e26ccdd95bc55cc17a25f4bc5b8ba9198657",
"size": "7846",
"b... |
import collections
import copy
import sling
import sling.log as log
import string
from collections import defaultdict
from sling.task.workflow import register_task
from util import load_kb
# A span is a [begin, end) range of tokens in the category title string.
# It is resolved to a list of PIDs and a QID along with ... | {
"content_hash": "eef87869e421df9c6ba5eb3c7d62c4f2",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 80,
"avg_line_length": 35.76883116883117,
"alnum_prop": 0.6147701691961368,
"repo_name": "google/sling",
"id": "5ac23f8684f153595bb2b098dfd01b5c51b4af04",
"size": "14560",... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
from .. import models
class BackupProtectableItemsOperations(object):
"""BackupProtectableItemsOperations operations.
:param client: Client for service requests.
:param config: Configuration of ... | {
"content_hash": "977c822e38c6da2a4ed5430effcb9938",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 169,
"avg_line_length": 45.17142857142857,
"alnum_prop": 0.635673624288425,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "ea8ab20dbe21089c0cdd2c3331f15f545fdb7945",
"si... |
"""initial migration
Revision ID: 413244c14ee
Revises: None
Create Date: 2015-09-15 00:50:22.590027
"""
# revision identifiers, used by Alembic.
revision = '413244c14ee'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! #... | {
"content_hash": "81104bfe09d1e8e441cd90cc3ca85fb8",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 63,
"avg_line_length": 26.21212121212121,
"alnum_prop": 0.6739884393063584,
"repo_name": "JXNU-ACS/learn-blog",
"id": "70fa95010a24fe9a11fa6cc239592a0575be8014",
"size": "8... |
"""
Copyright Google Inc. 2019
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distribut... | {
"content_hash": "f913633b4e15d642ad141800316b907f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 112,
"avg_line_length": 34.505494505494504,
"alnum_prop": 0.6111464968152867,
"repo_name": "GoogleCloudPlatform/training-data-analyst",
"id": "668abae91e5b7e2b7657a967c052042... |
from autosar.element import Element
class SwcImplementation(Element):
""" Swc implementation """
def __init__(self,name, behaviorRef, parent=None):
super().__init__(name, parent)
self.behaviorRef = behaviorRef
self.codeDescriptors = None
self.programmingLanguage = None
... | {
"content_hash": "d9e053dc4a5b49a5d5904870fd2c4804",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 54,
"avg_line_length": 31.857142857142858,
"alnum_prop": 0.6028187059577194,
"repo_name": "cogu/autosar",
"id": "80924c2afe3572a37f966abd0477a50f765c1748",
"size": "1561",
... |
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest import test
class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests hosts API using admin privileges.
"""
@classmethod
def setup_clien... | {
"content_hash": "1eae68df72df82bceb996e7bcfbacc54",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 76,
"avg_line_length": 38.93491124260355,
"alnum_prop": 0.5861702127659575,
"repo_name": "rzarzynski/tempest",
"id": "95be59efca784675cf68baccc31f09edd8ef73f9",
"size": "7... |
from __future__ import unicode_literals
from decimal import Decimal
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('round', '0013_plot_batch'),
]
operations = [
migrations.AlterField(
model_name='round',
name='sc... | {
"content_hash": "96aff138dadac678aa0d3b3e64e6573f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 92,
"avg_line_length": 22.94736842105263,
"alnum_prop": 0.6123853211009175,
"repo_name": "adminq80/Interactive_estimation",
"id": "4759382af32499e3b8fd3617fe3ebc22abe8f173",
... |
from pkg_resources import parse_version
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from wagtail.core.models impo... | {
"content_hash": "f2aabf086d6487261f94584ee18e4d4e",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 114,
"avg_line_length": 33.55555555555556,
"alnum_prop": 0.6413197729422895,
"repo_name": "csalom/puput",
"id": "04c5db42bce50739f9a6339e1fecbe712ae09b34",
"size": "8456",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Click.place'
db.add_column('banner_rotator_click', 'place', self.gf('django.db.models.fields.related.Foreign... | {
"content_hash": "64911be5f2e1f7917bed8b4e0dde1631",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 214,
"avg_line_length": 76.21698113207547,
"alnum_prop": 0.5511820769897264,
"repo_name": "martinogden/django-banner-rotator",
"id": "ecf5cc76a1cddefef596a5e8cd74777bb9dd3c0... |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | {
"content_hash": "9e4df775b1b7736cc3a3dcb87e823f14",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 91,
"avg_line_length": 30.401574803149607,
"alnum_prop": 0.4693084693084693,
"repo_name": "airbnb/streamalert",
"id": "9b14255a86b394fc3e0aacb891573a48ad8fac6a",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.