text stringlengths 4 1.02M | meta dict |
|---|---|
import egads
# import thermodynamic module and rename to simplify usage
import egads.algorithms.thermodynamics as thermo
# get list of all NetCDF files in 'data' directory
filenames = egads.input.get_file_list('data/*.nc')
f = egads.input.EgadsNetCdf() # create EgadsNetCdf instance
for name in filenames: ... | {
"content_hash": "0cfcaa074a603b6a1aba310d82769b5f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 41.888888888888886,
"alnum_prop": 0.649867374005305,
"repo_name": "eufarn7sp/egads-eufar",
"id": "8b1555be93f973526ed169d807f6c8b0ee7c2a33",
"size": ... |
import json
def read_json_data(file_path):
with open(file_path) as f:
data = json.load(f)
return data
| {
"content_hash": "3346230518b42b13e550f2b10fe6f412",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 30,
"avg_line_length": 17.142857142857142,
"alnum_prop": 0.625,
"repo_name": "edx/edx-app-android",
"id": "f69a7d7450f7184268ff9fc3e38666b1e3c7bec6",
"size": "120",
"binar... |
from __future__ import division
import vistrails.core.db.action
from vistrails.core.db.locator import XMLFileLocator
from vistrails.core.db.io import serialize, unserialize
from vistrails.core import debug
from vistrails.core.interpreter.default import get_default_interpreter
from vistrails.core.log.group_exec import ... | {
"content_hash": "030df4801b6a1b69bbf385f4d1a78bfe",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 98,
"avg_line_length": 37.90998043052838,
"alnum_prop": 0.561377245508982,
"repo_name": "hjanime/VisTrails",
"id": "ee2c905a791ebedbd98e09e0c04ddcb30a5f4b32",
"size": "212... |
from collections import deque
class Node():
def __init__(self,label=None,data=None):
self.label = label
self.data = data
self.children = dict()
self.iscomplete = True
def addChild(self,key,data=None):
if not isinstance(key,Node):
self.children[key] ... | {
"content_hash": "c5946aecbb6b8dd4963d928bdc28244f",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 85,
"avg_line_length": 30.951219512195124,
"alnum_prop": 0.5282374573154714,
"repo_name": "Faraaz54/python_training_problems",
"id": "af592b85978c5cbcb6b74af048b3cea180210c0... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cubanoshaciamiami.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "47dad5869540a3efef009b6b90b6e172",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 81,
"avg_line_length": 27.444444444444443,
"alnum_prop": 0.6963562753036437,
"repo_name": "edilio/cubanoshaciamiami.com",
"id": "96f0c97566f7b1bd91686531c55c2e7a4d19ac49",
"... |
import collections
import os
import tabulate
import yaml
from molecule import state
from molecule import util
from molecule.driver import basedriver
class Molecule(object):
def __init__(self, config, args):
"""
Initialize a new molecule class and returns None.
:param config: A molecule ... | {
"content_hash": "bc65692b828ac7b8fb77642992c7eb04",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 79,
"avg_line_length": 34.07123287671233,
"alnum_prop": 0.5679478932132519,
"repo_name": "rgreinho/molecule",
"id": "2c8b41c206e130e77ed2647e567a59ba55cc582c",
"size": "13... |
MAX_CHILDREN = 2
class BTree:
def __init__(self):
self.root = Node()
def insert(self, key=None, value=None):
mid, sib = self.root.insert(key, value)
if mid:
old_root = self.root
self.root = Node()
self.root.children = [old_root, sib]
self... | {
"content_hash": "cc591a5569977a6dbbaabc7d102aa0fa",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 30.194444444444443,
"alnum_prop": 0.5142594296228151,
"repo_name": "asp2insp/lodestone",
"id": "2b45e72650dfe848bfb3652f3d0b8099800c0a96",
"size": "... |
"""Generic Node base class for all workers that run on hosts."""
import inspect
import os
import random
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_service import looping... | {
"content_hash": "62428e8047e2c00016da92bb63a8c5db",
"timestamp": "",
"source": "github",
"line_count": 473,
"max_line_length": 79,
"avg_line_length": 36.95771670190275,
"alnum_prop": 0.57725530576054,
"repo_name": "JioCloud/cinder",
"id": "01f929edee903460ef11b5be18666a84757a0a36",
"size": "18251"... |
import os
import yaml
import pytest
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from numpy.testing import assert_allclose
from tardis.io.atom_data.base import AtomData
from tardis.simulation import Simulation
from tardis.io.config_reader import Configuration
quantity_comparison = [
(... | {
"content_hash": "f84c4fe6e3b636006ae785cff296871f",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 80,
"avg_line_length": 35.44814814814815,
"alnum_prop": 0.6044300491066764,
"repo_name": "kaushik94/tardis",
"id": "c27195584169d0bae07e51f45bd71a15d7956631",
"size": "957... |
import hmac
from hashlib import sha1
import os
from google.cloud import secretmanager
PROJECT_NAME = os.environ.get("PROJECT_NAME")
class EventSource(object):
"""
A source of event data being delivered to the webhook
"""
def __init__(self, signature_header, verification_func):
self.signatur... | {
"content_hash": "e07ebfe41b258b8018152e8269648323",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 76,
"avg_line_length": 26.126984126984127,
"alnum_prop": 0.6376063183475091,
"repo_name": "GoogleCloudPlatform/fourkeys",
"id": "c592ce6b3882b5256defe608b49cbc557250c645",
... |
import unittest
import mock
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
@testing.parameterize(*testing.product({
'dtype': [numpy... | {
"content_hash": "eec97056933d4d9f165479c07e94b951",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 77,
"avg_line_length": 34.33057851239669,
"alnum_prop": 0.5816080885893115,
"repo_name": "benob/chainer",
"id": "a8d6639280f3841ba638e38852ed91876312a449",
"size": "4154",... |
import asyncio
import aiohttp
@asyncio.coroutine
def aiohttp_request(loop, method, url, as_text, **kwargs):
with aiohttp.ClientSession(loop=loop) as session:
response = yield from session.request(method, url, **kwargs) # NOQA: E999
if as_text:
content = yield from response.text() # N... | {
"content_hash": "5af1ef5c8ddbfd617eab1619fdb50c66",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 33.84615384615385,
"alnum_prop": 0.6454545454545455,
"repo_name": "poussik/vcrpy",
"id": "5b77fae0c69fbfca696956d858c0a428adc82141",
"size": "440",
... |
"""Checks if a set of configuration(s) is version and dependency compatible."""
import re
import sys
import six
from six.moves import range
import six.moves.configparser
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util import tf_inspect
PATH_TO_DIR = "tensorflow/tools/tensorfl... | {
"content_hash": "e2bb63b933bf6216ea312f71160800a9",
"timestamp": "",
"source": "github",
"line_count": 887,
"max_line_length": 80,
"avg_line_length": 38.174746335963924,
"alnum_prop": 0.5690912849590974,
"repo_name": "Intel-Corporation/tensorflow",
"id": "7139118d1fcb9a0a31a5c55d30eac8e486055e4c",
... |
"""Expose a TestCase class.
- TestCase: a basic Arrange, Act, Assert test case implementation
"""
import mock
class TestCase(object):
"""Arrange, Act, Assert test case.
Sub-classes implement test cases by *arranging* the environment in
the :meth:`.arrange` class method, perform the *action* in the
... | {
"content_hash": "499058d26ffc3a49a2ee8475b9f5ec73",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 73,
"avg_line_length": 31.04724409448819,
"alnum_prop": 0.635049454729901,
"repo_name": "dave-shawley/fluent-test",
"id": "f36a8a08eff722d4f2ccbb27aa06af9edc4fd38b",
"size... |
import pytest
import re
import capybara
class TestHaveNoneOfSelectors:
@pytest.fixture(autouse=True)
def setup_session(self, session):
session.visit("/with_html")
def test_is_false_if_any_of_the_given_locators_are_on_the_page(self, session):
assert session.has_none_of_selectors("xpath", ... | {
"content_hash": "6c83337f970f19c8bb46eedebdec8975",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 97,
"avg_line_length": 45.9375,
"alnum_prop": 0.6462585034013606,
"repo_name": "elliterate/capybara.py",
"id": "b5f92ccbed2f22f04a49d4ba88ddaef5a0e4591c",
"size": "2205",
... |
from django.db import models
# Classes
##########
class Artist(models.Model):
name = models.CharField(max_length=100, unique=True)
def __unicode__(self):
return u"Artist #{}: {}".format(self.id, self.name)
@staticmethod
def getArtists():
artists = []
for artist in Ar... | {
"content_hash": "de5491ae00ec8615ad4d25a9130a18ee",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 98,
"avg_line_length": 33.329032258064515,
"alnum_prop": 0.5586527293844367,
"repo_name": "BitLooter/Cadence",
"id": "73a3fea5b6a7721df45652541e5b3940e5f16cad",
"size": "5... |
"""
========================
Cycle finding algorithms
========================
"""
# Copyright (C) 2010 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
from networkx.utils import *
fro... | {
"content_hash": "b8e97e42c970f1f27f12fd69ef1af73d",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 80,
"avg_line_length": 33.309178743961354,
"alnum_prop": 0.5628716461203771,
"repo_name": "lthurlow/Network-Grapher",
"id": "d302ba6e96be7a432f9ea69dc23579885ab561d8",
"si... |
from runner.koan import *
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
# * A set of three numbers (other th... | {
"content_hash": "41e5b33c34329f4071f24a85c007ad2a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 28.305882352941175,
"alnum_prop": 0.6122194513715711,
"repo_name": "r3dshirt/Python-Koans",
"id": "661f53afe0a377bb9d4242d42e232ba575f4c9f2",
"size":... |
import pytest
from molecule.model import schema_v2
@pytest.fixture
def _model_dependency_section_data():
return {
'dependency': {
'name': 'galaxy',
'enabled': True,
'options': {
'foo': 'bar',
},
'env': {
'FOO': 'f... | {
"content_hash": "89a87a0be6dfc27a0c84cc624c6a9343",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 78,
"avg_line_length": 23.28448275862069,
"alnum_prop": 0.5138837467604591,
"repo_name": "metacloud/molecule",
"id": "fe505e59794c57e5a6d43e1e8160ee05a4a032eb",
"size": "3... |
from __future__ import absolute_import
from google.cloud.dataproc_v1 import ClusterControllerClient
from google.cloud.dataproc_v1 import JobControllerClient
from google.cloud.dataproc_v1 import WorkflowTemplateServiceClient
from google.cloud.dataproc_v1 import enums
from google.cloud.dataproc_v1 import types
__all__... | {
"content_hash": "1691f3becb1c702f97fd94151a3160f4",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 28,
"alnum_prop": 0.78125,
"repo_name": "tseaver/google-cloud-python",
"id": "772a0dbfd0de481827ea05a2c4e64022ecb8b388",
"size": "1051",
"binary": ... |
import hexchat
import threading
import twitch.hook, twitch.channel, twitch.logger, twitch.settings
log = twitch.logger.get()
# Don't show the "changed topic" message (but do update the topic bar)
def topic_print_cb(word, word_eol, msgtype):
return hexchat.EAT_ALL
# work around hexchat bugs (likes to segfault when ... | {
"content_hash": "ae96cf55a02ae23211472429f381484d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 26.927710843373493,
"alnum_prop": 0.6921700223713646,
"repo_name": "RenaKunisaki/hexchat-twitch",
"id": "9ead958a7da5188ea00a0712492768eef3546a67",
"... |
from django import forms
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ('title', 'text',) | {
"content_hash": "11619e28282dc188cd0667687bb1ffe9",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 35,
"avg_line_length": 17.555555555555557,
"alnum_prop": 0.6392405063291139,
"repo_name": "manojpandey/simple-blog",
"id": "3a30f8d31eff5cada284b305d879eb090d19b37c",
"size"... |
""" Testing suite for the PyTorch CLIP model. """
import inspect
import os
import tempfile
import unittest
import requests
from transformers.file_utils import is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from .test_configuration_com... | {
"content_hash": "0baf095368c52d68271571d5b105a29b",
"timestamp": "",
"source": "github",
"line_count": 547,
"max_line_length": 119,
"avg_line_length": 37.09323583180987,
"alnum_prop": 0.6325776244455397,
"repo_name": "huggingface/pytorch-transformers",
"id": "c5ab9416d152e01d5fd9da2d9c118daa629d9346... |
"""image_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | {
"content_hash": "454bbb30cfa4cef7095bb1e26d24226c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 98,
"avg_line_length": 39.67857142857143,
"alnum_prop": 0.7245724572457246,
"repo_name": "pstrinkle/drf-image-app",
"id": "57e2b61e709aa25118efc6bfe19814e0fcf6564b",
"size"... |
class Node:
#initializes Node based on JSON data
#param metro - JSON city data
#param edges - edges associated with Graph
def __init__(self, metro, edges):
self.code = metro['code']
self.name = metro['name']
self.country = metro['country']
self.continent = metro['contine... | {
"content_hash": "8a9cbfd47d7976b9ba564e35f178a2ee",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 36.97222222222222,
"alnum_prop": 0.5867768595041323,
"repo_name": "anneomcl/FlightNetwork",
"id": "52c5ea0cd395da4b498fc90c7db8c2b82ff1c408",
"size":... |
import argparse
import csv
import sys
import avro.schema
from collections import namedtuple
from avro.datafile import DataFileReader, DataFileWriter
from avro.io import DatumReader, DatumWriter
################################################################################
#
# CLI arg parsing
#
######################... | {
"content_hash": "1c1c30adbe62a3412e49bebaec52403f",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 86,
"avg_line_length": 38.205128205128204,
"alnum_prop": 0.5308724832214765,
"repo_name": "faulconbridge/aver-spark",
"id": "b500abc126a1fa4dc75b11f18115db334eca6f0d",
"si... |
"""
Sun Oct 12 11:38:18 IDT 2014
by xorpd.
A script for auto generating the xorpd's website.
"""
from mako.template import Template
from mako.lookup import TemplateLookup
import os
import shutil
import lib.utils
class MakeWebsiteError(Exception): pass
# The content's directory name:
CONTENT_DIR = "content"
# The... | {
"content_hash": "e4dc43b5c8959d02e12ac44747733b8c",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 81,
"avg_line_length": 31.43030303030303,
"alnum_prop": 0.5713459313536444,
"repo_name": "xorpd/static_weber",
"id": "e155402c94beb9d80968eeab9cc2a66dc08c2f60",
"size": "5... |
from pathlib import Path
import asyncpgsa
import django
import pytest
import yaml
from aiohttp.web import Application
from aioworkers.core.config import Config
from aioworkers.core.context import Context
from django.core.management import call_command
from dvhb_hybrid import BASE_DIR
TESTS_DIR = Path(__file__).paren... | {
"content_hash": "8c12b6b017e5385e4653880826e18ee6",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 56,
"avg_line_length": 20.942528735632184,
"alnum_prop": 0.650384193194292,
"repo_name": "dvhbru/dvhb-hybrid",
"id": "ecc3430af4b37af007089e10038e07b04ae80079",
"size": "18... |
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.domain.definitions.retail_decisions_cc_fraud_check_output import RetailDecisionsCCFraudCheckOutput
from ingenico.connect.sdk.domain.definitions.validation_bank_account_output import ValidationBankAccountOutput
class ResultDoRiskAssessme... | {
"content_hash": "043c25a9d53c3d8422161717540c433e",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 135,
"avg_line_length": 46.179245283018865,
"alnum_prop": 0.6947906026557712,
"repo_name": "Ingenico-ePayments/connect-sdk-python3",
"id": "248d59aa6a08db2c84579acba9e553efa... |
import asyncio
import aiomysql
import asynctest
from domopyc.web.switch_service import SwichService
class SwitchServiceTest(asynctest.TestCase):
@asyncio.coroutine
def setUp(self):
self.pool = yield from aiomysql.create_pool(host='127.0.0.1', port=3306,
... | {
"content_hash": "4b6316056c788f5551258bd431e2b302",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 107,
"avg_line_length": 39.785714285714285,
"alnum_prop": 0.624326750448833,
"repo_name": "bamthomas/DomoPyc",
"id": "6bb0b6b8e39ac843a48b3146f8077424eb328734",
"size": "22... |
"""pyWWA local module."""
# stdlib
import json
import os
# Local
from .cmdline import parse_cmdline
# Shared configuration
SETTINGS = {}
# Eventually updated by command line parsing
CTX = parse_cmdline([])
# Eventually updated to be a JABBER instance
JABBER = None
def get_table_file(filename):
"""Return file po... | {
"content_hash": "cd81cf66c6eaf54d47644abf0d76c93a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 26.023809523809526,
"alnum_prop": 0.6614821591948765,
"repo_name": "akrherz/pyWWA",
"id": "e3d157cc55774c52229e5abef002e6d2065a3f94",
"size": "1093",... |
import json
import sys
from datetime import datetime
from optparse import OptionParser
def read_benchmark(fname):
blob = json.load(open(fname))
tstamp = blob['timestamp']
t = datetime.fromtimestamp(tstamp).strftime('%Y-%m-%d')
label = "%s (%s)" % (blob['commit'][:6], t)
tests = blob['tests']
return tstamp,... | {
"content_hash": "c8a5f72ec7524de548936ba61f25de3b",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 111,
"avg_line_length": 35.986486486486484,
"alnum_prop": 0.6214795343597447,
"repo_name": "netopyr/doppio",
"id": "98131cc560fba2316f2d8c13ec6441054c14d25a",
"size": "2663... |
import sys, os, time
import doctest
sys.path.append("..")
from mas.multiagent import *
def test_sim_basic() :
'''
>>> test_sim_basic()
Initialization.
Simulator: <<multiagent.Simulator has_driver=1>>
'''
print("Initialization.")
driver = Driver(context = Context(), schedule = Schedule())
... | {
"content_hash": "40e87f8cf3fe7f7db4c57272006736d1",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 95,
"avg_line_length": 25.89189189189189,
"alnum_prop": 0.6075156576200418,
"repo_name": "csningli/MultiAgent",
"id": "0d72d44a880647be4a8670e99775558fed31307e",
"size": "1... |
'''
This module contains the classes which represent XCB data types.
'''
from xcbgen.expr import Field, Expression
import __main__
class Type(object):
'''
Abstract base class for all XCB data types.
Contains default fields, and some abstract methods.
'''
def __init__(self, name):
'''
... | {
"content_hash": "6a57c7eb2eb45dad51d15f70f06d01c5",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 115,
"avg_line_length": 34.43255131964809,
"alnum_prop": 0.5698164629732146,
"repo_name": "maseek/rust-xcb",
"id": "f3ad41f9e56079b8c34dd0f5aa7557adff26a9f6",
"size": "234... |
"""Helper utilities for AOT compilation."""
import collections
import copy
import os
import re
import shlex
from typing import List, Tuple
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import meta_graph_pb2
from tensorflow.python.client import session
from tensorflow.python.framework i... | {
"content_hash": "e7a5b062db31280952361235c6997626",
"timestamp": "",
"source": "github",
"line_count": 509,
"max_line_length": 90,
"avg_line_length": 39.783889980353635,
"alnum_prop": 0.6701728395061728,
"repo_name": "gautam1858/tensorflow",
"id": "4ca907b091e993ec35ad49383d9c1e1868ac4d0c",
"size"... |
from __future__ import unicode_literals
from ..mesh import TVTKBaseInterface
def test_TVTKBaseInterface_inputs():
input_map = dict(ignore_exception=dict(nohash=True,
usedefault=True,
),
)
inputs = TVTKBaseInterface.input_spec()
for key, metadata in list(input_map.items()):
for metakey... | {
"content_hash": "0b6071c122e40ae7719d985a5dd83dcd",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 28.2,
"alnum_prop": 0.6761229314420804,
"repo_name": "mick-d/nipype",
"id": "d6e38722fe2e31d5c90933814fdf499bbcf91ea7",
"size": "477",
"binary": fa... |
import cgi
import logging
import os
import urllib
log = logging.getLogger(__name__)
class Request(object):
"""
Reqest object. Describes the request that has been sent in to be
processed.
@param req: the underlying request object from the http server.
@param path: the piece of the path that has ... | {
"content_hash": "661cd12edcdb35cf6eb02f9266b2b54a",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 90,
"avg_line_length": 35.70995670995671,
"alnum_prop": 0.6001939629045945,
"repo_name": "sassoftware/restlib",
"id": "8030653700bab7d2857291c9a9d1d59f8a1b753d",
"size": "... |
import hug
@hug.get('/image.png', output=hug.output_format.png_image)
def image():
return '../logo.png'
| {
"content_hash": "898473eb70600c636b5bb36eb389559f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 58,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.6636363636363637,
"repo_name": "giserh/hug",
"id": "1235809d672da43059f51904d00645aca695ec9e",
"size": "110",
"b... |
from .base import * # NOQA
import logging.config
# For security and performance reasons, DEBUG is turned off
DEBUG = False
TEMPLATE_DEBUG = False
# Must mention ALLOWED_HOSTS in production!
# ALLOWED_HOSTS = ["mysana.com"]
# Cache the templates in memory for speed-up
loaders = [
('django.template.loa... | {
"content_hash": "b74335a368b563fc599dbb7b8bc5d6ba",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 90,
"avg_line_length": 26.6984126984127,
"alnum_prop": 0.5600475624256838,
"repo_name": "triump0870/mysana",
"id": "260c853fdf91d39ad4668acb1b3d754d66652326",
"size": "1793... |
import sys
import os
import shutil
import logging
import errno
import argparse
def clone(in_path, new_path):
names = os.listdir(in_path)
if not os.path.exists(new_path): #create the path if it doesn't exist
os.makedirs(new_path)
for name in names:
in_path_name = os.path.join(in_path, name... | {
"content_hash": "aae0fb050379333611b1cd3a72441b3d",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 86,
"avg_line_length": 28.615384615384617,
"alnum_prop": 0.5934139784946236,
"repo_name": "samcheck/Scripts",
"id": "2368098b5f1db7b2b01b542ff3dd21a598d4d0ce",
"size": "160... |
import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", numpy.ndarray, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
toolbox.register("attr_bool", rand... | {
"content_hash": "13327bdbf0655140f5f31b8cc16a0e8d",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 94,
"avg_line_length": 31.759493670886076,
"alnum_prop": 0.6612196094061379,
"repo_name": "GrimRanger/GeneticAlgorithm",
"id": "e5dc03e99aa02d03908bddbe273f781f9e9f4f72",
"... |
import pytest
import srddl.core.exceptions as sce
import srddl.core.nameddict as scnd
class A(scnd.NamedDict):
@scnd.property(flags=['f1', 'f2'])
def _prop1(self, flags):
if flags['f1'] and flags['f2']: return 0
if flags['f1']: return 1
if flags['f2']: return 2
return 3
class ... | {
"content_hash": "645a4e0d599e96d44453d8562844fe48",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 63,
"avg_line_length": 23.122448979591837,
"alnum_prop": 0.5820829655781112,
"repo_name": "fmichea/srddl",
"id": "d3c0f889f5c6ad60dc10402be746e9419dbe5330",
"size": "2266",... |
import os
import scandir
from pontoon.base.models import Resource
from pontoon.base.utils import extension_in, first
def is_hidden(path):
"""
Return true if path contains hidden directory.
"""
for p in path.split(os.sep):
if p.startswith('.'):
return True
return False
def is... | {
"content_hash": "db9790901522aa8ea05bc2bab4b418e9",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 29.165354330708663,
"alnum_prop": 0.6630669546436285,
"repo_name": "mastizada/pontoon",
"id": "d175b4239dd51caa0cb2bcee9e0760e03e64dc23",
"size": "3... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('structure', '0014_remove_customer_type'),
]
operations = [
migrations.AddField(
model_name='servicesettings',
name='error_traceback',
field=models.TextFi... | {
"content_hash": "de75a9e2eac487792fe5f1621c2cf20a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 22.125,
"alnum_prop": 0.5903954802259888,
"repo_name": "opennode/nodeconductor-assembly-waldur",
"id": "c3ce78b2a049fc5dfa09e5d871e35dcf41345b1c",
"s... |
"""Support for deCONZ lights."""
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLOR,
ATTR_TRANSITION, EFFECT_COLORLOOP, FLASH_LONG, FLASH_SHORT,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_FLASH, SUPPOR... | {
"content_hash": "82eec17a3274f4a03f8c0844bf160e8d",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 78,
"avg_line_length": 32.241176470588236,
"alnum_prop": 0.6042692939244664,
"repo_name": "auduny/home-assistant",
"id": "7514162fefad44eb0ec1c3d943e273849c9bcb87",
"size"... |
import argparse
import fileinput
import re
import sys
#
# This script gets or updates version number. Version number
# is in AssemblyInfo.cs with the following format:
# <major version>.<minor version>.<build number>.<revision>
#
# Example:
# [assembly: AssemblyVersion("0.5.3.0")]
# [assembly: AssemblyFileVe... | {
"content_hash": "1fc269a7d06a03ccbbef9d882d3853d6",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 86,
"avg_line_length": 31.897959183673468,
"alnum_prop": 0.5844529750479847,
"repo_name": "bloomberg/collectdwin",
"id": "d8df99362236075b70fe08f837686ee04ef3820e",
"size":... |
import os
DESCRIPTION = "scicast: Single Cell Iterative Clustering and Statistical Testing. A package for interrogating single cell sequencing data."
LONG_DESCRIPTION = """\
scicast is a python utility that automates many of the repetitive steps of analyzing single cell sequencing data.
-k-means clustering to identi... | {
"content_hash": "3752e96c90d4a118763f5026ae5f85e2",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 139,
"avg_line_length": 32.373831775700936,
"alnum_prop": 0.6394341801385681,
"repo_name": "iandriver/SCICAST",
"id": "719e1b91a7e5479a9c87c45ac0abc831f246ed0b",
"size": "... |
import better_exceptions
better_exceptions.hook()
better_exceptions.MAX_LENGTH = None
def div():
var = "9" * 150
return 1 / var
div()
| {
"content_hash": "15d1ab2d4e5997cfea9c9dc6b875e9e7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 35,
"avg_line_length": 14.272727272727273,
"alnum_prop": 0.6178343949044586,
"repo_name": "Delgan/better-exceptions",
"id": "4d193b85a894ba865f5f9db10b3aa72061930479",
"siz... |
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine.resources.openstack.neutron import neutron
from heat.engine import support
class Firewall(neutron.NeutronResource):
"""A resou... | {
"content_hash": "b9dae3ca34e0d86ab72413a4e30a24a9",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 79,
"avg_line_length": 35.85947046843177,
"alnum_prop": 0.5734083035156472,
"repo_name": "openstack/heat",
"id": "93c865e76f5fba820749e728f1ba1aa7729ff5ab",
"size": "18182... |
from __future__ import unicode_literals
from django.conf.urls import url
from django.template.response import TemplateResponse
from django.views.generic.base import TemplateView
import advanced_reports
from advanced_reports.backoffice.base import BackOfficeBase
from advanced_reports.backoffice.contrib.views import Adva... | {
"content_hash": "1c4406e6dea06f20fc4ebf10a3cf1d17",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 114,
"avg_line_length": 41.264150943396224,
"alnum_prop": 0.7924096936442615,
"repo_name": "vikingco/django-advanced-reports",
"id": "338f0bb7c0b38ff6e87458a62742ebbe4ec33b27... |
from __future__ import division, absolute_import, print_function
import sys
import os
import re
import functools
import itertools
import warnings
import weakref
import contextlib
from operator import itemgetter, index as opindex
import numpy as np
from . import format
from ._datasource import DataSource
from numpy.co... | {
"content_hash": "6caeda39a3fb2e0effe722f7925a120c",
"timestamp": "",
"source": "github",
"line_count": 2334,
"max_line_length": 95,
"avg_line_length": 36.99571550985433,
"alnum_prop": 0.5627460971881225,
"repo_name": "shoyer/numpy",
"id": "694ad169471df674e101bde6369db0afb4aed80b",
"size": "86348"... |
from __future__ import division
from typing import List, Optional
import configparser
import datetime
import json
import logging
import os
import queue
import re
import threading
import docker
from zabbixdocker.lib.zabbix import ZabbixMetric, ZabbixSender
class DockerDiscoveryService(threading.Thread):
""" Thi... | {
"content_hash": "9303f6a7af46146f7a7ec35c1a7cbb58",
"timestamp": "",
"source": "github",
"line_count": 622,
"max_line_length": 120,
"avg_line_length": 37.247588424437296,
"alnum_prop": 0.47362741712707185,
"repo_name": "bhuisgen/zabbix-docker",
"id": "4e5d9a46aa64f7fdc443734f0840be77043f0837",
"si... |
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import sys
from multiprocessing import Process
ERR_SLEEP = 15
MAX_NONCE = 1000000L
settings = {}
pp = pprint.PrettyPrinter(indent=4)
class BitcoinRPC:
OBJID = 1
def __init__(self, host, port, username, passwo... | {
"content_hash": "6126b8f402018527061ab852a4a137b6",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 84,
"avg_line_length": 25.412244897959184,
"alnum_prop": 0.6451975586251205,
"repo_name": "solarcoin/solarcoin",
"id": "19c4f7ec7373389bc8c4c5bf1b24fc1eb2ef9903",
"size": ... |
from sys import argv
script, first, second, third, fourth = argv
print "This script is called:", script
print "Name a fruit:", first
#print "Your name:", second
print "Your favorite ice-cream flavor:", third
print "Your pet's name:", fourth
age = raw_input("How old are you? ")
height = raw_input("How tall are you? "... | {
"content_hash": "e8e1533452cd2cb54ce77cbde165e0eb",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.6959798994974874,
"repo_name": "CodeCatz/litterbox",
"id": "3e13222587832fde1794f4f62e67e8a931c5bfcb",
"size": "3... |
"""
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
_... | {
"content_hash": "530bcb5146c2ff2593d04c0ede46f626",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 112,
"avg_line_length": 33.03930131004367,
"alnum_prop": 0.5732223103357124,
"repo_name": "arokem/scipy",
"id": "078aad5daaedcfe25e3f49656e206727c5ab8551",
"size": "7566",... |
import re
import unicodedata
import json
from django.core.exceptions import ImproperlyConfigured
from django.core.validators import validate_email, ValidationError
from django.core import urlresolvers
from django.db.models import FieldDoesNotExist
from django.db.models.fields import (DateTimeField, DateField,
... | {
"content_hash": "88e32af5060162a389f29742071b1b4a",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 79,
"avg_line_length": 33.55980861244019,
"alnum_prop": 0.6174793270601654,
"repo_name": "nangia/django-allauth",
"id": "821e18907e36ae86f97f94e8ef967d68f1e508f3",
"size":... |
"""Functions for transforming encoded taxonomy files into a bycat taxonomy df"""
import pandas as pd
import numpy as np
__author__ = "Peter J Usherwood"
__python_version__ = "3.6"
def domains_to_binary(df_encoded, domain_column_key='Domain', num_domains=10):
"""
Transform the domains column into binary to b... | {
"content_hash": "6b9a89663a42aa3d9b1c12fd28b09ebe",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 114,
"avg_line_length": 39.674418604651166,
"alnum_prop": 0.6296893317702228,
"repo_name": "Usherwood/usherwood_ds",
"id": "fea843d3d3d1c5d2d6a4e0a1edcc2f6b022361df",
"siz... |
import os
from django.conf import urls
def register_urlpatterns():
"""
Регистрация конфигурации урлов для приложения m3.contrib.users
"""
return urls.defaults.patterns('',
(r'^op_static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.join(
os... | {
"content_hash": "75ee1c7c141f58c573ec37cc2acfecb1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 28,
"alnum_prop": 0.5934065934065934,
"repo_name": "barsgroup/objectpack",
"id": "398b28d9aee6d0f729e3c5949158e6457b769bcf",
"size": "430",
"binary... |
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from django.utils.decorators import method_decorator
from django.http import HttpResponseRedirect
class LoginRequiredMixin(object):
"""
需要有self.mod... | {
"content_hash": "1fe0a0ae1f9cbaeac5f719a6762f0363",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 83,
"avg_line_length": 37.94871794871795,
"alnum_prop": 0.6567567567567567,
"repo_name": "xu2243051/easyui-menu",
"id": "ab4245e73e981baa0b965f8d1e44f8aa9e95656c",
"size": ... |
from __future__ import print_function
import logging
import pprint
import math
import numpy
import os
import operator
import theano
from six.moves import input
from picklable_itertools.extras import equizip
from theano import tensor
from blocks.bricks import Tanh, Initializable
from blocks.bricks.base import applicat... | {
"content_hash": "4edeb82f3c242499e7236854e3774b0f",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 78,
"avg_line_length": 39.84,
"alnum_prop": 0.5876583256101329,
"repo_name": "dmitriy-serdyuk/blocks-examples",
"id": "b52278df4cb1d68aac2f822c5b9178dd85a6dc90",
"size": "... |
from itertools import chain
import logging
import os
import sys
import cdec.configobj
from cdec.sa._sa import gzip_or_text
from cdec.sa.features import EgivenFCoherent, SampleCountF, CountEF,\
MaxLexEgivenF, MaxLexFgivenE, IsSingletonF, IsSingletonFE,\
IsSupportedOnline
import cdec.sa
# maximum span of... | {
"content_hash": "8caeeb632b81562f20fdb546e5f6b01e",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 92,
"avg_line_length": 46.18852459016394,
"alnum_prop": 0.6120674356699202,
"repo_name": "carhaas/cdec-semparse",
"id": "777f5afd6c7ee07c818a2358662db8d21eb13fed",
"size":... |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("shs_auth", "0003_auto_20150906_0833")]
operations = [
migrations.AlterModelOptions(
name="user",
options={
... | {
"content_hash": "32062eadc85e0e4b4019fb58dc83c82d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 121,
"avg_line_length": 32.891891891891895,
"alnum_prop": 0.4897288414133114,
"repo_name": "JanMalte/secondhandshop_server",
"id": "f9c04f6b87f073c36cf9314bea9c9e1f44a655f5",... |
from test.test_support import verbose, verify, TestFailed
import sys
import new
class Eggs:
def get_yolks(self):
return self.yolks
print 'new.module()'
m = new.module('Spam')
if verbose:
print m
m.Eggs = Eggs
sys.modules['Spam'] = m
import Spam
def get_more_yolks(self):
return self.yolks + 3
pri... | {
"content_hash": "11556d7f46835cd754e223f18f4d66f2",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 76,
"avg_line_length": 29.587878787878786,
"alnum_prop": 0.6257681278164686,
"repo_name": "MalloyPower/parsing-python",
"id": "f022f7e843fb85ac6905d55efeebcadf2ba4442a",
"... |
import pytest
from facts.user_data import UserFacts
def test_user(tmpdir):
filename = str(tmpdir.join('user.yml'))
obj = UserFacts(filename)
assert obj.data == {}
obj.write('foo', 'bar')
assert obj.data == {'foo': 'bar'}
assert obj.read('foo') == 'bar'
obj.delete('foo')
assert obj.data... | {
"content_hash": "3a0dc548cbcebf47e561fb8e9d1024b0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 43,
"avg_line_length": 25.153846153846153,
"alnum_prop": 0.6085626911314985,
"repo_name": "johnnoone/facts",
"id": "9ef23773f587c1c3b0bb5be738be98e47c42a409",
"size": "327"... |
import urlparse
import requests
__author__ = 'ola'
class BoomerangClient:
BASE_URL = 'http://api.boomerang.io/v1'
def __init__(self, project_id, api_key):
self.url = "%s/api_key/%s/projects/%s/boomerangs/" % (self.BASE_URL, api_key, project_id)
def boomerang_url(self, bid):
return urlp... | {
"content_hash": "1eba9f040bd5514b3cd505be82136d0c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 97,
"avg_line_length": 23.375,
"alnum_prop": 0.6342245989304813,
"repo_name": "olalidmark/boomerang-client",
"id": "4a05e53a1cb60e71bfce4960cd0a5062bcd88462",
"size": "959"... |
def Square(x):
return x * x
# Now call it!
print Square(3)
def foo(x=2, y=3):
print "foo(x = %d, y = %d)" % (x, y)
print foo() # x=2, y=3
print foo(4) # x=4, y=3
print foo(5, 6) # x=5, y=6
print foo(y=7) # x=2, y=7 <- NEW
def poor_man_printf(fmt, *args):
# Operator % substitutes format string with arg... | {
"content_hash": "5c3e817cba5c27ffe15ed29631fd58f5",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 21.978494623655912,
"alnum_prop": 0.6267123287671232,
"repo_name": "denfromufa/mipt-course",
"id": "eb0be804e03d51ba23e40b572efa3027593a2657",
"size"... |
import logging
import threading
import json
import socket
from socketserver import (ThreadingTCPServer, StreamRequestHandler)
from time import sleep
from typing import (Callable, Dict, Optional, TYPE_CHECKING, Tuple, cast)
from .shared_probe_proxy import SharedDebugProbeProxy
from ..core import exceptions
from .debug_... | {
"content_hash": "afdbbf829c002577329073f56e7fcfc5",
"timestamp": "",
"source": "github",
"line_count": 475,
"max_line_length": 194,
"avg_line_length": 45.612631578947365,
"alnum_prop": 0.5736638050401551,
"repo_name": "flit/pyOCD",
"id": "3954ca4422141eb4e81557fd8ed193bd328572f2",
"size": "22343",... |
import os
import sys
import timeit
import openpyxl
def writer(optimised, cols, rows):
"""
Create a worksheet with variable width rows. Because data must be
serialised row by row it is often the width of the rows which is most
important.
"""
wb = openpyxl.Workbook(optimized_write=optimised)
... | {
"content_hash": "987dbb3b4ccdf6d77898a7b4b4ac97fe",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 96,
"avg_line_length": 32.69491525423729,
"alnum_prop": 0.55883877656817,
"repo_name": "benpruitt/customarrayformatter",
"id": "1ed65b9597fbd7a1500db629e35f14d649e5b57a",
"... |
from __future__ import unicode_literals
import datetime
from django.db import models
from django.db.models import Q
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from localflavo... | {
"content_hash": "2f949878ef91a87c30e902258939be07",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 129,
"avg_line_length": 39.206989247311824,
"alnum_prop": 0.6515598217346589,
"repo_name": "SeattleAttic/HedyNet",
"id": "1bb439bae96b421205211e80aa6c5c980eea1dc6",
"size"... |
from drift import management
import argparse, os, sys
sys.dont_write_bytecode = True
if __name__ == "__main__":
path = os.path.dirname(__file__)
sys.path.insert(0, path)
management.execute_cmd()
| {
"content_hash": "646bc84f362c5bd2fa2876ec95977e10",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 36,
"avg_line_length": 26,
"alnum_prop": 0.6586538461538461,
"repo_name": "1939Games/drift",
"id": "1ce5328c3fd3bb322a510956422f87032b6b62ee",
"size": "233",
"binary": fal... |
import json
import logging
from datetime import datetime
from typing import List, Optional
import requests
from authlib.jose import JWTClaims, jwt
from authlib.jose.errors import DecodeError, JoseError
from authlib.oidc.core import CodeIDToken
from django.contrib.auth.models import Permission
from django.core.cache im... | {
"content_hash": "51e8fdc2a9189981082c6c971eabbcb6",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 88,
"avg_line_length": 32.75579322638146,
"alnum_prop": 0.6140618197649107,
"repo_name": "mociepka/saleor",
"id": "f4c2ee0369abb90ea4f68c42173c09535a474170",
"size": "1837... |
"""
@author: stoberblog
@detail: Functions in this file deal with storing and retrieval
of data to a database. Generic functions are used for
abstraction, allowing ease to change database backend.
@created: Friday 17th Feburary 2017
@modified... | {
"content_hash": "4b2e74d723854662fd3bf4f5c0d8a334",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 236,
"avg_line_length": 32.472131147540985,
"alnum_prop": 0.5806744749596123,
"repo_name": "stoberblog/sunspec-modbus",
"id": "d4f0c7a5cb8554eedb6d315c9e9d7b05a4cbcebe",
"... |
from django.db import models
from django_thumborstorage.storages import ThumborStorage, ThumborMigrationStorage
class PersonManager(models.Manager):
def get_by_natural_key(self, first_name, last_name):
return self.get(first_name=first_name, last_name=last_name)
class Person(models.Model):
"""A model... | {
"content_hash": "8fd36592d04838b8b37001a6a756daee",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 93,
"avg_line_length": 37.160919540229884,
"alnum_prop": 0.6226415094339622,
"repo_name": "lCharlie123l/django-thumborstorage",
"id": "ef1024c5a0fbac670954b3a3dd38fdffad5b974... |
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('corporate', '0002_customer_default_discount'),
]
operations = [
migrations.CreateModel(
name='CustomerPlan',
fields=[
... | {
"content_hash": "7b9603687bf78967d250570a51aff347",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 118,
"avg_line_length": 45.064516129032256,
"alnum_prop": 0.5891195418754474,
"repo_name": "timabbott/zulip",
"id": "50457b446df757bcd5ca5b3283de8e894359661e",
"size": "144... |
meal = raw_input("Meal")
tax = raw_input("Tax")
tip = raw_input("Tip")
meal = meal + meal * tax
total = meal + meal * tip
print("%.2f" % total)
| {
"content_hash": "9ed2d844d99ff09d3604949ec7738477",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 25,
"avg_line_length": 18.25,
"alnum_prop": 0.5958904109589042,
"repo_name": "ArcherCraftStore/Tip-Calculator",
"id": "134ba1830bee3655ed9a14449763d5002e763b13",
"size": "14... |
import unittest
from telemetry.testing import simple_mock
_ = simple_mock.DONT_CARE
# pylint: disable=no-member
class SimpleMockUnitTest(unittest.TestCase):
def testBasic(self):
mock = simple_mock.MockObject()
mock.ExpectCall('foo')
mock.foo()
def testReturn(self):
mock = simple_mock.MockObject... | {
"content_hash": "690c2ee2e21038e8a674c5a6c842f65d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 66,
"avg_line_length": 22.0875,
"alnum_prop": 0.6485568760611206,
"repo_name": "sahiljain/catapult",
"id": "67cee584ac6f02d63280e456690b1a7dc3a628e3",
"size": "1929",
"bi... |
class WrongArgumentsError(Exception):
"""
The program was called with incorrect arguments or an incorrect combination of them.
"""
pass
class WrongShapeError(Exception):
"""
A sequence has the wrong shape.
"""
pass
class ClassNotRegisteredError(Exception):
"""
Tried to create a... | {
"content_hash": "764fdbd88cfb51ccaff377b53ec0cda0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 23.11764705882353,
"alnum_prop": 0.6793893129770993,
"repo_name": "arnomoonens/DeepRL",
"id": "dbf81f10c847b2bd8b07ebb36a467d16e8f26ae6",
"size": "41... |
"""sympify -- convert objects SymPy internal format"""
from __future__ import print_function, division
from inspect import getmro
from .core import all_classes as sympy_classes
from .compatibility import iterable, string_types, range
from .evaluate import global_evaluate
class SympifyError(ValueError):
def __i... | {
"content_hash": "f8dec7de8344fcb9c4e35b3e6b01114a",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 99,
"avg_line_length": 30.785087719298247,
"alnum_prop": 0.5809944436529421,
"repo_name": "yashsharan/sympy",
"id": "194d2bd880e6dd114b7f67bd9abf62467015a8df",
"size": "14... |
"""
Measure resonators, one at a time, with the readout tone centered in the filterbank bin.
"""
from __future__ import division
import time
import numpy as np
from kid_readout.roach import analog, calculate, hardware_tools, tools
from kid_readout.measurement import acquire, basic
from kid_readout.equipment import h... | {
"content_hash": "45847f396d51c3222ea63d22f9b2706d",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 119,
"avg_line_length": 53.90151515151515,
"alnum_prop": 0.6543921293042867,
"repo_name": "ColumbiaCMB/kid_readout",
"id": "7f810f0d5ccf4e869c34adf4930e5969377c3962",
"siz... |
"""Tests for vocab_utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from ..utils import misc_utils
class MiscUtilsTest(tf.test.TestCase):
def testFormatBpeText(self):
bpe_line = (
b"En@@ ough to make alread... | {
"content_hash": "db34cd443ebecf8eff7b192d2180859c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 27.41176470588235,
"alnum_prop": 0.6341201716738197,
"repo_name": "tensorflow/nmt",
"id": "cae2173c2995dce164d32f2e42f176d6bc6b2a92",
"size": "1610",... |
__author__ = 'falmeida@google.com (Filipe Almeida)'
class OrderedDict:
"""Ordered dictionary implementation."""
# Define the minimum functionality we need for our application.
# Easiser would be to subclass from UserDict.DictMixin, and only
# define __getitem__, __setitem__, __delitem__, and keys, but that's
... | {
"content_hash": "d3b2233f189450f055dd2e3a50049da3",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 28.849462365591396,
"alnum_prop": 0.6097651882221394,
"repo_name": "google/streamhtmlparser",
"id": "6046621edeedf3366c9d9afdadb485bc6218529c",
"siz... |
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base import H2OEstimator
from h2o.exceptions import H2OValueError
from h2o.frame import H2OFrame
from h2o.utils.typechecks import assert_is_type, Enum, numeric
import h2o
class H2OXGBoostEstimator(H2OEsti... | {
"content_hash": "e1bf985c8be51b835ccc2ac1b1ebaa48",
"timestamp": "",
"source": "github",
"line_count": 969,
"max_line_length": 214,
"avg_line_length": 30.50361197110423,
"alnum_prop": 0.58965423912308,
"repo_name": "h2oai/h2o-dev",
"id": "10abd0701db53e8b59d6fb925df58abda4a98f5e",
"size": "29759",... |
from scrapinghub import ScrapinghubClient
apikey = '11befd9da9304fecb83dfa114d1926e9'
client = ScrapinghubClient(apikey)
project = client.get_project(252342)
project.jobs.run('javname')
project.jobs.run('javcode')
project.jobs.run('thzride')
project.jobs.run('myspider')
| {
"content_hash": "6d638de87eed4cd933d686be89ec3be3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 43,
"avg_line_length": 30.22222222222222,
"alnum_prop": 0.8051470588235294,
"repo_name": "jiangtianyu2009/PiSoftCake",
"id": "2bdef2702c7d9946e99205acf4d30bc465498aa4",
"siz... |
import tornado.ioloop
import tornado.web
from tornado.httpclient import AsyncHTTPClient
from tornado import gen
import math
import tornado
import gdal
from helpers import TileSampler, CoordSystem
import json
from geojson import Feature, Point
import geojson
from algo import generate_line_segments, generate_visible, ite... | {
"content_hash": "edb714c237bcf678d0bfa82cc14acf42",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 113,
"avg_line_length": 36.6875,
"alnum_prop": 0.6228279386712096,
"repo_name": "lachesis/shed",
"id": "240061e528ae5c6dc77901b5b8ea2e3d323e0c71",
"size": "2935",
"binary... |
import numbers
from typing import Any, Union
import numpy as np
import pandas as pd
from pandas.api.types import is_bool_dtype, is_integer_dtype, CategoricalDtype
from pyspark.pandas._typing import Dtype, IndexOpsLike, SeriesOrIndex
from pyspark.pandas.base import column_op, IndexOpsMixin, numpy_column_op
from pyspar... | {
"content_hash": "a0b444a674c0c0ed7bfca9784391681a",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 100,
"avg_line_length": 42.223091976516635,
"alnum_prop": 0.6228680014831294,
"repo_name": "chuckchen/spark",
"id": "3e746643d98719fa5693734105461a8254dbf07e",
"size": "22... |
from SCons.Script import *
########################################################################
#
# generate a builder for weighted pushdown systems
#
def PASSBuilder(env, engine, action, suffix='.out', target_scanner=None, **kwargs):
def pass_generator(target, source, env, for_signature):
actions... | {
"content_hash": "49534693d7b06b3ba1a072be29fa2874",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 114,
"avg_line_length": 23.88888888888889,
"alnum_prop": 0.5441860465116279,
"repo_name": "corvette-berkeley/precimonious",
"id": "91f8cfc0f49af6223ac0cdf32798e675e52ff9a6",
... |
__version__ = "2.5"
__tabversion__ = "2.4" # Table version
#-----------------------------------------------------------------------------
# === User configurable parameters ===
#
# Change these to modify the default behavior of yacc (if you wish)
#------------------------------------------... | {
"content_hash": "f05404c39e1d872855ec45eb900cc771",
"timestamp": "",
"source": "github",
"line_count": 2843,
"max_line_length": 172,
"avg_line_length": 37.67710165318326,
"alnum_prop": 0.4650939168751634,
"repo_name": "strawlab/pyopy",
"id": "bf3a30b986b38d81271638cb123ad1dc89d336a2",
"size": "109... |
from info import __doc__
from numpy.version import version as __version__
import multiarray
import umath
import _internal # for freeze programs
import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
from numeric import *
from fromnumeric import *
import defchararray as char
import records as rec
from records... | {
"content_hash": "2231264465b930c8906805c9a6495357",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 51,
"avg_line_length": 23.925,
"alnum_prop": 0.7053291536050157,
"repo_name": "stefanv/numpy",
"id": "fa7df13d8930c00091e5fe9598d625df8ad9c4e5",
"size": "958",
"binary": ... |
from msrest.serialization import Model
class ServiceSasParameters(Model):
"""The parameters to list service SAS credentials of a speicific resource.
:param canonicalized_resource: The canonical path to the signed resource.
:type canonicalized_resource: str
:param resource: The signed services accessi... | {
"content_hash": "32789151fff1bdcdd5c8945eab2bedb0",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 414,
"avg_line_length": 50.74766355140187,
"alnum_prop": 0.6556169429097606,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "e9e4b615799c248388f9626c318a10eb5189bea2",
... |
import asyncore
import base64
import mimetypes
import os
import shutil
import smtpd
import sys
import tempfile
import threading
from email import charset, message_from_binary_file, message_from_bytes
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr
from io import St... | {
"content_hash": "4b421837196442c25a7f9ddfea30219b",
"timestamp": "",
"source": "github",
"line_count": 1723,
"max_line_length": 119,
"avg_line_length": 41.75914103308183,
"alnum_prop": 0.6019374296396158,
"repo_name": "atul-bhouraskar/django",
"id": "30f8252e0a88a95de05601899f1f03ec60ffd2db",
"siz... |
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
import matplotlib.pyplot as plt
from itertools import chain
def drift_subtractor(resultstable, exposuretime = 0.5):
resultstable.rename(columns={'particle':'trajectory'}, inplace=True)
resultstable.rename(columns={'frame':'slice'}, inp... | {
"content_hash": "b5e9584db4176081ef71c2c651579c21",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 161,
"avg_line_length": 50.60674157303371,
"alnum_prop": 0.7320159857904085,
"repo_name": "flynn949/beadpy",
"id": "ca0db7d616ea28ef8ec8a1b0355e3d7132d5b8d5",
"size": "4504... |
from __future__ import print_function
import collections
import math
import numpy as np
import os
import random
import tensorflow as tf
import zipfile
from itertools import compress
from matplotlib import pylab
from six.moves import range
from six.moves.urllib.request import urlretrieve
from sklearn.manifold import TSN... | {
"content_hash": "92b7545c3cd905bf1031dce59eb96427",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 105,
"avg_line_length": 48.32420091324201,
"alnum_prop": 0.5412453935557026,
"repo_name": "SirRujak/OpenSpeech-Prediciton",
"id": "a35c53fddba52430cd4ff34db45af2905b4baf0c",... |
from webob import exc
from neutron.api.v2 import attributes as attr
from neutron import context
from neutron.db import db_base_plugin_v2
from neutron.db import portsecurity_db
from neutron.db import securitygroups_db
from neutron.extensions import portsecurity as psec
from neutron.extensions import securitygroup as ex... | {
"content_hash": "fadf3c263f3db711ed013fd43ed9968d",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 79,
"avg_line_length": 49.9946380697051,
"alnum_prop": 0.5582368082368082,
"repo_name": "shakamunyi/neutron-vrrp",
"id": "8845905781ffa9477bd5980fe04fb7a0e013b4e3",
"size"... |
import argparse
import os
import sys
from os import path
from ansible import __version__ as ansible_ver
from . import __version__ as prudentia_ver
# Setting Ansible config file environment variable as first thing
cwd = path.dirname(path.realpath(__file__))
os.environ['ANSIBLE_CONFIG'] = path.join(cwd, 'ansible.cfg')
... | {
"content_hash": "c8141452a0843c48bf1b04b59c509893",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 101,
"avg_line_length": 36.719298245614034,
"alnum_prop": 0.6392737697085523,
"repo_name": "StarterSquad/prudentia",
"id": "d74b76ad57d48d1af7a80ea329a9edbf60c2b541",
"size... |
def add_native_methods(clazz):
def init0____():
raise NotImplementedError()
def loadDNSconfig0____():
raise NotImplementedError()
def notifyAddrChange0____():
raise NotImplementedError()
clazz.init0____ = staticmethod(init0____)
clazz.loadDNSconfig0____ = staticmethod(load... | {
"content_hash": "d5403858baea19f326c7db87a787b69d",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 69,
"avg_line_length": 29.071428571428573,
"alnum_prop": 0.6486486486486487,
"repo_name": "laffra/pava",
"id": "448dc53ab5db7e19fd599e7251f88dd7a1cab007",
"size": "407",
... |
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):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
is_dangerous = False
... | {
"content_hash": "f89e3b450bec6526a292314f0f0206a2",
"timestamp": "",
"source": "github",
"line_count": 1085,
"max_line_length": 233,
"avg_line_length": 91.64792626728111,
"alnum_prop": 0.5796476196222772,
"repo_name": "looker/sentry",
"id": "75170930d6def80aa988ed0581e653febe3bb95d",
"size": "9946... |
from __future__ import annotations
import pytest
from securicad.model import Model, Object, View
from securicad.model.exceptions import DuplicateViewException, MissingViewException
def test_create(model: Model, view: View):
assert model.view(1) == view
def test_double_delete(view: View):
view.delete()
... | {
"content_hash": "d034108ffbab005b5ed2ae16d239e5d4",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 83,
"avg_line_length": 27.11842105263158,
"alnum_prop": 0.6681222707423581,
"repo_name": "foreseeti/securicad-model-sdk",
"id": "7a9ad59c5f9b14cf67b8f819f87a2a28033d083b",
... |
import pytest
from pytest_embedded import Dut
@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
@pytest.mark.parametrize('config', [
'default',
'release',
], indirect=True)
def test_spiffs_generic(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('')
... | {
"content_hash": "b4bba8279834b0a51ff08533b86b2fdd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 60,
"avg_line_length": 25.9,
"alnum_prop": 0.6833976833976834,
"repo_name": "espressif/esp-idf",
"id": "33e5253937a8a377e1ff49534f0f37939f7e596f",
"size": "880",
"binary"... |
from flask import Flask, jsonify, render_template, request
from flask.ext.mysql import MySQL
import random
# config file
import config
app = Flask(__name__)
# MySQL configurations
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = config.DB_USER
app.config['MYSQL_DATABASE_PASSWORD'] = config.DB_PASS
app.config... | {
"content_hash": "817672fcd7368706bd2783c01cfe19b8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 157,
"avg_line_length": 31.22222222222222,
"alnum_prop": 0.6868327402135231,
"repo_name": "acro5piano/flask_api_server",
"id": "850f3b369d19df1f85a77803c8058eb05e2fdd36",
"... |
from argparse import ArgumentParser, _SubParsersAction, _MutuallyExclusiveGroup
from gooey.gui.lang.i18n import _
class GooeySubParser(_SubParsersAction):
def __init__(self, *args, **kwargs):
super(GooeySubParser, self).__init__(*args, **kwargs)
class GooeyMutuallyExclusiveGroup(_MutuallyExclusiveGroup... | {
"content_hash": "d9079fb89432e53f519d9d980a72ff86",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 83,
"avg_line_length": 36.73148148148148,
"alnum_prop": 0.6720443660196622,
"repo_name": "jschultz/Gooey",
"id": "3e88c94a9df378e4dfaa035b900dd154f5a6e51e",
"size": "3967"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.