text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import unicode_literals, absolute_import
import six
from collections import namedtuple
from decimal import Decimal as D
from dateutil.parser import parse
from . import base
from . import stores
from . import devices
Price = namedtuple('Price', ['value', 'currency'])
class Product(base.AppFigureObj... | {
"content_hash": "d465c5a8d9878c4c5c47a768bc2de671",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 76,
"avg_line_length": 29.985507246376812,
"alnum_prop": 0.6075398743354278,
"repo_name": "mobify/python-appfigures",
"id": "e29df54310eb684821c2d1ad4a989720754eb04d",
"si... |
import os
import json
import requests
from requests.auth import HTTPDigestAuth
from collections import OrderedDict
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def get_solr_json(solr_url,
query,
api_key=None,... | {
"content_hash": "15ecdf83f1e61e059fc571c701785e53",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 83,
"avg_line_length": 48.343283582089555,
"alnum_prop": 0.715961716579191,
"repo_name": "mredar/ucldc_api_data_quality",
"id": "37975406d6be9d06e98f62b42559b45eb0fe8120",
... |
class GaloisFieldElement(object):
"""
Element of a finite field
"""
def __init__(self):
pass
def __eq__(self, other):
return self.__dict__ == other.__dict__
class GaloisFieldArithmetic(object):
"""
A collection of arithmetic operators for finite field elements
"""
... | {
"content_hash": "e4dbc091ff04d0de4125af4cd4f22ebf",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 69,
"avg_line_length": 17.176470588235293,
"alnum_prop": 0.4460616438356164,
"repo_name": "FederatedAI/FATE",
"id": "2c452790ef60fa6130810f619f1779261009a4a8",
"size": "183... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('structure', '0016_customerpermissionreview'),
]
operations = [
migrations.RemoveField(model_name='customer', name='is_company',),
]
| {
"content_hash": "0b169104f49ea8ae8ede6a42e5720baf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 74,
"avg_line_length": 21.583333333333332,
"alnum_prop": 0.6602316602316602,
"repo_name": "opennode/nodeconductor-assembly-waldur",
"id": "6ef428be3cfbd0720dad1f0fda08efa1551... |
import unittest
from unittest import mock
import wikipedia
from orangecontrib.text.wikipedia import WikipediaAPI
from orangecontrib.text.corpus import Corpus
class StopingMock(mock.Mock):
def __init__(self, allow_calls=0):
super().__init__()
self.allow_calls = allow_calls
self.call_count... | {
"content_hash": "0974b2d83a00f8f83374361f21a975a4",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 93,
"avg_line_length": 31.5125,
"alnum_prop": 0.6120587068623562,
"repo_name": "cheral/orange3-text",
"id": "b8c78e939aba6abd79648de743505698d501d01b",
"size": "2521",
"b... |
import json
import nltk.sentiment.util
import os
import random
from _operator import itemgetter
from datetime import timedelta
from nltk.sentiment import SentimentIntensityAnalyzer
from Clustering.clustering import find_tweets_with_keywords_idf
from config.config import PROJECT_DIR, PCLOUD_DIR
from inputoutput.cli imp... | {
"content_hash": "bf9bb759ff55fea2ff466c0735a13089",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 124,
"avg_line_length": 36.621212121212125,
"alnum_prop": 0.5982623086470832,
"repo_name": "den1den/web-inf-ret-ml",
"id": "8cba69d28c7bf632b287a1970dce0c27dfdc4480",
"siz... |
from __future__ import division, with_statement
import functools
# http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
def memoized(obj):
cache = obj.cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
key = str(args) + str(kwargs)
if key not in cache:
cache... | {
"content_hash": "f0a567df335485d21b198c7fa9b90543",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 85,
"avg_line_length": 35.395833333333336,
"alnum_prop": 0.5397292525014714,
"repo_name": "nwinter/bantling",
"id": "c597b24bf562067bce9475c53fa9c9441c507502",
"size": "344... |
from .base import BaseImporter
from pupa.utils import get_pseudo_id, _make_pseudo_id
from opencivicdata.legislative.models import (Event, EventLocation, EventSource, EventDocument,
EventDocumentLink, EventLink, EventParticipant,
... | {
"content_hash": "93d576f2d063ce06ea0f7987e775e3ab",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 96,
"avg_line_length": 44.371428571428574,
"alnum_prop": 0.5091221292122773,
"repo_name": "opencivicdata/pupa",
"id": "8d4e0dac52f85bf225d45d836f42ae53a562bd1b",
"size": "... |
import pyaudio
import wave
import sys
CHUNK = 1024
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels=wf.ge... | {
"content_hash": "44377b4bfdcc753f031591703a7daf00",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 18.633333333333333,
"alnum_prop": 0.6189624329159212,
"repo_name": "tdb-alcorn/pymusic",
"id": "f828549b7ec984c74f87eae157b7482fa396233a",
"size": "5... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1HostAli... | {
"content_hash": "fc327dd05927dc0c7c8098d1facb1fdb",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 105,
"avg_line_length": 25.49645390070922,
"alnum_prop": 0.5171070931849792,
"repo_name": "sebgoa/client-python",
"id": "1af24f87300316f48f0e888977fbf9cd9550c884",
"size":... |
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^niwi-admin/', include(admin.site.urls)),
)
from django.views.generic import RedirectView
from niwi.web.views.main import Sitemap, Robots
urlpatterns +=... | {
"content_hash": "c2e277a32781728995035d40320055cd",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 85,
"avg_line_length": 29.609756097560975,
"alnum_prop": 0.6729818780889621,
"repo_name": "niwinz/niwi-web",
"id": "10ef6efcf544a56e68005ab2e6356eb9b62403eb",
"size": "1239... |
from __future__ import absolute_import
from __future__ import unicode_literals
from pre_commit_hooks.check_case_conflict import find_conflicting_filenames
from pre_commit_hooks.check_case_conflict import main
from pre_commit_hooks.util import cmd_output
from testing.util import cwd
from testing.util import write_file
... | {
"content_hash": "7e695e98d0a7f7dbddbc339a2f7de7c1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 75,
"avg_line_length": 30.439393939393938,
"alnum_prop": 0.600298656047785,
"repo_name": "bgschiller/pre-commit-hooks",
"id": "2a32918a7374840047427b951cc3be8a5c6bdf77",
"s... |
'''
Copyright (c) OS-Networks, http://os-networks.net
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... | {
"content_hash": "eb532926f8687bd6a89dbca053fc4bfd",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 132,
"avg_line_length": 39.74264705882353,
"alnum_prop": 0.6732654949121184,
"repo_name": "Knygar/hwios",
"id": "17162d28f70b9c1b9aa851f1f78ebbc0c5b8c3c1",
"size": "5405",... |
import numpy as np
import pytest
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.util... | {
"content_hash": "e44878918a9a12389cfcee987f9927c0",
"timestamp": "",
"source": "github",
"line_count": 618,
"max_line_length": 79,
"avg_line_length": 35.99514563106796,
"alnum_prop": 0.54488649134637,
"repo_name": "glemaitre/scikit-learn",
"id": "fd396ceb90712c3602cc12ca329035248d922810",
"size": ... |
import os
import numpy as np
import sys
from collections import OrderedDict
import math
import torch
import torch.nn.functional as F
from torch import nn
from pytorch_lightning import LightningModule
from pytorch_lightning import seed_everything
from .doppelganger import DoppelGANger
from .network import RNNInitialS... | {
"content_hash": "4610b8159ae00a41550f0e521445a8b9",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 95,
"avg_line_length": 47.77880184331797,
"alnum_prop": 0.5048225308641975,
"repo_name": "yangw1234/BigDL",
"id": "fbf96e5379a2b46ae7e90b2fd06452b73f5e53ca",
"size": "1270... |
import mechanize
class Navigator():
br = mechanize.Browser()
logged_in = False
def clearBrowser(self):
self.br = mechanize.Browser()
def login(self, username, password):
login_url = "https://auth.vt.edu/login?service=https://webapps.banner.vt.edu/banner-cas-prod/authorized/banner/S... | {
"content_hash": "e61a923b3ec687a01aaa02cb9e832975",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 131,
"avg_line_length": 32.15555555555556,
"alnum_prop": 0.5618521078092605,
"repo_name": "ajn123/VT-Python-Class-Add",
"id": "09c36ec771923c4802c162a440f733b69ebeccd4",
"s... |
import logging
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from django.urls import reverse
from seaserv import ccnet_api
from ... | {
"content_hash": "3308db42aefa2e0a170da9463a8e52aa",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 83,
"avg_line_length": 34.02857142857143,
"alnum_prop": 0.6351805205709488,
"repo_name": "miurahr/seahub",
"id": "d48a13618e176729747e9cd9d70e62a4ab632fa8",
"size": "4803"... |
'''
Simple test script which prints all HTTP responses' URLs and their total
count from a warc file whose path is passed as command line argument.
Does not support gzipped files.
'''
from warcreader import WarcFile
from sys import argv
from io import open
def main():
filename = argv[1]
with open(fil... | {
"content_hash": "add6cd499f1af9475c2086057b4a42c6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 22.8,
"alnum_prop": 0.6701754385964912,
"repo_name": "msvana/warcreader",
"id": "f6bfae608e41cc19d3e5a6da75d1fc83db69ac2b",
"size": "1158",
"binary... |
from django.dispatch.robustapply import *
import unittest
def noArgument():
pass
def oneArgument(blah):
pass
def twoArgument(blah, other):
pass
class TestCases(unittest.TestCase):
def test01(self):
robustApply(noArgument)
def test02(self):
self.assertRaises(TypeError, robus... | {
"content_hash": "b44539acec87b0fee058ba7a74119c03",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 85,
"avg_line_length": 21.647058823529413,
"alnum_prop": 0.6616847826086957,
"repo_name": "diofeher/django-nfa",
"id": "499450eec4873ccf218c58fb63e8a4664424f47a",
"size": "... |
'''
Contributors of this code: Alexander Belchenko, Harco Kuppens, Justin Riley.
http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/
https://stackoverflow.com/questions/566746/how-to-get-linux-console-window-width-in-python
https://gist.github.com/jtriley/1108174
I changed python2 ... | {
"content_hash": "465e9f9cc81729e912fbd4a13fbc5dc6",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 179,
"avg_line_length": 33.21782178217822,
"alnum_prop": 0.6038748137108793,
"repo_name": "willettk/common_language",
"id": "de162afa6c237c8e4898acd945debbb501b4d3bd",
"si... |
import json
import queue
import time
from collections import namedtuple
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
from dataset import to_sentences, tokens_to_ids, tf_Examples, SENTENCE_END, PAD_TOKEN
ModelInput = namedtuple('ModelInput',
... | {
"content_hash": "171e9a39839411eae90cdedd91f8008b",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 143,
"avg_line_length": 39.19736842105263,
"alnum_prop": 0.6295177352579165,
"repo_name": "drakessn/Question-Answering",
"id": "9a39f400d184898616ff0ceb25365d0170d60626",
... |
import logging
import numpy as np
import pandas as pd
from . import snpmatch
from . import parsers
from . import snp_genotype
log = logging.getLogger(__name__)
def simulateSNPs(g, AccID, numSNPs, outFile=None, err_rate=0.001):
assert type(AccID) is str, "provide Accession ID as a string"
assert AccID in g.g.a... | {
"content_hash": "58eb2b7dbe7d7da37a2258b1462a2bf8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 185,
"avg_line_length": 57.19117647058823,
"alnum_prop": 0.651581383389046,
"repo_name": "Gregor-Mendel-Institute/SNPmatch",
"id": "bc10a3950ca1027577d27908a6d9c6baaafca64a",... |
import re
import sys
from subprocess import PIPE, STDOUT
import subprocess
def err(msg="Undetermined error"):
print "ERROR"
print msg
sys.exit(0)
if __name__ == '__main__':
if len(sys.argv) < 2:
genders_query = '~NONE' # Trick to list all hosts
else:
genders_query = sys.argv[1]
... | {
"content_hash": "fb0de1ff5069a26fe00d75060666c00f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 84,
"avg_line_length": 23.9,
"alnum_prop": 0.5913528591352859,
"repo_name": "wcooley/splunk-puppet",
"id": "56b73ee069c1e2b2d540e72bc0dec739ab8eb107",
"size": "1516",
"bi... |
import logging
import unittest
import bus
class FakeHandler:
def __init__(self):
self.handle_called = False
self.command = None
def handle(self, command):
self.handle_called = True
self.command = command
class RaiseExceptionHandler:
def __init__(self):
pass
... | {
"content_hash": "eb2925e048863bf549bf8f56f6c17318",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 61,
"avg_line_length": 23.046875,
"alnum_prop": 0.6196610169491525,
"repo_name": "guillaumevincent/rangevoting",
"id": "6fe729973136f9779c45b1f2dda3ceb2cb369709",
"size": "... |
import win32com.client
import array
import PPCOM
from PPCOM import enumInterfaces
from PPCOM import enumFrequencies
from PPCOM import enumSonosArrays
import sys
import os
#Define global variables
m_sLastError = ""
PY3 = sys.version_info.major == 3
#Distinguishing identifier of PSoC3/5 families
LEOPARD_ID = 0xE0;
PANT... | {
"content_hash": "4d4054120a341bab903243e342d484b6",
"timestamp": "",
"source": "github",
"line_count": 613,
"max_line_length": 207,
"avg_line_length": 32.54649265905383,
"alnum_prop": 0.61841511703674,
"repo_name": "open-storm/perfect-cell",
"id": "1972c2e50004c20b0be261b879d281de43980f1c",
"size"... |
import factory
from oscar.core.loading import get_model
__all__ = [
'RangeFactory', 'ConditionFactory', 'BenefitFactory',
'ConditionalOfferFactory',
]
class RangeFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda n: 'Range %d' % n)
slug = factory.Sequence(lambda n: 'range-%d' % n)
... | {
"content_hash": "ff909eadfc205b173cc9cc79ca9a7d9d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 68,
"avg_line_length": 26.462962962962962,
"alnum_prop": 0.675297410776767,
"repo_name": "john-parton/django-oscar",
"id": "b5ddaf402321506f72c1f2c6558e09ee6fb692ab",
"size... |
import os
from pants.base.build_environment import get_buildroot, pants_version
from pants.build_graph.aliased_target import AliasTargetFactory
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.build_graph.files import Files
from pants.build_graph.intransitive_dependency import (
Intrans... | {
"content_hash": "132742d3ac39ad74ccc054bd49c40765",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 98,
"avg_line_length": 34.61224489795919,
"alnum_prop": 0.6904481132075472,
"repo_name": "wisechengyi/pants",
"id": "cd57295efc5ef36df0c82425fbac654f8e084edb",
"size": "182... |
import json
import os
import shutil
from datetime import date, timedelta
import mock
from django.conf import settings
from django.core import management
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon, Persona
from olympia.stats.management.commands import (
s... | {
"content_hash": "467adb1116ae6bb7d08c6c9d2d2b27ca",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 95,
"avg_line_length": 44.13966480446928,
"alnum_prop": 0.5801797240855587,
"repo_name": "jpetto/olympia",
"id": "cddc3e435062bc2c9ebad09ba2b998fde8b69f57",
"size": "15802... |
from __future__ import print_function
import json
import unittest
import bleach
import doctest
import mock
import multiprocessing
import os
import re
import signal
import sqlalchemy
import subprocess
import tempfile
import warnings
from datetime import timedelta
from dateutil.relativedelta import relativedelta
from e... | {
"content_hash": "aea6cde9003fa4a1cdb298bb432f0c9a",
"timestamp": "",
"source": "github",
"line_count": 2506,
"max_line_length": 109,
"avg_line_length": 39.89385474860335,
"alnum_prop": 0.5872526856982816,
"repo_name": "RealImpactAnalytics/airflow",
"id": "ce32482d04f2a45c9d8f5a4364310cf508aca4f2",
... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
from indra.sources.cwms.processor import CWMSProcessor
from indra.sources.cwms.rdf_processor import CWMSRDFProcessor
from indra.sources.trips import client
logger = logging.getLogger(__name__)
def p... | {
"content_hash": "5711357b391cde73cbfd17cab65ded7d",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 75,
"avg_line_length": 28.091836734693878,
"alnum_prop": 0.6465673810388667,
"repo_name": "pvtodorov/indra",
"id": "0fb3e0a9f9dfc6f14a98f2ac13c717572cc63868",
"size": "2753... |
import os
import sys
import knowledgebase
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = knowledgebase.__version__
if sys.argv[-1] == 'publish':
try:
import wheel
except ImportError:
print('Wheel library missing. Please run "pip insta... | {
"content_hash": "edbd85d5c2542468469d0fe233fa2852",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 70,
"avg_line_length": 28.88235294117647,
"alnum_prop": 0.6186354378818737,
"repo_name": "bazzite/django-knowledgebase",
"id": "376ae219d7658a8d874ecd840a6c7d2b2b93c805",
"... |
import sys
import os.path
import unittest
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
import configgen.utils.videoMode as videoMode
class VideoModeUtilTest(unittest.TestCase):
pass
#def test_createSimpleFillValues(self):
# self.assertEquals(videoMode.createV... | {
"content_hash": "ed37058ccfc23a8bb1223e687919ce35",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 100,
"avg_line_length": 33.38095238095238,
"alnum_prop": 0.7061340941512125,
"repo_name": "digitalLumberjack/recalbox-configgen",
"id": "779b36513025df2566bebe4b6f3c13977678c... |
"""
Representation Tutorial for RLPy
================================
Assumes you have created the IncrTabularTut.py agent according to the tutorial and
placed it in the Representations/ directory.
Tests the Representation on the GridWorld domain usin SARSA
"""
__author__ = "Robert H. Klein"
from rlpy.Domains import G... | {
"content_hash": "d59b27f5cf6809d0eb7f0897737f3e76",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 82,
"avg_line_length": 33.74576271186441,
"alnum_prop": 0.6790557508789553,
"repo_name": "imanolarrieta/RL",
"id": "8ecaca2f7278ccbe40fad3e89ea4dcf9ee6f9de9",
"size": "2013... |
import os, re
import pytest
from pytest import raises
from jenkinsflow.flow import parallel, FailedChildJobsException
from .framework import api_select
from .framework.utils import assert_lines_in
from .framework.abort_job import abort
from .cfg import ApiType
here = os.path.abspath(os.path.dirname(__file__))
@p... | {
"content_hash": "bb3fdf7b017f8fcb111d90466bef5375",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 135,
"avg_line_length": 36.275,
"alnum_prop": 0.656788421778084,
"repo_name": "lechat/jenkinsflow",
"id": "da5160310159cedee040c071769b0c8276b66e99",
"size": "1589",
"bin... |
"""The tests for the Sun component."""
from datetime import datetime, timedelta
from unittest.mock import patch
from pytest import mark
import homeassistant.components.sun as sun
from homeassistant.const import EVENT_STATE_CHANGED
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
i... | {
"content_hash": "f48f239a88d617fa6a63ebbac28db5bb",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 87,
"avg_line_length": 30.630208333333332,
"alnum_prop": 0.6340758374426118,
"repo_name": "leppa/home-assistant",
"id": "e04de7e2578ff514811d6dcbf0b466a912bfaf79",
"size":... |
import os
# Setup config name.
config.name = 'GWP-ASan' + config.name_suffix
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Test suffixes.
config.suffixes = ['.c', '.cpp', '.test']
# C & CXX flags.
c_flags = ([config.target_cflags])
# Android doesn't want -lrt.
if not config.android:
... | {
"content_hash": "423b5bfed721787d9e49d887b94f2847",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 97,
"avg_line_length": 33.55813953488372,
"alnum_prop": 0.6812196812196812,
"repo_name": "endlessm/chromium-browser",
"id": "a1b2551c2f9daf9372c3b7a9f197e1dfa41e5c92",
"siz... |
import sys
import os
import subprocess
import time
import getpass
DEBUG=False
VERBOSE=False
cookies = "--insecure --cookie-jar .cookies.txt --cookie .cookies.txt"
PREFIX=os.path.dirname(os.path.realpath(__file__))
def cmd_exists(cmd):
""" Returns: bool, True if 'cmd' is in PATH, False otherwise."""
return sub... | {
"content_hash": "9e00399999aadf89ee69fad1c06a4da7",
"timestamp": "",
"source": "github",
"line_count": 485,
"max_line_length": 81,
"avg_line_length": 35.30103092783505,
"alnum_prop": 0.5614158051515683,
"repo_name": "nkinkade/operator",
"id": "eca9d2ac147160b57a2dfe20ac1256614a3b7968",
"size": "17... |
import theano.tensor as T
class Operation():
def __init__(self, input, op_name):
self.input = input
self.operate = self.get_operation(op_name)
self.output = self.operate(input, axis=1)
def get_operation(self, op_name):
if op_name == 'sum':
return T.sum
elif op_name == 'mean':
return T.mean
elif ... | {
"content_hash": "b5994888496fcd4eca7f25680292fd44",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 54,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.6474820143884892,
"repo_name": "nusnlp/corelm",
"id": "9612f394a9628642182d1ce81d0a0f9d6bb3ca73",
"size": "417",
... |
"""ttsa.py: Traveling Tournament Problem Using Simulated Annealing"""
__author__ = "Colin Burgin"
__copyright__ = "Copyright 2017, Virginia Tech"
__credits__ = [""]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "Colin Burgin"
__email__ = "cburgin@vt.edu"
__status__ = "in progress"
# Standard Python Librari... | {
"content_hash": "6e2a25277ff2f8b124f96e3d47fc0860",
"timestamp": "",
"source": "github",
"line_count": 478,
"max_line_length": 250,
"avg_line_length": 38.77405857740586,
"alnum_prop": 0.5336678536743282,
"repo_name": "cburgin/TPP-SA",
"id": "065f6bf3cf0bd224638c34864f6b296e9c693d4f",
"size": "1855... |
from functools import partial
import time
import os
import tensorflow.compat.v2 as tf
tf.enable_v2_behavior()
import bit_common
import bit_hyperrule
import bit_tf2.models as models
import input_pipeline_tf2_or_jax as input_pipeline
def reshape_for_keras(features, batch_size, crop_size):
features["image"] = tf.res... | {
"content_hash": "15d26e15e05c54b9ad8948c9bb5f1c3c",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 90,
"avg_line_length": 35.330882352941174,
"alnum_prop": 0.6795005202913632,
"repo_name": "google-research/big_transfer",
"id": "5292887839d96f884e66a35882199fa15baff319",
... |
"""
pyexcel.plugin.parsers.django
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Export data into database datables
:copyright: (c) 2015-2017 by Onni Software Ltd.
:license: New BSD License
"""
import pyexcel_io.database.common as django
from pyexcel_io import get_data, iget_data
from pyexcel.parser impor... | {
"content_hash": "953dc617215e625c8b0d67f4924b2785",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 33.878787878787875,
"alnum_prop": 0.6082289803220036,
"repo_name": "caspartse/QQ-Groups-Spider",
"id": "a2bf1b155a32c1d3375b9134de4f54a683270cfa",
"s... |
import gc
import sys
import time
import unittest
from django.dispatch import Signal, receiver
if sys.platform.startswith('java'):
def garbage_collect():
# Some JVM GCs will execute finalizers in a different thread, meaning
# we need to wait for that to complete before we go on looking for the
... | {
"content_hash": "78c1d264f3c13edafd5d77100f774748",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 78,
"avg_line_length": 31.48170731707317,
"alnum_prop": 0.6135967460778617,
"repo_name": "makinacorpus/django",
"id": "5f7dca87cc5f44530123fb94bd25c2b1eb94f139",
"size": "... |
"""Disallow seconds in durations
Revision ID: 178d297eae7e
Revises: cf9e1b4e2f5f
Create Date: 2021-05-27 13:14:59.253773
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '178d297eae7e'
down_revision = 'cf9e1b4e2f5f'
branch_labels = None
depends_on = None
def upgrade():
op.execute... | {
"content_hash": "e22d4e08cb1e6695edf94d89527eb8bb",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 210,
"avg_line_length": 38.492537313432834,
"alnum_prop": 0.6793330748352074,
"repo_name": "ThiefMaster/indico",
"id": "71e9328684c4b474ab09b2edfe27bda9521e0577",
"size": "... |
"""Checker functions for filtering."""
from warnings import warn
import numpy as np
###################################################################################################
###################################################################################################
def check_filter_definition(pass... | {
"content_hash": "e63b33b7fe5c6162bdcc32208355898d",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 105,
"avg_line_length": 40.66438356164384,
"alnum_prop": 0.6090618157318511,
"repo_name": "srcole/neurodsp",
"id": "4140e88ce28973f969cc9a7d8610c00a4114ce74",
"size": "593... |
""" Framework for filtered REST requests
@copyright: 2013-14 (c) Sahana Software Foundation
@license: MIT
@requires: U{B{I{gluon}} <http://web2py.com>}
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Softwa... | {
"content_hash": "ea634f174cfbf3f4eb1e7fcf3f41118a",
"timestamp": "",
"source": "github",
"line_count": 2947,
"max_line_length": 143,
"avg_line_length": 36.701051917203934,
"alnum_prop": 0.4659294735479576,
"repo_name": "gnarula/eden_deployment",
"id": "d8e219d819d7ab1943832fd4528667a350d80eca",
"s... |
from pgcli.packages.expanded import expanded_table
import pytest
def test_expanded_table_renders():
input = [("hello", 123),("world", 456)]
expected = """-[ RECORD 0 ]
name | hello
age | 123
-[ RECORD 1 ]
name | world
age | 456
"""
assert expected == expanded_table(input, ["name", "age"])
| {
"content_hash": "a8d12854997e1936fc1f72a9e2c5af25",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 21.857142857142858,
"alnum_prop": 0.6372549019607843,
"repo_name": "czchen/debian-pgcli",
"id": "6f2c6591c3216889f96c130869a352bfdbb4634b",
"size": "... |
"""
This subpackage provides classes to communicate with other applications via the
`Simple Application Messaging Protocal (SAMP)
<http://www.ivoa.net/documents/SAMP/>`_.
Before integration into Astropy it was known as
`SAMPy <https://pypi.python.org/pypi/sampy/>`_, and was developed by Luigi Paioro
(INAF - Istituto N... | {
"content_hash": "203bf095080ed8df73951752d8c9edba",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 81,
"avg_line_length": 25.763157894736842,
"alnum_prop": 0.6996935648621042,
"repo_name": "bsipocz/astropy",
"id": "dcd6e9240860aac5908d5a0af75fb7171987eb84",
"size": "1043... |
from django.db.models import Q, Sum
from django.db.models.deletion import ProtectedError
from django.db.utils import IntegrityError
from django.forms.models import modelform_factory
from django.test import TestCase, skipIfDBFeature
from .models import (
A, Address, B, Board, C, CharLink, Company, Contact, Content,... | {
"content_hash": "f6fec9859e88ee88252f9309a0aed015",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 92,
"avg_line_length": 43.13833992094862,
"alnum_prop": 0.6367051493494594,
"repo_name": "tomchristie/django",
"id": "9add025a46a2a926b1039394fedac62d64f40021",
"size": "1... |
import Gaffer
import GafferScene
GafferScene.TweakPlug = Gaffer.TweakPlug
GafferScene.TweaksPlug = Gaffer.TweaksPlug
| {
"content_hash": "2ba4c619af4d14731ed6e6c1d0664f23",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 23.6,
"alnum_prop": 0.8559322033898306,
"repo_name": "johnhaddon/gaffer",
"id": "34b66ad5e213727152d8a4f6160ef3aa129ca433",
"size": "1914",
"binary"... |
from .sub_resource import SubResource
class BackendAddressPool(SubResource):
"""Pool of backend IP addresses.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:ivar backend_ip_configurations: Gets collection of refe... | {
"content_hash": "4c1313e4772773f2545d3e38aea2f71a",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 128,
"avg_line_length": 42.3448275862069,
"alnum_prop": 0.6640879478827362,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "67f2ddd8888c2d687d2959e8b07fc5100e0c62eb",
... |
import girder_client
GIRDER_URL = 'http://127.0.0.1/api/v1'
GIRDER_LOGIN = 'user'
GIRDER_API_KEY = 'API_KEY'
gc = girder_client.GirderClient(apiUrl=GIRDER_URL)
gc.authenticate(username=GIRDER_LOGIN, apiKey=GIRDER_API_KEY)
def handle_item(item, bc):
bc = bc + (item['name'],)
print '/'.join(bc)
def handle_fol... | {
"content_hash": "463a638190538a19a47e3c8978e25968",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 69,
"avg_line_length": 27.954545454545453,
"alnum_prop": 0.6341463414634146,
"repo_name": "data-exp-lab/girder",
"id": "56df5dcc218c25241120bd74b369bf09f2a97809",
"size": "... |
"""
vg_config.py: Default configuration values all here (and only here), as well as logic
for reading and generating config files.
"""
import argparse, sys, os, os.path, errno, random, subprocess, shutil, itertools, glob, tarfile
import doctest, re, json, collections, time, timeit
import logging, logging.handlers, st... | {
"content_hash": "d5f304f18d3d1e4a28267e20520975df",
"timestamp": "",
"source": "github",
"line_count": 757,
"max_line_length": 127,
"avg_line_length": 31.27212681638045,
"alnum_prop": 0.6946310142356271,
"repo_name": "vgteam/toil-vg",
"id": "df0090d061a5a285d0e6a305a758bbe5c5f22c35",
"size": "2369... |
import numpy as np
from sklearn.metrics import cohen_kappa_score as kappa # noqa
from sklearn.metrics import mean_squared_error as mse
from sklearn.metrics import mean_absolute_error as mae # noqa
from sklearn.metrics import r2_score as r2 # noqa
from ..const import EPS
def mape(y, p):
"""Mean Absolute Percen... | {
"content_hash": "1e2cb45ebd890b7c505c0f6701d587b3",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 62,
"avg_line_length": 23.56756756756757,
"alnum_prop": 0.6100917431192661,
"repo_name": "jeongyoonlee/Kaggler",
"id": "c049c64cdedc895ed0045cbb35a493481112cbee",
"size": "... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scheduling_partitioned', '0006_unique_indexes'),
]
operations = [
# (case_id, alert_schedule_id) covered by unique(case_id, alert_schedule_id, recipient_type, recipient_id)
migrations.Alter... | {
"content_hash": "88619b01153a598df652e60fe57a237e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 114,
"avg_line_length": 38.904761904761905,
"alnum_prop": 0.627906976744186,
"repo_name": "dimagi/commcare-hq",
"id": "5ef4182b59f5e30aae503e8fa1e51136b94a4b01",
"size": "8... |
import re
from reportlab import platypus
from facturapdf import flowables, helper
def element(item):
elements = {
'framebreak': {'class': platypus.FrameBreak},
'simpleline': {'class': flowables.SimpleLine, 'cast': {0: float, 1: float}},
'paragraph': {'class': flowables.Paragraph},
... | {
"content_hash": "5d5ad535ca159687f98c9e05c5c66302",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 84,
"avg_line_length": 32.53125,
"alnum_prop": 0.56388088376561,
"repo_name": "initios/factura-pdf",
"id": "fe7889e7ca8545bc28c5f41c3a73643d2fc70a2c",
"size": "1041",
"bi... |
"""Support for IP Cameras."""
from __future__ import annotations
import asyncio
from contextlib import closing
import logging
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEM... | {
"content_hash": "d6b0b959090c428044f55c88e20694fa",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 88,
"avg_line_length": 33.38172043010753,
"alnum_prop": 0.6329521662103398,
"repo_name": "aronsky/home-assistant",
"id": "d486f78d334f55255b06093de6cb2263b3b6ebd6",
"size"... |
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from jsonfield import JSONField
from openslides.utils.models import RESTModelMixin
from .access_permissions import (
ObjectProtocolAccessPermissions,
Protocol... | {
"content_hash": "7ecc7fb9771d5910c8c8e3b4064b36b3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 83,
"avg_line_length": 27.883333333333333,
"alnum_prop": 0.6999402271368799,
"repo_name": "OpenSlides/openslides-protocol",
"id": "3c35357bd518007a47eff7eb74af47245a4d9749",
... |
from __future__ import print_function
from __future__ import division
import ftplib
from fnmatch import fnmatch
from StringIO import StringIO
import pkgutil
import importlib
from path import path
from fuzzywuzzy import process
import resources
from magicmethods import load_class
from yml import ConfigReader, HistoryR... | {
"content_hash": "f6c73d88a98507d1cff52517897042ca",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 114,
"avg_line_length": 30.20498614958449,
"alnum_prop": 0.6507703595011005,
"repo_name": "robinandeer/cosmid",
"id": "79419658bd13cb07a9349c61ca36427fd98c2b89",
"size": "... |
from login.permissions import cache_clear
def mqtt_cache_clear():
# call cache_clear locally
cache_clear()
# and signal through mqtt
from mqtt.publish import SingletonPublishClient
SingletonPublishClient().publish_message('cache_clear')
| {
"content_hash": "ac9de1aa2cd7747e5a0543f72cf3bc9f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 23.727272727272727,
"alnum_prop": 0.7394636015325671,
"repo_name": "EMSTrack/WebServerAndClient",
"id": "5b0134d3dfc2be04506d7c623d016a14796ddf41",
"... |
from lib import *
#from keras.layers.merge import Concatenate
from keras.layers import Merge
import copy
from collections import Counter
from sklearn.metrics import confusion_matrix
from sklearn.metrics import f1_score
import math
word2topic = pickle.load(open("word2topic", "r"))
embedding = pickle.load(open("word2top... | {
"content_hash": "2b21ee35dc79e4d7a7d3b64e18264df7",
"timestamp": "",
"source": "github",
"line_count": 700,
"max_line_length": 383,
"avg_line_length": 38.92285714285714,
"alnum_prop": 0.5525214710416207,
"repo_name": "ProjectsUCSC/NLP",
"id": "cee880c71cad4665991f33a755343d2f613833bc",
"size": "27... |
from gailtf.baselines.common.mpi_running_mean_std import RunningMeanStd
import gailtf.baselines.common.tf_util as U
import tensorflow as tf
import gym
from gailtf.baselines.common.distributions import make_pdtype
class CnnPolicy(object):
recurrent = False
def __init__(self, name, ob_space, ac_space, kind='larg... | {
"content_hash": "2b01d08a260185eca70d10ebf32f3c2e",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 107,
"avg_line_length": 41.666666666666664,
"alnum_prop": 0.5835789473684211,
"repo_name": "ryanjulian/gail-tf",
"id": "36a01894c8c6239968511b3507ea799acb51fbac",
"size": "... |
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import *
from math import *
import math
from direct.fsm.FSM import FSM
from toontown.minigame import ArrowKeys
from direct.showbase import PythonUtil... | {
"content_hash": "c93b494e620dd39b1b6d77bc102b4a44",
"timestamp": "",
"source": "github",
"line_count": 731,
"max_line_length": 170,
"avg_line_length": 41.56497948016416,
"alnum_prop": 0.5822472353870458,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "edc657c96d0a45d6a0761763153f3e97d4b... |
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# --... | {
"content_hash": "18922a8843eeb606417a2f36f01e12ea",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 79,
"avg_line_length": 32.20640569395018,
"alnum_prop": 0.7048618784530387,
"repo_name": "michaelkuty/django-reclass",
"id": "e170c2dcf062501f36e91a5920a3f71f5114ea42",
"s... |
# encoding: utf-8
"""
This script tests ``GitWildMatchPattern``.
"""
from __future__ import unicode_literals
import re
import sys
import unittest
import pathspec.patterns.gitwildmatch
import pathspec.util
from pathspec.patterns.gitwildmatch import GitWildMatchPattern
if sys.version_info[0] >= 3:
unichr = chr
clas... | {
"content_hash": "e79fcf34292d53bbc2b2df8602ac5f6d",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 751,
"avg_line_length": 26.974683544303797,
"alnum_prop": 0.669169404035664,
"repo_name": "TeamSPoon/logicmoo_workspace",
"id": "e552d5ef5398f47f6f90f27c8360be4f63a2fe82",
... |
import datetime
import os
import unittest
from copy import copy
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.utils.layermapping import (
InvalidDecimal, InvalidString, LayerMapError, LayerMapping,
MissingForeignKey,
)
from d... | {
"content_hash": "13689ae613f8b6b35489b6eb067dd6f6",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 105,
"avg_line_length": 44.37283950617284,
"alnum_prop": 0.640977129820266,
"repo_name": "schinckel/django",
"id": "50fdb4815a7211675efea033aac29cf064a0a404",
"size": "179... |
"""Tests for the gcp module - serviceusage.py"""
import typing
import unittest
import mock
from tests.providers.gcp import gcp_mocks
class GoogleServiceUsageTest(unittest.TestCase):
"""Test Google Service Usage class."""
# pylint: disable=line-too-long
@typing.no_type_check
@mock.patch('libcloudforensics.p... | {
"content_hash": "6f7019f80b4432e80881acf2a4c0fac2",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 96,
"avg_line_length": 45.80357142857143,
"alnum_prop": 0.7508771929824561,
"repo_name": "google/cloud-forensics-utils",
"id": "8f90b22ad491efb7d1c5f5fea26d7b0194d74d6e",
"... |
import asyncore
import email.mime.text
from email.message import EmailMessage
import email.utils
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textwrap
import unittest
from test import support, mock_socket
try:
import threading
except Import... | {
"content_hash": "3bdfaa884a94399abbfbe3353024adc4",
"timestamp": "",
"source": "github",
"line_count": 1153,
"max_line_length": 90,
"avg_line_length": 38.67823070251518,
"alnum_prop": 0.5977666158399857,
"repo_name": "munyirik/python",
"id": "e66ae9be51c044e8124c49628627f057fb83bac3",
"size": "446... |
"""Unit tests for the astropy.coordinates.angle_utilities module"""
import numpy as np
import pytest
import astropy.units as u
from astropy.coordinates.angle_utilities import (
golden_spiral_grid, uniform_spherical_random_surface, uniform_spherical_random_volume)
from astropy.utils import NumpyRNGContext
def te... | {
"content_hash": "b7b7486b513f03faeadd983b226cbb70",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 90,
"avg_line_length": 33.205882352941174,
"alnum_prop": 0.6837909654561559,
"repo_name": "lpsinger/astropy",
"id": "885938f5578aa255f29881cb5771a9a4e498a186",
"size": "112... |
import logging
import os
import config
import destalinator
import slackbot
import slacker
import utils
import json
class Executor(object):
def __init__(self, debug=False, verbose=False):
self.debug = debug
self.verbose = verbose
self.config = config.Config()
slackbot_token = os.... | {
"content_hash": "0add3eae07274c4f886d0c6752f45233",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 94,
"avg_line_length": 34.351351351351354,
"alnum_prop": 0.6341463414634146,
"repo_name": "rossrader/destalinator",
"id": "af0ba61f2e635c5c71f41ff6c24c0afba92857ee",
"size"... |
from django import forms
from main.models import Episode, Location
# from django.contrib.admin import widgets
class Who(forms.Form):
locked_by = forms.CharField(max_length=32, required=True,
label="Please enter your name")
# class Episode_Form(forms.ModelForm):
# exclude=[]
# class Meta:
# ... | {
"content_hash": "48fdadd78325bfa3426f1074bfe5518c",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 84,
"avg_line_length": 39.48837209302326,
"alnum_prop": 0.6166077738515902,
"repo_name": "yoe/veyepar",
"id": "c51f63caa7a5ea81744cf0487835a4c91fd0550a",
"size": "3409",
... |
from __future__ import print_function
import sys
import esky
if getattr(sys,"frozen",False):
#app = esky.Esky(sys.executable,"https://example-app.com/downloads/")
app = esky.Esky(sys.executable,"http://localhost:8000")
try:
app.auto_update()
except Exception as e:
print ("ERROR UPDATIN... | {
"content_hash": "d524af507a85f809a28437d20b6e5369",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 73,
"avg_line_length": 24.8,
"alnum_prop": 0.6612903225806451,
"repo_name": "datalytica/esky",
"id": "92fdfad5a5c8f457ec592b00910f096707ba371b",
"size": "372",
"binary": ... |
import saga
c = saga.Context ('ssh')
c.user_id = 'dinesh'
s = saga.Session ()
s.add_context (c)
js = saga.job.Service("lsf+ssh://yellowstone.ucar.edu", session=s)
| {
"content_hash": "3063f0561573a6cc7ef2363db0f5e18c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 16.7,
"alnum_prop": 0.6586826347305389,
"repo_name": "telamonian/saga-python",
"id": "e98f840060550cbd1298c8c34ce001405e2006d3",
"size": "168",
"bi... |
from flask import Blueprint, jsonify, current_app, request, g
from web.autorizacao import requer_acesso
from web.autenticacao import requer_usuario
from domain.recurso import DTOAgendamento, DTOIntervalo
from domain.usuario.nivel_acesso import *
from domain.iso8601 import to_iso
from domain.excecoes import *
api = Blu... | {
"content_hash": "e2c8a49106cb6c9df04091997d981085",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 85,
"avg_line_length": 31.491071428571427,
"alnum_prop": 0.6640204139495322,
"repo_name": "ESEGroup/Paraguai",
"id": "64036144c866f9eba20043ea2b27e01467a42ad7",
"size": "3... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class Class(models.Model):
cls_id = models.AutoField("ClassManagement id", primary_key=True)
teacher = models.ManyToManyField(User, related_name='teacher', blank=True)
students = models.ManyToManyFie... | {
"content_hash": "da8652dff9019b058956576173ff1321",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 81,
"avg_line_length": 32.6,
"alnum_prop": 0.6932515337423313,
"repo_name": "Mihai925/EduCoding",
"id": "2895684f9dac73fed03073e3225fcc0f91eea2b0",
"size": "652",
"binary... |
import os
import sys
sys.path.insert(0, os.path.join('..', 'src'))
| {
"content_hash": "26bf0b094e7b6a922a1ecddb06914bd4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 17,
"alnum_prop": 0.6470588235294118,
"repo_name": "davetcoleman/catkin_pkg",
"id": "4a31225b8fbd8224d76b6950ce3b9de2f4e3d3fa",
"size": "68",
"binar... |
"""A simple example to test the a DistributionStrategy with Estimators.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.keras import metrics as metrics_module
def build_model_fn_optimizer():
"""Simple... | {
"content_hash": "0efe028daa178212e1059a86c0f2e6db",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 80,
"avg_line_length": 34.71590909090909,
"alnum_prop": 0.6880523731587561,
"repo_name": "ageron/tensorflow",
"id": "cfaee03a2003089366a506168be2942c279f45bf",
"size": "374... |
import unittest
import provider.lax_provider as lax_provider
import tests.settings_mock as settings_mock
import base64
import json
import tests.test_data as test_data
from provider.lax_provider import ErrorCallingLaxException
from mock import mock, patch, MagicMock
from ddt import ddt, data, unpack
@ddt
class TestLax... | {
"content_hash": "f5f88bfbf238098c671bcbb718f2b18d",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 167,
"avg_line_length": 50.25454545454546,
"alnum_prop": 0.6260853835021708,
"repo_name": "gnott/elife-bot",
"id": "00d71756027ef9c46f6de3f9931508a24ca06a0a",
"size": "110... |
import random
import numpy as np
import sys
from domain.make_env import make_env
from neat_src import *
class GymTask():
"""Problem domain to be solved by neural network. Uses OpenAI Gym patterns.
"""
def __init__(self, game, paramOnly=False, nReps=1):
"""Initializes task environment
Args:
ga... | {
"content_hash": "cd3719f32947c507a5ca507cbba98d11",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 78,
"avg_line_length": 31,
"alnum_prop": 0.5957924263674614,
"repo_name": "google/brain-tokyo-workshop",
"id": "3ebd386999749995c5a353a1c390f5d3c33cacee",
"size": "3565",
... |
'''
Test the upgrade master from 3.1.0.233
@author: YeTian 2018-11-25
'''
import os
import tempfile
import uuid
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstacklib.utils.ssh as ssh
import... | {
"content_hash": "750e074ce00408243804f33b546fdee5",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 80,
"avg_line_length": 36.776119402985074,
"alnum_prop": 0.6814123376623377,
"repo_name": "zstackio/zstack-woodpecker",
"id": "73e160f93b41142c6e49c0a71702bc88166cd438",
"s... |
from PyQt5.QtWidgets import QComboBox
from sdbcore.logger import Logger
from sdbcore.stencildatalistener import StencilDataStencilListListener
class StencilListWidget(QComboBox, StencilDataStencilListListener):
def __init__(self, parent, stencil_data):
super().__init__(parent)
self.__stencil_data... | {
"content_hash": "0dd013e44482d450de33d89cd6ea26fc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 34.5625,
"alnum_prop": 0.6537070524412296,
"repo_name": "thfabian/serialbox2",
"id": "3389c473e1e3221b2394245a54534b437dd22115",
"size": "1513",
"b... |
"""
Tests for the Root Controller
"""
import pytest
import bottle
from controller import root
def test_static_routing():
# Ensure that you can retrieve the JS and resources. (Wrap this in a
# pytest.warns so that it allows for ResourceWarnings becuase of opening,
# but not closing the resource files.)
... | {
"content_hash": "cf951e44c1a8e73409d135c5562dca7a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 33.32,
"alnum_prop": 0.6866746698679472,
"repo_name": "sumnerevans/wireless-debugging",
"id": "ea9146a14522658bd566034a01662efb4dedac67",
"size": "83... |
import logging
import operator
import pytest
from cassandra import ConsistencyLevel
from pytest import mark
from dtest import Tester, create_ks, create_cf
from tools.data import insert_c1c2
from tools.misc import generate_ssl_stores
from itertools import product
since = pytest.mark.since
logger = logging.getLogger(_... | {
"content_hash": "0a005acf48ad6cb095d4a2ab93acd72b",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 145,
"avg_line_length": 42.235849056603776,
"alnum_prop": 0.6209515300424391,
"repo_name": "pcmanus/cassandra-dtest",
"id": "34109202eb67ba481daff50c3010f4dad61fa72e",
"si... |
from datetime import datetime
from django.db import models
class WithScrobbleCountsManager(models.Manager):
"""
Adds a with_scrobble_counts() method.
"""
# Can we filter these (things) by Album?
is_filterable_by_album = True
# Can we filter these (things) by Artist?
is_filterable_by_art... | {
"content_hash": "ca066549fb23769aa960535151679462",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 82,
"avg_line_length": 33,
"alnum_prop": 0.5908253808806295,
"repo_name": "philgyford/django-ditto",
"id": "587bb9f918d1af60247fb15b1fff4e1d279bf485",
"size": "5973",
"b... |
import re
def list_parser(names):
"""Parse a list of elements, some of which might be one-level sublists
within parentheses, into a a list of lists of those elements. For
example: list_parser('(a,b),c') -> [['a', 'b'], 'c']"""
elems = re.split(',', names)
ret = []
accum = []
for elem in el... | {
"content_hash": "bdc6a5c3e958ae34fc423058f82d3a8d",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 74,
"avg_line_length": 30.88888888888889,
"alnum_prop": 0.529226618705036,
"repo_name": "gem5/gem5",
"id": "d888f13460e5e8d8f390a547f314d0bdeeb4b1f4",
"size": "4293",
"bi... |
"""
Contains common test fixtures used to run AWS Identity and Access Management (IAM)
tests.
"""
import sys
# This is needed so Python can find test_tools on the path.
sys.path.append('../..')
from test_tools.fixtures.common import *
| {
"content_hash": "6ee6d51e903259e0c15450196fd611fb",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 82,
"avg_line_length": 26.22222222222222,
"alnum_prop": 0.7330508474576272,
"repo_name": "awsdocs/aws-doc-sdk-examples",
"id": "1a8cb23fd6b598dab767f678a49c37496963cb6f",
"s... |
from sqlagg.columns import SimpleColumn
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumnGroup
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.sqlreport import DatabaseColumn
from corehq.apps.reports.standard import DatespanMixin, CustomProjectReport
fro... | {
"content_hash": "3536f2a9103f716cd788ebeb831aefce",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 113,
"avg_line_length": 44.188235294117646,
"alnum_prop": 0.6112886048988285,
"repo_name": "dimagi/commcare-hq",
"id": "0a17d3321d32e2540f76bcd4ed0cd4ab8172bed8",
"size": "... |
from orgmode import ORGMODE, apply_count, repeat, realign_tags
from orgmode import settings
from orgmode.exceptions import HeadingDomError
from orgmode.keybinding import Keybinding, Plug, MODE_INSERT, MODE_NORMAL
from orgmode.menu import Submenu, Separator, ActionEntry
from orgmode.liborgmode.base import Direction
from... | {
"content_hash": "ed6c056293d1c18bf7c0930233b581ab",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 237,
"avg_line_length": 42.59079283887468,
"alnum_prop": 0.7129045817570407,
"repo_name": "mmcclimon/dotfiles",
"id": "0d9b0263e20dc7d1db9cb125b490bec38eb38d7b",
"size": "... |
try:
from django.conf.urls import patterns, include, url
except ImportError: # django < 1.4
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('reportengine.views',
# Listing of reports
url('^$', 'report_list', name='reports-list'),
# view report redirected to cur... | {
"content_hash": "3d0703fc5720f8081737f093bd967673",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 127,
"avg_line_length": 55.90243902439025,
"alnum_prop": 0.6226003490401396,
"repo_name": "dmpayton/django-reportengine",
"id": "d20829254a111c69e404e80a703ef1c74bd1a252",
... |
import re
from .mesonlib import MesonException
class ParseException(MesonException):
def __init__(self, text, lineno, colno):
super().__init__(text)
self.lineno = lineno
self.colno = colno
class Token:
def __init__(self, tid, lineno, colno, value):
self.tid = tid
self.l... | {
"content_hash": "85840020ea520e00a9a628602e83ba3c",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 117,
"avg_line_length": 32.083191850594226,
"alnum_prop": 0.5164840980049743,
"repo_name": "centricular/meson",
"id": "f593c8e3111101011c9de85e256e614162bd9609",
"size": "... |
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView
from django_cradmin import javascriptregistry
class RoleSelectView(javascriptregistry.viewmixin.WithinRoleViewMixin, ListVi... | {
"content_hash": "344f3eb6b770e5729958e63be4c7cd06",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 88,
"avg_line_length": 39.87850467289719,
"alnum_prop": 0.657839231310054,
"repo_name": "appressoas/django_cradmin",
"id": "d544eacf3b60dcf35aa4fb1ee09d64de36b72728",
"siz... |
from behave import given, when, then
from bass.hubkey import generate_hub_key, parse_hub_key, PARTS, is_hub_key
import re
@given(u'parameter "{param}" is "{value}"')
def set_param(context, param, value):
context.params[param] = value
@given(u'parameter "ids" is array "{ids}"')
def id_is_array(context, ids):
... | {
"content_hash": "4701bfce09c6663064004f69086f4813",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 90,
"avg_line_length": 30.324324324324323,
"alnum_prop": 0.678698752228164,
"repo_name": "openpermissions/bass",
"id": "c338ac8350e36df03796ff4cdeacf9e80732a1c5",
"size": "... |
'''
JSON related utilities.
This module provides a few things:
1) A handy function for getting an object down to something that can be
JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) Th... | {
"content_hash": "1c74b95e5d0e12c482eabebf56976c3a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 79,
"avg_line_length": 34.93788819875776,
"alnum_prop": 0.6264888888888889,
"repo_name": "JioCloud/ironic",
"id": "74db2e90b7e10651358e7f28d95e875971f53c23",
"size": "6440... |
import warnings
from collections.abc import Callable
from django.conf import settings
from django.utils.module_loading import import_string
def su_login_callback(user):
if hasattr(settings, "SU_LOGIN"):
warnings.warn(
"SU_LOGIN is deprecated, use SU_LOGIN_CALLBACK",
DeprecationWar... | {
"content_hash": "b61d3630f1c38f69dc0be21cacb85272",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 60,
"avg_line_length": 26,
"alnum_prop": 0.65625,
"repo_name": "PetrDlouhy/django-su",
"id": "160993be44b5a7c68b7e0de6539b73ec5bec65ff",
"size": "857",
"binary": false,
... |
from networkx import DiGraph, dijkstra_path
import os.path, sys
from pydispatch import dispatcher
try:
import xml.etree.cElementTree as ElementTree
except ImportError:
import xml.etree.ElementTree as ElementTree
import inspect, marshal, types
from object import Object
from region import Region
from pathway imp... | {
"content_hash": "d5309f19709174d67aef448b7c6b0057",
"timestamp": "",
"source": "github",
"line_count": 849,
"max_line_length": 277,
"avg_line_length": 40.266195524146056,
"alnum_prop": 0.6073538875563096,
"repo_name": "JaneliaSciComp/Neuroptikon",
"id": "10775cd86e4868857ba068762b04488d45cbcaf4",
... |
from tests.base_unittest import BaseUnitTest
from pypokerengine.engine.card import Card
from pypokerengine.engine.player import Player
from pypokerengine.engine.poker_constants import PokerConstants as Const
from nose.tools import *
class PlayerTest(BaseUnitTest):
def setUp(self):
self.player = Player("uuid", 1... | {
"content_hash": "c5fbce926069c5f81cfaaf4158cf824a",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 94,
"avg_line_length": 37.94708994708995,
"alnum_prop": 0.7062186279977691,
"repo_name": "ishikota/PyPokerEngine",
"id": "d765de6c85829a01126665a9c76c196fbb222ccf",
"size"... |
class Vector2D(object):
def __init__(self, vec2d):
"""
Initialize your data structure here.
:type vec2d: List[List[int]]
"""
self.cursor = -1
if len(vec2d) > 0:
self.data = reduce(lambda a,b:a+b, vec2d)
else:
self.data = []
sel... | {
"content_hash": "68f9bebeec559cecc7dc61c3d20938fe",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 24.035714285714285,
"alnum_prop": 0.5200594353640416,
"repo_name": "luosch/leetcode",
"id": "b2b6f5f0018b7b41629b2de4ceb29abc93fb941b",
"size": "673"... |
import asyncio
from functools import partial
from unittest import mock
import pytest
from yarl import URL
import aiohttp
import aiohttp.helpers
import aiohttp.web
@pytest.fixture
def proxy_test_server(raw_test_server, loop, monkeypatch):
"""Handle all proxy requests and imitate remote server response."""
_... | {
"content_hash": "8ad9e74e43243bb24032e396e98db3e4",
"timestamp": "",
"source": "github",
"line_count": 507,
"max_line_length": 76,
"avg_line_length": 29.775147928994084,
"alnum_prop": 0.6758081611022787,
"repo_name": "Eyepea/aiohttp",
"id": "5cc57164f810e3fced39bbd79f4643a336ac612e",
"size": "1510... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungro... | {
"content_hash": "9f929f2bb9d827bb763d5c55ee919995",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 107,
"avg_line_length": 53.05172413793103,
"alnum_prop": 0.7198570035749107,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d04a341320d8020cc4a134f776fd463d362771f4",
"s... |
import os
import datetime
import time
import platform
import mimetypes
from tempfile import NamedTemporaryFile
import warnings
# DJANGO IMPORTS
from django.core.files import File
from django.utils.six import string_types
# FILEBROWSER IMPORTS
from filebrowser.settings import EXTENSIONS, VERSIONS, ADMIN_VERSIONS, VERS... | {
"content_hash": "29d115976615c86f769cc3a61ffc1e3e",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 203,
"avg_line_length": 32.80701754385965,
"alnum_prop": 0.6154545454545455,
"repo_name": "nemesisdesign/django-filebrowser",
"id": "6881a43faf382d89406cb5f94a7b1600a218edbd... |
from typing import ( # pylint: disable=unused-import
Union, Optional, Any, TYPE_CHECKING
)
from azure.storage.blob import generate_account_sas as generate_blob_account_sas
from azure.storage.blob import generate_container_sas, generate_blob_sas
if TYPE_CHECKING:
from datetime import datetime
from ._models... | {
"content_hash": "d9949409657237071d1db7491bdcb64c",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 118,
"avg_line_length": 54.64646464646464,
"alnum_prop": 0.711275415896488,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6555dce5d2ec590f0db8ef5068e2c1f616bd56dd",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.