text stringlengths 4 1.02M | meta dict |
|---|---|
import pytest
from hybra import core
import datetime
import os
from helpers import filters
from helpers import counters
from helpers import urls
from helpers import exporter
class TestTextFilter:
def setup(self):
self.dataMedia = core.data('news', folder='', terms=['yle.json'])
self.dataFacebo... | {
"content_hash": "ff9fe112e78298a0fd439fcdf2027821",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 85,
"avg_line_length": 30.0919881305638,
"alnum_prop": 0.5796272556947046,
"repo_name": "HIIT/hybra-core",
"id": "102d6cd36185b6b3d7b407fa0cceb808eccdf78d",
"size": "10155... |
import os
PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Eng')
DEBUG = DEVELOPMENT = not PRODUCTION
try:
# This part is surrounded in try/except because the config.py file is
# also used in the run.py script which is used to compile/minify the client
# side files (*.less, *.coffee, *... | {
"content_hash": "7044b60c07dcb662408595b13d1bdae6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 82,
"avg_line_length": 35.6231884057971,
"alnum_prop": 0.628152969894223,
"repo_name": "gmist/3dhero2",
"id": "02599bb4e8e354b6b6d0219c2441a296262381c1",
"size": "2475",
... |
"""Pipelines for image preprocessing"""
import os
def lren_build_daily_folder_path_callable(folder, date):
daily_folder = os.path.join(folder, date.strftime('%Y'), date.strftime('%Y%m%d'))
# Ugly hack for LREN
if not os.path.isdir(daily_folder):
daily_folder = os.path.join(folder, '2014', date.... | {
"content_hash": "a9e36661a3ddde2bb74cfca30d8e78ab",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 85,
"avg_line_length": 26.7,
"alnum_prop": 0.6610486891385767,
"repo_name": "LREN-CHUV/airflow-mri-preprocessing-dags",
"id": "6e4721f5a5fe0be8e4e6b742672fbfcc28a07672",
"s... |
from .latest_activity import LatestActivity
from .chart import TagChart
class Tagged:
"""Base class for wrapping `values` dictionaries of related
tag information
"""
def __init__(self, **kwargs):
self._latest_translation = kwargs.pop("latest_translation", None)
self.approved_strings =... | {
"content_hash": "1f585c8bb3df11fc72762c54a97ac64e",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 88,
"avg_line_length": 28.1875,
"alnum_prop": 0.6513303769401331,
"repo_name": "mozilla/pontoon",
"id": "b9fc64a6d6cf061f78d75db1871d87f4969115a5",
"size": "1804",
"binar... |
import unittest
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.util.testing import PymatgenTest
from pymatgen.util.coord import in_coord_list
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.analysis.wulff import WulffShape
import json
impor... | {
"content_hash": "f9556664057147727a0c30247e9692ae",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 41.41081081081081,
"alnum_prop": 0.5678109907322804,
"repo_name": "tschaume/pymatgen",
"id": "fe9514d5a150f3ed59fdf81d3ad303da81bb413c",
"size": "76... |
from fabric.api import task, cd, run, env, prompt, execute, sudo
from fabric.api import open_shell, settings, put, local
import os
import boto.ec2
import time
# IMPORTANT: This fabfile requires a credentials.py file to be imported
# from its current directory, since turning a repo for a Django app into
# a package is... | {
"content_hash": "efbde86a7e3ad82a20e5a2f32eca7fe2",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 250,
"avg_line_length": 39.51293103448276,
"alnum_prop": 0.6804843460237809,
"repo_name": "defzzd/django-imagr",
"id": "7ec3fe808a659f0a93adfe3146a519076c2002cc",
"size": ... |
import json
from flask import Flask, render_template, request, abort, Response
from app.util import doTranslate
app = Flask(__name__)
@app.errorhandler(500)
def not_found():
return Response({'error': 'Bad Request'}, status=400)
@app.route("/")
def index():
return render_template('index.html')
@app.rout... | {
"content_hash": "c617added1f2da2072b10eea747e784f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 98,
"avg_line_length": 23.774193548387096,
"alnum_prop": 0.6648575305291723,
"repo_name": "fkrafi/moses-web",
"id": "2e82ceee54edd4f0d8962427489ecd97ee90dd0e",
"size": "737... |
import asyncio
import logging
import ssl
import threading
try:
from asyncio import all_tasks as asyncio_all_tasks # from py39, asyncio.Task.all_tasks is deprecated
except ImportError:
asyncio_all_tasks = asyncio.Task.all_tasks # pylint: disable=no-member
from tornado.ioloop import IOLoop
from tornado.testin... | {
"content_hash": "e3dcb53cafee5357dbdd22a697239d1a",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 192,
"avg_line_length": 42.83838383838384,
"alnum_prop": 0.6000943173779769,
"repo_name": "renatahodovan/fuzzinator",
"id": "e7434713a5a04fa1e769ceef798fc48772c51574",
"si... |
'''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.org
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.functions
i... | {
"content_hash": "0f861cac6db59cb87fec38c0ebfe6edd",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 105,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.6625,
"repo_name": "stoeps13/ibmcnx2",
"id": "c95045adddab0d97b5d263ded1875ffaba3bfb6d",
"size": "3040",
"bina... |
from __future__ import absolute_import, unicode_literals
from django import forms
from .models import User
class UserForm(forms.ModelForm):
class Meta:
# Set this form to use the User model.
model = User
# Constrain the UserForm to just these fields.
fields = ("full_name",)
| {
"content_hash": "c8759201e16e41771c5940605be385d4",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 56,
"avg_line_length": 21.133333333333333,
"alnum_prop": 0.6624605678233438,
"repo_name": "harshnoise/shor",
"id": "0e567b8438dbad8a4727224c0802d2dfc8c011d7",
"size": "341"... |
"""piddleSVG
This module implements an SVG PIDDLE canvas.
In other words, this is a PIDDLE backend that renders into a
SVG file.
Bits have been shamelessly cobbled from piddlePDF.py and/or
piddlePS.py
Greg Landrum (greglandrum@earthlink.net) 3/10/2000
"""
"""
Functionality implemented:
-drawLine
-drawPolygon
... | {
"content_hash": "dc2d35f32bd01f91a65f55eb2f42f507",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 108,
"avg_line_length": 31.152173913043477,
"alnum_prop": 0.6017969295184926,
"repo_name": "adalke/rdkit",
"id": "b8fcc581c6fc3f45d93edb45db86e6fe99782ff4",
"size": "23687... |
from runner.koan import *
import random
class DiceSet(object):
def __init__(self):
self._values = []
@property
def values(self):
return self._values
def roll(self, n):
# Needs implementing!
# Tip: random.randint(min, max) can be used to generate random numbers
... | {
"content_hash": "8d0f884b9cb674d611ec391bc0b7748f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 27.3943661971831,
"alnum_prop": 0.5902313624678663,
"repo_name": "aishraj/pykons_solution",
"id": "967641c2bf383ad4519c03c776adbd2d7e562765",
"size":... |
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.search.setting import SearchSetting
from tests import test_site_url, test_user_credentials
ctx = ClientContext(test_site_url).with_credentials(test_user_credentials)
setting = SearchSetting(ctx)
result = setting.ping_admin_endpoint... | {
"content_hash": "3f37c561a65b14acd6a39b22524a39e4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 92,
"avg_line_length": 50.72727272727273,
"alnum_prop": 0.7437275985663082,
"repo_name": "vgrem/Office365-REST-Python-Client",
"id": "a5d8ade5ee2ee6345f80ca9418e453ac4fe11ec6... |
"""
State S21 : Login
"""
from ...util.funcutils import singleton
from .StateSCC import StateSCC
@singleton
class StateS21R(StateSCC):
"""State S21 : Login"""
def do(self, handler, data):
"""Action of the state S21R: exchange id and login"""
with handler.lock:
try:
... | {
"content_hash": "5bda2b594ed32f31db13627bb65823a3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 81,
"avg_line_length": 35.86666666666667,
"alnum_prop": 0.5043370508054523,
"repo_name": "thethythy/Mnemopwd",
"id": "13a02e0fa1e85a669d88e0694be8513f186d5ffb",
"size": "30... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "af5ac090b86f2db11a8243e1b2b94f25",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 30.665384615384614,
"alnum_prop": 0.7009908440988336,
"repo_name": "PythonicNinja/k-center-problem",
"id": "1558b5620c9e351c30c053c02ad8fbf72e9b6d93",... |
from tempest.lib.services.identity.v2 import identity_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestIdentityClient(base.BaseServiceTest):
FAKE_TOKEN = {
"tokens": {
"id": "cbc36478b0bd8e67e89",
"name": "FakeToken",
... | {
"content_hash": "5619fcdae4b9df761d6f40b427835846",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 38.559006211180126,
"alnum_prop": 0.4267074742268041,
"repo_name": "sebrandon1/tempest",
"id": "96d50d759447aba8483cf968844bc32c3691c9d5",
"size": "... |
import pytest
def test_valid(script_runner, tmpdir):
ret = script_runner.run('o2r-meta', '-debug', 'validate',
'-s', 'schema/json/o2r-meta-schema.json',
'-c', 'schema/json/example_metadata_o2r_valid.json')
print(ret.stdout)
print(ret.stderr)
assert ret.success, "process should return s... | {
"content_hash": "f1965468905d57140f96d9e6998df249",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 103,
"avg_line_length": 43.96078431372549,
"alnum_prop": 0.6766280107047279,
"repo_name": "o2r-project/o2r-meta",
"id": "2caf52ad9d06033c04758fe8b343ad84fb10ed7b",
"size": ... |
import touchphat
import signal
import paho.mqtt.client as paho
import time
import json
import ssl
import ConfigParser as configparser
import sys
#Variables
confFile = "/home/pi/nursery/nursery.conf"
ca_certs = "/etc/ssl/certs/ca-certificates.crt"
#Read details from the config file
config = configparser.SafeConfigPars... | {
"content_hash": "c3cf9c7237b7e3ac7b3f890f1b3158b2",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 149,
"avg_line_length": 30.54054054054054,
"alnum_prop": 0.6631268436578172,
"repo_name": "mattmole/nursery-temperature-touch",
"id": "12efd0a31de89ba1ad0affc02b92b705bc6460... |
"""
Module responsible for handling protocol requests and returning
responses.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ga4gh.datamodel as datamodel
import ga4gh.exceptions as exceptions
import ga4gh.protocol as protocol
def _parseIntege... | {
"content_hash": "02c10f195bb98cdc304e55b14432206b",
"timestamp": "",
"source": "github",
"line_count": 962,
"max_line_length": 79,
"avg_line_length": 38.09043659043659,
"alnum_prop": 0.6338181917419425,
"repo_name": "macieksmuga/server",
"id": "a011aa3ebc5912b7894e3929248a01ebb43c3a92",
"size": "3... |
import datetime
import configparser
config = configparser.ConfigParser(allow_no_value=True)
config.read("/Users/matt_weeden/freelance/stock_codes_Ro/code/settings.ini")
print config.sections()
for key in config['TickerSymbols']:
print key
s_date = config['Settings']['start_date']
print s_date
s_date = datetime.... | {
"content_hash": "2a0f8760f16c96eeac5357456059d816",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 24.733333333333334,
"alnum_prop": 0.7493261455525606,
"repo_name": "mweeden2/stock_codes",
"id": "4ef441da6761e15eeaec50330b6ea813347ce51c",
"size": ... |
from django import forms
from . import models
class NewPostForm(forms.ModelForm):
class Meta:
model = models.Post
fields = ('title', 'url')
| {
"content_hash": "4cef0df7b682fafe4ccf0ebafb1887a0",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 35,
"avg_line_length": 20.25,
"alnum_prop": 0.6481481481481481,
"repo_name": "rodriguesrl/reddit-clone-udemy",
"id": "39c2767626a51f5c55c72cc7940d3da9e5e2e9ad",
"size": "162... |
from __future__ import unicode_literals
from django import template
from django.utils.html import conditional_escape
from account.utils import user_display
register = template.Library()
class UserDisplayNode(template.Node):
def __init__(self, user, as_var=None):
self.user_var = template.Variable(user... | {
"content_hash": "ad32804d3d363f67cbc9b5bbf5043289",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 102,
"avg_line_length": 25.53061224489796,
"alnum_prop": 0.6147082334132694,
"repo_name": "mgpyh/django-user-accounts",
"id": "6fccf80d857eeaeb322857bcc75565e9bcd03f2c",
"s... |
"""
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once.
For example, 2143 is a 4-digit pandigital and is also prime.
What is the largest n-digit pandigital prime that exists?
"""
from math import sqrt
import primes
import permutations
primesToCheck = primes.creat... | {
"content_hash": "05cd908d7d91d9445d42cd7428f9552d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 104,
"avg_line_length": 23.342105263157894,
"alnum_prop": 0.6538895152198422,
"repo_name": "pgrm/project-euler",
"id": "67ad93c918563d42d5a5e62e3744c5002f0e5b21",
"size": "... |
import os
from shutil import copyfile
from typing import List, Optional, Tuple
from tokenizers import processors
from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging
if is_sentencepiece_ava... | {
"content_hash": "fd368ee60c6bb39f0d59c64d91fe0006",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 250,
"avg_line_length": 40.64981949458484,
"alnum_prop": 0.627797513321492,
"repo_name": "huggingface/transformers",
"id": "0ac14033a44aa800d5c78d8c6e86589f5766c4cc",
"siz... |
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.21
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class PaymentModule(object):
"""
NOTE: This class is auto generated by t... | {
"content_hash": "b19b6a7e94f8ab7844f3b66c8df731a9",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 24.582417582417584,
"alnum_prop": 0.5169870362092087,
"repo_name": "kinow-io/kinow-python-sdk",
"id": "ecd5d59fc807292b7dbc27e8d4ca34b2e6ae766c",
"s... |
__author__ = "Andre Merzky, Ole Weidner, Alexander Grill"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
import radical.utils.signatures as rus
import saga.adaptors.base as sab
import saga.session as ss
import saga.task as st
import saga.url ... | {
"content_hash": "06dbebac200c67cbef223240adfb4b1c",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 80,
"avg_line_length": 32.325905292479106,
"alnum_prop": 0.43817320120637654,
"repo_name": "poojavade/Genomics_Docker",
"id": "bf71975874f28d906fa4611187c1460d116e71c4",
"... |
from __future__ import absolute_import
from .. import backend as K
from .. import activations
from .. import initializers
from .. import regularizers
from .. import constraints
from ..engine import Layer
from ..engine import InputSpec
from ..utils import conv_utils
from ..legacy import interfaces
# imports for backwa... | {
"content_hash": "d271bbfadc818c733f75b89149b1799a",
"timestamp": "",
"source": "github",
"line_count": 2128,
"max_line_length": 123,
"avg_line_length": 44.86419172932331,
"alnum_prop": 0.5511621330037394,
"repo_name": "ryfeus/lambda-packs",
"id": "5c3aac406dd8e63e51ae020ba4cad5bc45135f09",
"size":... |
"""Starts a virtual machine."""
from baseCmd import *
from baseResponse import *
class startVirtualMachineCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""The ID of the virtual machine"""
"""Required"""
self.id = None
self.typeInfo['id'] = 'uui... | {
"content_hash": "7ff7286f83d95c435fa919c07e571449",
"timestamp": "",
"source": "github",
"line_count": 629,
"max_line_length": 131,
"avg_line_length": 38.82193958664547,
"alnum_prop": 0.5727507268929931,
"repo_name": "MissionCriticalCloud/marvin",
"id": "84f6f32c12f8e6ad1970194e3bec94be2e67a162",
... |
"""Syncronizes Zookeeper to file system.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import glob
import os
import kazoo
from treadmill import fs
from treadmill import utils
from treadmill impor... | {
"content_hash": "94b85e0cdb31a9883bbd700117455700",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 78,
"avg_line_length": 31.418685121107266,
"alnum_prop": 0.5389867841409691,
"repo_name": "ceache/treadmill",
"id": "adfaea3cc8c14a84c003ec6fceaba00f36e0ea1f",
"size": "90... |
from datetime import datetime, timedelta
from django.test.client import RequestFactory
from django.http import Http404
from bulbs.utils.test import BaseIndexableTestCase
from bulbs.liveblog.views import LiveblogNewEntriesView
from bulbs.liveblog.models import LiveBlogEntry
from example.testcontent.models import Test... | {
"content_hash": "6b0daf7188a154c7b7f42041d969cf16",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 90,
"avg_line_length": 40.76923076923077,
"alnum_prop": 0.6226415094339622,
"repo_name": "theonion/django-bulbs",
"id": "c6d09fad6bd1957fb593e5c05119b1f264ebecff",
"size": ... |
"""
A series of tests to establish that the command-line management tools work as
advertised - especially with regards to the handling of the
DJANGO_SETTINGS_MODULE and default settings.py files.
"""
from __future__ import unicode_literals
import codecs
import os
import re
import shutil
import socket
import subprocess... | {
"content_hash": "d304ce643689cf1bc961a950b0d0b63c",
"timestamp": "",
"source": "github",
"line_count": 2176,
"max_line_length": 118,
"avg_line_length": 43.56112132352941,
"alnum_prop": 0.6347360980704512,
"repo_name": "karyon/django",
"id": "60c3a68fd2d99bfade146105707fa13fb9cef71d",
"size": "9485... |
import urllib2
from bs4 import BeautifulSoup
page = urllib2.urlopen("https://contrataciondelestado.es/wps/portal/plataforma")
soup = BeautifulSoup(page)
links = soup('div')
#print links[0]
#print
#print links[2]
print '-----------FIN----------------'
for link in links:
try:
link['class']
#print link
... | {
"content_hash": "7dbf97b96289f1ca830105ee0d2d0bd6",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 80,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6247334754797441,
"repo_name": "jmartinz/pyCrawler",
"id": "618b6cc53d63332896f01c6302fec7fb05f11f9a",
"size": "4... |
from .language import language_detection | {
"content_hash": "a299a732d8ae27e7df65c2c5606b38ad",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 40,
"alnum_prop": 0.875,
"repo_name": "salarmohtaj/language_detection",
"id": "2730ee2aa4215e171c26cfb27e4deeb42927c4d2",
"size": "40",
"binary": fa... |
"""Production settings and globals."""
from __future__ import absolute_import
from os import environ
from .base import *
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured
def get_en... | {
"content_hash": "11c3360e3a615892672574ec6bc42172",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 95,
"avg_line_length": 32.39506172839506,
"alnum_prop": 0.6859756097560976,
"repo_name": "prengifo/GuardabosquesUSB",
"id": "31af9f12062375ee6a5ce529cf60817b825896c2",
"siz... |
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.dialects import mysql
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
user_id = sa.Column(sa.Integer, primary_key=True)
username = sa.Co... | {
"content_hash": "f1fb8398be0f3d23fce1ae56736eea70",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 119,
"avg_line_length": 42.46762589928058,
"alnum_prop": 0.684736574623073,
"repo_name": "wknet123/harbor",
"id": "c928edc1741782ddfc3ac69252568778cb82e07b",
"size": "5950... |
import unittest
from katas.kyu_8.sum_arrays import sum_array
class SumArrayTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(sum_array([]), 0)
def test_equals_2(self):
self.assertEqual(sum_array([1, 2, 3]), 6)
def test_equals_3(self):
self.assertEqual(sum_arra... | {
"content_hash": "c69c7c1fbff7f7f94af5ba94ab3d0a1c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 25.058823529411764,
"alnum_prop": 0.6291079812206573,
"repo_name": "the-zebulan/CodeWars",
"id": "59f60a1b1a63763fddae2b4f120c6e671d1ec1c9",
"size": ... |
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import default_backend
from cry... | {
"content_hash": "3bc3cbbc202d9a11236c7b21e6080d64",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 31.05,
"alnum_prop": 0.6819645732689211,
"repo_name": "ad-m/django-atom",
"id": "b749bc69bca1a45477f0c230c6dd229837ab46af",
"size": "3772",
"binar... |
from java.awt import Robot, Toolkit
from java.awt.event import InputEvent
from java.awt.MouseInfo import getPointerInfo
from .base import PyMouseMeta
r = Robot()
class PyMouse(PyMouseMeta):
def press(self, x, y, button = 1):
button_list = [None, InputEvent.BUTTON1_MASK, InputEvent.BUTTON3_MASK, InputEvent... | {
"content_hash": "ea9285964f220d04adf4250b21a71c3b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 103,
"avg_line_length": 32.464285714285715,
"alnum_prop": 0.6633663366336634,
"repo_name": "CamelBackNotation/hackdfw",
"id": "b9775532a625c13d4dbb74d6ba462d311d03cc75",
"s... |
import pytest
from django.core.urlresolvers import reverse
from articles.views import ArticleListView
from tests.factories import ArticleFactory
@pytest.mark.django_db
class TestVirtualFields(object):
def _request(self, admin_client):
response = admin_client.get(reverse('articles:list'))
assert ... | {
"content_hash": "c8762696cd7ac62e7cc47f2efb21349f",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 33.9811320754717,
"alnum_prop": 0.6268739589117157,
"repo_name": "ddaan/django-arctic",
"id": "94fdf462fa618b00ef0300ad34f3e8b940806bce",
"size": "18... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/bio/shared_bio_component_food_flavor.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "f68d712d9b74cc26e30a2dfa9c1adcb5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 23,
"alnum_prop": 0.6889632107023411,
"repo_name": "obi-two/Rebelion",
"id": "2f4bbf68831bde0b8a9e94c8505a06685e70da50",
"size": "444",
"binary": f... |
from model.group import Group
testdata = [Group(name="name1", header="header1", footer="footer1"),
Group(name="name2", header="header2", footer="footer2")]
| {
"content_hash": "6de3beadb68c4ca9c2deeb543d86d41a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 68,
"avg_line_length": 42.25,
"alnum_prop": 0.6686390532544378,
"repo_name": "tkapriyan/python_training",
"id": "06347ce569ee912377e2960bae7ce314211b3789",
"size": "169",
... |
import mock
import greenlet
import threading
from rackattack.tcp import publish
class OneThreadedPublish(publish.Publish):
def __init__(self, amqpURL):
self.threadStartMock = mock.Mock()
threading.Thread.__init__ = mock.Mock()
threading.Thread.daemon = mock.Mock()
threading.Thread... | {
"content_hash": "bbf92201e6dbb0ca251e956db1d4454e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 62,
"avg_line_length": 34.02272727272727,
"alnum_prop": 0.6432865731462926,
"repo_name": "eliran-stratoscale/rackattack-api",
"id": "392792e339952ee5c0ebe9a5c6d54db7be233e83"... |
import configparser
import fileinput
import os
import pwd
import shutil
import sys
swift_run_time_user = None
def _chown_to_swift(path):
global swift_run_time_user
uc = pwd.getpwnam(swift_run_time_user)
os.chown(path, uc.pw_uid, uc.pw_gid)
def _unpatch_pipeline_line(orig_line, storlet_middleware):
... | {
"content_hash": "76c9a0927f4935aaa6655630ecfd4b75",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 79,
"avg_line_length": 31.585470085470085,
"alnum_prop": 0.5831416587741848,
"repo_name": "openstack/storlets",
"id": "0ba743b2f75944162d8567270a654accfacda0ee",
"size": "... |
"""
DMLC submission script, MPI version
"""
# pylint: disable=invalid-name
from __future__ import absolute_import
import sys
import subprocess, logging
from threading import Thread
from . import tracker
def get_mpi_env(envs):
"""get the mpirun command for setting the envornment
support both openmpi and mpich2... | {
"content_hash": "b9ecb4a0b8da182034d59e18b7189c60",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 85,
"avg_line_length": 32,
"alnum_prop": 0.522484756097561,
"repo_name": "yhpeng-git/mxnet",
"id": "943db95f91fd6e7828104a9e7df01d3eb38ce13e",
"size": "2624",
"binary": f... |
from testfixtures import compare
from service.ws_re.register.registers import Registers
from service.ws_re.register.repo import DataRepo
from service.ws_re.register.test_base import BaseTestRegister, copy_tst_data
from service.ws_re.volumes import Volumes
class TestRegisters(BaseTestRegister):
def test_init(self... | {
"content_hash": "44def6772cc58dd6524146fb207237e7",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 112,
"avg_line_length": 39.472972972972975,
"alnum_prop": 0.5826771653543307,
"repo_name": "the-it/WS_THEbotIT",
"id": "cafdbec703cfdf22c3e62ae1ab267e16bdded3ee",
"size": "... |
import sys
import time
import random
sys.path.insert(0, '..')
import rrdmodel
m = rrdmodel.RRDModel('.')
year_minutes = 60*24*365
start = (int(time.time()) - year_minutes*60) * 1000
recv_total = 0
send_total = 0
one_percent = year_minutes / 100
for minute in xrange(year_minutes):
recv_total += int(random.random(... | {
"content_hash": "471c596f3f437c4b93bc652bb291dac4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 27.363636363636363,
"alnum_prop": 0.6578073089700996,
"repo_name": "welshjf/bitnomon",
"id": "80cf0463bfbdac773c8e5843905ccb3c194afbe3",
"size": "621... |
import logging
import time
import sys
import gevent
from cStringIO import StringIO
from Debug import Debug
from Config import config
from util import helper
from PeerHashfield import PeerHashfield
if config.use_tempfiles:
import tempfile
# Communicate remote peers
class Peer(object):
__slots__ = (
... | {
"content_hash": "068e6f90d62aebea7750282c3d7a3ca6",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 156,
"avg_line_length": 38.447447447447445,
"alnum_prop": 0.5694759040849801,
"repo_name": "kustomzone/Fuzium",
"id": "ad5cf8dd82a176d277e5f4493ecc0e26524b8ad6",
"size": "... |
"""The tests for the uptime sensor platform."""
import unittest
from unittest.mock import patch
from datetime import timedelta
from homeassistant.util.async_ import run_coroutine_threadsafe
from homeassistant.setup import setup_component
from homeassistant.components.sensor.uptime import UptimeSensor
from tests.common... | {
"content_hash": "5ac542ebf0598495bcba89bf965e1b7a",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 71,
"avg_line_length": 36.376068376068375,
"alnum_prop": 0.5700187969924813,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "00552dd9e49883e9d88e116dc395521353616d57",... |
"""Utilities for unit-testing Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import numpy as np
from tensorflow.python import keras
from tensorflow.python.eager import context
from tensorflow.python.framework import tensor_shap... | {
"content_hash": "1cee43de146b24f453339798c82151e7",
"timestamp": "",
"source": "github",
"line_count": 614,
"max_line_length": 80,
"avg_line_length": 34.55048859934853,
"alnum_prop": 0.6603186574903366,
"repo_name": "asimshankar/tensorflow",
"id": "fd062b0ab337aa6fa62a7603a36749cde315c3da",
"size"... |
from __future__ import print_function
from optparse import OptionParser
from os.path import exists
from sys import stderr
from util import check_output
opts = OptionParser()
opts.add_option('-a', help='action (valid actions are: install,deploy)')
opts.add_option('-v', help='gerrit version')
opts.add_option('-d', help=... | {
"content_hash": "476037c16374a2afca0609c58a779592",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 72,
"avg_line_length": 28.207792207792206,
"alnum_prop": 0.5824125230202578,
"repo_name": "zommarin/gerrit",
"id": "4779abe577a0d84e04d59f03b987e1475cc23011",
"size": "2786... |
import matplotlib.pyplot as plt
import numpy as np
class CurveHighLighter(object):
def __init__(self, ax, alpha=0.3, linewidth=3):
self.ax = ax
self.alpha = alpha
self.linewidth = 3
ax.figure.canvas.mpl_connect('motion_notify_event', self.on_move)
def highlight(self, target):
... | {
"content_hash": "8a61b5014c040d544cf68eeb0e515d9a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 33.07142857142857,
"alnum_prop": 0.5291576673866091,
"repo_name": "UpSea/midProjects",
"id": "38ae95994c73166f96312a32b54ff6975b6d3df4",
"size": "138... |
"""Support for monitoring the state of Digital Ocean droplets."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOVING,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import ATTR_ATTRIBUTION
import homeassistant.helpers.config_va... | {
"content_hash": "bc066733a2ed4afcb591352214a4e606",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 71,
"avg_line_length": 28.294117647058822,
"alnum_prop": 0.6302841302841303,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "b518809286288d81216ce32dc01490d36b457178... |
import os
import json
from flask import abort
class Config():
def __init__(self, config_file=None):
self.config_file = os.path.dirname(__file__) + '/../cfg/config.json'
if config_file is not None:
self.config_file = os.path.dirname(__file__) + '/../cfg/' + config_file
def load(self... | {
"content_hash": "58eb5b55201398986741eed28d3a945c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 83,
"avg_line_length": 28.458333333333332,
"alnum_prop": 0.49633967789165445,
"repo_name": "mcchin/data-collector",
"id": "e991ba27549ff4c2bc614d653abea5112d812eae",
"size"... |
import logging
import typing as t
from globus_sdk import exc, utils
from globus_sdk.authorizers import BasicAuthorizer
from globus_sdk.response import GlobusHTTPResponse
from ..flow_managers import GlobusAuthorizationCodeFlowManager
from ..oauth2_constants import DEFAULT_REQUESTED_SCOPES
from ..response import OAuthD... | {
"content_hash": "709335d9ba859fb30ddf8216ea56a49e",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 98,
"avg_line_length": 43.53488372093023,
"alnum_prop": 0.6547008547008547,
"repo_name": "globus/globus-sdk-python",
"id": "d9ba1b556524202706cc4d080b85d227b95f80d1",
"siz... |
from django.conf.urls.defaults import patterns, url
from django.views.generic.simple import direct_to_template
# views
from django.contrib.auth import views as auth_views
from django.conf import settings
from lingcod.openid import views as oid_views
from registration import views as reg_views
from registration.views i... | {
"content_hash": "5dbba7724f49c9556ccdaa590cd85b8d",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 108,
"avg_line_length": 41.20192307692308,
"alnum_prop": 0.6686114352392065,
"repo_name": "google-code-export/marinemap",
"id": "2375382b4e279e25c4a58025f795da5a154d34fa",
... |
'''This module contains the different readers used to parse both the
target and the query records from files.'''
import os.path
from itertools import islice
from Bio import SeqIO
from Bio.Seq import Seq
from pyPaSWAS.Core.SWSeqRecord import SWSeqRecord
from pyPaSWAS.Core.Exceptions import InvalidOptionException
from ... | {
"content_hash": "f2892c0b6a7e3b3044822f8d8731a481",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 136,
"avg_line_length": 47.00847457627118,
"alnum_prop": 0.6224986479177934,
"repo_name": "swarris/pyPaSWAS",
"id": "5009f6e15000d747d09a4084d7b4a1582bede2e7",
"size": "55... |
import ctypes
from kowhai import *
# protocol commands
KOW_CMD_GET_VERSION = 0x00
KOW_CMD_GET_VERSION_ACK = 0x0F
KOW_CMD_GET_TREE_LIST = 0x10
KOW_CMD_GET_TREE_LIST_ACK = 0x1F
KOW_CMD_GET_TREE_LIST_ACK_END = 0x1E
KOW_CMD_WRITE_DATA = 0x20
KOW_CMD_WRITE_DATA_END = 0x21
KOW_CMD_WRITE_DATA_ACK = 0x2F
KOW_CMD_READ_DATA =... | {
"content_hash": "d07aa8995cbcdda740c7a80042169475",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 153,
"avg_line_length": 37.71895424836601,
"alnum_prop": 0.6473748050597816,
"repo_name": "djpnewton/kowhai",
"id": "1626b4e19e5afb7be31bd900dae489a9c43baed7",
"size": "57... |
import os
import sys
from warnings import warn
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unicode, iri_to_uri
from django... | {
"content_hash": "09ba853b67b62407392d773354677a98",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 96,
"avg_line_length": 39.22162162162162,
"alnum_prop": 0.5836549062844543,
"repo_name": "mixman/djangodev",
"id": "eba9dd39cac5465bba5cae9da3387ee5c22e8064",
"size": "725... |
import unittest
import filecmp
import time
from threading import Event
from rx import *
from TorrentPython.DownloadManager import DownloadManager
from TorrentPython.MetaInfo import MetaInfo
from TorrentPython.RoutingTable import RoutingTable
from TorrentPython.TorrentUtils import TorrentUtils
SAMPLE_TORRENT_PATH = '... | {
"content_hash": "421c1cb84f3aeabaa7208577ff7b3384",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 102,
"avg_line_length": 29.3855421686747,
"alnum_prop": 0.6178761787617876,
"repo_name": "reignofmiracle/RM_Torrent",
"id": "ef42b5fd10e3f183d9e120f7b6f8bd2a7330fbfa",
"siz... |
import platform
import re
# Platform identification constants.
UNKNOWN = 0
RASPBERRY_PI = 1
BEAGLEBONE_BLACK = 2
def platform_detect():
"""Detect if running on the Raspberry Pi or Beaglebone Black and return the
platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN."""
# Han... | {
"content_hash": "09fc5bc546b8c25b8d04d14592dff23e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 94,
"avg_line_length": 36.10843373493976,
"alnum_prop": 0.6139472806139473,
"repo_name": "rjkunde/TempHumiditySensorProject",
"id": "4aec91096a06377d1f959e244809b756eded6212"... |
import django
from django.conf import settings
from django.utils.importlib import import_module
import sys
from tornado import web, ioloop
from sockjs.tornado import SockJSRouter
from swampdragon import discover_routes, load_field_deserializers
from swampdragon.settings_provider import SettingsHandler
def run_server(... | {
"content_hash": "ad65a528695c2985260cbed3fac1cca0",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 80,
"avg_line_length": 28.2,
"alnum_prop": 0.6495271867612293,
"repo_name": "h-hirokawa/swampdragon",
"id": "aea03b311fa855aa1c2a2d28486c8276ef34369b",
"size": "1692",
"b... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 0, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 12); | {
"content_hash": "bae6151b5c3d65403483e9846ee86ab8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 164,
"avg_line_length": 37.714285714285715,
"alnum_prop": 0.7045454545454546,
"repo_name": "antoinecarme/pyaf",
"id": "773cdfe8845fb046de1008e4679a13ce675d6604",
"size": "26... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
replaces = [
("PartyList", "0016_auto_20180411_1734"),
("PartyList", "0017_auto_20180411_1739"),
("PartyList", "0018_auto_20180411_1740"),
]
dependencies = [
... | {
"content_hash": "11491dd9fe9a82671f3f4559778b1f2e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 51,
"avg_line_length": 26.441176470588236,
"alnum_prop": 0.5728587319243604,
"repo_name": "sigmapi-gammaiota/sigmapi-web",
"id": "e168e959851abf5b5207578a3c3f6a88ced0cc25",
... |
"""
Classes to represent the default SQL aggregate functions
"""
import copy
from django.db.models.fields import IntegerField, FloatField
__all__ = ['Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance']
# Fake fields used to identify aggregate types in data-conversion operations.
ordinal_aggregat... | {
"content_hash": "74840fdc3f6f82c2ff0c63c036d78573",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 91,
"avg_line_length": 30.985294117647058,
"alnum_prop": 0.6120075937351684,
"repo_name": "AlexHill/django",
"id": "8542a330c64c4aae607dc38a9bb15e13a177258c",
"size": "421... |
"""Functions for setting up a Samba configuration (LDB and LDAP backends)."""
from base64 import b64encode
import errno
import ldb
import os
import sys
import uuid
import time
import shutil
import subprocess
import urllib
from ldb import SCOPE_BASE, SCOPE_ONELEVEL, LdbError, timestring
from samba import Ldb, read_an... | {
"content_hash": "03a5ed8df28d6a44047ece52dcaf625c",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 183,
"avg_line_length": 40.32515337423313,
"alnum_prop": 0.5645519549672904,
"repo_name": "jorik041/pth-toolkit",
"id": "f88b0db89c52f3128204a259415a7b9f2e307316",
"size":... |
"""
ulid/api/monotonic
~~~~~~~~~~~~~~~~~~
Contains the public API of the `ulid` package using the monotonic provider.
"""
from .. import consts, providers, ulid
from . import api
API = api.Api(providers.MONOTONIC)
create = API.create
from_bytes = API.from_bytes
from_int = API.from_int
from_randomness = A... | {
"content_hash": "be78f3e92176b7343ab06a0164553d37",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 22.939393939393938,
"alnum_prop": 0.7239101717305152,
"repo_name": "ahawker/ulid",
"id": "2734933579a7c23e272627b869c090475f0761f5",
"size": "757",
... |
"""
Read tuples from a corpus consisting of categorized strings.
For example, from the question classification corpus:
NUM:dist How far is it from Denver to Aspen ?
LOC:city What county is Modesto , California in ?
HUM:desc Who was Galileo ?
DESC:def What is an atom ?
NUM:date When did Hawaii become a state ?
"""
# b... | {
"content_hash": "93fcb35f31aec731ca82f7041a57999d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 36.132075471698116,
"alnum_prop": 0.6407310704960836,
"repo_name": "bbengfort/TextBlob",
"id": "d84ec5f41ad740c38bc1a70ea96bbf8bda034668",
"size": "2... |
import pytest
from pillowtalk import *
from pillowtalk.schemas import add_schema
@pytest.fixture
def models(mybase):
@add_schema
class Person(mybase):
items = []
FIELDS = ["id", "name"]
description = fields.String(required=False)
# ADDITIONAL_FIELDS = dict(
# d... | {
"content_hash": "0925f63aacea9077b00bc093d2a93628",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 66,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.5287449392712551,
"repo_name": "jvrana/Pillowtalk",
"id": "c217ae36438e7cf0d3a5a0c9f9fc62b019249021",
"size": "12... |
from wtforms import ValidationError
from uchan.lib import validation
from uchan.lib.service import board_service
class BoardValidator:
def __call__(self, form, field):
if not validation.check_board_name_validity(field.data):
raise ValidationError('Board name not valid.')
board = boar... | {
"content_hash": "7f5faafe8c99fc0ac35009375972655c",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 68,
"avg_line_length": 31.466666666666665,
"alnum_prop": 0.6772598870056498,
"repo_name": "Floens/uchan",
"id": "385328e89bd542581753a67f28ef8276f4b4156a",
"size": "1416",
... |
"""Discrete Cosine Transform ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math as _math
from tensorflow.python.framework import dtypes as _dtypes
from tensorflow.python.framework import ops as _ops
from tensorflow.python.framework import t... | {
"content_hash": "cbadfebdf442c622a197da268d81eed2",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 100,
"avg_line_length": 39.79775280898876,
"alnum_prop": 0.6380575945793338,
"repo_name": "jendap/tensorflow",
"id": "d042c95c049538354836ef83f0b21d8babccedc8",
"size": "7... |
"""Nagcat single-test scheduler"""
from collections import defaultdict
from nagcat import errors, log
from nagcat import scheduler
class ObjectDummy(defaultdict):
"""Provide a replacement for a real ObjectParser"""
def __init__(self):
super(ObjectDummy, self).__init__(list)
def types(self):
... | {
"content_hash": "dec3e13ea72d9649e43cbb874374fc99",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 26.76271186440678,
"alnum_prop": 0.6219126029132362,
"repo_name": "marineam/nagcat",
"id": "656f797ca0d6dce84014c50700ee43fcc2b98d25",
"size": "2167"... |
"""Create the assaults on officers table
Revision ID: 720df9948a25
Revises: 4e98ea7e43d
Create Date: 2016-06-15 15:47:59.913618
"""
# revision identifiers, used by Alembic.
revision = '720df9948a25'
down_revision = '4e98ea7e43d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
... | {
"content_hash": "92a6085559bfdab06bb04acae5ba9c3f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 36.371428571428574,
"alnum_prop": 0.6661429693637078,
"repo_name": "codeforamerica/comport",
"id": "68938036552f4a789b187b7687a4a87034409b77",
"size"... |
import datetime
import sys
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from .. import _serialization
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
... | {
"content_hash": "cc6149df8b05f1ac7859c932396a678f",
"timestamp": "",
"source": "github",
"line_count": 11359,
"max_line_length": 151,
"avg_line_length": 43.69944537371247,
"alnum_prop": 0.6537827721391992,
"repo_name": "Azure/azure-sdk-for-python",
"id": "03479a0e8329fd7fcc6b0b59ac60f5a1d6d7058e",
... |
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import sys, string
from xml.dom import minidom
from xml.sax._exceptions import SAXReaderNotAvailable
import unittest
from reportlab.graphics.shapes import *
from reportlab.graphics import renderSVG
def warn... | {
"content_hash": "bd7e72b496605d547cee6aac36b11ab6",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 105,
"avg_line_length": 37.024734982332156,
"alnum_prop": 0.5623210536361901,
"repo_name": "MatthewWilkes/reportlab",
"id": "c9b9587e8386cbb2565d7df2946f32815fec777c",
"si... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from google.protobuf import text_format as _text_format
from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
# Needed to trigger the call to _set_call_cpp_shape_fn.
from tensorfl... | {
"content_hash": "4f56d938dcb8904dbf3e2ab80c558956",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 75,
"avg_line_length": 22.17105263157895,
"alnum_prop": 0.6991097922848665,
"repo_name": "ryfeus/lambda-packs",
"id": "ef59a4488e5bfce020c44f9d358fd68f01273d6a",
"size": "1... |
from tempest_lib import decorators
import testtools
from tempest.api.telemetry import base
from tempest import config
from tempest import test
CONF = config.CONF
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
@classmethod
def skip_checks(cls):
super(TelemetryNotificationAPITestJSON... | {
"content_hash": "fa3a40a723215928b7142d8d28922b68",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 34.203125,
"alnum_prop": 0.6473275468250342,
"repo_name": "danielmellado/tempest",
"id": "73a5fd4d87b0441ba0e058a26a1731063317f99f",
"size": "2762",
... |
__author__ = 'greg'
from cassandra.cluster import Cluster
import cassandra
import pymongo
import uuid
import json
from cassandra.concurrent import execute_concurrent
cluster = Cluster()
cassandra_session = cluster.connect('serengeti')
# try:
# cassandra_session.execute("drop table classifications")
# print "t... | {
"content_hash": "a7918b39cef8b3691cbda0b832b12043",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 248,
"avg_line_length": 40.96296296296296,
"alnum_prop": 0.7246835443037974,
"repo_name": "camallen/aggregation",
"id": "0e2c8839e63e9aa64a9e6e66663e17d327bd9c70",
"size": ... |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import json
class Api(object):
def __init__(self, options):
pass
def start(self):
pass
def halt(self):
pass
class HttpRequestHandler(BaseHTTPRequestHandler):
def do_OPTIONS(self):
self.send_response(204... | {
"content_hash": "d3f2c722cdd42cc2de0ec938cb392bd5",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 78,
"avg_line_length": 23.87272727272727,
"alnum_prop": 0.524942878903275,
"repo_name": "zorg/zorg",
"id": "404d5af1b1e9ce45a602769f28b4509cc60f3b4f",
"size": "5252",
"b... |
from Crypto.Cipher import AES
from cryptopals.set1.challenge_02 import fixed_xor
import struct
def block_iterator(text):
return (text[i: i + 16] for i in xrange(0, len(text), 16))
def _aes_ctr_xor(text, key, nonce):
# Set up the cipher
cipher = AES.new(key, AES.MODE_ECB)
# Start the counter
cou... | {
"content_hash": "b4448eb447eb8de05fcd1795676933b4",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 71,
"avg_line_length": 25.85,
"alnum_prop": 0.6711798839458414,
"repo_name": "ericnorris/cryptopals-solutions",
"id": "d20b6072f43f59e0e9fe0989530e21897d57919c",
"size": "1... |
from twisted.internet import defer
from synapse.api.errors import AuthError, SynapseError, Codes
from synapse.types import RoomAlias
from .base import ClientV1RestServlet, client_path_pattern
import simplejson as json
import logging
logger = logging.getLogger(__name__)
def register_servlets(hs, http_server):
... | {
"content_hash": "d093e88fb06530f0f4f9f5a7c79f6115",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 80,
"avg_line_length": 32.48091603053435,
"alnum_prop": 0.581433607520564,
"repo_name": "howethomas/synapse",
"id": "6758a888b32b01f43485f727eec52868004eac67",
"size": "48... |
__all__ = ['skymodel_arlexecute'] | {
"content_hash": "ca875841e48e07b89c8842ff26cc82ee",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 33,
"avg_line_length": 33,
"alnum_prop": 0.6363636363636364,
"repo_name": "SKA-ScienceDataProcessor/algorithm-reference-library",
"id": "fccd544da2866928a269e1a4b6b690ee6675d3... |
import os
import sys
current_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = os.path.join(current_dir, '..')
project_dir = os.path.join(test_dir, '..', '..')
sys.path.insert(0, project_dir)
| {
"content_hash": "1c146819ad1550a796dc76e8fd745f31",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 56,
"avg_line_length": 25.5,
"alnum_prop": 0.6617647058823529,
"repo_name": "RaviSoji/probabilistic_LDA",
"id": "f0f246f2240481539e9fcaa9238deacb33cdaed0",
"size": "883",
... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Mts20140618DeleteTemplateRequest(RestApi):
def __init__(self,domain='mts.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.TemplateId = None
def getapiname(self):
return 'mts.aliyuncs.com.DeleteTemplate.2014-06-1... | {
"content_hash": "7f0ceadea2d21446ddd49b0f049c9128",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.739938080495356,
"repo_name": "francisar/rds_manager",
"id": "3a2d6ee453be85f8180042bc6344b09be984e2b4",
"size": ... |
import os
def ruler(char):
"""
Dynamically generates a string containing a 'horizontal line' or 'ruler' sized to fit the current width of the tty.
Takes one argument, a string containing the desired ruler char, and returns a string.
Examples:
Arg "*" will return "****...<tty width>...****"
Arg "=" wil... | {
"content_hash": "d18428ca277e64ee41c1835cfda65106",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 117,
"avg_line_length": 34.03333333333333,
"alnum_prop": 0.643486777668952,
"repo_name": "ndonaghy/hephaestus",
"id": "b3ecfd8ba6aff8f162b62897e5f8645f2f9faee1",
"size": "1... |
import os
import uuid
from oslo_config import cfg
import six
from sahara import conductor as c
from sahara import context
from sahara import exceptions as e
from sahara.i18n import _
from sahara.service.edp import base_engine
from sahara.service.edp.binary_retrievers import dispatch
from sahara.service.edp import hdf... | {
"content_hash": "be90d9d4f3ef0d449d29cb1513eca9d4",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 79,
"avg_line_length": 41.50526315789474,
"alnum_prop": 0.5536393608927213,
"repo_name": "zhangjunli177/sahara",
"id": "f614fe25022fa2a76028ca10dccf601909fc5426",
"size": ... |
"""dump_timeseries.py: Dumps the displacements as a timeseries in a data frame"""
from argparse import ArgumentParser
import logging
import sys
import os
from os import path
from time import time
from glob import glob
import pickle
import pandas as pd
import numpy as np
import more_itertools
from scipy.interpolate im... | {
"content_hash": "cd304a49b009dfe6ef7d6171016c0229",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 135,
"avg_line_length": 39.40340909090909,
"alnum_prop": 0.6462869502523432,
"repo_name": "viveksck/langchangetrack",
"id": "16b81cb6976031f79d155ea40622fb0d05c7d311",
"si... |
import os
from pybmpdb import summary
def test_run():
report = Report()
report.makeInputFiles(report.std_tables)
class Report:
def __init__(self):
self.std_tables = ["bacteria", "metals"]
self.std_docs = ["Bacteria", "Metals"]
self.cbay_tables = [
"tss_cbay",
... | {
"content_hash": "f7fb4e21b62bc5736f3d23629c34c003",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 76,
"avg_line_length": 30.669565217391305,
"alnum_prop": 0.5318967961440317,
"repo_name": "phobson/pybmpdb",
"id": "5788f7ad32d3f834cbd9b191c29afee4becf7b36",
"size": "352... |
"""Base Estimator class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import os
import tempfile
import time
import six
from tensorflow.contrib import framework as contrib_framework
from tensorflow.contrib import layers
from tensorflow.con... | {
"content_hash": "b9588f50551de669b601067318dc69eb",
"timestamp": "",
"source": "github",
"line_count": 549,
"max_line_length": 80,
"avg_line_length": 36.032786885245905,
"alnum_prop": 0.6480638964715398,
"repo_name": "plowman/python-mcparseface",
"id": "f752b2b3a9c27bd7e5fe5ddc77d33af8b95e02a2",
"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import pytest
import time
import ray
import ray.ray_constants as ray_constants
from ray.tests.cluster_utils import Cluster
from ray.tests.conftest import generate_internal_config_map
logger = l... | {
"content_hash": "ed523f6a1edaa69ac8afdb8c8ef204b2",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 77,
"avg_line_length": 30.955555555555556,
"alnum_prop": 0.6920315865039484,
"repo_name": "atumanov/ray",
"id": "979f4728330f9d394ad6d1c73da768fa039ee36e",
"size": "2786",
... |
import urllib
import simplejson
googleGeocodeUrl = 'http://maps.googleapis.com/maps/api/geocode/json?'
def get_coordinates(query, from_sensor=False):
query = query.encode('utf-8')
params = {
'address': query,
'sensor': "true" if from_sensor else "false"
}
url = googleGeocode... | {
"content_hash": "dbc83f2c2bafcebc28271a103120e45b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 35,
"alnum_prop": 0.6363636363636364,
"repo_name": "ameybhole77/BE-project",
"id": "e3976c8b27c51495caca3df93adf8cf374ede573",
"size": "770",
"bina... |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="Demo of launcher.",
version="0.0.0",
author="Matthew Goodman",
author_email="meawoppl@gmail.com",
description="An example of how to use the conda launcher.",... | {
"content_hash": "43d3c8b2ff5807a2910a8e33ef4d9563",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.6645021645021645,
"repo_name": "meawoppl/hello-launcher",
"id": "c06d236c0d488d8e91eae9f46a8fe6356fbf774a",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
import django_mobile_app_distribution.models
from django.conf import settings
import django.core.files.storage
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_d... | {
"content_hash": "ce1296f96a904c198a23edf459e454d5",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 323,
"avg_line_length": 53.411764705882355,
"alnum_prop": 0.5944933920704846,
"repo_name": "Proper-Job/django-mobile-app-distribution",
"id": "e9c085d3e472f549192ad360ef7bf52... |
import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
import sys
REPO_ROOT = os.path.abspath('..')
sys.path.insert(0, REPO_ROOT)
# Set $PYTHONPATH for nbsphinx to run notebooks
pythonpath = os.environ.get('PYTHONPATH', '')
if pythonpath:
os.environ['PYTHONPATH'] = REPO_ROOT + ':' + pythonpath
else:
os.env... | {
"content_hash": "08b34c2359687a542ea696d4aef768cc",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 79,
"avg_line_length": 29.86577181208054,
"alnum_prop": 0.6631460674157303,
"repo_name": "computationalmodelling/magnics",
"id": "946a3c161d73accdef9fb8315048eb54c4c0f8e3",
... |
from tensorforce.core import layer_modules, TensorDict, TensorsSpec, tf_function, tf_util
from tensorforce.core.policies import ActionValue, ParametrizedPolicy
class ParametrizedActionValue(ActionValue, ParametrizedPolicy):
"""
Policy which parametrizes an action-value function, conditioned on the output of a... | {
"content_hash": "22324025d5ed28d51c41f34ba36c2fc1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 99,
"avg_line_length": 44.3936170212766,
"alnum_prop": 0.6240115025161754,
"repo_name": "reinforceio/tensorforce",
"id": "f2bcd074cf6a0835526bd10fc0137ecca3324820",
"size":... |
"""
Common functions and regex expressions for github
"""
import re
GITHUB_REGEX = re.compile(
r'^(https://github.com/|\w+@github\.com:)(?P<repository>[a-zA-Z0-9_\-]+/[a-zA-Z0-9_\-]+)\.git$')
GITHUB_ISSUE_REGEX = re.compile(r'^(([a-zA-Z0-9_\-]*|[a-zA-Z0-9_\-]+/[a-zA-Z0-9_\-]+)#|GH-)(?P<issue>\d+)$')
def extract... | {
"content_hash": "cb1fa6735dd9cd77315efeb4d8d1f214",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 108,
"avg_line_length": 23.95,
"alnum_prop": 0.6040361864996521,
"repo_name": "zalando/turnstile",
"id": "42c82a6c7f9252021cd7aa0f772af75291a4da58",
"size": "1437",
"bina... |
from django import http
from django.shortcuts import render_to_response
from django.template.loader import get_template
from django.template import Context
import xhtml2pdf.pisa as pisa
try:
import StringIO
StringIO = StringIO.StringIO
except Exception:
from io import StringIO
import cgi
def index(request)... | {
"content_hash": "bc80a8c0fbb7042e6ec3c3399df93276",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 83,
"avg_line_length": 33.98571428571429,
"alnum_prop": 0.5519125683060109,
"repo_name": "zulumarketing/html2pdf",
"id": "d59e870d1e3d0f995bda92f7d9d00256dcec49b3",
"size":... |
import json
import os
from io import BytesIO
from contextlib import closing, contextmanager
from datetime import datetime
from mox import Mox, IgnoreArg
from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase
from jsonlog import ConcurrentModificationException
from jsonlog import DataStor... | {
"content_hash": "2dacbcd2ba94c8b85c745fb63ce3cf2d",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 88,
"avg_line_length": 29.72762645914397,
"alnum_prop": 0.5760471204188482,
"repo_name": "uucidl/pyjsonlog",
"id": "c9dddb38f73e3425c426adc7282fcb3df234aa38",
"size": "764... |
<<<<<<< HEAD
<<<<<<< HEAD
"""Python 'zlib_codec' Codec - zlib compression encoding.
This codec de/encodes from bytes to bytes.
Written by Marc-Andre Lemburg (mal@lemburg.com).
"""
import codecs
import zlib # this codec needs the optional zlib module !
### Codec APIs
def zlib_encode(input, errors='strict'):
ass... | {
"content_hash": "8151edc2852f4132022d741931190ecc",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 57,
"avg_line_length": 28.48945147679325,
"alnum_prop": 0.6590639810426541,
"repo_name": "ArcherSys/ArcherSys",
"id": "63429284fbf794d0a1638467a6eb8e4cda971725",
"size": "... |
from functools import update_wrapper, partial
from django import forms
from django.conf import settings
from django.forms.formsets import all_valid
from django.forms.models import (modelform_factory, modelformset_factory,
inlineformset_factory, BaseInlineFormSet)
from django.contrib.contenttypes.models import Conte... | {
"content_hash": "e40c8e084b77188fab37b152654f558a",
"timestamp": "",
"source": "github",
"line_count": 1464,
"max_line_length": 173,
"avg_line_length": 43.372950819672134,
"alnum_prop": 0.5864279189895745,
"repo_name": "aleida/django",
"id": "4d23f8f3842854c3b49684e9c81948e42282d318",
"size": "634... |
import logging
import re
from sqlalchemy.exc import IntegrityError
# dicom refers to pydicom library
import dicom
from dicom.errors import InvalidDicomError
from . import utils
#######################################################################################################################
# GLOBAL VARIABLES... | {
"content_hash": "e6a3ee75cb52412f41d9f6398d92a769",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 119,
"avg_line_length": 40.0281425891182,
"alnum_prop": 0.6176236231544411,
"repo_name": "LREN-CHUV/mri-meta-extract",
"id": "e4b1109b10e35542728949eb78579aa0c28d2c9f",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.