text stringlengths 4 1.02M | meta dict |
|---|---|
import json
from questionnaire.models import SimpleQuestion, MCQ, Quiz
JSON_FILEPATH = 'questionnaire/questions/'
JSON_FILENAME = 'questions.json'
def addquestions(filename=JSON_FILEPATH + JSON_FILENAME):
with open(filename) as jsonfile:
quesjson = json.load(jsonfile)
questions = quesjson['QUEST... | {
"content_hash": "f318dad7b6648621eba561e2682e67ad",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 84,
"avg_line_length": 29.276923076923076,
"alnum_prop": 0.4813452443510247,
"repo_name": "super1337/Super1337-CTF",
"id": "fe01f764bd5010e9e4013a31338b3d7949b61507",
"size... |
"""
Calculate the average protein lengths from the blast output files.
"""
import os
import sys
import argparse
from roblib import bcolors, median
def av_protein_lengths(sample, blastfile, fractionout, summaryout, searchtype):
"""
Calculate the average length of the best hit of all the proteins
"""
q ... | {
"content_hash": "3e5194dd3af76cba0e66b52fad57429f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 109,
"avg_line_length": 37.97674418604651,
"alnum_prop": 0.6117575015309247,
"repo_name": "linsalrob/EdwardsLab",
"id": "03e2f1634290ca0e1ec0fec8f6abec265bfd8dec",
"size": ... |
from pifx.client import LIFXWebAPIClient
class PIFX:
"""Main PIFX class"""
def __init__(self, api_key, http_endpoint=None):
self.client = LIFXWebAPIClient(api_key, http_endpoint)
def list_lights(self, selector='all'):
"""Given a selector (defaults to all), return a list of lights.
... | {
"content_hash": "96e9420bdcb344c146f6043c82443102",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 84,
"avg_line_length": 32.902877697841724,
"alnum_prop": 0.5746146277468023,
"repo_name": "cydrobolt/pifx",
"id": "fb36ef0650d27f91e47b601c7cb7a4b5ac41ea2c",
"size": "9779... |
from openstack_dashboard.test.integration_tests.pages import basepage
class SharesPage(basepage.BaseNavigationPage):
def __init__(self, driver, conf):
super(SharesPage, self).__init__(driver, conf)
self._page_title = "Shares"
| {
"content_hash": "73f7bd16a08338eaf8e2bbdf8b84a235",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 69,
"avg_line_length": 35.42857142857143,
"alnum_prop": 0.7056451612903226,
"repo_name": "openstack/manila-ui",
"id": "fd7cb2625d4f5d7305c8e9f9ea5d9d7634567cbd",
"size": "82... |
import time
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, StorageAccountPreparer, api_version_constraint,
JMESPathCheck, JMESPathCheckExists, NoneCheck)
from azure.cli.core.profiles import ResourceType
@api_version_constraint(ResourceType.MGMT_STORAGE, min_api='201... | {
"content_hash": "a12a9d31676299f74e303810dc9a15bb",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 115,
"avg_line_length": 48.577235772357724,
"alnum_prop": 0.6046861924686192,
"repo_name": "yugangw-msft/azure-cli",
"id": "7abeaf28c355ef7446cbf4d570d50989139a14b8",
"siz... |
import os
import sys
from mock import patch
import pytest
from decouple import Config, RepositoryEnv, UndefinedValueError
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
from io import StringIO
else:
from StringIO import StringIO
ENVFILE = '''
KeyTrue=True
KeyOne=1
... | {
"content_hash": "bf6e2c3c29641f8d647e6a0ad7194981",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 24.63888888888889,
"alnum_prop": 0.7046223224351748,
"repo_name": "henriquebastos/django-decouple",
"id": "1d35d301c65c90df82ef14f98140db466e5e9fcb",
... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "d9cb2801bc3d66167d55dd3eae13e5e3",
"timestamp": "",
"source": "github",
"line_count": 582,
"max_line_length": 377,
"avg_line_length": 39.02061855670103,
"alnum_prop": 0.5803170409511229,
"repo_name": "napalm-automation/napalm-yang",
"id": "8e5d75627cbbb0ab285cf23000bd38f5c3b268aa",
... |
import sys
import unittest
import re
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from Exscript.emulators import CommandSet
class CommandSetTest(unittest.TestCase):
CORRELATE = CommandSet
def testConstructor(self):
CommandSet()
CommandSet(stric... | {
"content_hash": "00b338f6da9ee855fc6a4a94aecf2fa3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 25.08888888888889,
"alnum_prop": 0.6182462356067316,
"repo_name": "knipknap/exscript",
"id": "68464eef018ba358c76a107ae1501a8d2785cbf2",
"size": "112... |
"""Creates a survey-distribution class for interfacing with Qualtrics API v3
This module creates a class for encapsulating a Qualtrics Survey Distribution
based upon a Qualtrics Mailing List object, Qualtrics Message id, Qualtrics
Survey id, and email settings for send date, from name, reply-to email address,
subject,... | {
"content_hash": "e24beaa94a29ec6297a6ff585c6c8742",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 80,
"avg_line_length": 38.89622641509434,
"alnum_prop": 0.579674993936454,
"repo_name": "KaiAnalytics/qualtrics-mailer",
"id": "14b471cf7e05dbb876edfa07d72a9b7d4be104c1",
... |
"""
Resystem Scheduling Service.
Released under New BSD License.
Copyright © 2015, Vadim Markovtsev :: Angry Developers LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source ... | {
"content_hash": "faf673a45e42750e4bca2cc09b89113d",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 41.71621621621622,
"alnum_prop": 0.68837058632977,
"repo_name": "AngryDevelopersLLC/res-scheduler",
"id": "99a7ca8628fdec72873ef9263ef8cee5b1b43b10",
... |
from __future__ import print_function
from __future__ import absolute_import
import os
import tct
import sys
#
import PIL
params = tct.readjson(sys.argv[1])
binabspath = sys.argv[2]
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfile'])
reason = ''
resultfile = params['resultfile... | {
"content_hash": "8215f7e382f1e4674f8df73934ba0940",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 113,
"avg_line_length": 29.689655172413794,
"alnum_prop": 0.5177119628339141,
"repo_name": "marble/Toolchain_RenderDocumentation",
"id": "fa836b40ece8cffe73fd9ee36e9e71747fe... |
"""Tools to summarise the output of (multiple calls to) evaluation, confidence, etc."""
# TODO: PlotSystems: legend in plot
# TODO: examples for documentation (including different output formats)
# TODO: scores as percentage?
from __future__ import print_function, absolute_import, division
import os
import itertools
... | {
"content_hash": "052b2cb1835142bd84f5979bb3d28109",
"timestamp": "",
"source": "github",
"line_count": 931,
"max_line_length": 259,
"avg_line_length": 45.0687432867884,
"alnum_prop": 0.5549703281775066,
"repo_name": "jamesxia4/neleval",
"id": "9f4e657b6e61147ed1ca5bf397e3010f5e30a4eb",
"size": "41... |
import yaml
from toskeriser.exceptions import TkStackException
from .test_upper import TestUpper
class TestGroupForceUpdate(TestUpper):
@classmethod
def setUpClass(self):
self._file_path = 'data/examples/example_group_force_update.yaml'
self._new_path = 'data/examples/example_group_force_up... | {
"content_hash": "ced5f99c09604654892e4794eff867cf",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 82,
"avg_line_length": 26.96551724137931,
"alnum_prop": 0.525149190110827,
"repo_name": "di-unipi-socc/TosKeriser",
"id": "e20279658ac881cd6bb79145b3962f3750fde727",
"size"... |
from persimmon.view.pins import OutputPin
from persimmon.view.blocks.block import Block # MYPY HACK
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from sklearn.neighbors import KNeighborsClassifier
Builder.load_file('persimmon/view/blocks/knnblock.kv')
class KNNBlock(Block):
est_out ... | {
"content_hash": "b87e706490f5ee318021eb75a5003a8d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 25.875,
"alnum_prop": 0.7777777777777778,
"repo_name": "AlvarBer/Persimmon",
"id": "038a26b286b7b6008a07c3589d2109e1883a3c66",
"size": "414",
"bina... |
"""
This package provides a collection of simulation area classes.
Area expresses a simulation surface by its shape and extent in the
two-dimensional space with the origin in (0, 0).
"""
__docformat__ = 'reStructuredText'
__all__ = ['rectangle', 'square']
| {
"content_hash": "d0e38ab4d9394a3dd2909a04a498d923",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 66,
"avg_line_length": 23.636363636363637,
"alnum_prop": 0.7192307692307692,
"repo_name": "mkalewski/sim2net",
"id": "f58630ce95cd483680163525f238bf22bc433390",
"size": "82... |
"""Test suite for the runtime profiler."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from pyperf.profilers import runtime
def test_runtime_gives_reasonable_results():
"""Ensure runtime is measured within s... | {
"content_hash": "8b5e3a0869fdbf055b83b1ddc18eb1bd",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 33.6,
"alnum_prop": 0.7127976190476191,
"repo_name": "kevinconway/PyPerf",
"id": "4451192eb3adc0cd4f9af5b4622b4fc4eba616a3",
"size": "672",
"binary... |
from past.builtins import basestring
from airflow.sensors.base_sensor_operator import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
class NamedHivePartitionSensor(BaseSensorOperator):
"""
Waits for a set of partitions to show up in Hive.
:param partition_names: List of fully qua... | {
"content_hash": "de85c6106d3ed63a2687f19121f7f033",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 101,
"avg_line_length": 37.13253012048193,
"alnum_prop": 0.6171317326411421,
"repo_name": "owlabs/incubator-airflow",
"id": "6f254589658540187dcb604bc34040e1bbfae787",
"siz... |
from sqlalchemy.orm import validates
from sqlalchemy import UniqueConstraint
from eachday import app, db, bcrypt
from datetime import datetime, date, timedelta
import jwt
import marshmallow
from marshmallow import Schema, fields, validate, ValidationError
class User(db.Model):
__tablename__ = 'user'
TOKEN_EXP... | {
"content_hash": "c81fe22fcc8fffe18a97720a27ecb8bf",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 78,
"avg_line_length": 32.339622641509436,
"alnum_prop": 0.6277712952158693,
"repo_name": "bcongdon/EachDay",
"id": "953cb120eba3a233658ce86af467546aadda29b4",
"size": "34... |
"""
(c) April 2017 by Daniel Seita
Code for plotting behavioral cloning. No need to use command line arguments,
just run `python plot_bc.py`. Easy! Right now it generates two figures per
environment, one with validation set losses and the other with returns. The
latter is probably more interesting.
"""
import argpars... | {
"content_hash": "ecda409cf4c017a1ef1c04938e48bc36",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 89,
"avg_line_length": 40.62566844919786,
"alnum_prop": 0.601553244701856,
"repo_name": "DanielTakeshi/rl_algorithms",
"id": "0dae5e859296fd9ede68d149de4bb44b1c19f02b",
"s... |
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Sitepath(models.Model):
TYPE = {
'page': _('page'),
'ima... | {
"content_hash": "2934fd0cb066e318511eb2b21aec4a60",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 106,
"avg_line_length": 34.578947368421055,
"alnum_prop": 0.6354642313546424,
"repo_name": "StuartMacKay/django-sitepaths",
"id": "8904d71b211a5d136fed22d2a114a0e8fef15806",
... |
import pymongo
import sys
# Connect to the database.
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.students
grades = db.grades
# Find IDs and scores for homework documents.
hw_query = {"type": "homework"}
selector = {"student_id":1, "score": 1}
homework = grades.find(hw_query, selector)
# ... | {
"content_hash": "3c5281e1dd60dff362fb23afb8f8e74c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 96,
"avg_line_length": 27.585365853658537,
"alnum_prop": 0.7064544650751547,
"repo_name": "ronaldsmartin/m101p",
"id": "309e8262e080939210181cb3131f3f3138a16a07",
"size": "... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0002_remove_content_type_name'),
... | {
"content_hash": "3ab851080ad10d7c2a192005fad109c0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 175,
"avg_line_length": 40.36666666666667,
"alnum_prop": 0.611065235342692,
"repo_name": "delitamakanda/BukkakeGramNew",
"id": "c042ce5a2e7e3050f55da2953befe9990a839444",
"... |
import json
import unittest
from cryptography.hazmat.primitives.asymmetric.rsa import (
RSAPrivateKey,
RSAPublicKey,
)
from jwt.exceptions import MalformedJWKError, UnsupportedKeyTypeError
from jwt.jwk import (
OctetJWK,
RSAJWK,
jwk_from_dict,
jwk_from_pem,
jwk_from_der,
jwk_from_byte... | {
"content_hash": "6bc2aeb58f23329642e5eeb52b5d63c6",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 79,
"avg_line_length": 30.45054945054945,
"alnum_prop": 0.6429086972212198,
"repo_name": "GehirnInc/python-jwt",
"id": "a6e2876b971a1625861a575c3279f18f7c626d8b",
"size": ... |
"""Auto-generated file, do not edit by hand. BS metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_BS = PhoneMetadata(id='BS', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='9\\d{2}', possible_number_pattern='\\d{... | {
"content_hash": "8daa5f245c4858212e5a401028efae70",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 143,
"avg_line_length": 66.83333333333333,
"alnum_prop": 0.7331670822942643,
"repo_name": "vicky2135/lucious",
"id": "3f7f893c2e2dbd9310e45352f625433127ecf325",
"size": "80... |
import os
import sys
import codecs
import optparse
from Danpass import DanPASS
SCRIPT = '[danpass_parser.py]: '
parser = optparse.OptionParser()
parser.add_option('-o', '--output',
dest="fout",
default="danpass_out",
)
parser.add_option('-c', '--corpus',
... | {
"content_hash": "c3d078c1c3c29cd5d426d2ba463c1c5a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 62,
"avg_line_length": 24.15625,
"alnum_prop": 0.610608020698577,
"repo_name": "dresen/praat",
"id": "0ff62a8b1374f6616c51acea76d80d5b94074841",
"size": "773",
"binary": ... |
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.db.models import Q
from django_statsd.clients import statsd
from elasticsearch_dsl import filter as es_filter
from elasticsearch_dsl import function as es_function
from elasticsearch_dsl import query, Search
f... | {
"content_hash": "4c05b2f44365e55892e9b5d5282e3c2f",
"timestamp": "",
"source": "github",
"line_count": 803,
"max_line_length": 79,
"avg_line_length": 38.742216687422165,
"alnum_prop": 0.594439087110254,
"repo_name": "ngokevin/zamboni",
"id": "eefac669c0ce73e4d7b0f0aeee3a2a6054870ba7",
"size": "311... |
import abc
import torch
import numpy
from .. import mean_functions
from .. import parameter
class GPModel(torch.nn.Module):
"""
A base class for Gaussian process models, that is, those of the form
.. math::
:nowrap:
\\begin{align}
\\theta & \sim p(\\theta) \\\\
f & \sim... | {
"content_hash": "3059c6fc6640865aae99ce35966a04c4",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 160,
"avg_line_length": 37.29007633587786,
"alnum_prop": 0.5946775844421699,
"repo_name": "t-vi/candlegp",
"id": "f29635c58b447a89960b25d379f710e5c4504c48",
"size": "5558"... |
from .calls import Call, FuncArg
from .error import ShortException
from .symbolic import strip_symbolic
class FunctionLookupError(ShortException): pass
class FunctionLookupBound:
def __init__(self, msg):
self.msg = msg
def __call__(self, *args, **kwargs):
raise NotImplementedError(self.msg)
... | {
"content_hash": "3ba6d3c2d9990de7b023f2e5915d851f",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 97,
"avg_line_length": 35.4320987654321,
"alnum_prop": 0.5401567944250871,
"repo_name": "machow/siuba",
"id": "5e6da15032a270022602505de074be569dfe031b",
"size": "11642",
... |
from remoteobjects import fields, dataobject
class Referencive(dataobject.DataObject):
related = fields.Object('Related')
other = fields.Object('OtherRelated')
class Related(dataobject.DataObject):
pass
class OtherRelated(dataobject.DataObject):
pass
| {
"content_hash": "01886ee91926ad71260c24c7dce5b3c8",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 24.727272727272727,
"alnum_prop": 0.7610294117647058,
"repo_name": "alex/remoteobjects",
"id": "33bfbce646674bb7101eccc888faf3eeefc8d607",
"size": "1... |
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pp... | {
"content_hash": "c2b87517b024eac48167ebfcff1d7b36",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 140,
"avg_line_length": 30.524590163934427,
"alnum_prop": 0.5829752953813104,
"repo_name": "docusign/docusign-python-client",
"id": "71dfef27321288b59853385626c81e69e4817d9d... |
"""Representing missing value for a field."""
from typing import Any
from pyglove.core.object_utils import common_traits
class MissingValue(common_traits.Formattable):
"""Value placeholder for an unassigned attribute."""
def format(self, *args, **kwargs): # pytype: disable=signature-mismatch
return 'MISSIN... | {
"content_hash": "339019a4b08ab10b1369972575b6d8d8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 28.5,
"alnum_prop": 0.7002923976608187,
"repo_name": "google/pyglove",
"id": "b9cbc2dd53e25f0c1a23fefddfc87945fb0cd8b7",
"size": "1268",
"binary": ... |
'''
This file contains classes and functions that implement the PyPXE HTTP service
'''
import socket
import struct
import os
import threading
import logging
from pypxe import helpers
class HTTPD:
'''
This class implements a HTTP Server, limited to GET and HEAD,
from RFC2616, RFC7230.
'''
... | {
"content_hash": "466d30bbdbf5cff21b4872e39a7ed70b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 138,
"avg_line_length": 42.629629629629626,
"alnum_prop": 0.5892701998262381,
"repo_name": "psychomario/PyPXE",
"id": "1dfa483cb1849d09de5806eeb7afe6eda19d051c",
"size": "... |
"""Placeholder objects replaced with real GIMP objects when calling GIMP PDB
procedures during export.
The following placeholder objects are defined:
* `PLACEHOLDERS['current_image']` - Represents the image currently being
processed.
* `PLACEHOLDERS['current_layer']` - Represents the layer currently being
proces... | {
"content_hash": "5fe8d5d939487e6411670c98f2c3abb0",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 87,
"avg_line_length": 29.39864864864865,
"alnum_prop": 0.7228223396920248,
"repo_name": "khalim19/gimp-plugin-export-layers",
"id": "260fc81b77c9502f24e2477b60a8a321fc39c45... |
from rest_framework.renderers import JSONRenderer
from rest_framework_csv.renderers import CSVRenderer
class KLPJSONRenderer(JSONRenderer):
'''
Sub-classes JSONRenderer to render GeoJSON where appropriate.
If the request contains a geometry=yes parameter, it converts features
to GeoJSON
... | {
"content_hash": "ebfcf0b261478a0eb2deba36de098d8c",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 80,
"avg_line_length": 35.03448275862069,
"alnum_prop": 0.5787401574803149,
"repo_name": "klpdotorg/dubdubdub",
"id": "ad29f250aae48fe1c4f71fa1d2becb95d6adbfc1",
"size": "3... |
import glob
import os
import subprocess
import tempfile
import mock
import unittest2 as unittest
# Django
from django.conf import settings
from django.core.urlresolvers import reverse
# Django-CRUM
from crum import impersonate
# AWX
from awx.main.utils import * # noqa
from awx.main.models import * # noqa
from awx.m... | {
"content_hash": "f440958b90c997c536b66cdb6f2cfb29",
"timestamp": "",
"source": "github",
"line_count": 957,
"max_line_length": 134,
"avg_line_length": 49.44827586206897,
"alnum_prop": 0.6050674105067411,
"repo_name": "snahelou/awx",
"id": "8da0e33d244598df780e16f383d223ea107f108c",
"size": "47390"... |
__all__ = ['restart', 'reload', 'wallpaper', 'theme']
from plugins.plasma import *
| {
"content_hash": "2b409ab06a2fec98dd12499016ea5085",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 53,
"avg_line_length": 41.5,
"alnum_prop": 0.6385542168674698,
"repo_name": "nielsvm/kde4-profiles",
"id": "cafa572b0b0ec18af98fb40ee7a4f4f0a9475dd6",
"size": "83",
"binar... |
"""
Define a family of algorithms, encapsulate each one, and make them
interchangeable. Strategy lets the algorithm vary independently from
clients that use it.
"""
import abc
class Context:
"""
Define the interface of interest to clients.
Maintain a reference to a Strategy object.
"""
def __ini... | {
"content_hash": "829215e091e640ad91709f7075ddd33f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 68,
"avg_line_length": 20.466666666666665,
"alnum_prop": 0.6742671009771987,
"repo_name": "tcp813/mouTools",
"id": "953e85fd2c74ba3d5279648a22e762cd4e533605",
"size": "1228... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'newsnet.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| {
"content_hash": "010902a8ff169be0c2f787bfb412ce8a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 27.6,
"alnum_prop": 0.6413043478260869,
"repo_name": "mike10010100/newsnet",
"id": "94b13d9254b83f30e36eac239c85ebc19e3151f6",
"size": "276",
"bina... |
from setuptools import setup, find_packages
setup(name="django-smart-selects",
version="1.2.3-dev",
description="Django application to handle chained model fields.",
author="Patrick Lauber",
packages=find_packages(),
include_package_data=True,
)
| {
"content_hash": "624556ee303259ae4f225e62988e1afc",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 31.444444444444443,
"alnum_prop": 0.6784452296819788,
"repo_name": "johtso/django-smart-selects",
"id": "3094eb322c97f387a63259ddffb389fd3bcfb2e5",
"s... |
""" parquet compat """
from __future__ import annotations
import io
import os
from typing import (
Any,
Literal,
)
from warnings import catch_warnings
from pandas._typing import (
FilePath,
ReadBuffer,
StorageOptions,
WriteBuffer,
)
from pandas.compat._optional import import_optional_dependenc... | {
"content_hash": "4992d374a3d1ad22e82ed69bfc7ec56b",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 87,
"avg_line_length": 35.35834896810506,
"alnum_prop": 0.5778414517669532,
"repo_name": "pandas-dev/pandas",
"id": "1c14722227124279dfb9f56cce298736455ae02c",
"size": "18... |
import logging, os, random
from zc.buildout import UserError, easy_install
from zc.recipe.egg import Egg
SETTINGS_TEMPLATE = '''
from %(settings_module)s import *
SECRET_KEY = "%(secret)s"
%(settings_override)s
'''
SCRIPT_TEMPLATES = {
'wsgi': easy_install.script_header + '''
%(relative_paths_setup)s
import s... | {
"content_hash": "509d69808f67f3a783b8c968e627334e",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 80,
"avg_line_length": 36.17956656346749,
"alnum_prop": 0.5618689029608078,
"repo_name": "abstract-open-solutions/djc.recipe2",
"id": "24f523f5f4a4e76e0f15d104b4d7f25fad4500... |
import unittest
import paddle.v2.framework.core as core
from paddle.v2.framework.op import Operator
import numpy
class TestGaussianRandomOp(unittest.TestCase):
def test_cpu(self):
self.gaussian_random_test(place=core.CPUPlace())
def test_gpu(self):
if core.is_compile_gpu():
self.g... | {
"content_hash": "cc07d6d37d2c365a9f0bc77b22c09cb3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 65,
"avg_line_length": 27.82857142857143,
"alnum_prop": 0.5985626283367557,
"repo_name": "pengli09/Paddle",
"id": "0dc7e091a5c8dd046f36cab7f79a15b2281cdd90",
"size": "974",... |
import airtablewrapper
import json
participantList = airtablewrapper.get_participants()
participantJSONArray = []
for participant in participantList:
newParticipant = {
'id': participant['fields']['Barcode']['text'],
'name': participant['fields']['First Name'] + " " + participant['fields']['Last N... | {
"content_hash": "108497cb561cc64fbe952259ff044f55",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 95,
"avg_line_length": 29.736842105263158,
"alnum_prop": 0.7061946902654868,
"repo_name": "zbreit18/AttendanceUC",
"id": "7f8c34696d1d5cf0a1a9bab707ed624300cbacc2",
"size":... |
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import psi_service_pb2 as psi__service__pb2
class PSIServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
cha... | {
"content_hash": "1448611ed060f83bb5f4d124d1d38575",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 105,
"avg_line_length": 41.45454545454545,
"alnum_prop": 0.6330409356725146,
"repo_name": "intel-analytics/BigDL",
"id": "9916c0356fbddefaab64a7852aedd0130f1f5a06",
"size"... |
import re
def ensure_trailing_slash(url):
if not url.endswith('/'):
url += '/'
return url
class Mountpoint:
def __init__(self, path):
self.path = ensure_trailing_slash(path)
def join(self, other):
if not isinstance(other, Mountpoint):
other = Mountpoint(other)
... | {
"content_hash": "8a3cc6b744e93fcad97cfca30dda1d0f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 22.540983606557376,
"alnum_prop": 0.5781818181818181,
"repo_name": "getweber/weber-cli",
"id": "f6936cc86956ab905386ea937e0f197d13813723",
"size": "1... |
from google.cloud.automl_v1.services.auto_ml.client import AutoMlClient
from google.cloud.automl_v1.services.auto_ml.async_client import AutoMlAsyncClient
from google.cloud.automl_v1.services.prediction_service.client import (
PredictionServiceClient,
)
from google.cloud.automl_v1.services.prediction_service.async_... | {
"content_hash": "01d5e0af9991b53058f964032a7a42b6",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 88,
"avg_line_length": 48.88586956521739,
"alnum_prop": 0.8290161200667038,
"repo_name": "googleapis/python-automl",
"id": "9f115aac3696680469b499065ebdf37f4d579c61",
"siz... |
import datetime
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
from app.database import Base
# 이 경우 경로를 위해 app.을 붙여줘야합니다
# users 테이블에 맵핑
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = ... | {
"content_hash": "465412634767eb2f0d6c5a530757783e",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 89,
"avg_line_length": 35.24561403508772,
"alnum_prop": 0.6550522648083623,
"repo_name": "zzsza/TIL",
"id": "3de93b2f5c28eeb4eeb5ac3639412e527fb4298e",
"size": "2105",
"b... |
from __future__ import unicode_literals
import pytest
def assert_no_error(result):
assert 'error' not in result, result['error_description']
def test_simple_search(ws):
params = {'latitude': 125994.28, 'longitude': 488781.51, 'hits': 3}
assert_no_error(ws.travel.hotel.simple_search(**params))
def test... | {
"content_hash": "d7850c58226961c8683062e6bc98a199",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 27.906976744186046,
"alnum_prop": 0.6783333333333333,
"repo_name": "alexandriagroup/rakuten-ws",
"id": "fcb60203581d00cae990051686b31b800bc14195",
"s... |
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from flask_security import SQLAlchemyUserDatastore
from annotator import annotations, commands, public, user
from annotator.extensions import (babel, cache, compress, csrf_protect, db, debug_toolbar, gitversion, mail, m... | {
"content_hash": "aa412f8179c0ef539bde0eb53bd9b671",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 117,
"avg_line_length": 34,
"alnum_prop": 0.6931818181818182,
"repo_name": "wroberts/annotator",
"id": "4f921e33696d7a7e29413dbb440067cd2843c0d4",
"size": "3016",
"binary... |
"""
Network-related utilities and helper functions.
"""
import socket
from six.moves.urllib import parse
from glance.openstack.common.gettextutils import _LW
from glance.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def parse_host_port(address, default_port=None):
"""Interpret a str... | {
"content_hash": "707c6a13bf4c71f61aeb7d2bf18b838d",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 78,
"avg_line_length": 33.93103448275862,
"alnum_prop": 0.6038617886178862,
"repo_name": "redhat-openstack/glance",
"id": "02f8f71d767e32835f6325d5c331e24f341dffa8",
"size... |
from _infos import __version__
# Include the lib folder in the python import path (so that packaged modules can be easily called, such as gooey which always call its submodules via gooey parent module)
import sys, os
thispathname = os.path.dirname(__file__)
sys.path.append(os.path.join(thispathname, 'lib'))
# Import ... | {
"content_hash": "437488c5a7c7bdf30ac1359f6fb64199",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 982,
"avg_line_length": 76.49411764705883,
"alnum_prop": 0.657912949861581,
"repo_name": "lrq3000/pyFileFixity",
"id": "38537e1fbdf6fa36d9f8beb93a880cf335e4b8ec",
"size": ... |
from pyramid.response import Response
from pyramid.view import view_config
from pyramid.compat import bytes_
from snovault import Item
from collections import OrderedDict
from copy import deepcopy
import json
import os
from urllib.parse import (
parse_qs,
urlencode,
)
from snovault.elasticsearch.interfaces impo... | {
"content_hash": "77c8dad2f680d6cf91a29f4093f3502b",
"timestamp": "",
"source": "github",
"line_count": 1834,
"max_line_length": 170,
"avg_line_length": 47.62213740458015,
"alnum_prop": 0.521450898224161,
"repo_name": "ENCODE-DCC/encoded",
"id": "de92712a31038512f2f26d86b195e5f15e951c06",
"size": "... |
from decimal import Decimal
from trading import file_logger
try:
import ujson as json
except ImportError:
import json
from pprint import pformat
import time
import requests
from trading.exchange import exchange_api_url, exchange_auth
def market_maker_strategy(open_orders, order_book, spreads):
time.s... | {
"content_hash": "794bd2cdd63e840ea6b527d10f9e3397",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 120,
"avg_line_length": 56.85245901639344,
"alnum_prop": 0.5219146482122261,
"repo_name": "PierreRochard/coinbase-exchange-order-book",
"id": "8d5296a7b7c863ac3c85f8ae18c392... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import perfdemo
version = perfdemo.__version__
setup(
name='perfdemo',
version=version,
author='',
author_email='[email protected]',
packages=[
'perfdemo',
],
i... | {
"content_hash": "9c1d2726f664a81a22216996ba7d9e78",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 41,
"avg_line_length": 17,
"alnum_prop": 0.6318082788671024,
"repo_name": "martinblech/pyconar2014_perfdemo",
"id": "23e454e9c0219cee41350b4c94e6730be0c823a6",
"size": "506... |
from typing import List, Tuple, Iterable
import unittest
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
# Find the first non-0 cell
for i, row in enumerate(grid):
for j, cell in enumerate(row):
if cell:
# Return perimeter st... | {
"content_hash": "0cc9afd929ce79b2d44ad69b185bbae2",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 93,
"avg_line_length": 28.26086956521739,
"alnum_prop": 0.5333333333333333,
"repo_name": "AustinTSchaffer/DailyProgrammer",
"id": "daaa6a5e26b001c0b1e75ed756532615315a931b",
... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0121_auto_20201005_2211'),
]
operations = [
migrations.RemoveField(
model_name='book',
name='lead',
),
migrations.RemoveField(
model_na... | {
"content_hash": "e9620b314e47f887683c6b96cbb814b3",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 46,
"avg_line_length": 20.782608695652176,
"alnum_prop": 0.5,
"repo_name": "flavoi/diventi",
"id": "4b7cb02cc6e5649ded973e7e048a82389ff4f80f",
"size": "528",
"binary": fa... |
import serial
import sys
from time import localtime,strftime
ser = serial.Serial(sys.argv[1],57600)
fout = open(sys.argv[2],'a')
while (1):
line = ser.readline()[4:]
fout.write(strftime("%H:%M:%S ",localtime()) + line)
fout.flush()
| {
"content_hash": "93876574bc2a5aa9da612cdd05b37cb1",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 57,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.6571428571428571,
"repo_name": "turon/mantis",
"id": "0cb2e1d3a2bbfee1150875bef72c4b834520de96",
"size": "245",
"... |
from msrest.serialization import Model
class NodeTransitionProgress(Model):
"""Information about an NodeTransition operation. This class contains an
OperationState and a NodeTransitionResult. The NodeTransitionResult is not
valid until OperationState
is Completed or Faulted.
.
:param state:... | {
"content_hash": "5e9d466d87e3d57cd90c54f15974e2c4",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 98,
"avg_line_length": 38.80769230769231,
"alnum_prop": 0.6947472745292369,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "1b31a4519621e7173c6af2b500928f0ac5ba7444",
... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v12.enums",
marshal="google.ads.googleads.v12",
manifest={"CallPlaceholderFieldEnum",},
)
class CallPlaceholderFieldEnum(proto.Message):
r"""Values for Call placeholder fields.
"""
class CallPlaceholderF... | {
"content_hash": "a94d34bf77bc02d5920100c521292c5a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 59,
"avg_line_length": 24.26923076923077,
"alnum_prop": 0.6370839936608558,
"repo_name": "googleads/google-ads-python",
"id": "f0f3d90b80ca12acf3c2103081eed5dc5e633386",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('phrasebook', '0010_auto_20170415_1417'),
]
operations = [
migrations.AlterField(
model_name='word',
... | {
"content_hash": "4e72d1fcfc32daa5b4debbd16c418f1b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 103,
"avg_line_length": 24.473684210526315,
"alnum_prop": 0.6365591397849463,
"repo_name": "DanCatchpole/phrasebook-django",
"id": "fbba235039d26102819b138e88dc99efc01a4be2",... |
"""Viterbi contour decoder.
"""
from motif.core import ContourDecoder
class ViterbiDecoder(ContourDecoder):
''' Viterbi contour decoder.
'''
def decode(self, ctr, Y):
raise NotImplementedError
@classmethod
def get_id(cls):
return 'viterbi'
| {
"content_hash": "e8e85f2a4ef25145b34fe15e2ec681dc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 37,
"avg_line_length": 19.928571428571427,
"alnum_prop": 0.6594982078853047,
"repo_name": "rabitt/motif",
"id": "e46e8bb4b1b0ae90d4ada4859248454e12bfacea",
"size": "279",
... |
import sys
import pyvips
image = pyvips.Image.new_from_file(sys.argv[1], access="sequential")
watermark = pyvips.Image.new_from_file(sys.argv[3], access="sequential")
# downsize the image by 50%
image = image.resize(0.5)
# set the watermark alpha to 20% (multiply A of RGBA by 0.2).
watermark *= [1, 1, 1, 0.2]
# ove... | {
"content_hash": "394c47d47fd9ccaac17f2b06f1c1aab3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 31.352941176470587,
"alnum_prop": 0.6848030018761726,
"repo_name": "jcupitt/pyvips",
"id": "4d235071bf70cd954451f764211902211230d06e",
"size": "553",... |
from __future__ import unicode_literals
from dbdiff.fixture import Fixture
from .base import TestImportBase, FixtureDir
class TestImport(TestImportBase):
"""Load test."""
def test_single_city(self):
"""Load single city."""
fixture_dir = FixtureDir('import')
self.import_data(
... | {
"content_hash": "a84c547d86e832d151b97366551549d3",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 27.75,
"alnum_prop": 0.6108108108108108,
"repo_name": "greenday2/django-cities-light",
"id": "b363cbf2e3248805dd82acbd17f58a6f84a989c1",
"size": "555... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ComputeResourceHostSPBMLicenseInfo(vim, *args, **kwargs):
'''The ComputeResourceHostSP... | {
"content_hash": "b12075683efcfa1adf311afcb0a69737",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 124,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6266548984995587,
"repo_name": "xuru/pyvisdk",
"id": "346adf153d56756eab2e513b104bbcedf9ff0c42",
"size": "1134",... |
from troveclient import base
class Flavor(base.Resource):
"""
A Flavor is an Instance type, specifying among other things, RAM size.
"""
def __repr__(self):
return "<Flavor: %s>" % self.name
class Flavors(base.ManagerWithFind):
"""
Manage :class:`Flavor` resources.
"""
resou... | {
"content_hash": "b20de9baea64c81255a633d782e3d3ce",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 74,
"avg_line_length": 21.235294117647058,
"alnum_prop": 0.5332409972299169,
"repo_name": "cp16net/python-troveclient",
"id": "1bb49d9c6e645d6e621b33b43521eabd530aec97",
"s... |
from ray.rllib.algorithms.pg.pg import PG, PGConfig, DEFAULT_CONFIG
from ray.rllib.algorithms.pg.pg_tf_policy import PGTF1Policy, PGTF2Policy
from ray.rllib.algorithms.pg.pg_torch_policy import PGTorchPolicy
from ray.rllib.algorithms.pg.utils import post_process_advantages
__all__ = [
"DEFAULT_CONFIG",
"post_... | {
"content_hash": "805501fcc958a78047fab3fb0d314f8b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 73,
"avg_line_length": 28.294117647058822,
"alnum_prop": 0.7172557172557172,
"repo_name": "ray-project/ray",
"id": "945c492c8168d88eb584b64ee6e531c361c69174",
"size": "481"... |
from functools import total_ordering
from dark.score import HigherIsBetterScore, LowerIsBetterScore
@total_ordering
class _Base(object):
"""
Holds information about a matching region from a read alignment.
You should not use this class directly. Use one of its subclasses,
either HSP or LSP, dependin... | {
"content_hash": "9ead23cb21027955e937d6f1178c3f94",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 79,
"avg_line_length": 44.113821138211385,
"alnum_prop": 0.6249539255436786,
"repo_name": "bamueh/dark-matter",
"id": "61dccfdb2eeb985a99b4254e023e74728b6dced1",
"size": "... |
import re
from distutils.command.build import build
from setuptools import setup
VERSION = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]",
open('aws_ir/_version.py', 'r').read(),
re.MULTILINE
).group(1)
setup(name="aws_ir",
version=VERSION,
author="Andrew Krug, Alex McCormack, Joel Ferrier, ... | {
"content_hash": "0f78d8d0d252acc00467186939e8edec",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 84,
"avg_line_length": 34.975,
"alnum_prop": 0.4839170836311651,
"repo_name": "ThreatResponse/aws_ir",
"id": "8d790f858eee4ab83a2e880d03d90a627acc40b7",
"size": "1399",
"... |
from cuttlebug.util import bidict
import collections
class ParseError(Exception): pass
UNSPECIFIED = -1
VOID = 0
CHAR = 1
INT = 3
FLOAT = 4
DOUBLE = 5
STRUCT = 6
UNION = 7
TYPEDEF = 8 # Weird case
SHORT = 9
LONG = 10
SIGNED,UNSIGNED = 1,0
SIZE_SHORT,SIZE_LONG = 0, 1
TYPES = bidict({"void": V... | {
"content_hash": "817492b01299cc33101878ae054c0a4e",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 147,
"avg_line_length": 31.707581227436823,
"alnum_prop": 0.533302971649778,
"repo_name": "ryansturmer/cuttlebug",
"id": "82b0db9a4e460bc61aa235e05556569e761ca9ca",
"size"... |
import re
import os
import os.path
import shutil
import uuid
import tempfile
import subprocess
from django.conf import settings
from edge.blast import BLAST_DB, default_genome_db_name
from edge.blast import Blast_Accession
from edge.models import Fragment, Genome
from edge.utils import make_required_dirs
def fragme... | {
"content_hash": "fb5175dcdccb849e69b512a4d215cfa8",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 98,
"avg_line_length": 32.616,
"alnum_prop": 0.6448368898700024,
"repo_name": "ginkgobioworks/edge",
"id": "d55ad7feb1aa12282b5b0a9427525567c2afa91e",
"size": "4077",
"b... |
import numpy as np
import h5py
def writeH5(pressure,u,v,w,velmag,filename):
"""
Write the h5 file that will save the information needed in proper structure.
pressure = numpy array with pressure values
u,v,w = numpy array with velocity data
filename = string with desired filename
dims = 3-tuple with the num... | {
"content_hash": "0e89823cbe9e729326b1419d09bdd93d",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 123,
"avg_line_length": 40.449438202247194,
"alnum_prop": 0.6475,
"repo_name": "stu314159/pyNFC",
"id": "4c8545a511fb19177617ff2205b1e338108c6365",
"size": "3600",
"binar... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'HelloSignRequest'
db.create_table(u'hello_sign_hellosignrequest', (
(... | {
"content_hash": "0b73ccca20237bb8513f5bf7e91f8d59",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 161,
"avg_line_length": 62.94565217391305,
"alnum_prop": 0.5952339837679157,
"repo_name": "rosscdh/django-hello_sign",
"id": "c8c370861252d72abab98f1ef1f58c775be5b519",
"si... |
from __future__ import print_function, division
from sympy.core import S, C, sympify
from sympy.core.add import Add
from sympy.core.basic import Basic
from sympy.core.containers import Tuple
from sympy.core.numbers import Rational
from sympy.core.operations import LatticeOp, ShortCircuit
from sympy.core.function impor... | {
"content_hash": "71a7dbf862175ec3e4e25d2b4f2fca66",
"timestamp": "",
"source": "github",
"line_count": 604,
"max_line_length": 80,
"avg_line_length": 26.177152317880793,
"alnum_prop": 0.5389285940168237,
"repo_name": "wdv4758h/ZipPy",
"id": "63410320efe2567a4a772bac93783baa947816f7",
"size": "1581... |
"""Runs a sweep over evaluation algorithms and prints results.
This experiment is far from ideal because it does not support sweeps over
different parameters for different algorithms at the moment.
"""
import functools
from typing import Callable
from typing import Sequence
import numpy as np
import time
from absl i... | {
"content_hash": "ade49e60eac1f6fe462be337c27e8b02",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 111,
"avg_line_length": 43.32596685082873,
"alnum_prop": 0.6817138485080336,
"repo_name": "abhisheknaik96/differential-value-iteration",
"id": "d4741f1bbd15d694c164dacea0ed9... |
from collections import defaultdict
from datetime import date, timedelta
from decimal import Decimal
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q, signals
... | {
"content_hash": "e3eba1c25e63731b7117c9b46a578de0",
"timestamp": "",
"source": "github",
"line_count": 1493,
"max_line_length": 88,
"avg_line_length": 32.8801071667783,
"alnum_prop": 0.5698716642900794,
"repo_name": "matthiask/zivinetz",
"id": "7ee740fe1230bf1d21212cfb20de26574a67e919",
"size": "4... |
from . import docdata # noqa. enforce signal registration.
| {
"content_hash": "e82572520a66d3ba2766664bca37db91",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 60,
"avg_line_length": 61,
"alnum_prop": 0.7540983606557377,
"repo_name": "edoburu/django-oscar-docdata",
"id": "84b61f6dc142deec7711f9fb360e8d97667dc26e",
"size": "61",
"... |
"""
URLConf for Django-Forum.
django-forum assumes that the forum application is living under
/forum/.
Usage in your base urls.py:
(r'^forum/', include('forum.urls')),
"""
from django.conf.urls.defaults import *
from forum.models import Forum
from forum.feeds import RssForumFeed, AtomForumFeed
from forum.sitema... | {
"content_hash": "22b198c76b4ac34a1131ce02d5fa8c26",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 109,
"avg_line_length": 33.95652173913044,
"alnum_prop": 0.6376440460947503,
"repo_name": "andrewychoi/django-forum",
"id": "31ccfd13ff872f2176ac587e7153625ef9596354",
"siz... |
from typing import Dict, Tuple
from hgijson.tests._models import SimpleModel, ComplexModel
EXAMPLE_VALUE_1 = "example-value-1"
EXAMPLE_VALUE_2 = "example-value-2"
EXAMPLE_VALUE_3 = "example-value-3"
EXAMPLE_VALUE_4 = "example-value-4"
EXAMPLE_PROPERTY_1 = "example-property-1"
EXAMPLE_PROPERTY_2 = "example-property-2... | {
"content_hash": "c4a2b2d98c340670416011deb8d73f7a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 117,
"avg_line_length": 35.90163934426229,
"alnum_prop": 0.6840182648401827,
"repo_name": "wtsi-hgi/python-json",
"id": "6871eeec50170cd55038f2d6b8a9cd252326083d",
"size": ... |
"""Generates graphs with a given eigenvector structure"""
import networkx as nx
from networkx.utils import np_random_state
__all__ = ['spectral_graph_forge']
def _truncate(x):
""" Returns the truncated value of x in the interval [0,1]
"""
if x < 0:
return 0
if x > 1:
return 1
r... | {
"content_hash": "61d4d931edbe555a837a39a97f8154d6",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 79,
"avg_line_length": 31.6010101010101,
"alnum_prop": 0.6560652069681956,
"repo_name": "sserrot/champion_relationships",
"id": "af470b4279120507013b06cee3652b4224ec90b8",
... |
class Solution(object):
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
length = len(nums) - 1
for i in range(k):
nums.insert(0, nums.pop(length))
| {
"content_hash": "7a30c3d4fd3a163c04c3cc6346d88cbf",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 74,
"avg_line_length": 30.8,
"alnum_prop": 0.525974025974026,
"repo_name": "andy-sheng/leetcode",
"id": "592136362fe3f80f686b15c9412217b70538b8f3",
"size": "308",
"binary... |
from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
from django.db.utils import DatabaseError
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
class Mig... | {
"content_hash": "7e2e26aaec82080098b096dc54527bf1",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 112,
"avg_line_length": 34.348837209302324,
"alnum_prop": 0.6242383209207854,
"repo_name": "yephper/django",
"id": "72f9f8cbb05d3afae78ca825cf18c0e95f42fd30",
"size": "2954... |
import read_amber_prmtop as ra
import networkx as nx
import itertools
class GhostAtom(ra.Atom):
pass
valences = {"H": 1,
"C": 4,
"N": 3,
"O": 2,
"S": 2,
"Se": 2,
"P": 5}
def tetravalent_atoms(atoms):
"""
Identifies possible candid... | {
"content_hash": "1f692d5cc763566556614e92268c0afd",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 119,
"avg_line_length": 40.70165745856354,
"alnum_prop": 0.6075743179041673,
"repo_name": "khs26/rotamer_library",
"id": "6b94b99412a01b78497cfbfd3e8c5e12e54915ea",
"size"... |
import unittest
from math import pi, atan, sqrt
from RULEngine.Util.geometry import get_angle
from RULEngine.Util.game_world import GameWorld
from RULEngine.Game.Referee import Referee
from RULEngine.Util.team_color_service import TeamColorService
from RULEngine.Game.Game import Game
from RULEngine.Game.Ball import Ba... | {
"content_hash": "ffa8eac6bc3d885b26f05c75af0f0a82",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 119,
"avg_line_length": 51.53398058252427,
"alnum_prop": 0.6109645817633761,
"repo_name": "AlexandraMercier/StrategyIA",
"id": "876b18ea8626438b6b3adf0de0099c525224074d",
... |
import sure # noqa # pylint: disable=unused-import
import moto.server as server
from moto import mock_kinesisvideoarchivedmedia
"""
Test the different server responses
"""
@mock_kinesisvideoarchivedmedia
def test_kinesisvideoarchivedmedia_server_is_up():
backend = server.create_backend_app("kinesis-video-archi... | {
"content_hash": "5c8a17a49e02edeadfb311fb9f0d131f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 29.41176470588235,
"alnum_prop": 0.76,
"repo_name": "spulec/moto",
"id": "d05a884b2ebe4f0c3ad28d8b719d41c15747d049",
"size": "500",
"binary": false... |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRespons... | {
"content_hash": "59721b25dccc063b1bcb7f3486b8ad5c",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 146,
"avg_line_length": 40.422222222222224,
"alnum_prop": 0.664467656221367,
"repo_name": "Azure/azure-sdk-for-python",
"id": "1a9d088e0b7873e0c501145a9a4bfa4d65b899a0",
"... |
"""Tests for the helper for managing project source code."""
from __future__ import unicode_literals
import unittest
from l2tdevtools import source_helper
from tests import test_lib
class SourceHelperTest(test_lib.BaseTestCase):
"""Tests for the helper to manager project source code."""
def testInitialize(se... | {
"content_hash": "78bbfff279cedac522c19e325b20a001",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 67,
"avg_line_length": 21.88,
"alnum_prop": 0.7129798903107861,
"repo_name": "Onager/l2tdevtools",
"id": "cfee0777513db999f991b0b04a66d3587d58143c",
"size": "593",
"binar... |
from django.conf.urls import include, url
app_name = 'sofort'
urlpatterns = [
url('^sofort/', include('django_sofortueberweisung.urls')),
]
| {
"content_hash": "10cc98777bd0e7c9fc6c73b437207f45",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 63,
"avg_line_length": 24.166666666666668,
"alnum_prop": 0.7034482758620689,
"repo_name": "ParticulateSolutions/django-sofortueberweisung",
"id": "f300412143390733592683f59a13... |
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import *
from builtins import obje... | {
"content_hash": "d0d32d13a84f50a56492ba5170782643",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 322,
"avg_line_length": 40.68350168350168,
"alnum_prop": 0.6096995779193909,
"repo_name": "sunil07t/e-mission-server",
"id": "3db06eb5819372605a06d7ef6af88664324974f8",
"s... |
import warnings
import django
from django.db import transaction
from django.db.models import ManyToManyField
from django.forms.models import model_to_dict
from simple_history.exceptions import AlternativeManagerError, NotHistoricalModelError
def update_change_reason(instance, reason):
attrs = {}
model = typ... | {
"content_hash": "d1230cf339110d3002ccb39f6774d80c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 88,
"avg_line_length": 36.875,
"alnum_prop": 0.6510015408320493,
"repo_name": "treyhunner/django-simple-history",
"id": "f7290b4c53116bdaf469ce7678a80eb24c95ee72",
"size":... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2010 (ita)
"""
Node: filesystem structure, contains lists of nodes
#. Each file/folder is represented by exactly one node.
#. Some potential class properties are stored on :py:class:`waflib.Build.BuildContext` : nodes to depend on, etc.
Unused class memb... | {
"content_hash": "6b2659a0711f64b7a5332f3ef34ffd84",
"timestamp": "",
"source": "github",
"line_count": 803,
"max_line_length": 166,
"avg_line_length": 24.074719800747197,
"alnum_prop": 0.6293192633974757,
"repo_name": "livioferrante/my-final-project",
"id": "33a5833f3cd7e8dd9b4b52c6ab1ae9c656f3c395"... |
"""
A test of the Average kernel used for the Averager.
"""
from firedrake import (IntervalMesh, Function, RectangleMesh, SpatialCoordinate,
VectorFunctionSpace, FiniteElement)
from gusto.recovery.recovery_kernels import AverageKernel
import numpy as np
import pytest
@pytest.fixture
def mesh(... | {
"content_hash": "4edb601d3c2ca8c3ff539d13f82c0b3e",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 102,
"avg_line_length": 35.94690265486726,
"alnum_prop": 0.6260462826193993,
"repo_name": "firedrakeproject/gusto",
"id": "13bffa657f136b612754be0bbb979e9befe203b3",
"size... |
"""
Render documents as plaintext.
Very scruffy and not very powerful.
Should probably be modified to generate markdown syntax.
"""
from __future__ import absolute_import
from pyth import document
from pyth.format import PythWriter
from six import StringIO
class PlaintextWriter(PythWriter):
@classmethod
def... | {
"content_hash": "d97035f12c6dc38d155b2adafa7503cc",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 76,
"avg_line_length": 27.32894736842105,
"alnum_prop": 0.5888300433317285,
"repo_name": "prechelt/pyth",
"id": "2a0c3495856d69a385aaa90d4d839dc091676b84",
"size": "2077",
... |
from django.contrib import admin
from events import models
class EventAdmin(admin.ModelAdmin):
list_display = ('name', 'start_time', 'location')
admin.site.register(models.Event, EventAdmin) | {
"content_hash": "d709ba4bb4598af68f07251fd74e8636",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 53,
"avg_line_length": 22.444444444444443,
"alnum_prop": 0.7425742574257426,
"repo_name": "madisona/django-events",
"id": "1b7cbf22c5e67d583aa8ff6d54a464bb1bf177c5",
"size":... |
from fdp.fairgraph import FAIRGraph
def build_base_uri(host, port):
if not host.startswith('http'):
host = f'http://{host}'
if int(port) == 80:
base_uri = host
else:
base_uri = f'{host}:{port}'
return base_uri
_fairgraph = None
def init_fairgraph(host, port, endpoint):
bas... | {
"content_hash": "4e256ec03ef615fa42af225d4395196f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 46,
"avg_line_length": 23.4,
"alnum_prop": 0.6303418803418803,
"repo_name": "NLeSC/ODEX-FAIRDataPoint",
"id": "8c68842a3a48725842c751b4b75276583998fe8e",
"size": "469",
"... |
import re
from SG_Utilities import *
import os
import fnmatch
## Returns a list of all reviews each as a separate string
def getReviews() :
reviews = []
for dirpath, subdirs, files in os.walk('Data') :
for filename in fnmatch.filter(files, '*.txt') :
filenamePath = os.path.join(dirpath, filename)
with open(... | {
"content_hash": "263191f3c956b6c7e2aab1d4d02baea5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 29.964285714285715,
"alnum_prop": 0.733015494636472,
"repo_name": "shubha1593/MovieReviewAnalysis",
"id": "9b62e7885d9fd05594d1b9ebf91ca36795299fc7",
... |
"""Scraper for Wyoming Supreme Court
CourtID: wyo
Court Short Name: Wyo.
History:
- 2014-07-02: mlr: Created new version when court got new website.
- 2015-07-06: m4h7: Updated to use JSON!
- 2016-06-09: arderyp: Updated because json endpoint moved and was changed
"""
import re
from datetime import date, datetime
... | {
"content_hash": "ac75e001c644ef59b392d8f538624b8b",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 85,
"avg_line_length": 33.6,
"alnum_prop": 0.5912698412698413,
"repo_name": "freelawproject/juriscraper",
"id": "726f81002a051bee8631d105b2ba9d14b9c2f30a",
"size": "2016",
... |
from distutils.core import setup
from distutils.extension import Extension
import commands
def pkgconfig(*packages, **kw):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
for token in commands.getoutput("pkg-config --libs --cflags %s" % ' '.join(packages)).split():
kw.setdefa... | {
"content_hash": "a1f8008b7c9bb1029c9d2afe59dd3358",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 98,
"avg_line_length": 32.6875,
"alnum_prop": 0.6290630975143403,
"repo_name": "ActiveState/code",
"id": "dd5cb9069384b462dbbe1faa13d64e29ca5c1ab9",
"size": "545",
"binar... |
"""
Provide math calls that uses intrinsics or libc math functions.
"""
from __future__ import print_function, absolute_import, division
import math
import operator
import sys
import numpy as np
import llvmlite.llvmpy.core as lc
from llvmlite.llvmpy.core import Type
from numba.targets.imputils import Registry, impl_... | {
"content_hash": "06ea404c2f0d80bba8d6fc5f14095338",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 87,
"avg_line_length": 34.968369829683695,
"alnum_prop": 0.6433342610631784,
"repo_name": "jriehl/numba",
"id": "8fba75332b44b56da579c0b0c64269c5cc9cd00c",
"size": "14372"... |
import click
GOOD_COLOR = 'green'
WARN_COLOR = 'yellow'
BAD_COLOR = 'red'
IGNORED_COLOR = 'blue'
def set_output_color(color):
# Print nothing except the ANSI escape sequence
click.secho('', nl=False, fg=color, reset=False)
def clear_output_color():
# Print nothing except the reset escape sequence
cl... | {
"content_hash": "e1450d523a31fe4003d3fd818c52030d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 84,
"avg_line_length": 27.07246376811594,
"alnum_prop": 0.6445396145610278,
"repo_name": "mcgid/morenines",
"id": "61cf11aba3784722fa4b2a0266c4d508b5da92e2",
"size": "1868"... |
import django
try:
from django.urls import path
url = None
except ImportError:
path = None
from django.conf.urls import url
from django.http import HttpResponse
def emptypage(request):
# Minimal page needed for some tests.
# We include a favicon link to stop browsers making a request to
... | {
"content_hash": "db58e10146eefe5c1e96d956036f2ad4",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 23.727272727272727,
"alnum_prop": 0.6580459770114943,
"repo_name": "django-functest/django-functest",
"id": "54c554d871721b9390512c382bf3daf425f0cef3",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.