text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from common import get_ldap_lookup, PETER, BILL
class MailerLdapTest(unittest.TestCase):
def setUp(self):
self.ldap_lookup = get_ldap_lookup(cache_engine='sqlite')
def test_sqlite_cached_get_mail(self):
michael_bolton = self.ldap_lookup.caching.get('michael_bolton')
... | {
"content_hash": "c0f94973d8891721b798660b559683b8",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 94,
"avg_line_length": 51.417582417582416,
"alnum_prop": 0.6646719384483865,
"repo_name": "jimmyraywv/cloud-custodian",
"id": "c979d2da3df7cd4964cd798af169bbb7bbe5efbe",
"s... |
"""
Simple script to rename .env.keep to .env after generating the project.
"""
import os
os.rename('.env.keep', '.env')
print('Django project was generated in {{ cookiecutter.repo_name }}.')
| {
"content_hash": "3924830612f468f80497dab26a0d9f64",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.6923076923076923,
"repo_name": "ameistad/django-template",
"id": "0cc439149e79c1ea716a6ae0f5f017922d850e7a",
"size... |
"""
author : wanghe
company: LogInsight
email_ : wangh@loginsight.cn
file: __init__.py.py
time : 16/4/15 下午9:20
"""
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wangblog.conf.settings")
from django.core.management import execute_from_command_line
execute_from_comm... | {
"content_hash": "a1a92edd3c7fad5062bdd7d0db533ca2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 21.1875,
"alnum_prop": 0.7109144542772862,
"repo_name": "wanghe4096/WangBlog",
"id": "ada89c20b79c585761623f7d8d0565bbe1b2f944",
"size": "367",
"bi... |
import io
import re
import errno
import pytest
from unittest import mock
import gpiozero.pins.data
import gpiozero.pins.local
from gpiozero.pins.local import LocalPiFactory
from gpiozero.pins.data import Style, HeaderInfo, PinInfo
from gpiozero import *
def test_pi_revision():
with mock.patch('gpiozero.devices.D... | {
"content_hash": "e8372896759bb194ac5eea65cd3da6aa",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 104,
"avg_line_length": 40.42142857142857,
"alnum_prop": 0.5699770277434175,
"repo_name": "waveform80/gpio-zero",
"id": "e0256d8b4b33c5f0df24afdfd96b888b43390927",
"size":... |
import argparse
import random
from collections import namedtuple
from pyborgeous import codestrings
from pyborgeous import docstrings
__VERSION__ = '0.5.1'
class Page:
"""
The page in a book in a shelf in a bookcase in a room in a library object
"""
# We iterate trough library_configuration, that's... | {
"content_hash": "26babb4e11e57221699bfb9cda09bb01",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 120,
"avg_line_length": 40.183673469387756,
"alnum_prop": 0.6242472611187695,
"repo_name": "Spacehug/pyborgeous",
"id": "b8df360f7f462caa7d7a91a94abfcc246ea5c143",
"size":... |
from parlai.utils.testing import AutoTeacherTest # noqa: F401
class TestDefaultTeacher(AutoTeacherTest):
task = 'xpersona'
class TestEnTeacher(AutoTeacherTest):
task = 'xpersona:En'
class TestZhTeacher(AutoTeacherTest):
task = 'xpersona:Zh'
class TestFrTeacher(AutoTeacherTest):
task = 'xpersona... | {
"content_hash": "2ae77f62b16e472e97fa7946e8553ba6",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 62,
"avg_line_length": 17.727272727272727,
"alnum_prop": 0.7350427350427351,
"repo_name": "facebookresearch/ParlAI",
"id": "52048a82bcfe07645f77967bc3daa59af38e7085",
"size... |
from django.core.cache import cache
from django.test.utils import override_settings
from django.utils.encoding import smart_text
from django.utils.translation import trim_whitespace
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.addons.models import (
Addon, AddonDependency, C... | {
"content_hash": "7a9e42181978937b378b86e8445fd528",
"timestamp": "",
"source": "github",
"line_count": 652,
"max_line_length": 79,
"avg_line_length": 41.00153374233129,
"alnum_prop": 0.6003815508921557,
"repo_name": "lavish205/olympia",
"id": "3b8b57b17be256d0b9a52d748a219c971125b426",
"size": "26... |
import vtk
import numpy as np
from vmtk import vmtkscripts
import argparse
import copy
# creates lines normal to surface for evaluation in the probe image with surface
def warp_surface(args):
print("warp the surface ")
reader = vmtkscripts.vmtkSurfaceReader()
reader.InputFileName = args.surface
re... | {
"content_hash": "c79b898569d0096e326335d22d9b55e0",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 120,
"avg_line_length": 34.721518987341774,
"alnum_prop": 0.6697047028800583,
"repo_name": "kayarre/Tools",
"id": "0ef8d7faf6179994e70f71f839bff1cab233fca7",
"size": "2767"... |
from datetime import datetime
from google.appengine.ext import ndb
from models import Despesa
def index():
despesas = Despesa.query().fetch()
now = datetime.now()
for despesa in despesas:
dias_vencidos = (now - datetime(year=now.year, month=despesa.data_vencimento[0],
day=... | {
"content_hash": "5f32ba68e3fc1ecfbbd8be09a65e86d7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 91,
"avg_line_length": 34.875,
"alnum_prop": 0.6523297491039427,
"repo_name": "giovaneliberato/keepfamily",
"id": "5fea4da3aa56c50190e858724205debe670f39ab",
"size": "558",... |
from lxml.builder import E
from jnpr.junos.utils.util import Util
from jnpr.junos.utils.start_shell import StartShell
class FS(Util):
"""
Filesystem (FS) utilities:
cat - show the contents of a file
checksum - calculate file checksum (md5,sha256,sha1)
copy - local file copy (not scp)
... | {
"content_hash": "6ffd60a752d3a2a78094d7c40e11b15e",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 79,
"avg_line_length": 36.72727272727273,
"alnum_prop": 0.4876965637740245,
"repo_name": "dgjnpr/py-junos-eznc",
"id": "ec8ca645fe46f94c3c84cf25238b4f88a37c66f2",
"size": ... |
import re, string
from tree import Tree, NodeId
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = ... | {
"content_hash": "264f590abd4ad5d99846c581b6beab8b",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 115,
"avg_line_length": 35.648648648648646,
"alnum_prop": 0.634950720242608,
"repo_name": "tonussi/multimedia",
"id": "a74a022918d5266834dea0711858ea56eb4254a4",
"size": "2... |
from signals import register
register('app.activate')
register('app.deactivate')
register('app.pre_start')
register('app.start')
register('app.ready')
register('app.close')
register('app.stop')
register('app.chdir')
register('app.command')
register('app.remote')
register('app.open_file')
register('project.init')
re... | {
"content_hash": "94418d80f78fbc5bb6bbce3e34e97355",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 35,
"avg_line_length": 21.38888888888889,
"alnum_prop": 0.7318181818181818,
"repo_name": "cloudteampro/juma-editor",
"id": "92916a7f0fb5559b25b599a97980eeb3df47d9bf",
"size... |
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
def setup_server():
class WSGIResponse(object):
def __init__(self, appresults):
self.appresults = appresults
self.iter = iter(appresults)
def __iter__(self):
return ... | {
"content_hash": "97a6db3998c7860c702dcf4ce0574c2e",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 77,
"avg_line_length": 27.274725274725274,
"alnum_prop": 0.5124899274778405,
"repo_name": "VHAINNOVATIONS/DmD",
"id": "3aaabf5ec313c8888c91a871a8596fee1c4361e8",
"size": "2... |
"""
Created on Fri Apr 28 11:30:56 2017
@author: Patrick Woo-Sam
"""
import dryscrape
import time
import pandas as pd
from io import StringIO
class Trajectory_browser:
def __init__(self):
self._url = 'https://trajbrowser.arc.nasa.gov/traj_browser.php'
self.session = dryscrape.Session()
s... | {
"content_hash": "89c7602adf5a9257d2dce0d8dfa1cbcd",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 30.56779661016949,
"alnum_prop": 0.48211810368727476,
"repo_name": "capsulecorplab/Space_Renegades",
"id": "e6393712a3509cab4f9ec60b75870ab43f6a948c",... |
import MySQLdb as mysql
db = mysql.connect(user='root',passwd='Hackathon@2017',db='weathercn',host='localhost')
db.autocommit(True)
cur = db.cursor()
sql = 'select time_stamp,response_time from httpaccess'
cur.execute(sql)
arr = []
for i in cur.fetchall():
arr.append([i[1], i[0]])
if len(arr) > 0:
print arr[-1... | {
"content_hash": "2e2e9ac78632c8f074f935687be3d100",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 87,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.6832298136645962,
"repo_name": "clovertrail/rocket",
"id": "50d95232f3931f43fd7b00f6b5c6dbc840a6cdd7",
"size": "3... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.conf import settings
from molly.utils.i18n import name_in_language
class Migration(DataMigration):
def forwards(self, orm):
"""
Move category names to the new i18n format
"""... | {
"content_hash": "bcf36cda4d24b06e0f113bd5a6eee8e7",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 152,
"avg_line_length": 58.44444444444444,
"alnum_prop": 0.5479509928179129,
"repo_name": "mollyproject/mollyproject",
"id": "c0431e3bd3090d9ceb15e9f32ce4d58debebe4e5",
"si... |
import argparse
import csv
import matplotlib.pyplot as plt
import numpy as np
# parser
parser = argparse.ArgumentParser('Plot GPU use')
parser.add_argument('csv_path', type=str)
args = parser.parse_args()
with open(args.csv_path, 'r') as csvfile:
plots = csv.reader(csvfile, delimiter=',')
y = [[int(r) for r in ... | {
"content_hash": "00fb6a2533dec9727ce459d4030d0f32",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 60,
"avg_line_length": 22.694444444444443,
"alnum_prop": 0.6719706242350061,
"repo_name": "mari-linhares/tensorflow-workshop",
"id": "4c8690f1eab0d549313fa647b8a26f370e09553d... |
import os
import re
# read content from validate.html
htmlContent = [x for x in open('validate.html')]
# identify template boundaries
preIdx = htmlContent.index([ x for x in htmlContent if re.match(r'\s*<!-- START AUTO-POPULATED TESTS -->',x) ][0])
postIdx = htmlContent.index([ x for x in htmlContent if re.match(r'\... | {
"content_hash": "029bd8b319d323519db38b6193a9f9b7",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 116,
"avg_line_length": 32.73684210526316,
"alnum_prop": 0.579849946409432,
"repo_name": "daryl314/markdown-browser",
"id": "c5ca6feea334dd92b081295f110fefb83ebe54ed",
"siz... |
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import mechanize
def query_url(url, br = None):
if br == None:
br = mechanize.Browser()
br.set_handle_robots(False)
br.open(url['url'].encode("ascii","ignore"))
return
| {
"content_hash": "516f358d2dca7d8ab6600417bdefd22d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 21.76923076923077,
"alnum_prop": 0.6254416961130742,
"repo_name": "cmu-db/db-webcrawler",
"id": "85a79ea8382c9f984d7cc11fc38c2aff63397bb9",
"size": "... |
"""Abstract base class of Port-specific entry points for the layout tests
test infrastructure (the Port and Driver classes)."""
import cgi
import difflib
import errno
import itertools
import json
import logging
import os
import operator
import optparse
import re
import sys
try:
from collections import OrderedDict... | {
"content_hash": "24b30a8b9242404e536844fa00192173",
"timestamp": "",
"source": "github",
"line_count": 1773,
"max_line_length": 189,
"avg_line_length": 43.51494641849972,
"alnum_prop": 0.6244037743674824,
"repo_name": "crosswalk-project/blink-crosswalk",
"id": "f62dd5e8c630d27738b184ae6a50ad9abd9d21... |
import sys
import argparse
import textwrap
from pandashells.lib import parallel_lib
def main():
msg = "Tool to run shell commands in parallel. Spawns processes "
msg += "to concurrently run commands supplied on stdin. "
msg = textwrap.dedent(
"""
Read a list of commands from stdin and e... | {
"content_hash": "06650b612a690943873600b97ca8cf4a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 37.03409090909091,
"alnum_prop": 0.5372813746548021,
"repo_name": "iiSeymour/pandashells",
"id": "8814bc9bdbb8e6cfdbf7885a65df3572e9d95d61",
"size": ... |
import math
from datetime import datetime
from datetime import timedelta
"""
Gets current starting time with flooding delay
"""
def get_cst_and_fd(nw_size_estimate, overlapping_bits):
hr_in_ms = 3600000.0
flood_delay_in_ms = (hr_in_ms/2) - (hr_in_ms/math.pi) * (math.atan(overlapping_bits - nw_size_estimat... | {
"content_hash": "37709a6be5f88e1a44986f45ddce479b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 108,
"avg_line_length": 35.214285714285715,
"alnum_prop": 0.6825557809330629,
"repo_name": "ansin218/p2p-voidphone-nse",
"id": "6cc7d7bc3e29a0110d68c8099eb68e883f8c5179",
"... |
from datautil import findFile
from datautil import filterEvents
from datautil import toTxt
import json
def printKeys(dict):
try:
print(dict.keys())
except:
print("Not a Dict Object")
def printList(list, indent = 0):
spacing = ""
for i in range(indent): spacing += " "
... | {
"content_hash": "39b87d518ceb5ace0ece8b7dc7129593",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 122,
"avg_line_length": 24.58974358974359,
"alnum_prop": 0.5964546402502607,
"repo_name": "benjaminy/Charcoal",
"id": "014bf917dbef0595b06ffe5db229d3c6a3ca80d7",
"size": "9... |
from office365.runtime.client_value import ClientValue
class ShiftAvailability(ClientValue):
"""Availability of the user to be scheduled for a shift and its recurrence pattern."""
pass
| {
"content_hash": "7b468980766601c6c3f5d8baa91df06b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 90,
"avg_line_length": 32.5,
"alnum_prop": 0.7743589743589744,
"repo_name": "vgrem/Office365-REST-Python-Client",
"id": "ba73b882a9713f27e06845351eb094ec231b6c04",
"size": "... |
from collections import Counter
from typing import Tuple
import numpy as np
import sklearn.metrics
from numpy.typing import ArrayLike
from sklearn.base import BaseEstimator
from sklearn.calibration import CalibratedClassifierCV
from sklearn.model_selection._split import _CVIterableWrapper
from .types import Calibrati... | {
"content_hash": "cc0dcc385320e139e9126270f36ab93f",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 78,
"avg_line_length": 28.57766990291262,
"alnum_prop": 0.5853575675216579,
"repo_name": "pyannote/pyannote-metrics",
"id": "1c80738026bfe32a6a747359475d07a6bc390252",
"si... |
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 CreateFriendship(Choreography):
def __init__(self, temboo_session):
"""
Creat... | {
"content_hash": "9bb79fc7d45ccb6c133727ce193c3916",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 191,
"avg_line_length": 46.395348837209305,
"alnum_prop": 0.700250626566416,
"repo_name": "jordanemedlock/psychtruths",
"id": "d12231bdbf7e7383526b04c883ca0fd812e3849c",
"s... |
__author__ = 'sohje'
__version__ = 0.02
import pymongo
from flask import Flask, g
from flask.ext.socketio import SocketIO
from fabric import main as fab_main
import config
from fabfile import env
def connect(host, port):
client = False
try:
client = pymongo.MongoClient(host, port)
except pymongo.e... | {
"content_hash": "be91d343e90d5dc60d2fc8c3df7c4154",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 29.866666666666667,
"alnum_prop": 0.6837797619047619,
"repo_name": "sohje/Nipsy",
"id": "1dd582034325356e491444050e2a2a1d2b21d09f",
"size": "1344",
... |
"""Tests for sparse ops."""
# Dependency imports
import numpy as np
import tensorflow.compat.v1 as tf1
from tensorflow_probability.python.internal import test_util
from tensorflow_probability.python.math import sparse
def _assert_sparse_tensor_value(test_case_instance, expected, actual):
test_case_instance.asser... | {
"content_hash": "32a85a90b864945564b78362551cad3a",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 80,
"avg_line_length": 37.43333333333333,
"alnum_prop": 0.6258236865538735,
"repo_name": "tensorflow/probability",
"id": "af3d4030bee4875f39eedf54005f64aa0a88c8a6",
"size"... |
from django.urls import path
from django.utils.translation import pgettext_lazy
from .views import follow, embed_follow, confirm_follow, unfollow_by_link
urlpatterns = [
path("<int:pk>/follow/", follow, name="foirequestfollower-follow"),
path(
"<int:pk>/follow/embed/", embed_follow, name="foirequestfo... | {
"content_hash": "0a47853f498fc2551dcc3f910737d4f7",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 86,
"avg_line_length": 32.714285714285715,
"alnum_prop": 0.653566229985444,
"repo_name": "fin/froide",
"id": "5759cfc630e7e2ddefe2f1ed5ec4b339357ed2b6",
"size": "687",
"b... |
''' This file serves db_content.py '''
import json
from sqlalchemy.orm import sessionmaker, scoped_session
# this are for parse_skill_name()
from atod.db import engine
from atod.db_models.hero import HeroModel
from atod.utils import dictionary
session = scoped_session(sessionmaker(bind=engine))
# FIXME: write heroe... | {
"content_hash": "45eccbbf2d292eff10897fa3136e9baa",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 78,
"avg_line_length": 28.326446280991735,
"alnum_prop": 0.5571115973741795,
"repo_name": "gasabr/AtoD",
"id": "5f31a88387c33b1ce8607890eae18198cfe37f6a",
"size": "6855",
... |
import os
import pathlib
import json
import time
import shutil
from filelock import Timeout
import pytest
import responses
import torch
from allennlp.common.file_utils import (
FileLock,
_resource_to_filename,
filename_to_url,
cached_path,
open_compressed,
CacheFile,
_Meta,
_find_entri... | {
"content_hash": "70bd2abf77d2c9037ab5c7de737dd66f",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 99,
"avg_line_length": 38.036468330134355,
"alnum_prop": 0.5955492758742493,
"repo_name": "allenai/allennlp",
"id": "14c61a2291a26e71383357faa5ecd9bc6198167b",
"size": "19... |
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUBootstrap(NURESTObject):
""" Represents a Bootstrap in the VSD
Notes:
Gateway bootstrap details.
"""
__rest_name__ = "bootstrap"
__resource_name__ = ... | {
"content_hash": "02bec313d7667657d73cbd461a31e945",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 259,
"avg_line_length": 27.941690962099127,
"alnum_prop": 0.5547787979966611,
"repo_name": "nuagenetworks/vspk-python",
"id": "2f1a1d8d394d3f2456a81b3724c617728b00e002",
"... |
"""Create the asset."""
import argparse
import subprocess
# Remember to also update the go_win asset when this is updated.
GO_URL = "https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz"
def create_asset(target_dir):
"""Create the asset."""
p1 = subprocess.Popen(["curl", GO_URL], stdout=subprocess.PIPE)
p2 ... | {
"content_hash": "f620b511e7a15e3dde7a13baa5745e06",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 24.821428571428573,
"alnum_prop": 0.6575539568345323,
"repo_name": "endlessm/chromium-browser",
"id": "57a307aba633d11708e59005b04ee68cf4b55ec2",
"si... |
"""Tests Face interface compliance of the gRPC Python Beta API."""
import collections
import unittest
from grpc._adapter import _intermediary_low
from grpc.beta import beta
from grpc_test import resources
from grpc_test import test_common as grpc_test_common
from grpc_test.beta import test_utilities
from grpc_test.fr... | {
"content_hash": "bbd16400d4dbf56bbda0fa5b23c55099",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 80,
"avg_line_length": 38.80555555555556,
"alnum_prop": 0.739203054163684,
"repo_name": "cgvarela/grpc",
"id": "ce4c59c0eea6be3043000ce39782907ed68f2d0c",
"size": "5720",
... |
import time
from subprocess import call, Popen, PIPE
import sys
import os
#--------------- GUI Modules -------------------------
from Tkinter import *
import ttk
import tkFileDialog
from PIL import Image, ImageTk # need to install: sudo apt-get install python-imaging-tk
#--------------- Representation related --------... | {
"content_hash": "36a12abde1aba30d6f1e82c1810fd516",
"timestamp": "",
"source": "github",
"line_count": 1676,
"max_line_length": 179,
"avg_line_length": 45.58174224343676,
"alnum_prop": 0.6646900975194712,
"repo_name": "princeedward/SimulationPlugins",
"id": "d809c4a8da87588e181455b646ab38e9119cfa87"... |
from app import app, flatpages, LESSON_DIR, DAY_DIR, pygments_style_defs, LINKS_ACTIVE, freezer
from flask import render_template, make_response
from itertools import groupby
@app.route('/')
def index():
"""Homepage"""
lesson_pages = [p for p in flatpages if LESSON_DIR in p.path]
lesson_pages = sorted(le... | {
"content_hash": "b299cc150fa646fc0448aff6eff81268",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 115,
"avg_line_length": 31.047619047619047,
"alnum_prop": 0.6602760736196319,
"repo_name": "neuroneuro15/SciCourseSite2",
"id": "f0c68c22ed64a2ef9e662f5a9c9a1de519ea8aa1",
... |
import time
from tempest_lib.common.utils import misc
from tempest_lib import exceptions as lib_exc
from tempest import exceptions
from tempest.services.network.json import base
class NetworkClient(base.BaseNetworkClient):
"""
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
V1 AP... | {
"content_hash": "38677f1d3a44e3609cbc739c0ec36512",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 79,
"avg_line_length": 38.220338983050844,
"alnum_prop": 0.6139372822299651,
"repo_name": "izadorozhna/tempest",
"id": "7821f37bd5ce092c0d6fd8192e10d7090c6dc49d",
"size": ... |
import pygame
from graphics import *
from math import *
from tower import *
# This class controls the radius for a tower, which is the median between a Tower and an Enemy.
# The radius will detect an enemy, and use stats from the tower to send projectiles at the enemy.
class TowerRadius(pygame.sprite.Sprite):
def __i... | {
"content_hash": "662ea38cfcd0131fc17a452aca642b8c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 97,
"avg_line_length": 31.227272727272727,
"alnum_prop": 0.6720038816108685,
"repo_name": "taytam/crystaldefense",
"id": "f66375f6fd68acf3a95f52af545cb97e48735c8a",
"size":... |
import datetime
import json
from unittest import mock
from django.db.models import Q
from django.test import TestCase
from elasticsearch.serializer import JSONSerializer
from wagtail.search.backends.elasticsearch6 import Elasticsearch6SearchBackend
from wagtail.search.query import MATCH_ALL
from wagtail.tests.search ... | {
"content_hash": "599cfe9f88d7716d2acbda99ac21f97c",
"timestamp": "",
"source": "github",
"line_count": 816,
"max_line_length": 156,
"avg_line_length": 38.856617647058826,
"alnum_prop": 0.525152174598669,
"repo_name": "mikedingjan/wagtail",
"id": "805601a94e29f91f6769ddc5aa71a72ebe0bd29a",
"size": ... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
demisto.results(demisto.executeCommand("grr_get_files", demisto.args()))
| {
"content_hash": "155200342ab85ef4fbaf0f04990c1597",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 41.25,
"alnum_prop": 0.7696969696969697,
"repo_name": "demisto/content",
"id": "dd0f0afc9ef27c7559a1a94db8ef793390233502",
"size": "165",
"binary": ... |
VERSION='2.0.1'
from client import Spotify, SpotifyException
| {
"content_hash": "1b3b597f50999bb63f845fd2d5f86b33",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 44,
"avg_line_length": 30.5,
"alnum_prop": 0.8032786885245902,
"repo_name": "issyrichards/spartify2",
"id": "9339d2a6b6a8a57bce39a4f81127fd68e2a0e6c3",
"size": "61",
"bina... |
import re
from BeautifulSoup import BeautifulSoup
from collections import defaultdict
# Use defaultdict to append duplicates, but output only the first entry
modules = defaultdict(list)
def normalize(string):
''' -> Remove parantheses part from ending of module names
-> Remove YUI from module name
''... | {
"content_hash": "879e01e298bbee85e3dd5334c6edede0",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 77,
"avg_line_length": 36.58461538461538,
"alnum_prop": 0.4953742640874685,
"repo_name": "rasikapohankar/zeroclickinfo-fathead",
"id": "83e549e9998a7a859134b9ef20e31394bba1fc... |
from random import choice
from string import letters
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from .models import Invitation
_ = lambda x: x
class EmailAuthenticationForm(Auth... | {
"content_hash": "c9d22196a8ee7213a3b07e45f7e5d747",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 33.75675675675676,
"alnum_prop": 0.6469175340272217,
"repo_name": "jacobjbollinger/sorbet",
"id": "4faf977c6239bd3281803c0fe83a432b8f5594f4",
"size":... |
from sahara.i18n import _
from sahara.plugins.cdh.client import services
from sahara.plugins.cdh.client import types
from sahara.plugins.cdh import exceptions as ex
CLUSTERS_PATH = "/clusters"
def create_cluster(resource_root, name, version=None, fullVersion=None):
"""Create a cluster
:param resource_root: ... | {
"content_hash": "d1b6e5bd801cb2d18d661a789e25c3ce",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 79,
"avg_line_length": 33.070422535211264,
"alnum_prop": 0.6081771720613288,
"repo_name": "matips/iosr-2015",
"id": "38f35fdffd6f9ea601c53eb3b410b87ade387408",
"size": "56... |
from pyramid.httpexceptions import HTTPInternalServerError
from pyramid_mailer.message import Message
from kotti.message import get_mailer
from kotti import get_settings
def mail_admin(msg):
"""
Send given message to the admins.
"""
admin = get_settings().get('kotti_dkbase.admin_email')
message = ... | {
"content_hash": "afa1cbb7340c7764b3697ecf8fd80906",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 27.514285714285716,
"alnum_prop": 0.6791277258566978,
"repo_name": "chrneumann/kotti_dkbase",
"id": "0bbc362da5aeefa4cb6209c9b33f7068b305e69a",
"size... |
import sys
import mock
from oslo.config import cfg
import testtools
import webtest
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import config
from neutron.common import exceptions
from neutron import context
from neutron.db import api as db
from neutron.db import quota_... | {
"content_hash": "458df1bb833ebbcae19969ae43c69470",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 78,
"avg_line_length": 43.99760765550239,
"alnum_prop": 0.554238486216084,
"repo_name": "sajuptpm/neutron-ipam",
"id": "0d88d937177619db244ec222592a91d5aa3bb949",
"size": ... |
import unittest
from libcloudcore.importer import Importer
class TestImporter(unittest.TestCase):
def setUp(self):
self.importer = Importer(__name__)
def test_get_driver(self):
driver = self.importer.get_driver("bigv")
self.assertTrue(driver.name == "bigv")
def test_get_client(... | {
"content_hash": "3dda00f42b3af4f40e58b713c3542f63",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 65,
"avg_line_length": 27.761904761904763,
"alnum_prop": 0.6620926243567753,
"repo_name": "Jc2k/libcloudcore",
"id": "12caafb6b891938e9ad09d392dc6291ad8a0ad10",
"size": "13... |
"""psCharStrings.py -- module implementing various kinds of CharStrings:
CFF dictionary data and Type1/Type2 CharStrings.
"""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import struct
DEBUG = 0
t1OperandEncoding = [None] * 256
t1OperandEncoding[0:32] = (32) *... | {
"content_hash": "543df5150e05dd9e6bdd0f3d33d08349",
"timestamp": "",
"source": "github",
"line_count": 1177,
"max_line_length": 82,
"avg_line_length": 25.074766355140188,
"alnum_prop": 0.6443262291193711,
"repo_name": "googlei18n/fontuley",
"id": "6ffdb994a5b5e6cc650550422e618581217c2115",
"size":... |
import copy
try:
import json
except ImportError:
import simplejson as json
import geolocation
import geolocation.abstract as abstract
class CodecError(StandardError):
"""Base exception class for codec errors"""
pass
class UnknownCodec(CodecError):
"""Failed to find any codec for the given forma... | {
"content_hash": "6890423eab9b1803029371c73ab8e8cd",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 91,
"avg_line_length": 23.75423728813559,
"alnum_prop": 0.6086336068498038,
"repo_name": "op/geolocation",
"id": "4729beaa53de3c4356de7b6b5a8e6511aa8a8bc6",
"size": "2864"... |
from flask import request, render_template, redirect, url_for, jsonify
from werkzeug.utils import secure_filename
from app import multiauth, errHandler, models, mysqlhandler, aws_s3Handler
from . import firmware
from app import mysql
runMySQL = mysqlhandler.MySQLHandler(mysql)
@firmware.route('/firmware')
def ind... | {
"content_hash": "2e884d72ec97ed9c031dc476bc5f143d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 151,
"avg_line_length": 32.236363636363635,
"alnum_prop": 0.6959954878736605,
"repo_name": "flyfax/huawei_metis",
"id": "e8440c601bec22566ee7af73fb2d4eb9496027bf",
"size": ... |
from pyrates.utility.grid_search import ClusterWorkerTemplate
import os
from pandas import DataFrame
from pyrates.utility import grid_search, welch
import numpy as np
from copy import deepcopy
class MinimalWorker(ClusterWorkerTemplate):
def worker_postprocessing(self, **kwargs):
self.processed_results = D... | {
"content_hash": "dff99698dc921a0a4b06bb315ea76e16",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 165,
"avg_line_length": 41.17910447761194,
"alnum_prop": 0.6219644798840159,
"repo_name": "Richert/BrainNetworks",
"id": "0846122cfd534c1bee41c641c90d7d2a974cea7a",
"size":... |
class LinkedListNode:
def __init__(self, value):
self.value = value
self.next = None
a = LinkedListNode("Angel Food")
b = LinkedListNode("Bundt")
c = LinkedListNode("Cheese")
d = LinkedListNode("Devil's Food")
e = LinkedListNode("Eccles")
a.next = b
b.next = c
c.next = d
d.next = e
def kth_to_l... | {
"content_hash": "dd36337d4f2a2e0cb1d6ceb8774d0ee1",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 86,
"avg_line_length": 25.80597014925373,
"alnum_prop": 0.6124927703875073,
"repo_name": "howardwkim/ctci",
"id": "5bd294830f1e98bc1c37d79e4f47cbea00e48f4c",
"size": "1729"... |
"""
WSGI config for FestPal_server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | {
"content_hash": "bf241fcb15c676a911259ae2e95b495b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.3125,
"alnum_prop": 0.7728395061728395,
"repo_name": "amentis/FestPal-Server",
"id": "95db95f63e4ab3c0bb279767ad8ed18825de9600",
"size": "405",
... |
import pytest
from browserstacker import ScreenShotsAPI
from .constants import BROWSERSTACK_USER, BROWSERSTACK_KEY
@pytest.yield_fixture()
def screenshoter(request):
"""
Instance of ScreenShotsAPI, parametrized with desired capabilities.
"""
if hasattr(request, 'param'):
browser = request.par... | {
"content_hash": "f0f7cbeb143c29e0958f24c390a232c6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 86,
"avg_line_length": 26.72222222222222,
"alnum_prop": 0.7193347193347194,
"repo_name": "Stranger6667/pytest-browserstack",
"id": "4129fdcc06d5239b67d23676a19d84ecd109b7f8",... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterpolar.marker.colorbar"
_path_str = "scatterpolar.marker.colorbar.tickformatstop"
... | {
"content_hash": "de4b39eba160c58a0e42745363485570",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 88,
"avg_line_length": 33.91166077738516,
"alnum_prop": 0.5645514223194749,
"repo_name": "plotly/plotly.py",
"id": "61eeba82553ab1f2d61924463d86311076ac073e",
"size": "959... |
class BuscacursoscrawlerPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "2051473749a96720991539103db24c7d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.7211538461538461,
"repo_name": "rpalmaotero/buscacursos-crawler",
"id": "091512babbedc958064a2d308632f53d9ed765c1",
... |
"""POSIX specific tests. These are implicitly run by test_psutil.py."""
import unittest
import subprocess
import time
import sys
import os
import datetime
import psutil
from test_psutil import (get_test_subprocess, reap_children, PYTHON, LINUX, OSX,
ignore_access_denied, sh)
def ps(cmd):
... | {
"content_hash": "a3ad40d93ce446f9b3d815e63fb394f4",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 84,
"avg_line_length": 38.566473988439306,
"alnum_prop": 0.595773381294964,
"repo_name": "tamentis/psutil",
"id": "4f6eae690cbf5c7a13c8925d10e3e83bd58c1cf2",
"size": "6881... |
"""
Testing the elmr.utils module
"""
##########################################################################
## Imports
##########################################################################
import unittest
from dateutil.tz import tzutc
from elmr.utils import classproperty
from datetime import datetime, time... | {
"content_hash": "1b73ccec02b30b72505239f6affaf3f0",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 74,
"avg_line_length": 28.522935779816514,
"alnum_prop": 0.508201994210357,
"repo_name": "bbengfort/jobs-report",
"id": "1fef334207449111e32c8070bf64dd18f457874f",
"size":... |
__all__ = ["data_sunspot", "data_synthetic", "data_random"] | {
"content_hash": "9e79d150968cb0dcd933156775180573",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 59,
"avg_line_length": 59,
"alnum_prop": 0.6271186440677966,
"repo_name": "aaskov/nsp",
"id": "e0b2a3b597144b956472550ebc46f75506d6575b",
"size": "59",
"binary": false,
... |
import contextlib
from neutron_lib import constants as n_consts
import webob.exc
from neutron.api import extensions
from neutron.common import config
from neutron import context
import neutron.extensions
from neutron.extensions import metering
from neutron.plugins.common import constants
from neutron.services.meterin... | {
"content_hash": "c776d175527b1eff694bb7a05da971d2",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 79,
"avg_line_length": 42.5527950310559,
"alnum_prop": 0.5091957378484893,
"repo_name": "igor-toga/local-snat",
"id": "594a3c4a1a0ca9efc718b22aa738e7e313cc6c38",
"size": "... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetComputer',
'Author': ['@harmj0y'],
'Description': ('Queries the domain for current computer objects. Part of PowerView.'),
'Background' : ... | {
"content_hash": "66444749b38749fd85e1480a0f15304d",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 121,
"avg_line_length": 37.588235294117645,
"alnum_prop": 0.4624413145539906,
"repo_name": "cobbr/ObfuscatedEmpire",
"id": "94d2fc1ac48dae3cb553cb17f7818838ad0c37df",
"siz... |
"""
==================================================
Test Images and Image Creation (:mod:`mango.data`)
==================================================
.. currentmodule:: mango.data
Functions for generating images with content.
Functions
=========
.. autosummary::
:toctree: generated/
fill_annular_circ... | {
"content_hash": "dd52dc338bb5d7714ce949a9c0eead75",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 125,
"avg_line_length": 36.45161290322581,
"alnum_prop": 0.6619469026548672,
"repo_name": "pymango/pymango",
"id": "00d67cc3ded74c1f7cfc44f26d8f68bb9d92ba51",
"size": "1130... |
"""
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Lars Buitinck
# Simon Wu <s8wu@uwaterloo.ca>
imp... | {
"content_hash": "36f95aeb1cc3361f94da60921258abf6",
"timestamp": "",
"source": "github",
"line_count": 1675,
"max_line_length": 81,
"avg_line_length": 39.57492537313433,
"alnum_prop": 0.6025223268163167,
"repo_name": "marcocaccin/scikit-learn",
"id": "70086b35543d3712beb647fe6e25425b206d0da1",
"si... |
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
# Define these once; use them twice!
strFrom = 'from@example.com'
strTo = 'to@example.com'
# Create the root message and fill in the from, to, and subject headers
msgRoot = MIMEMultipart('related')
... | {
"content_hash": "05f0e13d9543de57115bd710769074ce",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 108,
"avg_line_length": 35.04651162790697,
"alnum_prop": 0.7577969475779694,
"repo_name": "ActiveState/code",
"id": "75acb55d4d4fc5f273dae137d51593b72b8b4bb1",
"size": "163... |
"""Renewable certificates storage."""
import datetime
import logging
import os
import re
import configobj
import parsedatetime
import pytz
from letsencrypt import constants
from letsencrypt import crypto_util
from letsencrypt import errors
from letsencrypt import error_handler
from letsencrypt import le_util
logger ... | {
"content_hash": "be7bfeb158bf968f222218da9a090907",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 86,
"avg_line_length": 41.85024154589372,
"alnum_prop": 0.6243218284658895,
"repo_name": "TheBoegl/letsencrypt",
"id": "6786ac7450bee4d35231cbc95d4475776cd364f6",
"size": ... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Rank.slug'
db.add_column(u'dojo_rank', 'slug',
self.gf('autoslug.fields.AutoSlugField')(defaul... | {
"content_hash": "cfb3a0d243fd317c4515e6a4025f111b",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 187,
"avg_line_length": 72.95238095238095,
"alnum_prop": 0.5452567449956484,
"repo_name": "powellc/django-belts",
"id": "60eb665e5c5acefbd55d4db9cc7ca7030ef6f06e",
"size":... |
from setuptools import setup
setup(name='devmason_server',
version='1.0pre-20091019',
description='A Django implementation of a the pony-build server.',
author = 'Eric Holscher, Jacob Kaplan-Moss',
url = 'http://github.com/ericholscher/devmason-server',
license = 'BSD',
packages = [... | {
"content_hash": "7fc793e3d2136ee1627504d6ee5b3978",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.563953488372093,
"repo_name": "ericholscher/devmason-server",
"id": "721dc3033bbd6d960ca8c738906019657ee766f4",
"... |
from django.views.generic.base import TemplateView
class SlatesListView(TemplateView):
template_name = 'slates/slates_list.html'
| {
"content_hash": "4da5b853d7adc11b1b09e7d7d5dbd9fb",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 50,
"avg_line_length": 27,
"alnum_prop": 0.7925925925925926,
"repo_name": "sunpig/django-assets-build-example",
"id": "48e224aaa7944a78d7a359d6317b20bb6a338a89",
"size": "13... |
import ibis.expr.operations as ops
from . import helpers
def substring(translator, expr):
op = expr.op()
arg, start, length = op.args
arg_formatted = translator.translate(arg)
start_formatted = translator.translate(start)
# Impala is 1-indexed
if length is None or isinstance(length.op(), ops... | {
"content_hash": "89b0a90573b2148fad028fabd8c40ead",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 70,
"avg_line_length": 29.19,
"alnum_prop": 0.6135662898252826,
"repo_name": "cloudera/ibis",
"id": "06a96e48aa550371111ba958bce0075005cbc5d0",
"size": "2919",
"binary":... |
"""
Emit a file suitible to include() in a CMakeLists.txt file
with information from a python interpreter
Compatible for python 2.6 -> 3.4
"""
from __future__ import print_function
import sys, os
if len(sys.argv)<2:
out = sys.stdout
else:
out = open(sys.argv[1], 'w')
from distutils.sysconfig import get_con... | {
"content_hash": "bd409db548ea7a160c661f72c1619d8f",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 105,
"avg_line_length": 32.25454545454546,
"alnum_prop": 0.7125140924464487,
"repo_name": "frib-high-level-controls/FLAME",
"id": "ba95c91af05a0a442c60ba9a2d79bde2d4471b8f",
... |
from org.gluu.service.cdi.util import CdiUtil
from org.gluu.oxauth.security import Identity
from org.gluu.model.custom.script.type.auth import PersonAuthenticationType
from org.gluu.oxauth.service import UserService, AuthenticationService
from org.gluu.util import StringHelper
class PersonAuthentication(Pers... | {
"content_hash": "0a4e8ba3ecefb911b624d6b664b77214",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 107,
"avg_line_length": 37.56842105263158,
"alnum_prop": 0.6626506024096386,
"repo_name": "GluuFederation/oxAuth",
"id": "5a03b4d483765e9e3b7633676ccfabf17d93b945",
"size":... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "sandboxes.fancypages.sandbox.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "1fa20e5889f0a6e8a30be10662ec12fa",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 74,
"avg_line_length": 25.8,
"alnum_prop": 0.7015503875968992,
"repo_name": "socradev/django-fancypages",
"id": "5189e7610ba8298439613c5201823e600cdd5eb0",
"size": "280",
... |
"""
test_dashboard:
==========
A module intended for use with Nose.
"""
from __future__ import absolute_import
from unittest import TestCase
from _plotly_utils.exceptions import PlotlyError
import chart_studio.dashboard_objs.dashboard_objs as dashboard
class TestDashboard(TestCase):
def test_invalid_path(self)... | {
"content_hash": "85c7e162e4248f1796971d79241bbb78",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 86,
"avg_line_length": 28.58108108108108,
"alnum_prop": 0.45602836879432623,
"repo_name": "plotly/python-api",
"id": "623420941a200ce9d931fa4528dc3e27324932ca",
"size": "4... |
"""forms.py: appsearch forms"""
import operator
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.db.models.fields import BLANK_CHOICE_DASH
from django.forms import ValidationError
from django.forms.formsets import BaseFormSet
import dateutil.parser
class ModelSelectio... | {
"content_hash": "cd23dd1974df5e51a1bf1ffd1c8a6538",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 100,
"avg_line_length": 39.32786885245902,
"alnum_prop": 0.6217173822426011,
"repo_name": "pivotal-energy-solutions/django-appsearch",
"id": "b286c3d61d2ee153959235c6193a347... |
import logging
import random
from django.conf import settings
from django.db import transaction, IntegrityError
from django.utils import timezone
from share import exceptions
from share.harvest.exceptions import HarvesterConcurrencyError
from share.models import (
HarvestJob,
IngestJob,
NormalizedData,
... | {
"content_hash": "5d06b1c58e96126ca5274109eb184cd5",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 130,
"avg_line_length": 39.985955056179776,
"alnum_prop": 0.5939585528626624,
"repo_name": "aaxelb/SHARE",
"id": "bbf391c0709efc57c72c06be0d1ced35054444dd",
"size": "14235... |
#
# GaloisBenchmark.py
#
# Author(s):
# Alessio Parma <alessio.parma@gmail.com>
#
# Copyright (c) 2012-2016 Alessio Parma <alessio.parma@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal... | {
"content_hash": "35a6c386356aa3ee91f7e3691ba85d41",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 98,
"avg_line_length": 43.297872340425535,
"alnum_prop": 0.7007371007371007,
"repo_name": "pomma89/Dessert",
"id": "ce9fe3eb3030a7e54c223670219f81af0b30c428",
"size": "2037... |
from __future__ import unicode_literals
from django.db import migrations, models
import shop.models
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='product',
name='image',
... | {
"content_hash": "f07ef7c4e2501f1585fa786bc455a6b2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 158,
"avg_line_length": 25.842105263157894,
"alnum_prop": 0.6476578411405295,
"repo_name": "uppsaladatavetare/foobar-api",
"id": "16bc97b57448a0b3114520b02f103aa831386b67",
... |
"""
WSGI config for web_dev_final_project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.djang... | {
"content_hash": "6092c3b845659522235e91574b59ac90",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.7933070866141733,
"repo_name": "shintouki/augmented-pandemic",
"id": "77ceae98f4f514195549f7bd116a4f06407744f3",
"... |
import os
vars = {
'cube_sdk_version': '1.0.43-SNAPSHOT'
}
files = [
'README.md',
'README-cn.md',
'core/pom.xml',
'core/gradle.properties',
]
current_dir = os.path.dirname(os.path.realpath(__file__))
print current_dir
src_dir = current_dir + '/template/'
dst_dir... | {
"content_hash": "93db9dd9e230c77bedbb6dd0c7dff775",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 64,
"avg_line_length": 24.216216216216218,
"alnum_prop": 0.5736607142857143,
"repo_name": "muxiaolin/cube-sdk-dev",
"id": "44d3e6c14a24bbf0fe4e3931bf5bfe3a3edc831f",
"size"... |
"""Test forms."""
from app.public.forms import LoginForm
from app.user.forms import RegisterForm
class TestRegisterForm:
"""Register form."""
def test_validate_user_already_registered(self, user):
"""Enter username that is already registered."""
form = RegisterForm(username=user.username, em... | {
"content_hash": "0ce8a1ec166bb181e35f06508577a68b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 74,
"avg_line_length": 36.417910447761194,
"alnum_prop": 0.6331967213114754,
"repo_name": "iulian4ik/HeroesOfProgramming",
"id": "c701fb750f115b28db5d02b45bd16211e56764c0",
... |
from ._base import *
# DJANGO ######################################################################
ALLOWED_HOSTS = ('*', )
CACHES['default'].update({'BACKEND': 'redis_lock.django_cache.RedisCache'})
CSRF_COOKIE_SECURE = False # Don't require HTTPS for CSRF cookie
SESSION_COOKIE_SECURE = False # Don't require HTT... | {
"content_hash": "6c79e338c99340605d33f10d100db8b0",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 30.525641025641026,
"alnum_prop": 0.6157076858462831,
"repo_name": "ic-labs/django-icekit",
"id": "5374edf32e59aeabd8e8d174caee05fbc44f6271",
"size":... |
from murano.db import models
from murano.db import session as db_session
from murano.services import actions
from murano.services import states
class SessionServices(object):
@staticmethod
def get_sessions(environment_id, state=None):
"""Get list of sessions for specified environment.
:param ... | {
"content_hash": "ae204b649226fd92055e90aa1bd1598e",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 78,
"avg_line_length": 36.83177570093458,
"alnum_prop": 0.6536412078152753,
"repo_name": "openstack/murano",
"id": "3167eaeb0ed1028e4e2da530accc3f36fbe47fe1",
"size": "455... |
"""
Test script for the 'cmd' module
Original by Michael Schneider
"""
import cmd
import sys
import re
import unittest
import io
from test import support
class samplecmdclass(cmd.Cmd):
"""
Instance the sampleclass:
>>> mycmd = samplecmdclass()
Test for the function parseline():
>>> mycmd.parseli... | {
"content_hash": "8ed7a71469bc3b19350440888b67221a",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 76,
"avg_line_length": 25.765432098765434,
"alnum_prop": 0.5547037214502476,
"repo_name": "batermj/algorithm-challenger",
"id": "dd8981f8935b96a3462245fc2bb67478388a72e4",
... |
import os
from config import *
#Zdope_command = "/usr/local/bin/Zdope"
def get_dope_score(pdb_file):
result = os.popen("{0} {1}".format(Zdope_command, pdb_file))
result_lines = [l.strip() for l in result]
score_line = result_lines[-2]
return float(score_line.strip().split(":")[1])
| {
"content_hash": "da8264bd2e3683475220b130c0f9f52b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 30,
"alnum_prop": 0.65,
"repo_name": "Bolt64/ProtAnneal",
"id": "b6e3462d9229c50762ac328b8fe8d887b680375c",
"size": "323",
"binary": false,
"copi... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os.path
import sys
import numpy as np
import tensorflow as tf
from tfrecords_io import get_padded_batch
from tfrecords_io import get_spliced_batch
from tf_datasets import SequenceDatase... | {
"content_hash": "eb5509c0e53daea6874506a832b471d1",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 84,
"avg_line_length": 35.81363636363636,
"alnum_prop": 0.5501967254727758,
"repo_name": "npuichigo/voicenet",
"id": "f8b8b37548588dfdcedf5504a6b3c9cf29be295b",
"size": "8... |
from django.apps import AppConfig
class ImageboardConfig(AppConfig):
name = 'imageboard'
default_app_config = 'imageboard.apps.ImageboardConfig'
| {
"content_hash": "25abcb7e6d7f146b15ecd6979c89c16d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 19.125,
"alnum_prop": 0.7777777777777778,
"repo_name": "andrewnsk/dorokhin.moscow",
"id": "c27bb2f954eb55cf06759e4ed8fb2d2f9f25d8f4",
"size": "153",
... |
from pathlib import Path
from typing import Optional
from semver import VersionInfo
import virtool.github
def format_hmm_release(
updated: Optional[dict], release: dict, installed: dict
) -> Optional[dict]:
# The release dict will only be replaced if there is a 200 response from GitHub. A 304 indicates the ... | {
"content_hash": "1c3b83193555de6ffd89f379f2a9c9b9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 112,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6570135746606335,
"repo_name": "igboyes/virtool",
"id": "30348a5eff5674f2c3b226d9237d7cf5d7f82519",
"size": "110... |
from __future__ import print_function, division
#
import sys,os
quspin_path = os.path.join(os.getcwd(),"../../")
sys.path.insert(0,quspin_path)
#
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.basis import spin_basis_1d # Hilbert space spin basis
from quspin.tools.measurements import ... | {
"content_hash": "86775e868c793f9dcbc26dc62a587132",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 90,
"avg_line_length": 35.513513513513516,
"alnum_prop": 0.7267884322678844,
"repo_name": "weinbe58/QuSpin",
"id": "4389f6f5459e0e0c071f9a1a752f88ad60f2ddc4",
"size": "1314... |
"""Functions concerning tournament graphs.
A `tournament graph`_ is a complete oriented graph. In other words, it
is a directed graph in which there is exactly one directed edge joining
each pair of distinct nodes. For each function in this module that
accepts a graph as input, you must provide a tournament graph. The... | {
"content_hash": "d0770a5b9569ad10311bc5ff685d0426",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 81,
"avg_line_length": 29.970674486803517,
"alnum_prop": 0.6430528375733855,
"repo_name": "Sixshaman/networkx",
"id": "dfcb3d115e657961db6914b743714a1c042b7089",
"size": "... |
from oslo_config import cfg
from oslo_log import log as logging
from murano.common.i18n import _
from murano import version
paste_deploy_opts = [
cfg.StrOpt('flavor', help='Paste flavor'),
cfg.StrOpt('config_file', help='Path to Paste config file'),
]
bind_opts = [
cfg.StrOpt('bind-host', default='0.0.0.... | {
"content_hash": "eee34294ebf8118550e764b0e859e400",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 79,
"avg_line_length": 37.89716312056738,
"alnum_prop": 0.5979227098343782,
"repo_name": "olivierlemasle/murano",
"id": "63d3e8babe0f65b08e7a450d59e09b5678615e60",
"size":... |
from __future__ import division
from numpy import sqrt, mean, absolute, real, conj
def rms_flat(a):
"""
Return the root mean square of all the elements of *a*, flattened out.
"""
return sqrt(mean(absolute(a)**2))
def rms_fft(spectrum):
"""
Use Parseval's theorem to find the RMS value of a si... | {
"content_hash": "0fd19abc36bc55231352fc76cc1089ce",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 25.98611111111111,
"alnum_prop": 0.6130411544628541,
"repo_name": "sthenc/bss_tester",
"id": "c3d55d7a2707efee4d298a70b3055837801a641c",
"size": "189... |
"""
`Unit tests for cargo.expressions.Case`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
2016 Jared Lunde © The MIT License (MIT)
http://github.com/jaredlunde
"""
import unittest
from cargo import fields, ORM, safe
from cargo.expressions import Case
from unit_tests import ... | {
"content_hash": "1b74e5d49c402940cf3bdaca2f8dfd3c",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 35.208333333333336,
"alnum_prop": 0.49644970414201184,
"repo_name": "jaredlunde/cargo-orm",
"id": "5745ffb6f33fb9d0be2d8c52ed52cc0e61908096",
"size":... |
"""
Management class for basic VM operations.
"""
import functools
import os
import time
from eventlet import timeout as etimeout
from os_win import constants as os_win_const
from os_win import exceptions as os_win_exc
from os_win.utils.io import ioutils
from os_win import utilsfactory
from oslo_concurrency import pro... | {
"content_hash": "8baba9630252b7bd21af1cba59dd2fe5",
"timestamp": "",
"source": "github",
"line_count": 755,
"max_line_length": 79,
"avg_line_length": 42.8887417218543,
"alnum_prop": 0.5627065254315803,
"repo_name": "dims/nova",
"id": "ebf83f59fca2a669284068dec87ab7309d55a233",
"size": "33056",
"... |
"""
Copyright (c) 2017 Russell Harkanson
See the file LICENSE.txt for copying permission.
""" | {
"content_hash": "65bad07259fdbe646a606a1554e2043f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 18.8,
"alnum_prop": 0.7446808510638298,
"repo_name": "rharkanson/pyriscope",
"id": "6d574f246546c91ddcf7d3f63fd85766cef03c0d",
"size": "94",
"binary... |
"""
Module to set up run time parameters for Clawpack.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import datetime
import shutil
import gzip
import numpy... | {
"content_hash": "f30204b2a25b2f5f418cb0e6b20ba4b8",
"timestamp": "",
"source": "github",
"line_count": 475,
"max_line_length": 98,
"avg_line_length": 33.90315789473684,
"alnum_prop": 0.5869349230004968,
"repo_name": "mandli/surge-examples",
"id": "500f330e450e95ca6c35d75c41207dab741e2ea4",
"size":... |
from typing import List, Tuple
from phi import math
from . import GridCell
from ._geom import Geometry
from ..math import Tensor, expand
from ..math._shape import shape_stack, Shape, INSTANCE_DIM, non_channel
from ..math._magic_ops import variable_attributes, copy_with
from ..math.magic import slicing_dict
class Geo... | {
"content_hash": "318d814e76659462586796f29e227b2b",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 106,
"avg_line_length": 38.49514563106796,
"alnum_prop": 0.6567465321563682,
"repo_name": "tum-pbs/PhiFlow",
"id": "7c972392b7a084a73c5f1c9b50c412dcce6dc8cd",
"size": "396... |
from django.urls import path
from django.views.generic.base import RedirectView
from ..views import facultad
urlpatterns = [
# Portada de materias
path('',
facultad.HomePageView.as_view(),
name='home'),
path('materias/',
RedirectView.as_view(url='/facultad/'),
name='m... | {
"content_hash": "ab5987599599f7d6afe2d51c5ec940b5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 50,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.6107784431137725,
"repo_name": "maru/fiubar",
"id": "c23cb87b779d1dfb8550ff8d4b4dc78c00ae7669",
"size": "692",
... |
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | {
"content_hash": "27f43328dfb16c3159a7e5a514d07e64",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 166,
"avg_line_length": 43.707317073170735,
"alnum_prop": 0.6629464285714286,
"repo_name": "dbiesecke/dbiesecke.github.io",
"id": "bbbb957f4f1d6c5857f54d1068e13df83aae3ef9",
... |
""" Test the simple random number generator. """
import os
import shutil
import time
import unittest
import rnglib
TEST_DIR = 'tmp'
class TestSimpleRNG(unittest.TestCase):
""" Test the simple random number generator. """
def setUp(self):
now = time.time()
self.rng = rnglib.SimpleRNG(now)
... | {
"content_hash": "36863c6f6583980d355e84f1566749f1",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 76,
"avg_line_length": 32.15337423312884,
"alnum_prop": 0.5682121732493799,
"repo_name": "jddixon/rnglib",
"id": "d8802994cb813fe9d130495c1bac6bec1966298a",
"size": "5284"... |
"""This module provides backwards compatibility for RelatedObject."""
# flake8: noqa
try:
# Django <= 1.7
from django.db.models.related import RelatedObject
except:
# Django >= 1.8
# See: https://code.djangoproject.com/ticket/21414
from django.db.models.fields.related import (
ForeignObject... | {
"content_hash": "4e24feaa6fb49d00dcfb4c25ff202eeb",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.6974063400576369,
"repo_name": "AltSchool/dynamic-rest",
"id": "9e9bcb28cd00f2545ba60d93b95bf7148ef8d804",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.