text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import collections
import json
import os
import pickle
import gym
import ray
from ray.rllib.agents.registry import get_agent_class
from ray.rllib.env import MultiAgentEnv
from ray.rllib.env.bas... | {
"content_hash": "2fc22bc492858a32bd64063f91edb3ae",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 78,
"avg_line_length": 36.732394366197184,
"alnum_prop": 0.5878067484662577,
"repo_name": "ujvl/ray-ng",
"id": "f7ea31e966e25fb9da0b6f5256646ebd2078ce39",
"size": "7847",
... |
import json, shutil, cPickle, os, csv
import numpy as np
import preprocessors.fft as fft
from pandas import read_csv
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from theano import config
from pandas import DataFrame
from cnn.conv_net import ConvNet
from utils.loader import load_test_data
from utils.c... | {
"content_hash": "53967916c81a94d87bdec578351460e6",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 105,
"avg_line_length": 38.490566037735846,
"alnum_prop": 0.6323529411764706,
"repo_name": "IraKorshunova/kaggle-seizure-prediction",
"id": "2cd6c961ccfbe741eaa88d455cdf3077... |
from django.http import HttpResponse, Http404
from django.template import Context
from django.contrib.sites.models import Site
from listings.syndication.models import Feed
from listings.models import POSTING_ACTIVE
def display_feed(request, feed_url):
site = Site.objects.get_current()
try:
feed = sit... | {
"content_hash": "03840c7baeec84c9ec487cbb406d72b2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 81,
"avg_line_length": 34.94117647058823,
"alnum_prop": 0.7457912457912458,
"repo_name": "wtrevino/django-listings",
"id": "60fc9ca97ab6b601687dce3e3774c805a518e1e2",
"size... |
import os
import shutil
import glob
from PIL import Image
def parser():
rootDir = str(input("Informe o diretório de origem:\n"))
destDir = str(input("Informe o diretório de destino:\n"))
for dirName, subdirList, fileList in os.walk(rootDir):
print("Diretório encontrado: %s" % dirName)
has_... | {
"content_hash": "2c5319e2000257091d3ed10256d3d985",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 286,
"avg_line_length": 38.61417322834646,
"alnum_prop": 0.550978792822186,
"repo_name": "LADOSSIFPB/nutrif",
"id": "097844d06fa6f73445a080c7af0e84ad1e47746e",
"size": "49... |
"""Hparams for model architecture and trainer."""
import ast
from collections import abc
import copy
from typing import Any, Dict, Text
import six
import tensorflow as tf
import yaml
def eval_str_fn(val):
if val in {'true', 'false'}:
return val == 'true'
try:
return ast.literal_eval(val)
except (ValueEr... | {
"content_hash": "bc4e720409f05b2fa0227977b2948d51",
"timestamp": "",
"source": "github",
"line_count": 475,
"max_line_length": 118,
"avg_line_length": 30.541052631578946,
"alnum_prop": 0.5863376301096023,
"repo_name": "tensorflow/examples",
"id": "bfa0d7e2ee297fb79a00a09b581700c7ef78bfa7",
"size":... |
from flask_turboduck.auth import Auth
from app import app, db
from models import User
# Authentication wrapper for TurboDuck
auth = Auth(app, db, user_model=User)
| {
"content_hash": "dbbf8926b081d7943cdd5afb080b975c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.7818181818181819,
"repo_name": "DommertTech/flask-turnkey",
"id": "911c4d016f82a2443d64c6cdd27c892eac674dab",
"siz... |
import inspect
import types
import sys
from pkg_resources import get_distribution, DistributionNotFound
__title__ = 'implements'
__author__ = ('Kamil Sindi <ksindi@ksindi.com>, '
'Praveen G Shirali <praveengshirali@gmail.com>')
__license__ = 'Apache License, Version 2.0'
try:
__version__ = get_di... | {
"content_hash": "2cd703498dc1bbc3ff24ba21abd6d018",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 35.28846153846154,
"alnum_prop": 0.5816076294277929,
"repo_name": "ksindi/implements",
"id": "247df22a587eaf6a491d12c1b3edb4a953df3560",
"size": "79... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Folder'
db.create_table('documents_folder', (
('object_ptr', self.gf('django.db.models.fields.re... | {
"content_hash": "77ea38625d047b7e53add1ad8ac04981",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 203,
"avg_line_length": 71.8562874251497,
"alnum_prop": 0.5621666666666667,
"repo_name": "alejo8591/maker",
"id": "599ae52a2f18e45703a1345c7f5ac47999fbac44",
"size": "1213... |
from enum import auto, Enum
from collections import defaultdict
from dataclasses import dataclass, field
from datetime import datetime
from typing import Dict, List, Optional
from rdr_service.model.questionnaire_response import QuestionnaireResponseAnswer, QuestionnaireResponseStatus
class ParticipantResponses:
... | {
"content_hash": "32000e31b6343c904e0a1e581b16321a",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 114,
"avg_line_length": 33.37931034482759,
"alnum_prop": 0.6309400826446281,
"repo_name": "all-of-us/raw-data-repository",
"id": "cd434df44df00c1adb54cdd9c1923cd380c428ff",
... |
"""
minimize the total (weighted) travel cost for servicing
a set of customers from k facilities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
import math
import random
from pyscipopt import Model, quicksum, multidict
def kmedian(I,J,c,k):
"""kmedian -- minimize total cost of servicing customers f... | {
"content_hash": "fd7babe82d88c895793393c946b29e87",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 96,
"avg_line_length": 31.12727272727273,
"alnum_prop": 0.572429906542056,
"repo_name": "SCIP-Interfaces/PySCIPOpt",
"id": "db191081061414463971c0c60682d4c673fb1bb8",
"siz... |
from .repoclass import *
from .helpers import *
# Repository Eudat b2share Sandbox
HOST = "https://trng-b2share.eudat.eu/api" # api base url
ID = "b2share_sandbox"
LABEL = "b2share Sandbox"
class RepoClassEudat(Repo):
def get_host(self):
return str(HOST)
def get_label(self):
return str(LABE... | {
"content_hash": "340eb52213207a368574a4ef87ebee16",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 138,
"avg_line_length": 43.84905660377358,
"alnum_prop": 0.4961273666092943,
"repo_name": "o2r-project/o2r-shipper",
"id": "15e10dc92a5b87beb2c1b32be75e6ccc5c8425d3",
"siz... |
from __future__ import absolute_import, unicode_literals
from wsgi.app import app
class Message(object):
""" Represent a message to show to the user """
def __init__(self, message, level):
self.message = message
self.level = level
def __str__(self):
return self.message
def add... | {
"content_hash": "0592669ef9f104e3e4f88b03eaa0ce21",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 56,
"avg_line_length": 18.323529411764707,
"alnum_prop": 0.6581059390048154,
"repo_name": "Gagaro/PimpMyBot",
"id": "f7fd5218c50d2327c946c1834c84342a66f83131",
"size": "623... |
"""
ASN.1 type classes for the time stamp protocol (TSP). Exports the following
items:
- TimeStampReq()
- TimeStampResp()
Also adds TimeStampedData() support to asn1crypto.cms.ContentInfo(),
TimeStampedData() and TSTInfo() support to
asn1crypto.cms.EncapsulatedContentInfo() and some oids and value parsers to
asn1cr... | {
"content_hash": "b18fbebdcbdb964514d39b27bb53616d",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 101,
"avg_line_length": 26.15909090909091,
"alnum_prop": 0.6174754871540276,
"repo_name": "todaychi/hue",
"id": "ac73821bc912eef3b4b3eaf88fd2697093f21b5d",
"size": "8074",... |
import logging
from contextlib import contextmanager
from pathlib import Path
from typing import Dict, Set, Tuple
from airflow.configuration import conf
log = logging.getLogger(__name__)
# TODO(potiuk) change the tests use better approach sing Pytest fixtures rather than
# `unit_test_mode` parameter. It... | {
"content_hash": "205924724bad84ab6b2469f9d123f41f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 106,
"avg_line_length": 29.774193548387096,
"alnum_prop": 0.7009750812567714,
"repo_name": "danielvdende/incubator-airflow",
"id": "4728d33b4bd7dd716d28ca7148bf29383410564e",... |
from cloudkittyclient.common import base
class BaseAttributeMixin(object):
def _validate_attribute(self, attribute):
attr = getattr(self, attribute)
if attr:
kwargs = {attribute: attr}
return kwargs
def _get_resource(self, mgr, attribute):
kwargs = self._valida... | {
"content_hash": "5d59236e05010bcd59a46ed184e24ca4",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 25.210884353741495,
"alnum_prop": 0.6548839719373988,
"repo_name": "muraliselva10/python-cloudkittyclient",
"id": "85f4d00249e2d0dcf77cf70b38d888ab227... |
"""SVG handling utilities."""
def svg2str(display_object, dpi=300):
"""
Serializes a nilearn display object as a string
"""
from io import StringIO
image_buf = StringIO()
display_object.frame_axes.figure.savefig(
image_buf, dpi=dpi, format="svg", facecolor="k", edgecolor="k"
)
... | {
"content_hash": "aa4e6f9d10ff925cbdf839512dea6dbf",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 87,
"avg_line_length": 31.183908045977013,
"alnum_prop": 0.5665315149281238,
"repo_name": "poldracklab/mriqc",
"id": "076ea35de93e90b5ab5f47f9ee9fd391b106c821",
"size": "35... |
"""Tests for jax_cfd.grids."""
# TODO(jamieas): Consider updating these tests using the `hypothesis` framework.
from absl.testing import absltest
from absl.testing import parameterized
import jax
import jax.numpy as jnp
from jax_cfd.base import boundaries
from jax_cfd.base import grids
from jax_cfd.base import test_u... | {
"content_hash": "4f74084dcc83b009421ed300ccba957c",
"timestamp": "",
"source": "github",
"line_count": 705,
"max_line_length": 80,
"avg_line_length": 37.65815602836879,
"alnum_prop": 0.606651851293834,
"repo_name": "google/jax-cfd",
"id": "fd17b90c70aae182a2f89c545b4da53530806d20",
"size": "27124"... |
from processmonitor import ProcessIOMonitor
from processperfmonitor import ProcessPerfMonitor
| {
"content_hash": "baaaf14e1733c17059bc60b4a63993bb",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 49,
"avg_line_length": 47,
"alnum_prop": 0.9148936170212766,
"repo_name": "pombredanne/air",
"id": "4bb154a3c2d28bd69eac3920bed3cd5e7ed1ae58",
"size": "94",
"binary": fals... |
import pytest
import numpy as np
import os
import matplotlib
from distutils.spawn import find_executable
from astropy.coordinates import SkyCoord
from astropy import units
from astropy.wcs import WCS
from astropy.io import fits
from frb.figures import finder
remote_data = pytest.mark.remote_data
def data_path(fi... | {
"content_hash": "41aafcc551d73086e1c89ae5c61f9659",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 94,
"avg_line_length": 29.607843137254903,
"alnum_prop": 0.6225165562913907,
"repo_name": "FRBs/FRB",
"id": "3b07f888d10a1ccfe6053a803a8917ab84b146ac",
"size": "1536",
"b... |
from pprint import pprint
from hpOneView.oneview_client import OneViewClient
from hpOneView.exceptions import HPOneViewException
from config_loader import try_load_from_file
config = {
"ip": "172.16.102.59",
"credentials": {
"userName": "administrator",
"password": ""
}
}
# Try load config... | {
"content_hash": "8e534c2cae377d9fe4a595399d9491bd",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 76,
"avg_line_length": 30.448275862068964,
"alnum_prop": 0.7149867874669686,
"repo_name": "danielreed/python-hpOneView",
"id": "da634d5dfeeaef14156d147b66d6b9bfb1cca30c",
"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0111_auto_20200830_1753'),
]
operations = [
migrations.AlterField(
model_name='book',
name='icon_style',
field=models.CharField(blank=True, cho... | {
"content_hash": "b69d97eb47b22fcb740dbf61c744c85b",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 214,
"avg_line_length": 54.411764705882355,
"alnum_prop": 0.5113513513513513,
"repo_name": "flavoi/diventi",
"id": "60608643b48f5db86583ecdb4eede5f3d195d830",
"size": "2825... |
from classes import Command, FakeCommand
from wireutils import color_print, format, ansi_colors
import nbtencoder as nbt
def ride(entities, have_id=True):
bottommost = None
absoluteBottommost = None
for entity in entities[::-1]:
if bottommost == None:
absoluteBottommost = entity
else:
bottommost["Passeng... | {
"content_hash": "a7a08b3fbfd584da4ef6f5ab6d8cee26",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 111,
"avg_line_length": 31.53211009174312,
"alnum_prop": 0.6947919697410533,
"repo_name": "destruc7i0n/OneCommand",
"id": "a1d879f79db8714b4855c5ccf07366b548a890aa",
"size... |
from pybeats.api import BeatsAPI
class Base(object):
type = "unknown"
fields = []
refs = []
def __init__(self, **data):
self._update_from_data(data)
def _update_from_data(self, data):
self._update_fields_from_data(data)
self._update_refs_from_refs(data.get('refs', []))
... | {
"content_hash": "3ed04ead5eb2fd5cbb0d716fd49c1e9a",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 147,
"avg_line_length": 30.564102564102566,
"alnum_prop": 0.5612416107382551,
"repo_name": "imsparsh/pybeats",
"id": "b9dc9c95392d6c6db3e05b5aac9f8020aa9e89c0",
"size": "8... |
import numpy as np
import matplotlib.pyplot as plt
import glob
import pyfits
from corner import hist2d
from matplotlib.colors import LogNorm
from matplotlib import rc
plt.rc('text', usetex=True)
#rc('text.latex', preamble = ','.join('''
# \usepackage{txfonts}
# \usepackage{lmodern}
# '''.split()))
plt.rc('font', ... | {
"content_hash": "105dfb07fb6a7f22d3f95b2d8d7361e2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 30.878048780487806,
"alnum_prop": 0.6619273301737757,
"repo_name": "annayqho/TheCannon",
"id": "dc47ba74f3d302e4f03b62f551a72417cd9e6133",
"size": "1... |
from __future__ import division, print_function, absolute_import
__all__ = [
"test_pickle", "test_pickle",
]
import sys
import pytest
import pickle
import numpy as np
from george import GP, kernels, BasicSolver, HODLRSolver
def _fake_compute(arg, *args, **kwargs):
assert 0, "Unpickled GP shouldn't need to ... | {
"content_hash": "e878363565d48ce87c2fcd92565b9b8c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 26.88235294117647,
"alnum_prop": 0.6367614879649891,
"repo_name": "dfm/george",
"id": "331847725955e0178f6661bd6ead8936f0a222f3",
"size": "939",
"b... |
"""
Wrapper for OpenCV's support vector machine implementation.
"""
import cv2
class StatModel(object):
def __init__(self):
self.model_file = True
def load(self, model_file):
self.model_file = model_file
self.model.load(model_file)
def save(self, model_file):
self.model... | {
"content_hash": "11d8b256e80b6e8e5360fa51d5f945da",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 76,
"avg_line_length": 27.03030303030303,
"alnum_prop": 0.600896860986547,
"repo_name": "vismantic-ohtuprojekti/image-filtering-suite",
"id": "535c6dc98ee72e3fadff6ea85d2876a... |
import spconv.core_cc as _ext
from spconv.core_cc.csrc.sparse.all import SpconvOps
from spconv.core_cc.csrc.utils.boxops import BoxOps
from spconv.core_cc.cumm.common import CompileInfo
CPU_ONLY_BUILD = SpconvOps.is_cpu_only_build()
BUILD_CUMM_VERSION = SpconvOps.cumm_version()
BUILD_PCCM_VERSION = SpconvOps.pccm_ver... | {
"content_hash": "21e7f730721921ebf0c2e8b4cb7d50ae",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 38.23076923076923,
"alnum_prop": 0.7847082494969819,
"repo_name": "traveller59/spconv",
"id": "339bb5d9666a774f93c10223a8fc9e14cbd7dce1",
"size": "10... |
import unittest
from strategies.base import Decision, BaseStrategy
import random
class RandomStrategy(BaseStrategy):
"""
_input (obj:list): data to make decision on (prices in this case)
"""
def analysis(self):
rand = []
for item in self.input:
rand.append(random.random()... | {
"content_hash": "f61a75521b6c21342f5fcb697b0f9ab7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 69,
"avg_line_length": 25.53125,
"alnum_prop": 0.6034271725826194,
"repo_name": "saapooch/Carl-Chandra-Analysis",
"id": "6b9b73ae4b5a1f34847f588c33ec04bd0024288f",
"size": ... |
r"""Registry of landlab components being used.
The landlab registry keeps track of landlab components that have
be instantiated by a user. A user can then get a list of all
the components in use and then print a list of citations for
all of the components they have used.
Examples
--------
>>> from landlab import regi... | {
"content_hash": "7f0a9355c30e08b4dd2bb629afdb749f",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 150,
"avg_line_length": 31.93103448275862,
"alnum_prop": 0.5661447084233261,
"repo_name": "cmshobe/landlab",
"id": "e3d8abc710a89287fec6e534049857bc3ab1b3a4",
"size": "111... |
"""Proxy AMI-related calls from cloud controller to objectstore service."""
import binascii
import os
import shutil
import tarfile
import tempfile
from xml.etree import ElementTree
import boto.s3.connection
import eventlet
from nova import crypto
from nova import exception
from nova import flags
from nova import ima... | {
"content_hash": "d8ef961c3a0cd210de024ba88b8078a8",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 79,
"avg_line_length": 40.17377049180328,
"alnum_prop": 0.5200359095731657,
"repo_name": "30loops/nova",
"id": "3435558878649adc74b0ff65e3bdc530f29d2952",
"size": "13030",... |
from combat.finishers.impale import Impale
from combat.finishers.chokepunch import ChokePunch
from combat.finishers.crushskull import CrushSkull
| {
"content_hash": "6a30d038b98c008ab7858813be2c4322",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 50,
"avg_line_length": 48.333333333333336,
"alnum_prop": 0.8758620689655172,
"repo_name": "ChrisLR/Python-Roguelike-Template",
"id": "8ab19f7b99a7ca76cf958436b050f420cc17bea9"... |
__author__ = "Tom De Smedt"
__version__ = "1.9.5.6"
__copyright__ = "Copyright (c) 2008 Tom De Smedt"
__license__ = "GPL"
######################################################################################################
import cluster
import event
import layout
import proximity
import style
#### GRAPH NO... | {
"content_hash": "b372a1e67371190107d37259686db4a5",
"timestamp": "",
"source": "github",
"line_count": 845,
"max_line_length": 102,
"avg_line_length": 33.57869822485207,
"alnum_prop": 0.5491647282723621,
"repo_name": "est/nodebox-gl",
"id": "aebef07c99615611856d6725958dd2cea1c65077",
"size": "2906... |
import os
import subprocess
import GafferSceneTest
class OSLTestCase( GafferSceneTest.SceneTestCase ) :
def compileShader( self, sourceFileName ) :
outputFileName = self.temporaryDirectory() + "/" + os.path.splitext( os.path.basename( sourceFileName ) )[0] + ".oso"
subprocess.check_call(
[ "oslc", "-q" ] +... | {
"content_hash": "b37c4a4249f95fd5c4337faa985acc01",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 119,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6666666666666666,
"repo_name": "andrewkaufman/gaffer",
"id": "13b91fde10a2c8cce6dd24370115e336bbd8dbf0",
"size":... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import errno
import logging
import os
import subprocess
import warnings
from future import standard_library
standard_library.install_aliases()
from builtins... | {
"content_hash": "e466827ca4d92957c05950015e70e388",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 85,
"avg_line_length": 31.31615598885794,
"alnum_prop": 0.6626639982210363,
"repo_name": "jwi078/incubator-airflow",
"id": "3403656415dfb896a6f6751de97a28b8cba2fec6",
"siz... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
def factory(solver_str):
if solver_str == 'glpk':
import linprog.pyglpklp as pyglpklp
#res = [pyglpklp.linprog(obj, A_ub, b_ub) for obj in directions_ext]
#lp_fun = ft.partial(pyg... | {
"content_hash": "cdc4341a02a5a19a41de890cf691b109",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 34.629629629629626,
"alnum_prop": 0.6374331550802139,
"repo_name": "zutshi/S3CAMR",
"id": "9f44a15b3d768d3e06d8746c1844445296d8432f",
"size": "935",
... |
import sys
from PyQt4.QtGui import *
# Create an PyQT4 application object.
app = QApplication(sys.argv)
# The QWidget widget is the base class of all user interface objects in PyQt4.
window = QMainWindow()
# Set window size.
window.resize(320, 240)
# Set window title
window.setWindowTitle("Hello World... | {
"content_hash": "d1dabec977a2fa95f54671fd836087bb",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 21.163265306122447,
"alnum_prop": 0.583413693346191,
"repo_name": "3WiseMen/python",
"id": "01cf7a08e601dd440596de1a519489006a855baf",
"size": "1037"... |
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('extrequests', '0012_auto_20190822_1906'),
]
operations = [
migrations.AddField(
model_name='selforganizedsubmission',
name='country',
... | {
"content_hash": "09b997834598b1db4edea1988e0d2706",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 104,
"avg_line_length": 25.529411764705884,
"alnum_prop": 0.6359447004608295,
"repo_name": "swcarpentry/amy",
"id": "9b3bdef229c17901c633dbad1f5193ad9f7cb563",
"size": "483... |
import sys
from zoo.pipeline.api.utils import remove_batch
from .engine.topology import KerasNet
from bigdl.util.common import to_list
from zoo.common.utils import callZooFunc
if sys.version >= '3':
long = int
unicode = str
class Sequential(KerasNet):
"""
Container for a sequential model.
# Arg... | {
"content_hash": "93112f5dfcbd84c440a93ca74d38568d",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 88,
"avg_line_length": 30.645454545454545,
"alnum_prop": 0.5876594482349451,
"repo_name": "intel-analytics/analytics-zoo",
"id": "ebcffea296f1bdeabd33245f3a96da09c36e44a2",
... |
from django.conf.urls import patterns, url
import views
urlpatterns = patterns('',
url(
r'^$',
views.ApplicationListView.as_view(),
name='list_applications'
),
url(
r'^list/(?P<pk>\d+)/$',
views.ApplicationListView.as_view(),
name='list_applications_opening'
),
... | {
"content_hash": "dcebb49f0977c618690365d00c7e4089",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 59,
"avg_line_length": 23.694444444444443,
"alnum_prop": 0.5463071512309496,
"repo_name": "hizardapp/Hizard",
"id": "3ad6fb0526763cda958fdedfe44f266142bd1612",
"size": "853... |
import csv
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from pymongo import ASCENDING
from moocng.badges.models import Award
from moocng.courses.marks import calculate_course_mark
from moocng.courses.models import Course, KnowledgeQuantum
from moocng.mongodb impo... | {
"content_hash": "8294144c6f5be98603ade59889e37a48",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 85,
"avg_line_length": 31.934959349593495,
"alnum_prop": 0.5030549898167006,
"repo_name": "GeographicaGS/moocng",
"id": "647b869a1b2ba86bbed3d9a46b525e927607f50d",
"size":... |
import ast
import errno
import os
import platform
import shutil
import stat
import subprocess
import sys
from distutils import log
from distutils.command.build_ext import build_ext
from distutils.command.sdist import sdist
from distutils.errors import DistutilsError
PY3 = sys.version_info[0] == 3
def makedirs(path... | {
"content_hash": "84493a006066449b20a19e64b62013df",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 163,
"avg_line_length": 41.534979423868315,
"alnum_prop": 0.5853561874566531,
"repo_name": "fivejjs/pyuv",
"id": "8b951686945fe4b68c7e6058c202f2dc8c399c42",
"size": "10094... |
"""
txpostgres is a library for accessing a PostgreSQL_ database from the Twisted_
framework. It builds upon asynchronous features of the Psycopg_ database
library, which in turn exposes the asynchronous features of libpq_, the
PostgreSQL C library.
It requires a version of Psycopg that includes support for `asynchron... | {
"content_hash": "a8d572c24927373936b7351660b9b758",
"timestamp": "",
"source": "github",
"line_count": 928,
"max_line_length": 79,
"avg_line_length": 38.73706896551724,
"alnum_prop": 0.653388227439635,
"repo_name": "wulczer/txpostgres",
"id": "af161a85041d65c605c41fdd0a830c1cb435acaa",
"size": "36... |
def append_controls(oc, response, page, callback, **params):
page = int(page)
if 'pagination' in response['data']:
next_callback = Callback(callback, page=page+1, **params)
previous_callback = Callback(callback, page=page-1, **params)
pagination = response['data']['pagination']
... | {
"content_hash": "2dda7a489776aaa5a5ea9d554cfafe3c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 107,
"avg_line_length": 36.282051282051285,
"alnum_prop": 0.5406360424028268,
"repo_name": "shvets/music-plex-plugin",
"id": "fefef6905462816162eb94639557fe8341065812",
"si... |
from google.cloud import aiplatform
# [START aiplatform_sdk_resume_experiment_run_sample]
def resume_experiment_run_sample(
experiment_name: str,
run_name: str,
project: str,
location: str,
):
aiplatform.init(experiment_name=experiment_name, project=project, location=location)
aiplatform.sta... | {
"content_hash": "5e7a46a72576624640f32ee66df58929",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 88,
"avg_line_length": 25.5625,
"alnum_prop": 0.7359413202933985,
"repo_name": "googleapis/python-aiplatform",
"id": "6ba254f07f00b6247281ca0020bd658af4e41cf9",
"size": "98... |
"""
Module debug: various debugging utilities. Set DEBUG=False to disable them.
trap(message, breakOn) -- used to set code coverage breakpoints in the code.
bugprint(message) -- same as print, but only works in DEBUG mode.
printrap(message, breakOn) -- print a message (always), then call trap.
bugprintrap(messa... | {
"content_hash": "87ea13cb8b14348a895b3c02af25e449",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 81,
"avg_line_length": 29.305555555555557,
"alnum_prop": 0.6469194312796208,
"repo_name": "wyattjoh/Dea1337",
"id": "867c88134f3b6db23dd071ed212dcd6cc17987e4",
"size": "211... |
"""
Transport
"""
module = request.controller
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index():
"Module's Home Page"
return s3db.cms_index(module)
# ------------------... | {
"content_hash": "4ed3ada0607fe2d5b32d64dceb22605d",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 79,
"avg_line_length": 33.12,
"alnum_prop": 0.427536231884058,
"repo_name": "code-for-india/sahana_shelter_worldbank",
"id": "4e4aa2e563d6112eddbfe038e004f6ce6f06dadc",
"s... |
"""Domain object for statistics models."""
__author__ = 'Sean Lip'
import copy
import operator
import re
from core.platform import models
(stats_models,) = models.Registry.import_models([models.NAMES.statistics])
class StateCounter(object):
"""Domain object that keeps counts associated with states.
All me... | {
"content_hash": "06f8e6599d5d2a28ea9489fee6ac05cf",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 85,
"avg_line_length": 37.24,
"alnum_prop": 0.6397690655209453,
"repo_name": "openhatch/oh-missions-oppia-beta",
"id": "aaf2197f0c45f065ac00bd993e2f49db80b259d5",
"size": ... |
import wmi
import time
import math
import psutil
import subprocess
from tkinter import *
from tkinter import font
from comtypes import CLSCTX_ALL
from ctypes import cast, POINTER
from pycaw import AudioUtilities, IAudioEndpointVolume
from threading import Timer
import os
import sys
import socket
def giveMeLoadAverage... | {
"content_hash": "9089d403a0ff87dbabfae9e6d2842883",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 111,
"avg_line_length": 38.5,
"alnum_prop": 0.6816426816426816,
"repo_name": "grotadmorv/i3status",
"id": "d353dbb21cd7bbfed0464656f62ef0a228a0195c",
"size": "8547",
"bi... |
import os
from setuptools import setup
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='pyMPM',
version='0.1.0',
description='Python version of the MPM millimeter wave propagation model'... | {
"content_hash": "d11ce2fdd13d403033a1fafd952b2adb",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 78,
"avg_line_length": 28.79310344827586,
"alnum_prop": 0.6335329341317365,
"repo_name": "cchwala/pyMPM",
"id": "3a6fbde30acd7aae7d9fbf0dbd9d4ffff3e89d91",
"size": "835",
... |
"""
Rest Test MS
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Series of tools designed to help test the rest endpoints of mircroservices
:Copyright: (c) 2017 DELL Inc. or its subsidiaries. All Rights Reserved.
:License: Apache 2.0, see LICENSE for more details.
:Author: Akash Kwatra
Created on June 23, 2017
"""
__title__ = 'Rest Te... | {
"content_hash": "c5f0fe4ede05d1b8a19d3653cdfd106f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 26.5625,
"alnum_prop": 0.6564705882352941,
"repo_name": "MichaelRegert/smi-test-automation",
"id": "98f511b471fee26669efc50ce2dcb56038ac6601",
"size"... |
from elasticsearchadmin import *
| {
"content_hash": "d15de512fcf6d5072c785a36eb216bac",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.8484848484848485,
"repo_name": "anchor/elasticsearchadmin",
"id": "5ea61c581446bcb8e550246761fa772a0eba7581",
"size": "33",
"bin... |
from config.circos_setting import CircosSetting
from abbrator import Abbrator
from file_provider import file_provider, tmp_output_dir
from letterman import Letterman
#:__all__= ["file_provider", "abbrator"]
| {
"content_hash": "7dab7057b4755ac281ded82f61db9589",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 55,
"avg_line_length": 41.4,
"alnum_prop": 0.7971014492753623,
"repo_name": "ecotox/pacfm",
"id": "01bacb5ebf44eee0914a3588071a06f25da1edcc",
"size": "207",
"binary": fals... |
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
import time
import os
import eHive
class WatchDirectory(PatternMatchingEventHandler):
def __init__(self, file_name, observer, event_triggered):
self.observer = observer
self.event_triggered = event_trig... | {
"content_hash": "452d2ca51bb562568c0767b1dd56e4d0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 95,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.6086065573770492,
"repo_name": "Ensembl/ensembl-production",
"id": "ae7ba9483f123ce286cff6c4a2420680afc74e88",
"s... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render, render_to_response
from django.views.generic import View
from django.http import HttpResponse
from customers import models as m
import sys, json
f... | {
"content_hash": "0fa8146a34ed7834543fc04c603b34c2",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 139,
"avg_line_length": 47.9766081871345,
"alnum_prop": 0.5847147732813262,
"repo_name": "abhaystoic/barati",
"id": "21248f20b8d7e80dd6d9853b368fa6a3f3870114",
"size": "82... |
@annot('int -> int noenv')
def triple(n):
return n * 3
@annot('(int -> int noenv) -> int noenv')
def apply_two(f):
g = f
return g(2)
FV = new_env('FV', int)
@annot('void -> int')
def getctx():
return env(FV)
@annot('void -> void')
def make_multiple_func_vals():
# Sanity check multiple FuncVal ct... | {
"content_hash": "de51ea9bf48cee36666b2e9e3a735ef1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 52,
"avg_line_length": 20.615384615384617,
"alnum_prop": 0.5932835820895522,
"repo_name": "pshc/archipelago",
"id": "631138f1defdb2e0d61baaa3f0daf1c80d11d3ed",
"size": "537... |
import uuid
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.translation import ugettext_lazy as _
from asgiref.sync... | {
"content_hash": "6b8dcaff47573cb41ea0eecc07d08747",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 105,
"avg_line_length": 31.73992673992674,
"alnum_prop": 0.6021927293710329,
"repo_name": "vitorfs/bootcamp",
"id": "76229cc3491c2ace8be35f90b1778227a360e350",
"size": "86... |
"""This module contains Google BigQuery to Google Cloud Storage operator."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Sequence
from google.api_core.exceptions import Conflict
from google.api_core.retry import Retry
from google.cloud.bigquery import DEFAULT_RETRY, ExtractJob
from airf... | {
"content_hash": "cdcee8a574404a95d94c733e99cc6dc6",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 104,
"avg_line_length": 43.37327188940092,
"alnum_prop": 0.6261155971100723,
"repo_name": "nathanielvarona/airflow",
"id": "b229257d3d711dc6b22b659394881304e671ca9c",
"siz... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Person'
db.create_table(u'core_person', (
(u'id', self.gf('django.db.... | {
"content_hash": "0acd57d1ded35ddf7b71075868d1584c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 141,
"avg_line_length": 64.05263157894737,
"alnum_prop": 0.5858668857847165,
"repo_name": "lucascastejon/cleandevcertificates",
"id": "6700195061ad09f1ca0e5c7db7d753f691b8607... |
from autobahn.asyncio.websocket import WebSocketClientProtocol, \
WebSocketClientFactory
import trollius
class MyClientProtocol(WebSocketClientProtocol):
def onConnect(self, response):
print("Server connected: {0}".format(response.peer))
@trollius.coroutine
def onOpen(self):
print("... | {
"content_hash": "1ff02c294871458b7e20554f7185333a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 30.4390243902439,
"alnum_prop": 0.6538461538461539,
"repo_name": "iffy/AutobahnPython",
"id": "ad572cb803c66ee7ed1b2440eb033a47bd9f621b",
"size": "25... |
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(
name = 'sinchsms',
version = '1.0.4',
description = 'A module to send sms using the Sinch REST apis, www.sinch.com',
long_description = readme(),
author = 'Slava Savitskiy',
author_email = 'slava@si... | {
"content_hash": "f0af466d19eba6d3026167252896e4f9",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 80,
"avg_line_length": 31.85185185185185,
"alnum_prop": 0.6162790697674418,
"repo_name": "sinch/python-sinch-sms",
"id": "6c4d634f96434473ae3e488e153093debec157ab",
"size":... |
import os
import re
import warnings
from six.moves.urllib_parse import urlparse
from . import env
HEROKU_POSTGRES_ENV_NAME_RE = re.compile('HEROKU_POSTGRESQL_[A-Z_]*URL')
def from_heroku_envvars(config):
var_map = {
# SQL-Alchemy
'DATABASE_URL': 'SQLALCHEMY_DATABASE_URI',
# Celery w/ Ra... | {
"content_hash": "52eb9e3ba59724ff3a249de03136a98a",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 74,
"avg_line_length": 33.81188118811881,
"alnum_prop": 0.5891654465592973,
"repo_name": "mbr/flask-appconfig",
"id": "92f55dfd7b5f6378f9c6bdae7d7285f72d75e032",
"size": "... |
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import os
conn_string = os.path.join(os.path.dirname(__file__), 'db.sqlite')
engine = create_engine('sqlite:///' + conn_string,
convert_unicode=True)
db_session ... | {
"content_hash": "d270a8a23688fa766b1c407637bf9f32",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 27.5,
"alnum_prop": 0.7388429752066116,
"repo_name": "davenportw15/SnailMail",
"id": "9ea713af85cae976d61fbc79e48323932dde639c",
"size": "660",
"bi... |
from kafka.structs import *
from kafka.errors import *
| {
"content_hash": "9558ecb96d3e59dd46e2d91ef42130fa",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 27,
"avg_line_length": 27.5,
"alnum_prop": 0.7818181818181819,
"repo_name": "zackdever/kafka-python",
"id": "5761f722e78b7781d13d44c168682a8d82f8cc60",
"size": "55",
"bina... |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | {
"content_hash": "64d936e6c063d5c03b735712074d13f5",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 30.98181818181818,
"alnum_prop": 0.6842723004694836,
"repo_name": "RayRuizhiLiao/ITK_4D",
"id": "a8655ed41de0d21adcb11b5c932d11e77f285010",
"size": "... |
from datetime import datetime
import logging
from airflow.models import BaseOperator, DagRun
from airflow.utils.decorators import apply_defaults
from airflow import settings
class DagRunOrder(object):
def __init__(self, run_id=None, payload=None):
self.run_id = run_id
self.payload = payload
cla... | {
"content_hash": "2cd674c73c6f2287c1b188d167c62535",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 36.68333333333333,
"alnum_prop": 0.6188096319854611,
"repo_name": "jwi078/incubator-airflow",
"id": "7f8bb53400ad70d7f8c66f3f99037d01b125c684",
"size... |
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import HLS
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import Service
class Ruv(Service):
supported_domains = ["ruv.is"]
def get(self):
... | {
"content_hash": "a16e369d8e365d67a9957ca760328c98",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 135,
"avg_line_length": 37.31818181818182,
"alnum_prop": 0.5657734470158343,
"repo_name": "olof/debian-svtplay-dl",
"id": "b8d91a1c5d3112779a9812a56528f9a137d39225",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='FunContent',
fields=[
('id', mode... | {
"content_hash": "f3685599b78732aebc586a399a5e3408",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 177,
"avg_line_length": 43.714285714285715,
"alnum_prop": 0.5874183006535948,
"repo_name": "tndatacommons/tndata_backend",
"id": "37848bc0c78dc88db4023202b24ebcbd8f8e0cca",
... |
from __future__ import absolute_import, division, print_function
from .opengl import (OpenGLBuffer,
OpenGLTexture,
OpenGLShader,
OpenGLRender)
from .devices import PygameDevice
from .display import PygameDisplay
| {
"content_hash": "368bfdfaca228e172a14fdfb0498fabf",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 25.636363636363637,
"alnum_prop": 0.6205673758865248,
"repo_name": "jsa4000/OpenGL-Python",
"id": "cd6f713f562926b3c1b3f1f0472e264fe132cc13",
"size":... |
import unittest
import os
from lxml import etree
from redi import redi
file_dir = os.path.dirname(os.path.realpath(__file__))
goal_dir = os.path.join(file_dir, "../")
proj_root = os.path.abspath(goal_dir)+'/'
class TestUpdateRedcapFieldNameValueAndUnits(unittest.TestCase):
def setUp(self):
self.raw_xml ... | {
"content_hash": "8f0541e6974a4378e1fb1403811a3eee",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 220,
"avg_line_length": 45.228813559322035,
"alnum_prop": 0.704515645493723,
"repo_name": "indera/redi",
"id": "a71330d69b10962a0338f5550e8ef58201acafa3",
"size": "5337",
... |
"""Code generation utilities"""
import imp
import json
import os
import pkgutil
import pprint
import re
import sys
import textwrap
import jsonschema
from .utils import (SchemaInfo, is_valid_identifier, indent_docstring, indent_arglist,
load_metaschema)
class CodeSnippet(object):
"""Object wh... | {
"content_hash": "75280d2d2a1b68e2c63e371f0b9a59a0",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 123,
"avg_line_length": 36.91836734693877,
"alnum_prop": 0.5910263497328174,
"repo_name": "altair-viz/schemapi",
"id": "5cee08304115d5dc24bfb30e7c9e29e203e289ce",
"size": ... |
import base64
import datetime
import hashlib
import hmac
import json
import os
import random
import re
import string
import zipfile
import six
from dateutil.tz import tzlocal
from requests import Session
from requests.adapters import HTTPAdapter
from restle.exceptions import HTTPException
from six import text_type
im... | {
"content_hash": "6a99214ef17810e48e3fce4950735071",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 118,
"avg_line_length": 35.29819277108434,
"alnum_prop": 0.6066217254031914,
"repo_name": "consbio/python-databasin",
"id": "dd18ce0ab5debd4d39cc9c6a48c41d5dff0d029f",
"si... |
"""Test that thread-local storage can be read correctly."""
from __future__ import print_function
import unittest2
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TlsGlobalTestCase(TestBase):
mydir = TestBase.compute... | {
"content_hash": "badd518e0f03bcae3b4a1ebf0dc0f7c0",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 39.15625,
"alnum_prop": 0.5754189944134078,
"repo_name": "llvm-mirror/lldb",
"id": "52e63ecac995084ecfbf27bf1996767f21dd7a2d",
"size": "3759",
"bin... |
from django.db import models
from authentication.models import Account
from django.db import models
from posts.models import Post
from datetime import timedelta
class PrefSignUpManager(models.Manager):
def create_signup(self, post, name, location, duration,
begin_time_list, end_time_list):
... | {
"content_hash": "62f581f1acb35800e3f806eef7f34041",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 111,
"avg_line_length": 41.567796610169495,
"alnum_prop": 0.6880733944954128,
"repo_name": "bewallyt/Kalendr",
"id": "e2f4a7d56228813db5eb022144daea6850941d36",
"size": "4... |
import sys
import py
from rpython.jit.tl.tla.test_tla import assemble
py.path.local(__file__)
def usage():
print >> sys.stderr, 'Usage: tla_assembler.py filename.tla.py'
sys.exit(1)
def main():
if len(sys.argv) != 2:
usage()
filename = sys.argv[1]
if not filename.endswith('.tla.py'):
... | {
"content_hash": "b65562967e87f4a888791d5fe0228ef3",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 66,
"avg_line_length": 21.678571428571427,
"alnum_prop": 0.5947281713344317,
"repo_name": "jptomo/rpython-lang-scheme",
"id": "8f485718a8ad1f26bf138e0210df5a940134fed5",
"s... |
"""Utilities for file download and caching."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import abstractmethod
from contextlib import closing
import errno
import functools
import gc
import hashlib
import multiprocessing
import multiprocessing.... | {
"content_hash": "ac01285cb91f18e3307261311a1ec2b1",
"timestamp": "",
"source": "github",
"line_count": 999,
"max_line_length": 81,
"avg_line_length": 31.465465465465467,
"alnum_prop": 0.6581090538906916,
"repo_name": "ppwwyyxx/tensorflow",
"id": "38be0568b7564930d82892dc46abd43e9e1738f8",
"size": ... |
"""Abstract Protocol class."""
__all__ = ['Protocol', 'DatagramProtocol']
class BaseProtocol:
"""ABC for base protocol class.
Usually user implements protocols that derived from BaseProtocol
like Protocol or ProcessProtocol.
The only case when BaseProtocol should be implemented directly is
writ... | {
"content_hash": "cc5e2036a4f5b22f23873227a11b1c95",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 78,
"avg_line_length": 33.9765625,
"alnum_prop": 0.6654403311106002,
"repo_name": "mikhtonyuk/rxpython",
"id": "eb94fb6f2962e6b93c749cf94f33e9e58f2de2ed",
"size": "4349",
... |
from test.support import verbose, run_unittest, import_module
#Skip these tests if either fcntl or termios is not available
fcntl = import_module('fcntl')
import_module('termios')
import errno
import pty
import os
import sys
import signal
import unittest
TEST_STRING_1 = b"I wish to buy a fish license.\n"
TEST_STRING... | {
"content_hash": "132d4125d9708fabfc3896760b8bbef2",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 85,
"avg_line_length": 37.92537313432836,
"alnum_prop": 0.5610651974288338,
"repo_name": "MalloyPower/parsing-python",
"id": "e74ecd57469a11e128971e604389fff62bd1d314",
"s... |
from ops import *
import random
import math
from tensorflow.contrib.tensorboard.plugins import projector
# constants
ATOMS, ATOM_TO_NUM = getAllAtoms()
VOCAB_SIZE = len(ATOMS)
EMBEDDING_SIZE = 32
def saveWordsAsMetadata():
with open(LOG_DIR+"atoms_metadata.tsv", "w") as file:
file.write("Words\tIndex\n")
... | {
"content_hash": "f046ad7177e0bf19bdcc43736c3cb449",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 96,
"avg_line_length": 31.493827160493826,
"alnum_prop": 0.7103096824774598,
"repo_name": "ranjeethmahankali/BIMToVec",
"id": "49f57ba48e3f31de620f19fc53771a9b9930f4af",
"s... |
from __future__ import unicode_literals
from rest_framework import status
from rest_framework.decorators import detail_route
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from django.conf import settings
from django... | {
"content_hash": "23986bf809d07be16f3a09012e232467",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 118,
"avg_line_length": 32.84393063583815,
"alnum_prop": 0.6833861316437874,
"repo_name": "snazy2000/netbox",
"id": "9cf93cb4b94d8565c434497ee559a5aa2968cad5",
"size": "56... |
"""
Unit tests for the `corpora.Dictionary` class.
"""
from collections import Mapping
import logging
import tempfile
import unittest
import os
import os.path
import scipy
import gensim
from gensim.corpora import Dictionary
from six import PY3
from six.moves import zip
# sample data files are located in the same f... | {
"content_hash": "d48817fdfaff7d2454560233214bb41d",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 104,
"avg_line_length": 39.50570342205323,
"alnum_prop": 0.6077959576515881,
"repo_name": "boomsbloom/dtm-fmri",
"id": "16c499b2451e05eabb1249dd680e49aa64c8d77d",
"size": ... |
import pytest
def _make_tree_cfg(config_factory, tree_dir, tree_file):
cfg = config_factory('admin', 'mk', tree_file)
cfg.languages.starting_tree = tree_dir.joinpath(
"{0}.nex".format(tree_file)).read_text(encoding='utf8')
return cfg
def test_basic_starting_tree(config_factory, tree_dir):
cf... | {
"content_hash": "0b23ef4f7509e3f81261e5ef93e84eac",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 64,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.6782178217821783,
"repo_name": "lmaurits/BEASTling",
"id": "6ef42045f2facf8c19f6cf7d05cc19f41a6e36ee",
"size": "1... |
import io
from os.path import join
from json import load as json_load, dumps
from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import patch, MagicMock
from urllib.parse import urlparse
import requests
from ona_service.kubernetes_watcher import (
ENV_POD_NAME,
DEFAULT_KUB... | {
"content_hash": "015ac96a65aae3951ccddb2041f24d61",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 79,
"avg_line_length": 35.66818181818182,
"alnum_prop": 0.5786924939467313,
"repo_name": "obsrvbl/ona",
"id": "ce2f65d7a45531a9f490832c202601428294255c",
"size": "8434",
... |
from iss import util
import sys
import random
import logging
import numpy as np
class ErrorModel(object):
"""Main ErrorModel Class
This class is used to create inheriting classes and contains all
the functions that are shared by all ErrorModel classes
"""
@property
def logger(self):
... | {
"content_hash": "18401acbab583a158fbeb40f294b1b5f",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 84,
"avg_line_length": 37.72774869109948,
"alnum_prop": 0.5550929780738274,
"repo_name": "HadrienG/InSilicoSeq",
"id": "473942885a68cb08e69e4ad032cee5f7684eaadf",
"size": ... |
"""Unit tests for reviewboard.admin.siteconfig."""
import os
from django.conf import settings
from django.urls import reverse
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.admin.siteconfig import load_site_config
from reviewboard.testing.testcase import TestCase
class LoadSiteConfigTests... | {
"content_hash": "afdc2f2683a05f91cc003f09919ef8d8",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 35.602409638554214,
"alnum_prop": 0.6345177664974619,
"repo_name": "reviewboard/reviewboard",
"id": "220ed0528e147195a5a24ece4ba1c662bb75a18a",
"size... |
from MpfTestCase import MpfTestCase
from mock import MagicMock
class TestTooLongExitCountDelay(MpfTestCase):
def getConfigFile(self):
return 'test_too_long_exit_count_delay.yaml'
def getMachinePath(self):
return '../tests/machine_files/ball_device/'
def _ball_drained(self, *kwargs):
... | {
"content_hash": "0805485e53b60d64f1a12783d180c57e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 78,
"avg_line_length": 45.425,
"alnum_prop": 0.6802421574023115,
"repo_name": "spierepf/mpf",
"id": "020af9532dba0035ffae3e03a631e6c0c6dff9c1",
"size": "5452",
"binary":... |
from verta._swagger.base_type import BaseType
class VersioningGetCommitRequestResponse(BaseType):
def __init__(self, commit=None):
required = {
"commit": False,
}
self.commit = commit
for k, v in required.items():
if self[k] is None and v:
raise ValueError('attribute {} is requir... | {
"content_hash": "317dcec1264525fb20245caa28250318",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 62,
"avg_line_length": 25.434782608695652,
"alnum_prop": 0.6683760683760683,
"repo_name": "mitdbg/modeldb",
"id": "2f17dd31979356998249d65da3944a94456bbb8b",
"size": "628",... |
from setuptools import setup
#parse requirements
req_lines = [line.strip() for line in open("requirements.txt").readlines()]
install_reqs = list(filter(None, req_lines))
setup(
name = "auth-userpass",
version = "0.5.0",
author = "Francis Luong (Franco)",
author_email = "networkascode@definefunk.com",
... | {
"content_hash": "63fadf8fac31b97ec119b9bf284adf8e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 91,
"avg_line_length": 33.294117647058826,
"alnum_prop": 0.6925795053003534,
"repo_name": "francisluong/py-auth-userpass",
"id": "f81e38d1d887a9efa6f3794cae721a576322f644",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('dynamic_scraper', '0018_auto_20170506_2102'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "dedc4d31aff5231ecc2b78e2e749a5bc",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 163,
"avg_line_length": 39.16279069767442,
"alnum_prop": 0.5973871733966746,
"repo_name": "Habibullah-UET/FYP",
"id": "582fd9ef60799b0ff2a81a48cca8f721833bdb47",
"size": "1... |
__author__ = "Sylvain Dangin"
__licence__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Sylvain Dangin"
__email__ = "sylvain.dangin@gmail.com"
__status__ = "Development"
class first_word():
def transform(input_data):
"""Get the first word of a string with more than one word.
:param ... | {
"content_hash": "bec11fe830019ed944390884aadf53d4",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 32.3,
"alnum_prop": 0.5743034055727554,
"repo_name": "Sylvaner/PyConverter",
"id": "f84e7a4bf7df38be662b3adb844e8edd76052dce",
"size": "646",
"bina... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0009_question_impact'),
]
operations = [
migrations.RemoveField(
model_name='question',
name='layers',
),
... | {
"content_hash": "78f0f1df0e2c7c239166fce79e8daffa",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 43,
"avg_line_length": 19.176470588235293,
"alnum_prop": 0.588957055214724,
"repo_name": "Ecotrust/floodplain-restoration",
"id": "389afcfe746409a7e895bdb0f17d2379ae7f691f",
... |
"""
Configuration support functionality.
"""
try:
import os
import logging
import inject
from ConfigParser import SafeConfigParser
from pkg_resources import resource_stream
except ImportError as e:
print "Import Error: %s" % e
exit()
logger = logging.getLogger(__name__)
@inject.param('co... | {
"content_hash": "96a74bc6c825425a00ea402f881880bf",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 88,
"avg_line_length": 28.065217391304348,
"alnum_prop": 0.6576297443841983,
"repo_name": "phuonghoangtaisinh/vmcontroller.unstable",
"id": "5dc6b0a911198001f4a432d2ad17b6fda... |
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DifficultyLevel.pictogram'
db.add_column('o_b_difficulte', 'pictogram',
self.gf('django.db.models.fields.... | {
"content_hash": "7e7ae9f9551f8d06137d510a5b31637b",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 243,
"avg_line_length": 98.82038834951456,
"alnum_prop": 0.5534214275187896,
"repo_name": "johan--/Geotrek",
"id": "54bd2109823bfaf63e03991e1fee1c99e8d19988",
"size": "203... |
"""
edacc.web
---------
In this module the flask application instance is defined and configured
according to the settings in config.py.
:copyright: (c) 2010 by Daniel Diepold.
:license: MIT, see LICENSE for details.
"""
import uuid, datetime, os
from jinja2 import FileSystemBytecodeCache
fro... | {
"content_hash": "e865f070d5a0f6482a2d6c3e49c8f8d2",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 91,
"avg_line_length": 32.30769230769231,
"alnum_prop": 0.7271428571428571,
"repo_name": "ceari/edacc_web",
"id": "7d1e02c22a40cd832bc69679abfa6b069a46568c",
"size": "4224... |
import factory
import random
from datetime import timedelta
from datetime import datetime
from django.contrib.auth.models import User
from competition.models import (Competition, Game, GameScore, Team,
Organizer, OrganizerRole,
Registration, Invitation)
f... | {
"content_hash": "b212208aa4e378c95b5986d187809936",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 80,
"avg_line_length": 32.5398773006135,
"alnum_prop": 0.6919306184012066,
"repo_name": "michaelwisely/django-competition",
"id": "dbe15c32a7aaa0fae411066799675808d8d560c7",... |
from collections import OrderedDict
expected = OrderedDict(
[
("type", "list"),
("prefix", "alpha-upper"),
(
"items",
[
[OrderedDict([("type", "paragraph"), ("text", u"List paragraph one")])],
[OrderedDict([("type", "paragraph"), ("tex... | {
"content_hash": "d3b76972b3e32e3e5acebf8683a02d80",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 88,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.44155844155844154,
"repo_name": "elifesciences/elife-tools",
"id": "3a787cdf74b0c854d4fb369665a178e0d2ffcd2a",
"s... |
from openstack.tests.unit import base
from openstack.identity.v2 import role
IDENTIFIER = 'IDENTIFIER'
EXAMPLE = {
'enabled': 'True',
'description': '1',
'id': IDENTIFIER,
'name': '3',
}
class TestRole(base.TestCase):
def test_basic(self):
sot = role.Role()
self.assertEqual('rol... | {
"content_hash": "4827b45ff5d9f82db84c9ac693364105",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 65,
"avg_line_length": 29.09375,
"alnum_prop": 0.6412459720730398,
"repo_name": "stackforge/python-openstacksdk",
"id": "bb7b9f79a7dcceb4848157f9d435d08ad6001790",
"size": ... |
"""Implement the Google Smart Home traits."""
from __future__ import annotations
import logging
from homeassistant.components import (
alarm_control_panel,
binary_sensor,
camera,
cover,
fan,
group,
input_boolean,
input_select,
light,
lock,
media_player,
scene,
scrip... | {
"content_hash": "c03b8695449be17fcfd783eb37bb3163",
"timestamp": "",
"source": "github",
"line_count": 2324,
"max_line_length": 123,
"avg_line_length": 34.586919104991395,
"alnum_prop": 0.5808534461308783,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "9f79f0f7d9b49f57f35c88c569139871c3aab1... |
import os.path
import archivebot.wpull
def add_args(args, names, item):
for name in names:
value = name % item
if value:
args.append(value)
def make_args(item, default_user_agent, wpull_exe, youtube_dl_exe, phantomjs_exe, finished_warcs_dir, warc_max_size):
# --------------------... | {
"content_hash": "18c918931941e46c99e61764e3e135e7",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 123,
"avg_line_length": 37.261538461538464,
"alnum_prop": 0.4642857142857143,
"repo_name": "Frogging101/ArchiveBot",
"id": "888a7a7cd544a10cb8b742a8b5b83b92a4d02313",
"siz... |
import os
import sys
from setuptools import find_packages
from setuptools import setup
version = '1.32.0.dev0'
install_requires = [
'dns-lexicon>=3.2.1',
'setuptools>=41.6.0',
]
if not os.environ.get('SNAP_BUILD'):
install_requires.extend([
# We specify the minimum acme and certbot version as th... | {
"content_hash": "84b1095793aac4852b4933e6ff9d867b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 31.17808219178082,
"alnum_prop": 0.6120386643233744,
"repo_name": "lmcro/letsencrypt",
"id": "9a400bb90e42eeb1ecc8eed53b26e060d2a0b86a",
"size": "227... |
import mock
from nova import test
from nova.tests.unit import fake_instance
from nova.virt.virtualbox import constants
from nova.virt.virtualbox import exception
from nova.virt.virtualbox import pathutils
class PathUtilsTestCase(test.NoDBTestCase):
def setUp(self):
super(PathUtilsTestCase, self).setUp()... | {
"content_hash": "e9c48819a7f06ae2419f8f32d2ab5b37",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 78,
"avg_line_length": 38.864285714285714,
"alnum_prop": 0.6583348649145377,
"repo_name": "cloudbase/nova-virtualbox",
"id": "ae6a516ac565d4585d02be58d40b5c3a9278b067",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.