text stringlengths 4 1.02M | meta dict |
|---|---|
from pygame.constants import RLEACCEL
from thorpy.elements.clickable import Clickable
from thorpy._utils.images import load_image, change_color_on_img_ip
from thorpy.miscgui import constants, functions, style, painterstyle
class Checker(Clickable):
"""Checkable check or radio box."""
def __init__(self,
... | {
"content_hash": "06d8fff3a4c38d64dbefebd71c325ec5",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 88,
"avg_line_length": 37.17575757575757,
"alnum_prop": 0.5787414411477013,
"repo_name": "YannThorimbert/ThorPy-1.4.3",
"id": "b4d43424091dab413656694008050f72f75c8464",
"... |
"""
Django settings for cpof project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | {
"content_hash": "31e00b7a0ec49c82d5e220cf05c01c4f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 71,
"avg_line_length": 23.81111111111111,
"alnum_prop": 0.7022865142323845,
"repo_name": "rafaelsilvag/Rypace",
"id": "9feb2c1cd605a93160bb9acacd00c9bcdbb06f51",
"size": "2... |
import datetime
from app import db
class BucketList(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100), unique=True)
description = db.Column(db.Text, nullable=True)
interests = db.Column(db.String(120), nullable=True)
date_created = db.Colum... | {
"content_hash": "8c21bb1858662087c392590f6d64d574",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 39.733333333333334,
"alnum_prop": 0.6879194630872483,
"repo_name": "SerryJohns/bucket-list",
"id": "790bd96b30fe676462081306a479a799d322e3be",
"size"... |
from setuptools import setup, find_packages
setup(
name='panya-paste',
version='0.1.0',
description='Python Paste templates creating Panya buildout environments.',
long_description = open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(),
author='Praeke... | {
"content_hash": "a886a74d5eccfcea1d2f87bd763d081d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 124,
"avg_line_length": 33.54545454545455,
"alnum_prop": 0.6070460704607046,
"repo_name": "praekelt/panya-paste",
"id": "fbbb1cff14b7a6bbfedd32ce5554ff0b162a0c68",
"size": ... |
from stromx import runtime, cvimgproc, cvsupport
factory = runtime.Factory()
runtime.register(factory)
cvimgproc.register(factory)
cvsupport.register(factory)
stream = runtime.XmlReader().readStream("camera.xml", factory)
stream.start()
camera = stream.operators()[0]
canny = stream.operators()[2]
for i in range(5... | {
"content_hash": "167d5f6c0ddb1354ffc322a36cf11ba4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 75,
"avg_line_length": 25.08,
"alnum_prop": 0.6698564593301436,
"repo_name": "sparsebase/stromx",
"id": "bdb4d73a63b1ea4c33f56ed715274a0823010792",
"size": "1245",
"binar... |
'''
run the CCR scorer on all the groups, including no restriction to a single group
'''
import os
import sys
import json
import subprocess
import multiprocessing
from collections import defaultdict
targets = json.load(open('../../trec-kba-ccr-and-ssf-query-topics-2013-07-16.json'))['targets']
groups = set()
for targ i... | {
"content_hash": "bcfde4e68144ba42cde7bc7717c66a5d",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 275,
"avg_line_length": 32.59055118110236,
"alnum_prop": 0.6431505194491423,
"repo_name": "trec-kba/kba-scorer",
"id": "2dd0957479d881f5bf56fa1833ced4612529817c",
"size": ... |
"""Base class for concurrency policy."""
from __future__ import absolute_import, division
import collections
# Namedtuples for management requests. Used by the Message class to communicate
# items of work back to the policy.
AckRequest = collections.namedtuple(
"AckRequest", ["ack_id", "byte_size", "time_to_ack"... | {
"content_hash": "7c3c2482252c5b7c4107d1e1284218c2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 33.68421052631579,
"alnum_prop": 0.73125,
"repo_name": "tseaver/google-cloud-python",
"id": "ac1df0af8efff0514c14a3f9c152bbf7e0e8758d",
"size": "1237... |
import colorama
import common
import importlib
import registry
import os
import shutil
import subprocess
import sys
import time
from collections import defaultdict
sys.path.append(os.path.join(common.PROJECT_ROOT_PATH))
import config
EQUAL_PERFORMANCE_EPSILON = 3.0 # in percents
COLOR_READY = '\033[92m'
COLOR_NOT_F... | {
"content_hash": "68b0b552c3e6b8d84681dbf134d2e410",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 108,
"avg_line_length": 36.300242130750604,
"alnum_prop": 0.6087246531483458,
"repo_name": "artemalive/DigitalWhip",
"id": "af438b64bd2a13023a66ed3a1731e404a9d39a6c",
"siz... |
"""
NAME
shannon.py
PURPOSE
Methods for calculating various information gains during binary
classification.
COMMENTS
Copied from informationgain.py at
https://github.com/CitizenScienceInAstronomyWorkshop/Bureaucracy
METHODS
shannon(x):
expectedInformationGain(p0, M_ll, M_nn)
inform... | {
"content_hash": "4fd3c151eb8e5b965fd8ef2747313a36",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 80,
"avg_line_length": 28.544444444444444,
"alnum_prop": 0.5642273258077073,
"repo_name": "melaniebeck/GZExpress",
"id": "4be43dbb6452635cbc6c9be4ea024db63e0cd876",
"size"... |
"""
code changes must be documented in *one central place
per developer*, not per module.
"""
import os
import datetime
from django.conf import settings
from lino.utils import i2d, i2t
from lino.utils.restify import restify, doc2rst
from lino.api import dd, rt
blogs = dd.resolve_app('blogs')
tickets = dd.resolve_app... | {
"content_hash": "d54f3e3cd99f1a2877255093aeea7152",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 88,
"avg_line_length": 31.928571428571427,
"alnum_prop": 0.6030325627641064,
"repo_name": "lino-framework/xl",
"id": "0c83bd699eafe561b6b9bd894ecd0d129442769a",
"size": "4... |
"""Write Your Domain Module Here
"""
| {
"content_hash": "baff22f6e9e9f4e3e838a1020535a863",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 32,
"avg_line_length": 18.5,
"alnum_prop": 0.6756756756756757,
"repo_name": "bufferx/twork",
"id": "a61232402da46f5d86639e1176533828f66e8ec2",
"size": "37",
"binary": fals... |
import pytest
import json
from mock.mock import Mock
from insights.core.dr import SkipComponent
from insights.core import filters
from insights.specs import Specs
from insights.core.spec_factory import DatasourceProvider
from insights.specs.datasources.semanage import LocalSpecs, users_count_map_selinux_user
SEMANGE_... | {
"content_hash": "d24e8788a1e96331d33008cb673c0ec3",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 88,
"avg_line_length": 37.035714285714285,
"alnum_prop": 0.6589521054323368,
"repo_name": "RedHatInsights/insights-core",
"id": "bc5a72fb667c2e585e0991e72b691f97bd5c256d",
... |
"""
Created on Wed May 17 14:40:12 2017
@author: Mihaela
Filters the traffic from specific weekdays, between specific hours
Input:
Structure of lists:
dataframe = df
weekdays =[day_of_week, ...]
=[0-6, ...] Monday = 0, Tuesday = 1, ..., Sunday = 6
... | {
"content_hash": "35d3f5353fbee8d9ebfeb4c69314c1b6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 125,
"avg_line_length": 30.690140845070424,
"alnum_prop": 0.5759522716842589,
"repo_name": "Superchicken1/SambaFlow",
"id": "72341a5562cde79f37fc1e623c443bd49fbded88",
"siz... |
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
import requests
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True)
print... | {
"content_hash": "6428c80d1d857f02d46f0913121b6914",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 234,
"avg_line_length": 37.346020761245676,
"alnum_prop": 0.5548040396553322,
"repo_name": "zhan4402/list-help-bot",
"id": "0cb6d0901cd81aaa058abdddcbd9615a8231b707",
"siz... |
"""
Django settings for sais project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ins... | {
"content_hash": "c41f567eddf83881e9f6f712065608d3",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 71,
"avg_line_length": 26.57983193277311,
"alnum_prop": 0.6860575403098325,
"repo_name": "giojavi04/Test-Sais",
"id": "99debe21b9ab536e3f59f8414b6bc6ebeed28420",
"size": "... |
"""
./e04twostage.py http://camlistore.org 1 6
Found 10 urls
http://camlistore.org/ frequencies: [('camlistore', 13), ...]
...
First integer arg is depth, second is minimum word count.
"""
from queue import Queue
import re
from sys import argv
from threading import Thread
from e01extract import canonicalize, extrac... | {
"content_hash": "f84e621ec85e8138e9fb66292907d37e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 75,
"avg_line_length": 26.92222222222222,
"alnum_prop": 0.5864630623194387,
"repo_name": "bslatkin/pycon2014",
"id": "89af1caa963a0b213c8804f268d6b47e9290a098",
"size": "24... |
import re
from datetime import datetime, timedelta
import xlrd
import uuid
from string import Template
from xml.sax.saxutils import escape
from dateutil.parser import parse as parse_date
from scrapy.spider import BaseSpider
from scrapy.contrib.loader import ItemLoader
from scrapy.http import Request, Response, TextRes... | {
"content_hash": "1e7f259c8078e2a1eae8c40571eb8741",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 140,
"avg_line_length": 40.9203187250996,
"alnum_prop": 0.6120144095024828,
"repo_name": "SkyTruth/scraper",
"id": "770e41b02340994b8e79b8d4a42d2b5e38649b74",
"size": "103... |
"""The test for the Template sensor platform."""
from asyncio import Event
from datetime import timedelta
from unittest.mock import patch
import pytest
from homeassistant.bootstrap import async_from_config_dict
from homeassistant.components import sensor
from homeassistant.const import (
ATTR_ENTITY_PICTURE,
... | {
"content_hash": "0d71ea0a2909ee2cb52faa239da8c6f4",
"timestamp": "",
"source": "github",
"line_count": 1262,
"max_line_length": 142,
"avg_line_length": 34.038827258320126,
"alnum_prop": 0.5050399236445748,
"repo_name": "jawilson/home-assistant",
"id": "0352080bed830c641374e899f9be5d0ef4b6192c",
"s... |
"""Routines for loading PUDL data into various storage formats."""
import logging
import sys
from sqlite3 import Connection as SQLite3Connection
from sqlite3 import sqlite_version
from typing import Dict
import pandas as pd
import sqlalchemy as sa
from packaging import version
from sqlalchemy.exc import IntegrityErro... | {
"content_hash": "9b702838070fce13a66d3d564700f7b1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 35.083333333333336,
"alnum_prop": 0.6562606040040719,
"repo_name": "catalyst-cooperative/pudl",
"id": "d12a54f5ed45f307006a676d11714dc97fab10d4",
"si... |
import re
def compile(name):
print "Compiling "+name+"..."
file = open('src/' + name + '/' + name + '.tpl.html', 'r')
tpl=file.read()
tpl=tpl.replace("'","\\'");
tpl=tpl.replace("\n","").replace("\r","").replace("\t"," ")
tpl=re.sub("\s\s+" , " ", tpl)
file = open('src/' + name + '/' + name + '.js', 'r')
js=... | {
"content_hash": "765ae0262d29ef4e71b260f90028ff1c",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 60,
"avg_line_length": 22.488888888888887,
"alnum_prop": 0.6096837944664032,
"repo_name": "ilausuch/il.angularUI",
"id": "2bf777c3475351efc1a2aa4920ee4dcb2c1c37ec",
"size":... |
import os
import config
import logging
import json
import models.node as nm
import models.proxy as pr
INSTANCE_FILE = os.path.join(config.PERMDIR, 'details.json')
INSTANCE_INTERMEDIA_FILE = os.path.join(config.PERMDIR, 'details.tmp.json')
def write_details(nodes, proxies):
with open(INSTANCE_INTERMEDIA_FILE, 'w... | {
"content_hash": "7e6ccf12619916eafb2fc8fb17667247",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 75,
"avg_line_length": 25.279411764705884,
"alnum_prop": 0.5840605002908668,
"repo_name": "HunanTV/redis-ctl",
"id": "ad1293d7988c2118b0ca57ed6f07a28f6c2f03ab",
"size": "17... |
""" Slice nodes.
Slices are important when working with lists. Tracking them can allow to
achieve more compact code, or predict results at compile time.
There will be a method "computeExpressionSlice" to aid predicting them.
"""
from nuitka.PythonVersions import python_version
from nuitka.specs import BuiltinParamet... | {
"content_hash": "508a48ba177f95fe189fd0545bad0b37",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 87,
"avg_line_length": 32.39153439153439,
"alnum_prop": 0.6246324730480235,
"repo_name": "kayhayen/Nuitka",
"id": "3e43734854b6d7b5d3ce6ccff60372b6bc544d65",
"size": "1302... |
from flask import Flask
import json, requests
# configuration
DEBUG = True
SERVER = 'http://192.168.1.104:5000'
app = Flask(__name__)
app.config.from_object(__name__)
app.config.from_envvar('CURLYSERV_CONF', silent=True)
# Get list of files
def uploads(username, password):
url = app.config['SERVER'] + '/listoffiles... | {
"content_hash": "d4c035fc3e91926f628e7d1c4b36e5ad",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 77,
"avg_line_length": 30.068181818181817,
"alnum_prop": 0.6984126984126984,
"repo_name": "ayttew/curlyserver",
"id": "ba764f60a10014aaa03de58caa7a2c01a77ea7e9",
"size": "1... |
'''
Created on 2015/08/28
@author: haisland0909
'''
from sklearn.pipeline import FeatureUnion
from sklearn.grid_search import GridSearchCV
from sklearn import cross_validation
from sklearn import preprocessing
from sklearn.metrics import mean_absolute_error
import sklearn.linear_model
import sklearn.ensemble
import im... | {
"content_hash": "24db206131ccda02a20bd70a86c34707",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 81,
"avg_line_length": 26.412429378531073,
"alnum_prop": 0.5863101604278075,
"repo_name": "haisland0909/Denoising-Dirty-Documents",
"id": "b6cf0312428367e0a7e1e2df5ec913b772... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
import sys
from multiprocessing import Process
from . import logger
from... | {
"content_hash": "0ec15c83ff9e87f2be48c3d2dbd732a3",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 35.768595041322314,
"alnum_prop": 0.5861829944547134,
"repo_name": "caitinggui/musicbox",
"id": "5741f75342778d33ea01277a2b8c57457605d9a6",
"size": ... |
from __future__ import absolute_import
import os
import six
from pyarrow.pandas_compat import _pandas_api # noqa
from pyarrow.lib import FeatherError # noqa
from pyarrow.lib import Table, concat_tables
import pyarrow.lib as ext
def _check_pandas_version():
if _pandas_api.loose_version < '0.17.0':
rai... | {
"content_hash": "f632bc3210671bd895d2cfdb7d113d7c",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 78,
"avg_line_length": 30.11574074074074,
"alnum_prop": 0.5857033051498847,
"repo_name": "majetideepak/arrow",
"id": "91b77cb9644f3288366f7f43b6ae7a833182d9bc",
"size": "7... |
""" This module returns stats about the DynamoDB table """
from datetime import datetime, timedelta
from boto.exception import JSONResponseError, BotoServerError
from retrying import retry
from dynamic_dynamodb.aws import dynamodb
from dynamic_dynamodb.log_handler import LOGGER as logger
from dynamic_dynamodb.aws.clo... | {
"content_hash": "d00daa80a446449b7762717b517d69a5",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 141,
"avg_line_length": 34.96629213483146,
"alnum_prop": 0.6245501285347044,
"repo_name": "Spokeo/dynamic-dynamodb",
"id": "375d86338dd3ab29d69430fcb4177b36cef9bc9a",
"siz... |
""" Sahana Eden Member Search Module Automated Tests
@copyright: 2011-2016 (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 Softwar... | {
"content_hash": "8eafb886876f98164852f2b6f22c6613",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 97,
"avg_line_length": 36.7,
"alnum_prop": 0.5735694822888283,
"repo_name": "flavour/ifrc_qa",
"id": "7f280150c1e1cd14d3e2573f7cb6528239ae91e5",
"size": "4429",
"binary"... |
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/500... | {
"content_hash": "f415f721f8c6e5ed2b2823d148ec9938",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 106,
"avg_line_length": 30.03125,
"alnum_prop": 0.5376839601605471,
"repo_name": "pk-sam/crosswalk-test-suite",
"id": "c03f8719f878337ab44644644145bbdf4e26bbf8",
"size": "... |
import locale
import os
import re
from .basecase import BaseTestCase
from .cassconnect import create_db, remove_db, testrun_cqlsh
from .run_cqlsh import TimeoutError
from cqlshlib.cql3handling import CqlRuleSet
BEL = '\x07' # the terminal-bell character
CTRL_C = '\x03'
TAB = '\t'
# completions not printed out in thi... | {
"content_hash": "43ac377ec22b3386b935f3e71c2ba1ef",
"timestamp": "",
"source": "github",
"line_count": 1001,
"max_line_length": 157,
"avg_line_length": 55.83016983016983,
"alnum_prop": 0.49885481158071787,
"repo_name": "jrwest/cassandra",
"id": "c52624b1ed9a0bc9826c98f88d5bb88fea52df52",
"size": "... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetReference(Choreography):
def __init__(self, temboo_session):
"""
Create a ... | {
"content_hash": "25cae8a41a30a1067c19c51ea602b902",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 230,
"avg_line_length": 43.7037037037037,
"alnum_prop": 0.690677966101695,
"repo_name": "jordanemedlock/psychtruths",
"id": "f99efa7267fd60f6f8c93fb0b70f150c418d9daa",
"siz... |
import datetime, logging
import platform
HOST = platform.uname()[1]
class NullHandler(logging.Handler):
def emit(self, record):
pass
class MockHandler(logging.Handler):
def __init__(self, *args, **kwargs):
self.msgs = []
logging.Handler.__init__(self, *args, **kwargs)
def emit(se... | {
"content_hash": "8bb85991d5ab49b75becc3277bb53b1e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 135,
"avg_line_length": 33.559322033898304,
"alnum_prop": 0.6075757575757575,
"repo_name": "zain/jogging",
"id": "7c7d5c84d796958a6621245b506d8af20ba8f08b",
"size": "1980",... |
import os, sys
import time
from test.testlib import *
from git import *
class TestRepo(object):
def setup(self):
self.repo = Repo(GIT_REPO)
@raises(InvalidGitRepositoryError)
def test_new_should_raise_on_invalid_repo_location(self):
if sys.platform == "win32":
Repo("C:\\WIN... | {
"content_hash": "504a57422b2c39ba19fb079705facb39",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 142,
"avg_line_length": 38.3,
"alnum_prop": 0.5935052219321149,
"repo_name": "directeur/git-python",
"id": "669a8f62cb75410207229f08f3fa8db519161f51",
"size": "12472",
"... |
from .exceptions import NoSuchLibException, BadSignatureException, BadEncryptedDataException
from .saltlib import SaltLib
| {
"content_hash": "63fa6654c874240df76aa7c6aafeaedb",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 92,
"avg_line_length": 61,
"alnum_prop": 0.8852459016393442,
"repo_name": "assaabloy-ppi/salt-channel-python",
"id": "1cc89c509b4f07915e32e5ee7ea71aeef733dca9",
"size": "122... |
__author__ = 'Juan Batiz-Benet'
__email__ = 'juan@benet.ai'
__version__ = '0.2.3'
__doc__ = '''
`datastore-objects` is a simple *object mapper* on top of
[datastore](https://github.com/jbenet/datastore) (not relational). Thanks to
datastore's versatility, it makes it easy to (serialize and) persist custom
classes to an... | {
"content_hash": "7e1a1c8eef9b2b44a731baa07752754e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 76,
"avg_line_length": 33.54545454545455,
"alnum_prop": 0.7737127371273713,
"repo_name": "datastore/datastore.objects",
"id": "aa0b4543b73d3972abe603f029d105ba062d319d",
"s... |
import copy
import re
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
def __str__(self):
if self.next:
return str(self.next)
return ""
def __len__(self):
if self.next:
return len(self.next)
return 0
class ... | {
"content_hash": "862708ced519c806bcb05cba64c36e7c",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 95,
"avg_line_length": 32.31963470319635,
"alnum_prop": 0.5812376377507771,
"repo_name": "bruntonspall/regex-builder",
"id": "b9ab33f8e277e8010480b4c243b41258881c6c83",
"s... |
import pytest
from django.contrib.auth import get_user_model
pytestmark = pytest.mark.django_db
User = get_user_model()
def test_create_user():
u = User.objects.create_user(email='f@example.com', password='abc', name="test user")
assert u.is_active is True
assert u.is_staff is False
assert u.is_super... | {
"content_hash": "7f53256da19bed5c689744d30064314b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 89,
"avg_line_length": 29.928571428571427,
"alnum_prop": 0.6861575178997613,
"repo_name": "akarambir/askcoding",
"id": "cd57d166ada523fcc091bf831ee5d8a18ef57be9",
"size": "... |
__author__ = 'Sergey Sobko'
__email__ = 'S.Sobko@profitware.ru'
__copyright__ = 'Copyright 2015, The Profitware Group'
from scapy.packet import Packet, bind_layers
from scapy.layers.l2 import Ether
class PTPv2(Packet):
"""PTPv2 Protocol."""
# FIXME: Implement fields.
name = 'PTPv2'
bind_layers(Ether,... | {
"content_hash": "86791f819f4e970e5a59eecc6969a7ad",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 20.058823529411764,
"alnum_prop": 0.6832844574780058,
"repo_name": "profitware/iec61850",
"id": "7d75640cb473589cca269fe980ccd45851028864",
"size": "... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 30, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0); | {
"content_hash": "64bc49ba050ea8743ef0c39b834a3a6e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 165,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.7056603773584905,
"repo_name": "antoinecarme/pyaf",
"id": "35d8b82edaef19ec9b8da17cd94ba5c8be7399c7",
"size": "26... |
import logging
import traceback
import networkx as nx
from robograph.datamodel.base import exceptions
logging.basicConfig(level=logging.ERROR)
console = logging.getLogger(__name__)
class Graph:
"""
A graph, composed of nodes and edges. Leverages the Networkx library to
efficiently store graph components ... | {
"content_hash": "e69cf4796a921bf69285b9e9f9cae0e3",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 83,
"avg_line_length": 33.84393063583815,
"alnum_prop": 0.5771135781383433,
"repo_name": "csparpa/robograph",
"id": "398304336520a8c504bb70d74b46d2f6f4c29f5b",
"size": "58... |
"""decoders utilities."""
import functools
from typing import Dict, Optional
import chex
from clrs._src import probing
from clrs._src import specs
import haiku as hk
import jax
import jax.numpy as jnp
_Array = chex.Array
_DataPoint = probing.DataPoint
_Location = specs.Location
_Spec = specs.Spec
_Stage = specs.Stag... | {
"content_hash": "750151fdb5141f6a7ee3bebeb9fd2b1f",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 80,
"avg_line_length": 31.861035422343324,
"alnum_prop": 0.6102796544941418,
"repo_name": "deepmind/clrs",
"id": "974fec68129030693ad8d713d09dc0a796e070de",
"size": "12389... |
from pyjamas import DOM
from pyjamas import Factory
from FocusWidget import FocusWidget
from pyjamas.ui import Event
from __pyjamas__ import console
class ListBox(FocusWidget):
def __init__(self, **kwargs):
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-ListBox"
self.changeListeners ... | {
"content_hash": "1bd1a9eb4e47bee8d3a3c95b142563a0",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 77,
"avg_line_length": 33.48421052631579,
"alnum_prop": 0.6038981452373468,
"repo_name": "andreyvit/pyjamas",
"id": "99d5931f2268888919864a9add4b172f863f1baa",
"size": "70... |
"""Test configs for static_rnn_with_control_flow_v2."""
import tensorflow as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
from tensorflow.lite.testing.zip_test_utils import register_make_test_function
from tensorflow.python... | {
"content_hash": "174867109c3a747cf6d71c9f7b1ac068",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 80,
"avg_line_length": 38.348837209302324,
"alnum_prop": 0.6224984839296543,
"repo_name": "Intel-tensorflow/tensorflow",
"id": "163a655f1999c042c1aad0be4014d110fbb5a137",
"... |
import logging
import msgpack
import inspect
import os
import sys
import time
import zmq
import zmq.auth
from zmq.auth.thread import ThreadAuthenticator
import util
import util.config
import plugins
from daemon import Daemon
logger = logging.getLogger()
class Server(Daemon):
def load_plugins(self):
self... | {
"content_hash": "f6ab45ccfe0dc330b35fd25fb9becc15",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 125,
"avg_line_length": 33.27450980392157,
"alnum_prop": 0.6069534472598703,
"repo_name": "Darthone/atto",
"id": "5b0d265030173399119289ace0e1922491980897",
"size": "3417"... |
"""URL endpoint to allow bisect bots to post results to the dashboard."""
import json
import logging
from google.appengine.api import app_identity
from google.appengine.ext import ndb
from dashboard import post_data_handler
from dashboard import update_bug_with_results
from dashboard.common import datastore_hooks
fr... | {
"content_hash": "299110cc3f3e8d3835f56785a35c3b5a",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 78,
"avg_line_length": 29.02,
"alnum_prop": 0.6946933149552033,
"repo_name": "catapult-project/catapult-csm",
"id": "9154747816caa1647df703d20e2802120a2c6f86",
"size": "30... |
"""Generate KFDef YAML from kustomize packages.
This is a helper tool aimed at generating the RAW Yaml for KFDef specs into
kubeflow/manifests.
We use kustomize to make it easier to generate KFDef YAML files corresponding
to different KF versions but we don't want users to be exposed to that.
"""
import fire
import ... | {
"content_hash": "8a44a48263ab90e79e94d1890fa60ec2",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 77,
"avg_line_length": 31.813333333333333,
"alnum_prop": 0.5888516345347863,
"repo_name": "kubeflow/code-intelligence",
"id": "c47da6a1f56f5fb109191b97a409bf7d9224b0da",
"s... |
import os
import sys
import argparse
import subprocess as proc
import hashlib
parser = argparse.ArgumentParser(description="Launches multiple DotsBoxes instances")
parser.add_argument("ports", metavar="PORT", type=int, nargs="+", help="TCP ports to use")
parser.add_argument("--keep-configs", dest="keepconf", action=... | {
"content_hash": "d1442bb48c70ef6b5e534b1ae5bd3b15",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 148,
"avg_line_length": 30.685393258426966,
"alnum_prop": 0.6532405712193335,
"repo_name": "asavonic/DotsBoxes",
"id": "58435c8f09951ef82e5bfe5bf23d661391f0733c",
"size": "... |
from anu import Region
import pickle
regions = []
with open("regions.pickle", "rb") as f:
regions = pickle.load(f)
for r in regions:
r.Name = r.Name.replace("'", "\'")
r.Name = r.Name.replace("KAB. ", "")
r.Name = r.Name.replace("KAB ", "")
print len(regions)
with open("regions.pickle", "wb") as f:
... | {
"content_hash": "dfac7172beca5dae409f5e30976615c8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 40,
"avg_line_length": 23.133333333333333,
"alnum_prop": 0.6080691642651297,
"repo_name": "ekospinach/kawaldesa",
"id": "d6e5b0bf7a748ff13495d25844580a11c332e67c",
"size": ... |
from django.contrib import admin
from django.db.models import Q
from competition.models.competition_model import Competition
from competition.models.game_model import Game, GameScore
from competition.models.organizer_model import Organizer
from competition.models.organizer_model import OrganizerRole
from competition.m... | {
"content_hash": "e3d362b4d51a72a78752686f11c6c29e",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 78,
"avg_line_length": 31.929411764705883,
"alnum_prop": 0.6643330876934415,
"repo_name": "michaelwisely/django-competition",
"id": "2a80d24e493b5804db3add3fa23d0120bcfd5071... |
import os
from ZenPacks.zenoss.ZenPackLib import zenpacklib
CFG = zenpacklib.load_yaml([os.path.join(os.path.dirname(__file__), "zenpack.yaml")], verbose=False, level=30)
schema = CFG.zenpack_module.schema
| {
"content_hash": "6ae4ba1413b25658f99f8999cce84d3e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 110,
"avg_line_length": 41.4,
"alnum_prop": 0.7632850241545893,
"repo_name": "N-faycal/ZenPacks.iXsystems.TrueNAS",
"id": "a1cb83c088e7e6b5a4deed71d8f9425cfd47b6b2",
"size":... |
import json
import logging
from django.utils.text import normalize_newlines
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.debug import sensitive_variables
from horizon import exceptions
from horizon import forms
from horizon.utils import validators
from horizon import workflows
... | {
"content_hash": "197588b4291324c975589f273e77dd50",
"timestamp": "",
"source": "github",
"line_count": 525,
"max_line_length": 79,
"avg_line_length": 42.245714285714286,
"alnum_prop": 0.5212137607646873,
"repo_name": "fajoy/horizon-example",
"id": "fce4c8fd21ee20595cd63af9ef1533ec17d507d5",
"size"... |
from django import forms
from django.forms import Select
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from utils import get_site_languages
from models import TranslationRequest
class AddTranslationForm(forms.ModelForm):
class Meta:
model = TranslationRequest
... | {
"content_hash": "9f2d33cbc504d43653638cf0c819f07c",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 105,
"avg_line_length": 37.92857142857143,
"alnum_prop": 0.5917137476459511,
"repo_name": "aldryn/aldryn-translator",
"id": "1df16179ea964c49c689e035baf52aee61a8d440",
"siz... |
import os
from json import (
dumps,
loads,
)
from azure.common import (
AzureException,
)
from cryptography.hazmat.primitives.padding import PKCS7
from azure.storage.common._common_conversion import (
_encode_base64,
_decode_base64_to_bytes
)
from azure.storage.common._encryption import (
_gen... | {
"content_hash": "c3e75b3573a9ce70c0521510b01c9143",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 132,
"avg_line_length": 41.947712418300654,
"alnum_prop": 0.7050483016516048,
"repo_name": "Azure/azure-storage-python",
"id": "08c206560ca6b728b06cd74c695227fd4e8663c3",
... |
from datetime import datetime, timezone
from django import forms
from django.test import TestCase
from debug_toolbar.forms import SignedDataForm
SIGNATURE = "-WiogJKyy4E8Om00CrFSy0T6XHObwBa6Zb46u-vmeYE"
DATA = {"date": datetime(2020, 1, 1, tzinfo=timezone.utc), "value": "foo"}
SIGNED_DATA = f'{{"date": "2020-01-01 ... | {
"content_hash": "336b3d2f817c2243f6300c974e65a22f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 84,
"avg_line_length": 34.9,
"alnum_prop": 0.6418338108882522,
"repo_name": "tim-schilling/django-debug-toolbar",
"id": "a619ae89d466f6ba0aedf656fc724cad4d9a53a7",
"size": ... |
import urllib
import os
import collections
import sys
totals = {}
date_ranges = {}
data = collections.defaultdict(dict)
file_output = []
def printsymbols(sym_totals, output):
for symbol, changes in reversed(sorted(sym_totals.iteritems(), key=lambda x: sym_totals[x[0]])):
output += "%s %s%%\n" % (... | {
"content_hash": "0360d4920cc78fc5ef3e28f3277965e5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 102,
"avg_line_length": 35.46067415730337,
"alnum_prop": 0.6181875792141952,
"repo_name": "bestvibes/stock-portfolio-predictions",
"id": "e816110a569934952ad4f2e2769db3e1a6d1... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "0ce5f3a494a40ee7fd945cbd8928c60c",
"timestamp": "",
"source": "github",
"line_count": 954,
"max_line_length": 320,
"avg_line_length": 32.664570230607964,
"alnum_prop": 0.7000513445863552,
"repo_name": "mahabs/nitro",
"id": "b8f33331e2f23c3bf1113fc43127d851c9362cbd",
"size": "31776... |
from .directory import DirectoryManager
from .directory_device import DirectoryDeviceManager
from .directory_service import DirectoryServiceManager
from .directory_service_auths import DirectoryServiceAuthsManager
from .directory_service_policy import DirectoryServicePolicyManager
from .directory_service_session import... | {
"content_hash": "bb4f3fcce9cba35612f412c74571759a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 54.1875,
"alnum_prop": 0.8835063437139562,
"repo_name": "LaunchKey/launchkey-python",
"id": "e35ee5f9c45670b0d588e2be15e34cbde410cabe",
"size": "867"... |
from pipeline.storage import default_storage
from django import template
from django.template.loader import render_to_string
from pipeline.conf import settings
from pipeline.packager import Packager, PackageNotFound
from pipeline.utils import guess_type, path_is_url
register = template.Library()
class CommonNode(te... | {
"content_hash": "2de4f096499103fd86bfa71767b75832",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 155,
"avg_line_length": 34.31730769230769,
"alnum_prop": 0.6534043149341552,
"repo_name": "fahhem/django-pipeline",
"id": "6d298ade757fcdc022809f126c9f942b8c3d1fca",
"size... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/tatooine/shared_filler_building_tatt_style01_06.iff"
result.attribute_template_id = -1
result.stfName("building_name","filler_building_tatt_style01_06")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATION... | {
"content_hash": "f36778afab5438a0165a095f86a7e50c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.7151162790697675,
"repo_name": "obi-two/Rebelion",
"id": "04ce82a8ccffc35d48fad799f46031ce728ea86d",
"size": "489"... |
from django.conf import settings
from django.utils.translation import gettext as _
# TODO: can we use the builtin Django validator instead?
# see:
# https://docs.djangoproject.com/en/4.0/ref/validators/#fileextensionvalidator
def validate_file_extension(value):
from django.core.exceptions import ValidationError... | {
"content_hash": "8b4cc03a88c8ccf22d65b3895a7b58d0",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 84,
"avg_line_length": 37.0625,
"alnum_prop": 0.6306913996627319,
"repo_name": "django-helpdesk/django-helpdesk",
"id": "5fb80e39266c3a941a5d95ac015ee56ba7fb569e",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0005_name_created'),
]
operations = [
migrations.AlterField(
model_name='name',
name='created',
field... | {
"content_hash": "a4e612226aea8004a159ef0f6c7a1572",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 21.055555555555557,
"alnum_prop": 0.5910290237467019,
"repo_name": "karilint/django_local_library",
"id": "8bf47a78798599bb9dcd3b7b909a442ecaa0d5a1",
... |
import numpy as np
from functools import reduce
def lw_cov(X, center=True):
'''
Calculate the well-conditioned (it is invertible) and accurate (it is
asymptotically more accurate than the sample covariance matrix) Ledoit-Wolf
covariance estimator [1].
For X, a [p x n] matrix, where n is the number... | {
"content_hash": "b8a5a597ef92424c8f1df2978dd9c541",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 80,
"avg_line_length": 33.01282051282051,
"alnum_prop": 0.6194174757281553,
"repo_name": "wmvanvliet/psychic",
"id": "62782c52880d06d58f7f2b07349999c3145ad4d5",
"size": "7... |
from setuptools import find_packages, setup
setup(
name='pycharts',
version='0.1.5',
url='https://github.com/ycharts/pycharts',
license='MIT',
description='Client for the YCharts API',
author='YCharts Engineering',
author_email='support@ycharts.com',
keywords='development ycharts api re... | {
"content_hash": "ad4ffa34a47c43b3f232bdf1fe59f984",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 54,
"avg_line_length": 33.55555555555556,
"alnum_prop": 0.6158940397350994,
"repo_name": "ycharts/pycharts",
"id": "894a307cdb8e5532225d54aa1ba820b3ac6d2cf3",
"size": "906"... |
"""Agents following static paths
"""
__author__ = "Liyan Chen"
__copyright__ = "Copyright (c) 2017 Malmactor"
__license__ = "MIT"
import numpy as np
import time
def static_agent(path, simulation, render, config=None):
init_pos = np.array([0, 2, 0]) if config is None or "init_pos" not in config else config["in... | {
"content_hash": "fdad90ac33a9600bb44504bdb721d703",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 104,
"avg_line_length": 26.73913043478261,
"alnum_prop": 0.6471544715447154,
"repo_name": "Malmactor/malrio",
"id": "ff824dfe822fe2e752acbb447cf1234180b32cae",
"size": "615... |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView, CreateView
from django.views.generic import View
from braces.views import (
AjaxResponseMixin,
JSONResponseMixin,
LoginRequiredMixin,
StaffuserRequiredMixin,
)
from bas... | {
"content_hash": "5c5222278137ec1dd14346470fd42f68",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 77,
"avg_line_length": 27.8,
"alnum_prop": 0.6940047961630695,
"repo_name": "pkimber/base",
"id": "7b24cc10fe4c4835b540f9fe05aa614097a3a7fe",
"size": "2111",
"binary": fa... |
from random import randint
import math
class AbstractNameGenerator(object):
def __init__(self):
return
def nameGen(self,firstNames, lastNames):
names2 = firstNames
names1 = lastNames
firstNameRnd = int( math.floor( randint(0,len(names2) - 1) ) )
lastNameRnd = int( mat... | {
"content_hash": "b2e72621aec2f1af5143721328bcf504",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 70,
"avg_line_length": 28.05263157894737,
"alnum_prop": 0.6341463414634146,
"repo_name": "kittolau/selepy",
"id": "5b4a1b29c22db5db7f416f7d056e5ee92d135f47",
"size": "533",... |
import sys
import random
from time import sleep
import logging
from google import pygoogle
from multiprocessing import Process, Value, Manager, Array
from ctypes import c_char, c_char_p
import subprocess
import json
MAX_OUTPUT = 100 * 1024
resultStr = Array(c_char, MAX_OUTPUT);
def clear_output():
resultStr.value ... | {
"content_hash": "d5899428bc470612c62259a0c2a69a50",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 191,
"avg_line_length": 27.83211678832117,
"alnum_prop": 0.6435877261998426,
"repo_name": "lygaret/dotfiles",
"id": "6f8e4d373a94e9e392405cfd4dac847e7184b46b",
"size": "38... |
"""
CheckiOReferee is a base referee for checking you code.
arguments:
tests -- the dict contains tests in the specific structure.
You can find an example in tests.py.
cover_code -- is a wrapper for the user function and additional operations before give data
in the user func... | {
"content_hash": "5490b831f6ee6b3bf581219110df4bcc",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 102,
"avg_line_length": 47.15217391304348,
"alnum_prop": 0.7030889810972798,
"repo_name": "Bryukh-Checkio-Tasks/checkio-mission-gate-puzzle",
"id": "913addbd645b260569eb0b6bf... |
from m2core.m2core import M2Core, logger
from m2core import bases
from m2core import data_schemes
from m2core import db
from m2core import utils
from m2core import common
| {
"content_hash": "f493da0e71b5dd8de720a4d2570fbd47",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 40,
"avg_line_length": 28.5,
"alnum_prop": 0.8362573099415205,
"repo_name": "mdutkin/m2core",
"id": "505f349465a4be2fd4d0595f3bfbdddd77b44a26",
"size": "171",
"binary": fa... |
"""Auto-generated file, do not edit by hand. EE metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_EE = PhoneMetadata(id='EE', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2}', possible_number_pattern='\\d{... | {
"content_hash": "31dd31312ba7bbec3e0d792961dc32c9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 122,
"avg_line_length": 80.75,
"alnum_prop": 0.7492260061919505,
"repo_name": "agentr13/python-phonenumbers",
"id": "635456e8aa44702ad63f56ddcbeaa367a65defe7",
"size": "969... |
import os
import sys
from haproxy_stats import HaproxyStats
from vrouter.loadbalancer.ttypes import \
LoadbalancerStats, UveLoadbalancerStats, UveLoadbalancerTrace
LB_BASE_DIR = '/var/lib/contrail/loadbalancer/'
class LoadbalancerStatsUVE(object):
def __init__(self):
self.driver = HaproxyStats()
... | {
"content_hash": "243f19c126a28fac1522ad94cd1cb469",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 75,
"avg_line_length": 36.232142857142854,
"alnum_prop": 0.5241498275012322,
"repo_name": "tcpcloud/contrail-controller",
"id": "9a7e136a14f1e9c9eb02df8314dd9698a09bef36",
... |
import asyncio
import contextlib
import logging
import os
import time
from typing import List
import torch
logger = logging.getLogger(__name__)
DEBUG_COMPLETED_TIME = bool(os.environ.get('DEBUG_COMPLETED_TIME', False))
@contextlib.asynccontextmanager
async def completed(trace_name='',
name='',
... | {
"content_hash": "b80e1c3b9be3e9b12cfb1a6c0caec6ce",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 33.69421487603306,
"alnum_prop": 0.5761589403973509,
"repo_name": "open-mmlab/mmdetection",
"id": "fa12bfcaff1e781b0a8cc7d7c8b839c2f2955a05",
"size"... |
import matplotlib.pyplot as plt
import numpy as np
import numpy.ma as ma
import networkx as nx
import itertools
import toolz
from functools import reduce
from operator import mul
def product(iterable):
"""Calculate product of items in iterable.
"""
return reduce(mul, iterable, 1)
def pairwise(iterable)... | {
"content_hash": "31d706c7cb9fd9608c227ac2784899dd",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 129,
"avg_line_length": 30.471337579617835,
"alnum_prop": 0.5605142140468228,
"repo_name": "FRidh/seapy",
"id": "15055ef81a11a4cf28bb543c427ebfc6940a96ff",
"size": "9568",... |
import sip
sip.setapi('QVariant',2)
sip.setapi('QString',2)
from PyQt4 import QtCore,QtGui
from klusta_process_manager.config import get_klusta_path
class FolderView(QtGui.QWidget):
def __init__(self,model,parent=None):
super(FolderView,self).__init__(parent)
#Table (list of experiment)
self.table=QtGui.QT... | {
"content_hash": "5b860d3b9c6b4745ee292a6aa003379e",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 81,
"avg_line_length": 32.21804511278196,
"alnum_prop": 0.7458576429404901,
"repo_name": "tymoreau/klusta_process_manager",
"id": "855d99a5a0872012846f836655e7a73a43999f23",... |
"""
Session Management
(from web.py)
"""
import os, time, datetime, random, base64
import os.path
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import hashlib
sha1 = hashlib.sha1
except ImportError:
import sha
sha1 = sha.new
import utils
import webapi as web
__all__ = [... | {
"content_hash": "9d18de94b25616bc3621093568cbdab1",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 108,
"avg_line_length": 29.953890489913544,
"alnum_prop": 0.555416586492207,
"repo_name": "ruishihan/R7-with-notes",
"id": "ab75aca9a6caf62fecee7b69dd794ea661751684",
"siz... |
from collections import OrderedDict
from indy_common.types import ClientGetRevocRegDeltaField
from plenum.common.messages.fields import NonEmptyStringField, ConstantField, IntegerField
from indy_common.constants import TYPE, REVOC_REG_DEF_ID, FROM, TO, GET_REVOC_REG_DELTA
EXPECTED_GET_REVOC_REG_DELTA_FIELD = OrderedD... | {
"content_hash": "cd7fa24d110689ae9b2591bfde2c077c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 90,
"avg_line_length": 39.05882352941177,
"alnum_prop": 0.7695783132530121,
"repo_name": "spivachuk/sovrin-node",
"id": "34b8996af563d09c669c68744dfcdb3ed296d930",
"size": ... |
"""
Split a hex file signed by imagetool into its binary/image and
its header. This is needed to be able to pack these two parts
into the sample separately, saving flash space.
"""
import argparse
from intelhex import IntelHex
def dump_header(infile, image, header):
inhex = IntelHex(infile)
(start, end) = inh... | {
"content_hash": "b0cca28f707e0295167442ac74d9b009",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 62,
"avg_line_length": 31.782608695652176,
"alnum_prop": 0.6922024623803009,
"repo_name": "galak/zephyr",
"id": "8bf9841d82d132093cc16e9b122b0d7c2e934162",
"size": "825",
... |
import pkg_resources
from .elements.const import *
import os
LIB_PATH = pkg_resources.resource_filename('antlia', 'lib/')
os.environ["PYSDL2_DLL_PATH"] = LIB_PATH
try:
import sdl2
except ImportError:
import traceback
traceback.print_exc()
sys.exit(1)
def changeCursor(t):
if t == WAIT:
cursor = sdl2.SDL_Create... | {
"content_hash": "95a6783e499e87e2e9c81955f7acd166",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 68,
"avg_line_length": 25.09090909090909,
"alnum_prop": 0.75,
"repo_name": "Romaingin/Antlia",
"id": "24f208b8d154b4f938db3b8f530b4889269e87c6",
"size": "552",
"binary": ... |
import os
import codecs
import json
import pprint
import sqlite3
import platform
fold_base = 'data_row'
#fold_base = 'test_data_row'
jobs_target = 'topsy_fortuner_twibes'
client_id = platform.node()
print client_id
sql_init = '''
CREATE TABLE IF NOT EXISTS tweets (
tweet_id TEXT NOT NULL UNIQUE,
tweet_url TEXT NOT ... | {
"content_hash": "497d6890e035bb1b5667b7819f2145e5",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 164,
"avg_line_length": 24.75862068965517,
"alnum_prop": 0.6471680594243269,
"repo_name": "jianhuashao/WebDownloadJobsManage",
"id": "ba80de79ddc649e1960265a0452a3cbf216256ab... |
from django.contrib import admin
from tinycontent.models import TinyContent, TinyContentFileUpload
class TinyContentAdmin(admin.ModelAdmin):
list_display = ('name', )
search_fields = ('name', 'content', )
admin.site.register(TinyContent, TinyContentAdmin)
class TinyContentFileUploadAdmin(admin.ModelAdmin)... | {
"content_hash": "686e1b148ef166a6fbcf3ab3a02a3f07",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.7543103448275862,
"repo_name": "dominicrodger/django-tinycontent",
"id": "bfd9beb93e354f3dc99d409fae2cea958f2ec342",... |
import pytest
from jinja2 import DictLoader
from jinja2 import Environment
from jinja2 import TemplateRuntimeError
from jinja2 import TemplateSyntaxError
LAYOUTTEMPLATE = """\
|{% block block1 %}block 1 from layout{% endblock %}
|{% block block2 %}block 2 from layout{% endblock %}
|{% block block3 %}
{% block block4 ... | {
"content_hash": "3cc06bea2071f2137910c65721c4b336",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 88,
"avg_line_length": 33.03950617283951,
"alnum_prop": 0.4450340034377102,
"repo_name": "mitsuhiko/jinja2",
"id": "0c20d4da7d3c29e36bf8c7fb36c747b069b6f6e5",
"size": "133... |
from core import *
class InstancePool(object):
"""
Container for instances of Instance and Entity, that provides
some utility methods to search through them.
"""
def __init__(self):
self._items = []
# Handle special case of the top-most classes of the instantiation chain (Entity an... | {
"content_hash": "4913e4e1b2105d3dd23832f6c1514e1f",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 132,
"avg_line_length": 41.91304347826087,
"alnum_prop": 0.6023513139695712,
"repo_name": "filipefigcorreia/TracAdaptiveSoftwareArtifacts",
"id": "f7abf30589ea4193a84ae912031... |
import logging
from aquilon.aqdb.model import (Cluster, EsxCluster, ComputeCluster,
StorageCluster)
from aquilon.worker.templates.base import Plenary, PlenaryCollection
from aquilon.worker.templates.panutils import (StructureTemplate, PanValue,
... | {
"content_hash": "d8668a8cf273ca86dd85165ba033c636",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 110,
"avg_line_length": 43.610837438423644,
"alnum_prop": 0.6084942957189653,
"repo_name": "jrha/aquilon",
"id": "7c10a5ce9b747dad24fc9d60679797fb3bb6cec1",
"size": "9558"... |
from __future__ import absolute_import
from .administration import Administration
from ._parameters import *
__version__ = "3.5.9" | {
"content_hash": "5797f333b912b0415e024b2e7899942e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 26.2,
"alnum_prop": 0.7480916030534351,
"repo_name": "adegwerth/ArcREST",
"id": "40d9e1797d7f3a577a13d8e9a47420a0f243f6c2",
"size": "131",
"binary":... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('payments', '0003_auto_20161025_1221'),
]
operations = [
migrations.CreateModel(
nam... | {
"content_hash": "e80b334116ca0966fe7697bdda156762",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 194,
"avg_line_length": 48.77142857142857,
"alnum_prop": 0.616871704745167,
"repo_name": "onepercentclub/bluebottle",
"id": "bee59c8fb147c2846d7e40d4e3754167b1bf0c33",
"siz... |
import cv2
import time
import datetime
import numpy as np
import argparse
import sys
import Configuration as conf
import ConfigMe
import io
import os
savevideo = False
if (len(sys.argv)<2):
# Load the configuration file
ip = ConfigMe.readconfig("config.ini")
port = conf.videoport
elif sys.argv[1] == '-f':
pr... | {
"content_hash": "5fa2920edc980737214c57c91cb8f8e9",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 112,
"avg_line_length": 25,
"alnum_prop": 0.686412213740458,
"repo_name": "faturita/ShinkeyBot",
"id": "018185fce62fef379da74ec286c83da1f9af6106",
"size": "3292",
"binar... |
"""Various hooks to access stuff from the web"""
import os, sys, time
import urllib
def spawnWorkers(num, target, name=None, args=(), kwargs={}, daemon=1, interval=0):
"""Spawns the given number of workers, by default daemon, and returns a list of them.
'interval' determines the time delay between each launchi... | {
"content_hash": "96987e23b3c19ceab3101bd753b99f42",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 151,
"avg_line_length": 35.816326530612244,
"alnum_prop": 0.5605413105413105,
"repo_name": "brussell123/3dwikipedia",
"id": "fb6f65e56eca7dbb959e9bd082c900cea849886e",
"si... |
import sys
from modules.map.proto import map_pb2
from modules.map.proto import map_lane_pb2
from modules.map.proto import map_road_pb2
import math
from shapely.geometry import LineString, Point
LANE_WIDTH = 3.3
def convert(p, p2, distance):
delta_y = p2.y - p.y
delta_x = p2.x - p.x
# print math.atan2(de... | {
"content_hash": "3c8c2b884e8baa1cfd395f3dd18032cf",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 79,
"avg_line_length": 31.52,
"alnum_prop": 0.590482233502538,
"repo_name": "xiaoxq/apollo",
"id": "7ce829616e5a710da8946fbe038ae23c78bd56d5",
"size": "8665",
"binary": ... |
"""
raven.contrib.django.urls
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
try:
from django.conf.urls import patterns, url
except ImportError:
# for Django version l... | {
"content_hash": "499ce923ef6c8c71c86502cc641caca9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 112,
"avg_line_length": 31.526315789473685,
"alnum_prop": 0.66110183639399,
"repo_name": "karolaug/python-raven",
"id": "f9c17b38ab72fce5887f3f61fad00bbad05725e2",
"size": ... |
import json
import util
from collections import defaultdict
def get_fb_stats(freebase_data_file):
with open(freebase_data_file) as fb:
fact_counter = 0
relation_set = set()
entity_set = set()
for line in fb:
line = line.strip()
line = line[1:-1]
... | {
"content_hash": "b136400d7f81acca602258a7de8ba91f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 97,
"avg_line_length": 35.31645569620253,
"alnum_prop": 0.5831541218637993,
"repo_name": "rajarshd/TextKBQA",
"id": "5c289092fca154a970f4baf66643a08b1b3ab8d3",
"size": "279... |
'''
Lightweight wrapper class for preprocessed image data
'''
import copy
import numpy as np
from desispec.maskbits import ccdmask
from desispec import util
class Image(object):
def __init__(self, pix, ivar, mask=None, readnoise=0.0, camera='unknown',
meta=None):
"""
Create Image object
... | {
"content_hash": "4321ef68a5379a53f63904261fd02a32",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 101,
"avg_line_length": 38.20224719101124,
"alnum_prop": 0.53,
"repo_name": "timahutchinson/desispec",
"id": "182571f09f83a34686cd730c3fd47dac8892cc9e",
"size": "3400",
"... |
"""
For the ``future`` package.
Adds this import line:
from past.builtins import str as oldstr
at the top and wraps any unadorned string literals 'abc' or explicit byte-string
literals b'abc' in oldstr() calls so the code has the same behaviour on Py3 as
on Py2.6/2.7.
"""
from __future__ import unicode_literals... | {
"content_hash": "86bc740b88b9e51782c696121ea3d520",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 80,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.5938967136150235,
"repo_name": "rfguri/vimfiles",
"id": "575292d8c0b1bc7e320ad2840e48404c8170579e",
"size": "2556"... |
import numpy as np
from bokeh.models import BoxSelectTool
from bokeh.plotting import figure, show, output_file, gridplot
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select"
opts = dict(tools=TOOLS, plot_width=350, plot_height=350)
p1 = figure(title="selection on m... | {
"content_hash": "b3a3a5638255e0f6d981a4e5e5cd3592",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 32.48275862068966,
"alnum_prop": 0.7016985138004246,
"repo_name": "justacec/bokeh",
"id": "43f1a915b7c33bfb1ba576f6a5dffdd30f48dda6",
"size": "942",
... |
"""Iterative linear solvers over pytrees."""
from typing import Callable, TypeVar
import jax
# Any nested structure of NDArrays, viewed as a vector space (with some extra
# structure).
VectorPytree = TypeVar("VectorPytree")
def richardson_solve(matvec,
b, iterations):
"""Solve a linear syste... | {
"content_hash": "0b818348dce201da90bd677a8650b423",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 39.15873015873016,
"alnum_prop": 0.7020672882042968,
"repo_name": "google-research/google-research",
"id": "45182cf00e378dab00b3d2fa196804b3bc54326d",
... |
pi = 3.14159
def area(radius):
return pi*(radius**2)
def circumference(radius):
return 2*pi*radius
| {
"content_hash": "a23bd1538e4f2a48dd4490dc4e3c94e7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 26,
"avg_line_length": 13.75,
"alnum_prop": 0.6636363636363637,
"repo_name": "devendermishrajio/MITx-Foundations-of-Computer-Science",
"id": "20ecf6a42a9af48d76d092593d7a7b924... |
from itertools import chain, combinations
import numbers
import warnings
import numpy as np
from scipy import sparse
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..utils import check_array
from ..utils import deprecated
from ..utils.extmath import row_norms
from ..utils.extmath ... | {
"content_hash": "fb51d23045a6121becafcbd8a7f641b6",
"timestamp": "",
"source": "github",
"line_count": 1855,
"max_line_length": 88,
"avg_line_length": 35.984366576819404,
"alnum_prop": 0.5946277958382646,
"repo_name": "jpautom/scikit-learn",
"id": "56d4b4e54ae6b20848c0272ddd37085324c605d2",
"size"... |
import errno
import os
import shutil
import tempfile
from oslo_config import cfg
from gnocchi import storage
from gnocchi import utils
OPTS = [
cfg.StrOpt('file_basepath',
default='/var/lib/gnocchi',
help='Path used to store gnocchi data files.'),
]
class FileStorage(storage.Stor... | {
"content_hash": "e90389ce999a496d214b02cd612750ee",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 78,
"avg_line_length": 35.167883211678834,
"alnum_prop": 0.570568700705687,
"repo_name": "leandroreox/gnocchi",
"id": "697fffffa4c5c492af95d318b4f7fcf60da9f044",
"size": "... |
"""
Utilities for :mod:`empymod.model` such as checking input parameters.
This module consists of four groups of functions:
0. General settings
1. Class EMArray
2. Input parameter checks for modelling
3. Internal utilities
"""
# Copyright 2016-2022 The emsig community.
#
# This file is part of empymod.
#
... | {
"content_hash": "5096450df1cc35d0f0addda4c5efc486",
"timestamp": "",
"source": "github",
"line_count": 2034,
"max_line_length": 79,
"avg_line_length": 32.317109144542776,
"alnum_prop": 0.5438364291908174,
"repo_name": "prisae/empymod",
"id": "ddc8050b48961d0ec67aef1ef3f0fca5d2ee28f5",
"size": "657... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
VERSION = '0.0.48'
| {
"content_hash": "62063731db9b4cf3ca4da925ed584e40",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 93,
"avg_line_length": 34.6,
"alnum_prop": 0.6473988439306358,
"repo_name": "kslundberg/pants",
"id": "573340e7d5bc45b9b2cb098e66f22c0c5b72a791",
"size": "320",
"binary": ... |
import mock
import netaddr
from neutron.objects import port_forwarding
from neutron.objects import router
from neutron.tests import tools
from neutron.tests.unit.objects import test_base as obj_test_base
from neutron.tests.unit import testlib_api
class PortForwardingObjectTestCase(obj_test_base.BaseObjectIfaceTestC... | {
"content_hash": "915b84445839c20e12b4567dda89fb84",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 78,
"avg_line_length": 44.12307692307692,
"alnum_prop": 0.6005927475592747,
"repo_name": "noironetworks/neutron",
"id": "0500fbd565c50cc7e91cbc121ee1e0b3c8188a3a",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.