text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import traceback
import json
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from helpers.exceptions import NotAuthorizedException, FailedAuthenticationException
logger = logging.getLogger(__name__)
# TODO so we are using this as the catch ALL, and report... | {
"content_hash": "f117ba77048ad59afb4f2494455a7870",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 89,
"avg_line_length": 42.78947368421053,
"alnum_prop": 0.6703567035670357,
"repo_name": "brennentsmith/teletraan",
"id": "6f67094403821f2fa90aea847e1eafe5f7dbbca9",
"size"... |
"""
LOMAP: fingerprint calculations
=====
Alchemical free energy calculations hold increasing promise as an aid to drug
discovery efforts. However, applications of these techniques in discovery
projects have been relatively few, partly because of the difficulty of planning
and setting up calculations. The Lead Optimi... | {
"content_hash": "d9d07da7132486a1e11059ec3bd7bbd4",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 86,
"avg_line_length": 31.95098039215686,
"alnum_prop": 0.6655415771709113,
"repo_name": "MobleyLab/Lomap",
"id": "eafce410e5070fc9d13230b33fd6097ed31201cf",
"size": "3321... |
import sys
import atexit
import logging
import json
import time
from kafka import KafkaProducer
from kafka.errors import KafkaError, KafkaTimeoutError
from pyspark import SparkContext # how to talk to spark
from pyspark.streaming import StreamingContext
from pyspark.streaming.kafka import KafkaUtils
logger_format = "... | {
"content_hash": "5e307bce44488a2acd08793bdbd3b9f1",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 131,
"avg_line_length": 27.573033707865168,
"alnum_prop": 0.7294213528932355,
"repo_name": "samli6479/bigdata",
"id": "8e33944434700ee5f105bf03250a7274ea89e3db",
"size": "2... |
from django.db import models
class School(models.Model):
name = models.CharField(max_length=100)
class Parent(models.Model):
name = models.CharField(max_length=100)
class Child(models.Model):
mother = models.ForeignKey(Parent, related_name='mothers_children')
father = models.ForeignKey(Parent, relate... | {
"content_hash": "4198e530e3ef9f33bfde217721b1a1cc",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 151,
"avg_line_length": 30.420289855072465,
"alnum_prop": 0.7208194378275369,
"repo_name": "aprefontaine/TMScheduler",
"id": "9b1f8b4932f3b8018b1a8e49b6a51630344cc6d2",
"si... |
import sys
import os
import urllib2
import traceback
import types
# Appengine monkey patch
sys.path.append(os.path.join(os.path.dirname(__file__), 'appengine-monkey'))
import appengine_monkey
# Appengine imports
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from goo... | {
"content_hash": "1b0d78142b5b840820eca0736a549a5f",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 82,
"avg_line_length": 28.693181818181817,
"alnum_prop": 0.6261386138613861,
"repo_name": "csytan/pycmds",
"id": "64f41a5920452bfb241e7c286d566a245f9c9a96",
"size": "2542",... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1Securit... | {
"content_hash": "4427ef59b8c47e84abb3f545b55b53e6",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 421,
"avg_line_length": 39.5513698630137,
"alnum_prop": 0.6511386267209283,
"repo_name": "mbohlool/client-python",
"id": "56cef94e407f5ea521529c7d75ed8da16a530fb0",
"size"... |
import logging
from hypnotoad.core import plugin
LOG = logging.getLogger('root')
class disk_model_plugin(plugin.data_model_plugin):
def setup(self, config, model_version):
"""Called before the plugin is asked to do anything."""
if config.getboolean('Data Model Options', 'disk_model_plugin_enab... | {
"content_hash": "0314d66755a831ceffb09cddadbfb8b5",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 25.307692307692307,
"alnum_prop": 0.6058763931104356,
"repo_name": "hpc/hypnotoad",
"id": "60cb54abb545fef101dfa37c3c6d60ec151e142f",
"size": "1040",... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergl"
_path_str = "scattergl.textfont"
_valid_props = {"color", "colorsrc", "family",... | {
"content_hash": "d51a92e04f82bd3a186c9cf5889484e5",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 82,
"avg_line_length": 33.833333333333336,
"alnum_prop": 0.5516345723242275,
"repo_name": "plotly/plotly.py",
"id": "f4de12c9947f3d06a7701d9f7805c908b2fd8229",
"size": "11... |
"""
It creates an opennlp formatted POS dataset from ancora-dep corpus
Rodrigo Agerri (rodrigo.agerri@ehu.es)
19/0/2013
"""
import argparse
import os
import re
def clean_wsj(infile):
inb = [line for line in infile if line.startswith("#") == False]
inb = [line.replace(" ","\t") for line in inb]
inb = [li... | {
"content_hash": "53a8e4a578c4129bc36884510b29a632",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 113,
"avg_line_length": 36.84848484848485,
"alnum_prop": 0.5851151315789473,
"repo_name": "ragerri/ixa-pipe-convert",
"id": "a6832ea96fdd65a5e821a2b09624545ea976c630",
"siz... |
from __future__ import unicode_literals
from django.contrib.auth.decorators import permission_required, login_required
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from djshop.apps.base import views as base_views
from djshop.apps.s... | {
"content_hash": "65bdc9b5f29bdb78e8937f21bb5bc7af",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 107,
"avg_line_length": 32.15094339622642,
"alnum_prop": 0.7288732394366197,
"repo_name": "diegojromerolopez/djshop",
"id": "df02a4cab971ad52e928f771117f64aca15886f5",
"siz... |
from __future__ import print_function
from __future__ import absolute_import
from yarom import yarom_import
import rdflib as R
from .DataTestTemplate import _DataTest
DataObject = yarom_import('PyOpenWorm.dataObject.DataObject')
class SimplePropertyTest(_DataTest):
ctx_classes = (DataObject,)
# XXX: auto g... | {
"content_hash": "0b3caac619d90c326da04211ac368200",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 75,
"avg_line_length": 37.88826815642458,
"alnum_prop": 0.6070480684163964,
"repo_name": "gsarma/PyOpenWorm",
"id": "7e4854f03277f7e6324e554ee2026a07966efc44",
"size": "67... |
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_SimFeatureElementSubtraction_Void_Opening', [dirname(__file__)])
except ImportE... | {
"content_hash": "5e7f4fcaf17264f315efdc6278815283",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 172,
"avg_line_length": 45.31046931407942,
"alnum_prop": 0.7161979125169309,
"repo_name": "EnEff-BIM/EnEffBIM-Framework",
"id": "aab6606006ae2976b2d861fc010d6e75eff42bdc",
... |
from MovieData import MovieData
from pymongo import MongoClient
import json
import os
client = MongoClient()
db = client['IR']
collection = db['Movies']
directory_path="D:\info-ret\information-retrival-search-engine\informationRetrival\indexing\IR\IR"
for filename in os.listdir(directory_path):
if ".tx... | {
"content_hash": "59f6928182133e3217fb67b26376c94d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 145,
"avg_line_length": 33.270270270270274,
"alnum_prop": 0.620633631194151,
"repo_name": "BhavyaLight/information-retrival-search-engine",
"id": "a3dfbb19a640be5e7a255e9e008... |
import jinja2
from django_jinja import library
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import formats
from django.utils.translation import gettext_lazy as _
from translitua import translit
from dateutil.parser import parse as dt_parse
from catalog.utils import p... | {
"content_hash": "21adb28bc38eb100bfb8bd82bbb440d9",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 78,
"avg_line_length": 25.010362694300518,
"alnum_prop": 0.5661901802361715,
"repo_name": "dchaplinsky/declarations.com.ua",
"id": "a05bbef416c59ec0ddec6221f3efedae63095d32"... |
"""
Utilities for handling ISO 8601 duration format.
"""
import re
iso_duration_re = re.compile('PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$')
def parse_isoduration(duration):
"""
Convert duration in ISO 8601 format to second(s).
Year, Month, Week, and Day designators are not supported.
Example: 'PT12H30... | {
"content_hash": "3f310fceac896b26a231d2332c297fc9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.5942622950819673,
"repo_name": "savi-dev/heat",
"id": "df24de72ef7242614098863d0910275698f3fd51",
"size": "1350",... |
a = 'py file plugin'
| {
"content_hash": "2d8311b2ae846932e34476d9abfe441f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 20,
"avg_line_length": 21,
"alnum_prop": 0.6190476190476191,
"repo_name": "hohehohe2/hohe2PyUtils",
"id": "7380b1e2ca4d83ed1e708b8cd1d88f6b58c4c56d",
"size": "21",
"binary... |
from .. import cubes
import numpy as np
from astropy.io import fits
from astropy import wcs
import os
def test_subimage_integ_header():
# getting a dummy .fits file
if not os.path.exists('foo.fits'):
from astropy.utils.data import download_file
tmp_path = download_file('https://db.tt/oleS9xD6... | {
"content_hash": "27d467396c686086bdc194587c80313a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 30.209302325581394,
"alnum_prop": 0.5896843725943033,
"repo_name": "mikelum/pyspeckit",
"id": "86f808cc1b0d1e671049be0920d6e039e89fba71",
"size": "12... |
"""
Cost-Senstive Multi-Class Active Learning
"""
import copy
import os
import numpy as np
import matplotlib
matplotlib.use('tkAgg')
import matplotlib.pyplot as plt
try:
from sklearn.model_selection import train_test_split
except ImportError:
from sklearn.cross_validation import train_test_split
from sklearn.... | {
"content_hash": "4639658eb5dc01d2081d1bcfffe303c5",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 86,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.6199561403508772,
"repo_name": "ntucllab/libact",
"id": "b6e5b63c1c6e25ad01f4401ab910900fa6219bed",
"size": "458... |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from .accounts_api import AccountsApi
from .authentication_api import AuthenticationApi
from .billing_api import BillingApi
from .bulk_envelopes_api import BulkEnvelopesApi
from .bulk_process_data_api import BulkProcessDataApi
from .... | {
"content_hash": "5179c74fc76d01f02fbebbda388694f2",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 39.18518518518518,
"alnum_prop": 0.8412098298676749,
"repo_name": "docusign/docusign-python-client",
"id": "53585e54640dabd594f45849b255a0bec9706152",
... |
import _plotly_utils.basevalidators
class ZmidValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="zmid", parent_name="contourcarpet", **kwargs):
super(ZmidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | {
"content_hash": "ecba61f1c4d5515170d5e50a6a299efb",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 37.75,
"alnum_prop": 0.6114790286975718,
"repo_name": "plotly/plotly.py",
"id": "e830931e7942755d2c7b448b4a7f62ddc050fc04",
"size": "453",
"binary"... |
"""MNIST example with static subgraph optimizations.
This is a version of the Chainer MNIST example that has been modified
to support the static subgraph optimizations feature. Note that
the code is mostly unchanged except for the addition of the
`@static_graph` decorator to the model chain's `__call__()` method.
Thi... | {
"content_hash": "4e95c1c66f3ddd744b1fc245309a3d7a",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 77,
"avg_line_length": 37.98026315789474,
"alnum_prop": 0.605231248917374,
"repo_name": "chainer/chainer",
"id": "4a420e5175550cbe01c109faba0cb58b411c346c",
"size": "5773"... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if... | {
"content_hash": "d72e5eb2a4ad76ed088070adf946fe08",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 127,
"avg_line_length": 34.394904458598724,
"alnum_prop": 0.6866666666666666,
"repo_name": "orangle/Django-soap-webservice",
"id": "e07cb353ae458ec786714f7280183dc7382d71f0"... |
from .module import ExplorimmoModule
__all__ = ['ExplorimmoModule']
| {
"content_hash": "c8d5aabde1aa9c57063a03e49d19bee3",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 36,
"avg_line_length": 17.5,
"alnum_prop": 0.7285714285714285,
"repo_name": "Phyks/Flatisfy",
"id": "46d87cee8b50157a06b3255450f688d62ef8dc47",
"size": "839",
"binary": fa... |
"""
Include Commons template in home wiki.
This bot functions mainly in the en.wikipedia, because it
compares the names of articles and category in English
language (standard language in Commons). If the name of
an article in Commons will not be in English but with
redirect, this also functions.
Run:
Syntax:
pyt... | {
"content_hash": "84f3ff8e04860703a3d1ab538f5614ff",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 86,
"avg_line_length": 34.08108108108108,
"alnum_prop": 0.5222045995241872,
"repo_name": "trishnaguha/pywikibot-core",
"id": "4320e2db71cd835a5bc4ea88441f9c540e70ae7e",
"s... |
"""Convert RTG coverage statistics into a BED file of callable regions.
Provides a supplement to VCF files indicating callable regions where
a no-call indicates reference.
Defaults to requiring more than 4 reads of coverage to be callable.
"""
import sys
import gzip
def main(cov_file):
min_cov = 4
out_file =... | {
"content_hash": "6458de742a1e9d2b70545a61ec341664",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 98,
"avg_line_length": 41,
"alnum_prop": 0.5167682926829268,
"repo_name": "gifford-lab/bcbio-nextgen",
"id": "59dd8a15d03984bd1517f6cea218275240c46cbf",
"size": "1330",
"... |
from chatterbot.adapters.storage import DatabaseAdapter
from pymongo import MongoClient
# Use the default host and port
client = MongoClient()
# We can also specify the host and port explicitly
#client = MongoClient('localhost', 27017)
# Specify the name of the database
db = client['test-database']
# The mongo coll... | {
"content_hash": "fe5537ed8a28f14daf86780536a80e77",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 72,
"avg_line_length": 25.275862068965516,
"alnum_prop": 0.6466575716234653,
"repo_name": "dgoncalves1/ChatterBot",
"id": "ce46f9494bf0501b70cdd56026d0ac63ae2e6bee",
"size"... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
'''
Compat module for Python3.x's unittest.mock module
'''
import sys
# Python 2.7
# Note: Could use the pypi mock library on python3.x as well as python2.x. It
# is the same as the python3 stdlib mock library
try:
# Allow ... | {
"content_hash": "f591b0c37e4526c05a758aa6cb1bb0a1",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 86,
"avg_line_length": 36.26923076923077,
"alnum_prop": 0.6177094379639448,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "dd83e39167f0eb09f0bb88f6bf815bba7e1c... |
"""
@package mi.dataset.parser.test.test_wavss_a_dcl
@file mi/dataset/parser/test/test_hyd_o_dcl.py
@author Emily Hahn
@brief A test parser for the hydrogen series o instrument through a DCL
"""
__author__ = 'Emily Hahn'
__license__ = 'Apache 2.0'
import os
from nose.plugins.attrib import attr
from mi.core.exception... | {
"content_hash": "432cb5f9f9f4f4761d3b2772c598fa75",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 115,
"avg_line_length": 39.611111111111114,
"alnum_prop": 0.65890603085554,
"repo_name": "JeffRoy/mi-dataset",
"id": "71dafda1509c0c94a3a5e25cccf0a81addda695f",
"size": "35... |
import os
import sys
import tomli
distributions = sys.argv[1:]
if not distributions:
distributions = os.listdir("stubs")
for distribution in distributions:
with open(f"stubs/{distribution}/METADATA.toml", "rb") as file:
for apt_package in tomli.load(file).get("stubtest_apt_dependencies", []):
... | {
"content_hash": "0f7da2f0e8a2acbd249ff2cddbefd6cd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.6947674418604651,
"repo_name": "mdaniel/intellij-community",
"id": "20cbed8a848d768a1a0e3481ed6a1af564da0a11",
"si... |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="bar.marker.line", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "900e870563305060ed4f178c27f9a0b6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 85,
"avg_line_length": 38,
"alnum_prop": 0.5864661654135338,
"repo_name": "plotly/plotly.py",
"id": "0ada8567f270e54f5e3f0727635131701a970aa0",
"size": "532",
"binary": f... |
'''
Defines the structure of inbound messages.
@author: Peter Parente <parente@cs.unc.edu>
@copyright: Copyright (c) 2008 Peter Parente
@license: BSD License
All rights reserved. This program and the accompanying materials are made
available under the terms of The BSD License which accompanies this
distribution, and ... | {
"content_hash": "5cc6576848f4493cc9433c8a2d6eddd4",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 80,
"avg_line_length": 29.713414634146343,
"alnum_prop": 0.6810999384362816,
"repo_name": "parente/clique",
"id": "fa5f726d43ae815cb57228312b0d93dae3c16b37",
"size": "4873... |
import sys
import os
import subprocess
import shlex
import logging
import re
import urlparse
import dateutil.parser
import time
import pprint
import dxpy
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
#logger.setLevel(logging.DEBUG)
#logger.addHandler(dxpy.DXLogHandler())
logger.propagat... | {
"content_hash": "089d011b2b7e727e3eaee232c6dce02e",
"timestamp": "",
"source": "github",
"line_count": 715,
"max_line_length": 152,
"avg_line_length": 36.506293706293704,
"alnum_prop": 0.558539575511455,
"repo_name": "ENCODE-DCC/pipeline-container",
"id": "c018b74ac1e63190cd5a2862ba0a8ac8e63bb0b1",
... |
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @MarcoFalke
'''
from subprocess import check_output
import re
FOLDER_GREP = 'src'
FOLDER_TEST = 'src/test/'
CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/%s' % FOLDER_GREP
CMD_GREP_ARGS = r"egrep -r -I '(map(Mu... | {
"content_hash": "0fce593c3f5cdca6c21049882c7d076f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 213,
"avg_line_length": 40.275,
"alnum_prop": 0.6393544382371198,
"repo_name": "segwit/atbcoin-insight",
"id": "5d843fbcd48baebb207d45e53d666a111113e12b",
"size": "1824",
... |
import numpy
from chainer import cuda
from chainer import optimizer
class AdaGrad(optimizer.GradientMethod):
"""AdaGrad implementation.
See: http://jmlr.org/papers/v12/duchi11a.html
"""
def __init__(self, lr=0.001, eps=1e-8):
self.lr = lr
self.eps = eps
def init_state(self, pa... | {
"content_hash": "cf0683a4e29c75b8e2357dd48f2c2426",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 65,
"avg_line_length": 26.055555555555557,
"alnum_prop": 0.5341151385927505,
"repo_name": "cemoody/chainer",
"id": "cce2b592d88ae497e3fedfba6f44983363bbdfa1",
"size": "938"... |
"""Wrapper module for running eecli.main() from the command line."""
import os
import sys
if not (2, 6) <= sys.version_info[:3] < (3,):
sys.exit('earthengine requires python 2.6 or 2.7.')
def OutputAndExit(message):
sys.stderr.write('%s\n' % message)
sys.exit(1)
EECLI_DIR = os.path.dirname(os.path.abspath(o... | {
"content_hash": "d39037e679f5d09467c3d6cbfd0c89af",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 28.483870967741936,
"alnum_prop": 0.6908267270668177,
"repo_name": "gena/earthengine-api",
"id": "36f3905480e01f66543631fa1ac355d5c34e64eb",
"size": ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import collections
import contextlib
import multiprocessing
import os
import subprocess
from pants.backend.jvm.tasks.jvm_task import JvmTask
from pants.base.exception... | {
"content_hash": "458c450b2bd5c2b244f5198c4f044fcf",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 103,
"avg_line_length": 39.24875621890547,
"alnum_prop": 0.6543288122702497,
"repo_name": "dbentley/pants",
"id": "7495d335291c7c2d3a1bdec85b165866201579c1",
"size": "8036... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-gapcoinrpc"))
from decimal import Decimal
import json
import shutil
import subprocess
import time
from gapcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
START_P2P_PORT=11000
START_RPC... | {
"content_hash": "36fd1c85c0fa280fced46ec86351f70b",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 94,
"avg_line_length": 34.55555555555556,
"alnum_prop": 0.5886254019292605,
"repo_name": "gapcoin/gapcoin",
"id": "f1f77207d615e8ff1bef9c62c9afe735d7f39054",
"size": "5260... |
"""Module for testing the request review command."""
import os
from shutil import rmtree
from subprocess import PIPE
from subprocess import Popen
import unittest
from brokertest import TestBrokerCommand
if __name__ == "__main__":
import utils
utils.import_depends()
class TestRequestReview(TestBrokerComman... | {
"content_hash": "d1507c12506f7db08b58111f5e47e43f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 74,
"avg_line_length": 37.97080291970803,
"alnum_prop": 0.5486351403306421,
"repo_name": "quattor/aquilon",
"id": "7a8a9572cae2af1407d3f055a629d3fabf58a72b",
"size": "5907... |
import os
extension_modules = {}
directory = 'src/xxdata_11'
sources = ['xxdata_11.for', 'xxrptn.for', 'i4unit.for',
'i4fctn.for', 'xxword.for', 'xxcase.for', 'xfelem.for', 'xxslen.for',
'../xxdata_11.pyf', '../helper_functions.for']
extension_modules['_xxdata_11'] = dict(sources=sources, directory=directory)... | {
"content_hash": "e98a28ceb9ab159659d9e8a3fe8e4e07",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 34.05555555555556,
"alnum_prop": 0.6598694942903752,
"repo_name": "cfe316/atomic",
"id": "08eb55efbe4f14754abf2f7e5f8d2d115478c432",
"size": "1226",
... |
import intrepyd as ip
import intrepyd.components
import intrepyd.trace
if __name__ == "__main__":
ctx = ip.Context()
int8type = ctx.mk_int8_type()
ten = ctx.mk_number("10", int8type)
counter, Q = ip.components.mk_counter(ctx, "counter", type=int8type, limit=ten)
simulator = ctx.mk_simulator()
t... | {
"content_hash": "0b59e1d6e52004906b999f05e47c3016",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 83,
"avg_line_length": 30.375,
"alnum_prop": 0.6604938271604939,
"repo_name": "formalmethods/intrepyd",
"id": "8b93671d2e6619bfafd2d47307370ade7639e03c",
"size": "486",
"... |
"""Tests for the Griddy Power integration."""
| {
"content_hash": "5e5b9f6a82aa093ca94d419dd577898c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.717391304347826,
"repo_name": "robbiet480/home-assistant",
"id": "415ddc3ba5cd9c3c98f5096747d08093fa72083a",
"size": "46",
"bina... |
import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="y", parent_name="contourcarpet.colorbar", **kwargs):
super(YValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | {
"content_hash": "080199e45785bc4dd35ac1e718250f9f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 36.61538461538461,
"alnum_prop": 0.5882352941176471,
"repo_name": "plotly/plotly.py",
"id": "d18682972c6bcff5840ede870f27c365208918d0",
"size": "476"... |
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron._i18n import _
EXTENDED_ATTRIBUTES_2_0 = {
'networks': {
'network_extension': {'allow_post': True,
'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
... | {
"content_hash": "391b676a76a4c7d230ed62ebbc94ed0b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 70,
"avg_line_length": 29.037037037037038,
"alnum_prop": 0.4897959183673469,
"repo_name": "eayunstack/neutron",
"id": "7196996dd342a43f1de70a701408f99d95bf22ac",
"size": "2... |
import unittest
import logging
import Configuration
from . import GeoNamesTestCase
''' Test suite for all tools in the Sun Position Analysis Tools toolbox '''
def getTestSuite():
if Configuration.DEBUG == True:
print(" GeoNamesTestSuite.getSuite")
testSuite = unittest.TestS... | {
"content_hash": "f16a9a115f24d2c36a322268e001e708",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 86,
"avg_line_length": 22.347826086956523,
"alnum_prop": 0.6926070038910506,
"repo_name": "Esri/solutions-geoprocessing-toolbox",
"id": "13dab69e0724f3ed4a361343488321952dcd8... |
from oslo_serialization import jsonutils as json
from tempest.lib.common import rest_client
from tempest.lib.services.network import base
class NetworkVersionsClient(base.BaseNetworkClient):
def list_versions(self):
"""Do a GET / to fetch available API version information.
For more information,... | {
"content_hash": "7a4f879bd571c0a086fca347b32f6786",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 84,
"avg_line_length": 36.24242424242424,
"alnum_prop": 0.6630434782608695,
"repo_name": "openstack/tempest",
"id": "5aa79646a3e92db2a29d919f37cec509f19fc5a2",
"size": "182... |
import io
import json
import mimetypes
import os
import warnings
from abc import ABC, abstractmethod
from multidict import CIMultiDict
from . import hdrs
from .helpers import (PY_36, content_disposition_header, guess_filename,
parse_mimetype, sentinel)
from .streams import DEFAULT_LIMIT
__all_... | {
"content_hash": "0754ccc14179eef14529c8f15a9f5053",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 79,
"avg_line_length": 29.058823529411764,
"alnum_prop": 0.5915694212907835,
"repo_name": "pfreixes/aiohttp",
"id": "a43e63798644e38dd9419b223460a61585ce45e3",
"size": "83... |
import datetime
import json
from staaxe.models import App, Connection, ConnectionInfo, Payload
def export_to_json(appname):
app = App.get(App.name == appname)
ret_obj = {'connections': [], 'metadata': {}}
first_connection_date = datetime.datetime.now()
for connection in app.connection_set.order_by... | {
"content_hash": "40d7564faf2cbad320172c151c7af60a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 87,
"avg_line_length": 29.945945945945947,
"alnum_prop": 0.6083032490974729,
"repo_name": "sebbernery/staaxe-server",
"id": "301aed5be1ebfdc66d74b28b197eb27ca37833f1",
"siz... |
import os
import bdb
import types
from tkinter import *
from idlelib.WindowList import ListedToplevel
from idlelib.ScrolledList import ScrolledList
from idlelib import macosxSupport
class Idb(bdb.Bdb):
def __init__(self, gui):
self.gui = gui
bdb.Bdb.__init__(self)
def user_line(self, frame):... | {
"content_hash": "b70df6984f270f176fe9a049c6d8b987",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 79,
"avg_line_length": 33.33401221995927,
"alnum_prop": 0.5401111993645751,
"repo_name": "timm/timmnix",
"id": "d4872ed42af8201de11c0b764e70cc243e7ba900",
"size": "16367",... |
import dredd_hooks as hooks
import sys
# HELPERS
# NOTE move in separated module
import os
import sys
sys.path.append("/opt/xos")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
import django
from core.models import *
from services.volt.models import *
from services.vsg.models import *
from services.vt... | {
"content_hash": "2e58a8a44c7a2c2b282d9520b4c0e317",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 93,
"avg_line_length": 23.375,
"alnum_prop": 0.6522618875560052,
"repo_name": "cboling/xos",
"id": "b81e239035e3913165d3b8d5b029db7731ec21c6",
"size": "6919",
"binary": ... |
import os
import coverage
import colorize
from django.conf import settings
from django.test.simple import DjangoTestSuiteRunner
class CoverageTestRunner(DjangoTestSuiteRunner):
def run_tests(self, test_labels, verbosity=1, interactive=True, extra_tests=[]):
coveragemodules = getattr(settings, 'COVERAGE_M... | {
"content_hash": "ca8499b9ff11508d777ac8ec529ad352",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 34.61904761904762,
"alnum_prop": 0.6121045392022009,
"repo_name": "chop-dbhi/django-forkit",
"id": "afd6a3da4906418a9859615f9b81d578ffc9dc71",
"size"... |
from __future__ import unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
# DetailView
url(r'^detail/(?P<slug>[-\w]+)/$',
views.ArticleDetailView.as_view(),
name='article_detail'),
# ListView
url(r'^list/dict/$',
views.DictList.as_view()),
... | {
"content_hash": "8f953622cbaede9344dfe8c49f829fc2",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 73,
"avg_line_length": 38.204081632653065,
"alnum_prop": 0.6362179487179487,
"repo_name": "samuelmaudo/yepes",
"id": "1d0be41d48befb1a2b1eeee877a9b94134134854",
"size": "18... |
from cStringIO import StringIO
from Operand import *
from Instruction import *
from FlowControl import *
from Constants import *
from Opcodes import *
from Formatter import *
from Disass import Disassembler
from Exceptions import *
class CubinFile(object):
kernels = None
architecture = None
abiversion = No... | {
"content_hash": "cb4a3eba9fea2b8fd390bfbf82fbbe4c",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 96,
"avg_line_length": 33.25757575757576,
"alnum_prop": 0.49031890660592253,
"repo_name": "laanwj/decuda",
"id": "27304dc3ce3cebf9666fca88c6ea2ed0df26dd61",
"size": "8867"... |
from django import template
from geoprisma.models import Service
register = template.Library()
@register.simple_tag
def printWidgetOptionss(options):
"""
Construit un tableau de clef:valeur pour l'affichage javascript
Args:
options: Liste d'option
Returns:
La liste format... | {
"content_hash": "149c701f8d018e859e5e371ce6bb2ffa",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 84,
"avg_line_length": 26.826666666666668,
"alnum_prop": 0.5124254473161034,
"repo_name": "groupe-conseil-nutshimit-nippour/django-geoprisma",
"id": "3c767bc4f0588cad044250f3... |
"""Device discovery functions for Zigbee Home Automation."""
from __future__ import annotations
from collections import Counter
from collections.abc import Callable
import logging
from typing import TYPE_CHECKING
from homeassistant.const import CONF_TYPE, Platform
from homeassistant.core import HomeAssistant, callbac... | {
"content_hash": "69566c8f15c2d9a6bc991e98d6924a5a",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 93,
"avg_line_length": 36.71757925072046,
"alnum_prop": 0.5923396907621066,
"repo_name": "nkgilley/home-assistant",
"id": "6b690f4da085acee1a4bfb6c04064421f2b2acd9",
"size... |
import datetime
import random
import numpy as np
from hyperopt import hp, fmin, tpe
import os
import sys
from sklearn.linear_model import Ridge
sys.path.insert(0, os.getcwd())
import qml_workdir.classes.config
from qml.cv import QCV
from qml.helpers import get_engine
from qml.models import QXgb, QAvg, QRankedAvg,... | {
"content_hash": "7c6b473b0fdef2271338c22c1b368a43",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 123,
"avg_line_length": 33.52,
"alnum_prop": 0.5781622911694511,
"repo_name": "quantum13/mlbootcamp5",
"id": "de18b7f746ee4c3caec017e2f3b541c93181e4f5",
"size": "3352",
... |
__author__ = 'abr'
dataDir = '/home/abr/Downloads/000/'
_droidPath = "/home/abr/Downloads/droid/droid.sh"
_tikaWrapperPath = "/home/abr/Projects/git/TikaWrapper/target/tikaWrapper-0.0.2-jar-with-dependencies.jar"
_fidoPath = "/home/abr/Downloads/openplanets-fido-991c16a/fido/fido.py"
comleteFile = "scapetesting/g... | {
"content_hash": "9110b7d6d0ffc933fd911ce33606b8e9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 106,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.7581395348837209,
"repo_name": "openpreserve/Scape-Tool-Tester",
"id": "7e529fa61e5e0b87491e440034b62f86f012889e",... |
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.actions.message_send import send_rate_limited_pm_notification_to_bot_owner
from zerver.decorator import webhook_view
from zerver.lib.exceptions import Jsona... | {
"content_hash": "99d4d69bb6ae834304df0c9951a596bc",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 97,
"avg_line_length": 36.25,
"alnum_prop": 0.7263157894736842,
"repo_name": "zulip/zulip",
"id": "c76172313bd395810ba4f61ecc665422bc3a1604",
"size": "2755",
"binary": fa... |
import os
import boto3
from ..cli import echo
from .base import BaseRemoteStorage
class RemoteStorage(BaseRemoteStorage):
def __init__(self, config, root):
super(RemoteStorage, self).__init__(config, root)
self.check_s3_config()
def check_s3_config(self):
assert 'key' in self.config... | {
"content_hash": "34bbde393c8f3f2a48d9b17171491ff1",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 77,
"avg_line_length": 26.52054794520548,
"alnum_prop": 0.5945247933884298,
"repo_name": "saalaa/no-cloud",
"id": "af966cfdaa42ebe7e1f46e15bd0ff0880b8c3a37",
"size": "2042"... |
__all__ = ['__version__']
import pbr.version
version_info = pbr.version.VersionInfo('eclcli')
try:
__version__ = version_info.version_string()
except AttributeError:
__version__ = None
| {
"content_hash": "e0254ae02eb73137f5faae878e96da01",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 48,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.6615384615384615,
"repo_name": "anythingrandom/eclcli",
"id": "8112e4265ecd81fe58d607fb8289979022724cde",
"size": ... |
"""
Tests of runtime settings.
"""
import sys
import os
import docutils_difflib
import pprint
import warnings
import unittest
from types import StringType
import DocutilsTestSupport # must be imported before docutils
from docutils import frontend, utils
from docutils.writers import html4css1, pep_html
fro... | {
"content_hash": "cd0d3c2422c526b5841078ef4635eec4",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 77,
"avg_line_length": 36.57861635220126,
"alnum_prop": 0.5594910591471802,
"repo_name": "indro/t2c",
"id": "4ffc62e108a7dc48993584593e5dfd97d80c9945",
"size": "6055",
"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0013_auto_20151221_2208'),
]
operations = [
migrations.DeleteModel(
name='RequesterRanking',
),
]
| {
"content_hash": "23c8300fb7c1f52d3fbcce84216468cf",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 19.4375,
"alnum_prop": 0.6237942122186495,
"repo_name": "shirishgoyal/crowdsource-platform",
"id": "21094bf9aa4c129c27c2495ec54a90eaa721e056",
"size"... |
from django.contrib.auth.models import Group, User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.shortcuts import reverse
from model_utils.models import TimeStampedModel
class WorkbenchUser(TimeStampedModel):
user = models.OneToOneFiel... | {
"content_hash": "7ebf41b537697cefb218d6ea2e173f0c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 31.27027027027027,
"alnum_prop": 0.7268798617113224,
"repo_name": "MOOCworkbench/MOOCworkbench",
"id": "f04280472b6a7103a17cd7fc057f85cd86498d0c",
"s... |
from __future__ import unicode_literals
import copy
import datetime
import re
import threading
import unittest
import warnings
from decimal import Decimal, Rounded
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import no_style
from django.db ... | {
"content_hash": "5c1faf4a8e372468310d837242d2139e",
"timestamp": "",
"source": "github",
"line_count": 1281,
"max_line_length": 161,
"avg_line_length": 40.53239656518345,
"alnum_prop": 0.6208928777782058,
"repo_name": "nzavagli/UnrealPy",
"id": "11136e3b0973a965a35867745607799a6be023c8",
"size": "... |
"""
Gini based Inequality Metrics
"""
__author__ = "Sergio J. Rey <srey@asu.edu> "
import numpy as np
from scipy.stats import norm as NORM
__all__ = ['Gini', 'Gini_Spatial']
def _gini(x):
"""
Memory efficient calculation of Gini coefficient in relative mean difference form
Parameters
----------
... | {
"content_hash": "c8dc161020beb27e375b8d9e311b20b3",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 99,
"avg_line_length": 24.026881720430108,
"alnum_prop": 0.5679122846274335,
"repo_name": "lixun910/pysal",
"id": "3a2f4b0f645a4ffe13e20c1923febdf012a8a71d",
"size": "4469... |
git_refnames = "$Format:%d$"
git_full = "$Format:%H$"
# these strings are filled in when 'setup.py versioneer' creates _version.py
tag_prefix = ""
parentdir_prefix = "pystallone-"
versionfile_source = "pystallone/_version.py"
import os, sys, re, subprocess, errno
def run_command(commands, args, cwd=None, verbose=Fal... | {
"content_hash": "97b1d8ed9bbf1d0b8ac6f0d97c2924bb",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 87,
"avg_line_length": 40.06976744186046,
"alnum_prop": 0.585896691816599,
"repo_name": "markovmodel/pystallone",
"id": "cce5532556b0d7cf01f0dc63c785b26584d86618",
"size":... |
from fenalib.assert_utils import assert_type, assert_list_types
from fenalib.repr_utils import addrepr
@addrepr
class McFunction:
"""
Args:
full_path (str)
mfunc_name (str)
debug (bool)
Attributes:
full_path (str): The full path to the mcfunction file
mfunc_name (st... | {
"content_hash": "f4628467eebe8d5dc53558babc72d56c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 27.636363636363637,
"alnum_prop": 0.6013157894736842,
"repo_name": "Aquafina-water-bottle/Command-Compiler-Unlimited",
"id": "e99a363b3e37fbe925d2c3f03... |
import unittest
import threading
import time
import yaml
import json
import time
import logging
from multiprocessing import Process
try:
from test.onboarding import fakeslm_onboarding
except:
from onboarding import fakeslm_onboarding
try:
from test.instantiation import fakeslm_instantiation
except:
fr... | {
"content_hash": "8a748e481d24821b9d3f14590e438727",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 119,
"avg_line_length": 43.8009828009828,
"alnum_prop": 0.5927525663319684,
"repo_name": "tsoenen/son-mano-framework",
"id": "bde01d19e88f0a52d6c070fa32fff89f04ee5a63",
"s... |
from Main.models.categories import Category, Product_category
from Main.models.products import Product
from Main.utilities.logs import logError
from django.utils import timezone
import datetime
def getCategoryFromProduct(product):
category = Product_category.objects.filter(product_id=product["id"])[0].catego... | {
"content_hash": "f79763eebbde346c249ec8007935050f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 105,
"avg_line_length": 29.984126984126984,
"alnum_prop": 0.6273160402329275,
"repo_name": "G4brym/Ecomerce",
"id": "0586848a0f657d182dee332c3f79994c00867b84",
"size": "188... |
"""Agent action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import utils
class CreateAgent(show.ShowOne):
"""Create compute agent command"""
log = logging.getLogger(__name__ + ".CreateAgent")
def ge... | {
"content_hash": "ade23f155bd58b1a2acea4b34e7c6ffb",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 65,
"avg_line_length": 28.7248322147651,
"alnum_prop": 0.5432242990654206,
"repo_name": "varunarya10/python-openstackclient",
"id": "14c4b2c7f5b8512f1760f8adda1308dc7950ba15... |
import ldap
import os
import logging
logger = logging.getLogger(__name__)
class Authenticator:
def __init__(self, config):
if config.get('debug'):
self.authenticate = self.debug_auth
return
self.authenticate = self.ldap_auth
if 'ldap_cert_path' in config:
... | {
"content_hash": "fc48cd77a9d0006f2bcc4a8ff818e19c",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 95,
"avg_line_length": 32.36507936507937,
"alnum_prop": 0.5777341834232467,
"repo_name": "dwang159/oncall",
"id": "4f5ececb46ea789b0776ba4aafb80046eab60384",
"size": "2198"... |
"""
aip public
"""
from .ocr import AipOcr
from .nlp import AipNlp
from .face import AipFace
from .imagecensor import AipImageCensor
from .imagecensor import AipImageCensor as AipContentCensor
from .kg import AipKg
from .speech import AipSpeech
from .imageclassify import AipImageClassify
from .imagesearch import A... | {
"content_hash": "4f086129cf638dd5e7134d1cbfcfc646",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 26.8,
"alnum_prop": 0.8233830845771144,
"repo_name": "xbed/Mixly_Arduino",
"id": "e0cf3daf34128fe70df4e7c6f9aff27ee03b48b4",
"size": "426",
"binary... |
"""Light platform support for yeelight."""
import logging
import voluptuous as vol
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.service import extract_entity_ids
from homeassistant.util.color import (
color_temperature_mired_to_kelvin as mired_to_kelvin,
colo... | {
"content_hash": "3749c7c08325552a59c62e3e31afbd4f",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 79,
"avg_line_length": 33.176661264181526,
"alnum_prop": 0.5829018075232046,
"repo_name": "molobrakos/home-assistant",
"id": "fa62bdc35d7c971174858d626b2ac70975a0b524",
"s... |
"""Tests for ortools.util.python.sorted_interval_list."""
import unittest
from ortools.util.python import sorted_interval_list
class SortedIntervalListTest(unittest.TestCase):
def testCtorAndGetter(self):
bool_domain = sorted_interval_list.Domain(0, 1)
self.assertEqual(2, bool_domain.Size())
... | {
"content_hash": "81c3a18a0fc673a1b40d1f53e0d94403",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 39.23076923076923,
"alnum_prop": 0.6333333333333333,
"repo_name": "or-tools/or-tools",
"id": "252c766eea883c19dfbfe23c7e7327225d162b36",
"size": "366... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from fobi.base import BaseFormFieldPluginForm, get_theme
try:
from django.forms.widgets import NumberInput
except ImportError:
from django.forms.widgets import TextInput
class NumberInput(TextInput):
"""Number input.... | {
"content_hash": "6fa0ceede8196db0deb575be51e52d61",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 76,
"avg_line_length": 28.755555555555556,
"alnum_prop": 0.5904173106646059,
"repo_name": "mansonul/events",
"id": "e03dda48aa52747897ba1cda9424632d7ab7336d",
"size": "2588... |
import subprocess
import sys
import typer
from typer.testing import CliRunner
from docs_src.multiple_values.multiple_options import tutorial002 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_main():
result = runner.invoke(app)
assert result.exit_code == 0
assert "The s... | {
"content_hash": "91834fbbbf2f95cc6867a835fbc27aff",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 86,
"avg_line_length": 24.17948717948718,
"alnum_prop": 0.6383881230116649,
"repo_name": "tiangolo/typer",
"id": "d30357e76547e2c46943449770b21a9c1708b670",
"size": "943",
... |
def median(a, i, j, k):
"""
Return median of 3 integers from array a.
:param a: Iterable of elements
:param i: start element index
:param j: end element index
:param k: middle element index
:return: return median of values at indices i, j and k.
"""
ai, aj, ak = a[i], a[j], a[k]
... | {
"content_hash": "0550e369deea63b68024a40682f04a3b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 27.015384615384615,
"alnum_prop": 0.5671981776765376,
"repo_name": "aashutoshrathi/algos",
"id": "1a09e8be6476bd65552ca1d99c1134d03ed1d1cb",
"size": ... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Fill(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "table.cells"
_path_str = "table.cells.fill"
_valid_props = {"color", "colorsrc"}
# color
... | {
"content_hash": "b14cc09b44fab89988a89f94e87384bb",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 82,
"avg_line_length": 35.31976744186046,
"alnum_prop": 0.5450205761316872,
"repo_name": "plotly/python-api",
"id": "7b12bb070150e1fb2aeffaa52f9bb4f5f531100e",
"size": "60... |
"""Abstract tests for subclasses inheriting from meta_dataset.learners.base."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
from meta_dataset.learners.experimental import base as experimental_learner_base
from meta_da... | {
"content_hash": "fe134912a3fbc99225b1f7c7a08a55d4",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 81,
"avg_line_length": 33.861607142857146,
"alnum_prop": 0.6868820039551747,
"repo_name": "google-research/meta-dataset",
"id": "1370c8a316aec859f549129ff39cd8ef1f24ba38",
... |
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | {
"content_hash": "19b3a8e5b975bb86a375f22c7b809751",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 77,
"avg_line_length": 26.90960451977401,
"alnum_prop": 0.5761074952760865,
"repo_name": "jianajavier/pnc-cli",
"id": "cb483f8dbf7a2dee9ee217decd1c855c81b6fa40",
"size": "... |
from azure.cli.core.help_files import helps
# pylint: disable=line-too-long, too-many-lines
helps['network'] = """
type: group
short-summary: Manage Azure Network resources.
"""
helps['network dns'] = """
type: group
short-summary: Manage DNS domains in Azure.
"""
# region Application Gateway
helps... | {
"content_hash": "7467d789bbe1048d9f114bf55a1ae741",
"timestamp": "",
"source": "github",
"line_count": 2112,
"max_line_length": 264,
"avg_line_length": 29.820075757575758,
"alnum_prop": 0.6670212765957447,
"repo_name": "QingChenmsft/azure-cli",
"id": "ca74fa21fa30a319243f92544b73e47002e76fa5",
"si... |
import boto3
import sys
import os
defaultRegion = 'eu-west-1'
translate = boto3.client(service_name='translate', region_name=defaultRegion, use_ssl=True)
if len(sys.argv) >= 3:
inputFile = sys.argv[1]
outputLanguage = sys.argv[2]
outputFile = str(inputFile).replace('fr', outputLanguage)
if not os.path.isdir(out... | {
"content_hash": "ee8971730f8b6ed337c669b81c2b0234",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 116,
"avg_line_length": 35.02857142857143,
"alnum_prop": 0.7414355628058727,
"repo_name": "anamorph/recettes",
"id": "3bab554c6def4650e8983dff53007b3f1bc91e9e",
"size": "12... |
"""Decorator utility functions."""
from __future__ import annotations
from collections.abc import Callable, Hashable
from typing import Any, TypeVar
_KT = TypeVar("_KT", bound=Hashable)
_VT = TypeVar("_VT", bound=Callable[..., Any])
class Registry(dict[_KT, _VT]):
"""Registry of items."""
def register(self... | {
"content_hash": "db26d60962f9929757e813ffb96bc2f6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 69,
"avg_line_length": 27.136363636363637,
"alnum_prop": 0.6130653266331658,
"repo_name": "GenericStudent/home-assistant",
"id": "c648f6f1caba4b5f1283d445f83c8af495e2bdea",
... |
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import autodiscover_modules, import_string
from django.utils.translation import gettext as _
from cms.app_base import CMSApp
from cms.exceptions import AppAlreadyRegistered
from cms.utils.conf import get_cms_setti... | {
"content_hash": "c547752df1b318bc1d41196411ccd73d",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 77,
"avg_line_length": 29.81188118811881,
"alnum_prop": 0.5765526403188309,
"repo_name": "divio/django-cms",
"id": "c3c8f4aefac99aef666552521a16dd20daa98a55",
"size": "301... |
import numpy as np
import scipy.io as sio
import re, os, sys
import matplotlib.pyplot as plt
from random import randint
from sklearn.linear_model import SGDClassifier
import sklearn
import pywt
printing = False
def main():
dataPath = '/media/david/linux_media/kaggle/eeg/'
"""
data = sio.loadmat(dataPat... | {
"content_hash": "458697ea8fac7c0b6b55359c0b60b391",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 95,
"avg_line_length": 34.755102040816325,
"alnum_prop": 0.5704638872577804,
"repo_name": "drubinstein/kaggle_seizure",
"id": "6d67340ed1ccc4df998c94810c5ae7ed27ed7326",
"s... |
from Queue import Queue # Threadsafe queue for threads to use
from collections import Counter # To count stuff for us
import datetime # Because datetime printing is hard
import time # Should be obvious
import sys # Get system info
import threading # Should be obvious
import json # Also obvious
# FB API wrapper ... | {
"content_hash": "065ccfcbe912dbc56b9f4382092811e6",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 84,
"avg_line_length": 36.23357664233577,
"alnum_prop": 0.5393499865699705,
"repo_name": "hzsweers/fb_group_analytics",
"id": "85d0aa7a956bd0630a42d15be58084d13224b75a",
"... |
"""Tests for the GAE mail API wrapper."""
from core.platform.email import gae_email_services
from core.tests import test_utils
import feconf
class EmailTests(test_utils.GenericTestBase):
"""Tests for sending emails."""
def test_sending_email_to_admin(self):
# Emails are not sent if the CAN_SEND_EMAI... | {
"content_hash": "bb70d35c23d0295d54d43fc7a43585a9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 40.964285714285715,
"alnum_prop": 0.6233653007846556,
"repo_name": "kingctan/oppia",
"id": "e021cb4f1d3d1a1e35f966b75bd028581e971c74",
"size": "1770"... |
import logging
from docrane import util
from docrane.exceptions import ImageNotFoundError
LOG = logging.getLogger("docrane")
class Container(object):
def __init__(self, name, params, images_watcher):
self.name = name
self.params = params
self.docker_params = {}
self.images_watch... | {
"content_hash": "da9043f31e4e92e071ed28fe4d898230",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 31.38095238095238,
"alnum_prop": 0.5402124430955993,
"repo_name": "CloudBrewery/docrane",
"id": "4faa375635a4a4b31fe27b310842c464538001b7",
"size": ... |
class NoVersionsError(Exception):
"""
No versions found for package.
"""
def __str__(self):
return """<NoVersionsError {}>""".format(self.message)
class PIPError(Exception):
"""
PIP process failure.
"""
def __str__(self):
return """<PIPError {}>""".format(self.message... | {
"content_hash": "148617672f3d4d4a6d634c2dcdd785d2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 63,
"avg_line_length": 19.4,
"alnum_prop": 0.5670103092783505,
"repo_name": "vuolter/autoupgrade",
"id": "29e7f3eb2c1f6f93a3cf2ca51a068196ef002b45",
"size": "511",
"binar... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from genericm2m.models import RelatedObjectsDescriptor
@python_2_unicode_compatible
class TestModel(models.Model):
name = models.CharField(max_length=200)
test = RelatedObjectsDescriptor()
for_inline = models.For... | {
"content_hash": "a69149d1448cc308a2f0ccc2458111bb",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 61,
"avg_line_length": 22.904761904761905,
"alnum_prop": 0.6902286902286903,
"repo_name": "Eraldo/django-autocomplete-light",
"id": "42360342583e4fae309ae7ab21f393be8fe61f0c"... |
"""
Management utility to clean up tokens
"""
from datetime import datetime as dt
from optparse import make_option
from django.core.management.base import BaseCommand
from django.db.models import Count
from tardis.tardis_portal.models import Token, ObjectACL
from tardis.tardis_portal.auth.token_auth import TokenGroup... | {
"content_hash": "f9d33e042cc010c72cc6ecb63c159307",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 29.90740740740741,
"alnum_prop": 0.6396284829721363,
"repo_name": "pansapiens/mytardis",
"id": "654d2c97b2894ece9e1eb1bc5b0eb6253f23fb51",
"size": "1... |
import pandas as pd
from pandas.util.testing import assert_series_equal
from six import iteritems
from functools import partial
from toolz import groupby
from zipline.finance.asset_restrictions import (
RESTRICTION_STATES,
Restriction,
HistoricalRestrictions,
StaticRestrictions,
SecurityListRestri... | {
"content_hash": "d29c54d8e59b19b55ddd9c06d3157d24",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 79,
"avg_line_length": 40.575178997613364,
"alnum_prop": 0.6057878948297158,
"repo_name": "Scapogo/zipline",
"id": "72c1297d45c47b512484192e1971d220ae7a0ee3",
"size": "170... |
"""Main Flask module"""
from flask import Flask
from flask_restful import Api
from dbclient.models import db
from resources import Systems, SingleSystem, Routes
app = Flask(__name__)
api = Api(app, catch_all_404s=True)
db.init_app(app)
api.add_resource(Systems,
'/systems')
api.add_resource(SingleSys... | {
"content_hash": "3f718135358df442a00a7ff14543029e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6365461847389559,
"repo_name": "Srogozins/eve-travel-helper",
"id": "f292f03b40213112127e43e5ca611d60c3044f3d",
"... |
import os
import simplejson
from homely._errors import CleanupConflict, CleanupObstruction, HelperError
from homely._ui import note, warn
from homely._utils import (ENGINE2_CONFIG_PATH, FactConfig, RepoInfo,
isnecessarypath)
_ENGINE = None
_REPO = None
def initengine():
global _ENGIN... | {
"content_hash": "2ee48eb938521a85ec17ee2f533003a7",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 79,
"avg_line_length": 36.27663551401869,
"alnum_prop": 0.5336974443528442,
"repo_name": "toomuchphp/terraform",
"id": "1a2287e8519996ff436039f1b3cb287f5b77f31e",
"size": ... |
"""Examples."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| {
"content_hash": "e55c74e891007491ba8138da8d7ceb66",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 31.25,
"alnum_prop": 0.728,
"repo_name": "AlphaSmartDog/DeepLearningNotes",
"id": "c1425398ec788f14e0eb840fcb968cf0ce5c7673",
"size": "809",
"binary... |
import socket
import time
import datetime
import sys
from threading import Thread
class Server:
TAG = "NO TAG"
host = None
port = None
sock = None
running = False
clients = {}
def __init__(self, tag, host, port):
self.sock = None
self.host = host
self.port = port
self.TAG = tag
#starts the FTP ... | {
"content_hash": "cd14b2cfbabe2af3271b960701e93193",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 117,
"avg_line_length": 24.3125,
"alnum_prop": 0.650956869465867,
"repo_name": "tedgueniche/DummyPot",
"id": "027c214ac04a406320b5dc40d1160c94121d6562",
"size": "3501",
... |
import json
import fdb
from datadog_checks.base import AgentCheck
fdb.api_version(600)
class FoundationdbCheck(AgentCheck):
def __init__(self, name, init_config, instances):
super(FoundationdbCheck, self).__init__(name, init_config, instances)
self._db = None
def construct_database(self):
... | {
"content_hash": "234bd89c306bae704f630f684099afa9",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 120,
"avg_line_length": 50.19718309859155,
"alnum_prop": 0.5989057239057239,
"repo_name": "DataDog/integrations-core",
"id": "c80b418e9c938f0b515b0681fc825ff613965b28",
"s... |
class People(object):
country = "China"
@staticmethod
def getCountry():
return People.country
print(People.getCountry()) | {
"content_hash": "3d37c469e97b77644b7f91cbab836f44",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 26,
"avg_line_length": 12.9,
"alnum_prop": 0.7286821705426356,
"repo_name": "onezens/python",
"id": "7da0974a2b02be4840cbaf203638fd129c142aeb",
"size": "146",
"binary": f... |
from django.conf import settings
from django.http import HttpResponse
from django.utils.datastructures import MultiValueDictKeyError
from core.common import *
from images.models import Image
from notes.models import Note
from posts.models import Post, PostMedia
from posts.forms import PostForm
from posts.views import ... | {
"content_hash": "70cde837b6856458ed21ffb0223513a8",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 76,
"avg_line_length": 24.222707423580786,
"alnum_prop": 0.6327744726879394,
"repo_name": "PrincessTeruko/TsunArt",
"id": "27e81c30529507316935ce03019473c5e95370b1",
"size... |
import json
__all__ = ['ConsoleStorage']
SCHEME = ('cons', 'console', 'stdout')
class ConsoleStorage(object):
def __init__(self, config, parsed):
self.config = config
def save(measure):
try:
print(json.dump(measure))
except TypeError:
from logging import getL... | {
"content_hash": "503dc049ef89ab42a22b6061b442cb0e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 23.210526315789473,
"alnum_prop": 0.5668934240362812,
"repo_name": "skoenen/pyprol",
"id": "957ffba9f9ae8841d52ca7696d075a8fe843cce9",
"size": "441",... |
available_spaces = 60
# Prints
def print_start():
print('┌{}┐'.format('─' * available_spaces))
def print_empty():
print('│{}│'.format(' ' * available_spaces))
def print_left(value, padding=1):
print('│{}{}│'.format(' ' * padding, value.ljust(available_spaces - padding)))
def print_center(value):
... | {
"content_hash": "836067ba637e8464c9cbc1499d9513e5",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 82,
"avg_line_length": 18.875,
"alnum_prop": 0.6037527593818984,
"repo_name": "LonamiWebs/Py-Utils",
"id": "e7aff427f7692fbd4eeaa00783e810ee4b68eaab",
"size": "979",
"bin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.