text stringlengths 4 1.02M | meta dict |
|---|---|
'''
search a set of log files for bad accel values
'''
import sys, time, os, glob
import zipfile
from pymavlink import mavutil
# extra imports for pyinstaller
import json
from pymavlink.dialects.v10 import ardupilotmega
search_dirs = ['c:\Program Files\APM Planner',
'c:\Program Files\Mission Planner'... | {
"content_hash": "9a39b18b9282ed51ec4546a23f44980b",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 106,
"avg_line_length": 31.888111888111887,
"alnum_prop": 0.524780701754386,
"repo_name": "fschill/mavue",
"id": "e71b4e28c84d6eb35867f0cf1c47777376e95cc6",
"size": "4583"... |
import pytest
from pybiomart import Dataset
from pybiomart.server import Server
# pylint: disable=redefined-outer-name, no-self-use
@pytest.fixture
def query_params():
"""Example query parameters."""
return {
'attributes': ['ensembl_gene_id'],
'filters': {
'chromosome_name': ['1... | {
"content_hash": "1083550fec4583604e4bcef1b7bd1fb0",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 79,
"avg_line_length": 32.26219512195122,
"alnum_prop": 0.6042336042336043,
"repo_name": "jrderuiter/pybiomart",
"id": "666b3f281b5b8a3abcc66c3133d7593571a6afee",
"size": ... |
from flask_wtf import FlaskForm
from wtforms import (TextField, SubmitField, IntegerField)
class AddUserForm(FlaskForm):
name = TextField(u'用户名')
password = TextField(u'密码')
type_code = IntegerField(u'类型')
submit = SubmitField(u'添加')
| {
"content_hash": "3f291daa7edf4c9d9aae3d313dd44603",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 58,
"avg_line_length": 28,
"alnum_prop": 0.7182539682539683,
"repo_name": "tongxindao/shiyanlou",
"id": "02e1aee64310fa62a62c9e47b5197352439c8318",
"size": "311",
"binary"... |
"""
Detect a cycle in a linked list.
Note that the head pointer may be 'None' if the list is empty.
A Node is defined as:
class Node(object):
def __init__(self, data = None, next_node = None):
self.data = data
self.next = next_node
"""
def has_cycle(head):
seen = set()
wh... | {
"content_hash": "317bae9d22a039bc057d7ebb63bb5f8f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 62,
"avg_line_length": 21.38095238095238,
"alnum_prop": 0.5634743875278396,
"repo_name": "rootulp/hackerrank",
"id": "41d49e879cd09d05ad087f688495f45ef311ec78",
"size": "44... |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... | {
"content_hash": "86e4711028822efbdf5ac66d5b3d3b2d",
"timestamp": "",
"source": "github",
"line_count": 8146,
"max_line_length": 94,
"avg_line_length": 31.622391357721582,
"alnum_prop": 0.5443834531592106,
"repo_name": "ryfeus/lambda-packs",
"id": "a8cf02336083dfdcf3410597f4f43cd01ef4f425",
"size":... |
"""
======================================
Sparse inverse covariance estimation
======================================
Using the GraphicalLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matri... | {
"content_hash": "3525555ac2a772bd3c86ff4cd4f299b7",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 84,
"avg_line_length": 34.09933774834437,
"alnum_prop": 0.6801320644785396,
"repo_name": "sergeyf/scikit-learn",
"id": "8670ed4e061951125c2abf46f0d0c0f222319992",
"size": ... |
import errno
import os
import re
import subprocess
import sys
# these strings will be replaced by git during git-archive
git_refnames = "$Format:%d$"
git_full = "$Format:%H$"
# these strings are filled in when 'setup.py versioneer' creates _version.py
tag_prefix = ""
parentdir_prefix = "borgweb-"
versionfile_source =... | {
"content_hash": "5d7d86f4dad85c6cb43074a69115cec1",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 78,
"avg_line_length": 37.77292576419214,
"alnum_prop": 0.5942196531791908,
"repo_name": "pguth/borgweb",
"id": "006b08d571968a5344fc20ec3f845d6193fbf3e6",
"size": "9125",... |
import json
from django.http import HttpResponseBadRequest
from corehq.apps.app_manager.exceptions import (
ScheduleError,
)
from dimagi.utils.web import json_response
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.models import (
FormSchedule,
)
from corehq.apps.app_mana... | {
"content_hash": "aebc1d62c5078b604fdb266be960f9ff",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 95,
"avg_line_length": 32.869565217391305,
"alnum_prop": 0.6689814814814815,
"repo_name": "qedsoftware/commcare-hq",
"id": "df401472e92fe95ae10e7c72925b56fb3fb3f602",
"size... |
"""
Test model creation with custom fields
"""
from django.db import models
from django.test import TestCase
from django_any import any_model
class MySlugField(models.SlugField):
pass
class ModelWithCustomField(models.Model):
slug = MySlugField()
class Meta:
app_label = 'django_any'
class Cust... | {
"content_hash": "6872a0d228beb1978f6583768026b536",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 95,
"avg_line_length": 24.964285714285715,
"alnum_prop": 0.7224606580829757,
"repo_name": "softak/webfaction_demo",
"id": "57a2a619b8d2b48d4d8882c49beb33588bb33729",
"size"... |
import libqtile.config
from libqtile.widget.check_updates import CheckUpdates, Popen # noqa: F401
from test.widgets.conftest import FakeBar
wrong_distro = "Barch"
good_distro = "Arch"
cmd_0_line = "export toto" # quick "monkeypatch" simulating 0 output, ie 0 update
cmd_1_line = "echo toto" # quick "monkeypatch" sim... | {
"content_hash": "f013fb014d014206938e0465adedb753",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 97,
"avg_line_length": 31.635359116022098,
"alnum_prop": 0.6466992665036675,
"repo_name": "ramnes/qtile",
"id": "78c88de862724a1129044e040f7ef85b7d61bd54",
"size": "5726",... |
"""
Global settings:
Those which are typically edited during a deployment are in
000_config.py & their results parsed into here. Deployers
shouldn't typically need to edit any settings here.
"""
# Keep all our configuration options off the main global variables
# Use response.s3 for one-off variables... | {
"content_hash": "8faeae60bed69d475b7ac98cf20e6897",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 233,
"avg_line_length": 34.38073394495413,
"alnum_prop": 0.6742494996664443,
"repo_name": "anubhav929/eden",
"id": "919b755cc004cd2ecc9b5a6e0fab125c85fb9cc4",
"size": "150... |
from __future__ import absolute_import
from dp_tornado.engine.helper import Helper as dpHelper
import datetime as abs_datetime
class DateHelper(dpHelper):
def now(self, timezone=None):
return self.from_datetime(datetime=self.helper.datetime.now(timezone=timezone))
def from_datetime(self, datetime, t... | {
"content_hash": "5fc273262098b300f3b46f897efa6be4",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 110,
"avg_line_length": 45.37662337662338,
"alnum_prop": 0.6745850028620493,
"repo_name": "why2pac/dp-tornado",
"id": "e6e2dd2854fdd4c675aeeca23ebc0744c71cd7a8",
"size": "3... |
import json
from .address import FieldType
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, FieldType):
return {
'key': o.key.name,
'label': o.label,
'required': o.required,
'options': o.options,
... | {
"content_hash": "553a9ab5df2b02b6a4c5b06b36f2a265",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 39,
"avg_line_length": 25.785714285714285,
"alnum_prop": 0.5069252077562327,
"repo_name": "3DHubs/Ranch",
"id": "c36803f5b899c22f2e32fa8a345f220c3ff759e8",
"size": "361",
... |
"""Setup file for data structures assignment."""
from setuptools import setup
setup(
name="datastructures",
description="python implementations",
version=0.1,
author="Regenal",
author_email="regenal@mac.com",
license="MIT",
py_modules=['LinkList',],
package_dir={'': 'src'},
insta... | {
"content_hash": "a5dbaeb90913d12d5870b7b47d04a2ef",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 23.043478260869566,
"alnum_prop": 0.5830188679245283,
"repo_name": "regenalgrant/datastructures",
"id": "346aa2ec3221cd70fb1e3d6eb215cfdb396c5ef2",
"... |
from rest_framework import serializers as ser
from rest_framework import exceptions
from rest_framework.exceptions import ValidationError
from modularodm import Q
from modularodm.exceptions import ValidationValueError
from framework.auth.core import Auth
from framework.exceptions import PermissionsError
from website.... | {
"content_hash": "b4214616a6b9d716343dfeb328adb784",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 141,
"avg_line_length": 36.43429844097996,
"alnum_prop": 0.6205758298184486,
"repo_name": "Ghalko/osf.io",
"id": "74b0bcd2a66c65abba41f8af8fe6d05fede74837",
"size": "16359... |
from pexpect import *
import os, sys
import getpass
import time
class ssh_session:
"Session with extra state including the password to be used."
def __init__(self, user, host, password=None, verbose=0):
self.user = user
self.host = host
self.verbose = verbose
self.passwor... | {
"content_hash": "32097ff938c0d0e3630e1f644072bbba",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 80,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.4762946754194019,
"repo_name": "yuzhichang/pexpect",
"id": "6d1a774812cde3d9c7821c4f72672b4d07fe4405",
"size": "2... |
"""Provide a dispatcher to dispatch events.
This component implements a dispatcher to dispatch events from one or more
Sessions through callbacks.
"""
from __future__ import absolute_import
from . import internals
class EventDispatcher(object):
"""Dispatches events from one or more Sessions through callbacks
... | {
"content_hash": "77bea8edb84af32dc0ecfcc313de0ef2",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 38.2967032967033,
"alnum_prop": 0.7288378766140603,
"repo_name": "anshulkgupta/viznow",
"id": "38409dc9f2f39eedbf48d3d8f29e4d9c3ee9e5d7",
"size": "35... |
import factory
reload(factory)
from factory import *
import cpp_ethereum
reload(cpp_ethereum)
from cpp_ethereum import *
#
# Windows factories
#
def win_cpp_factory(branch='master', isPullRequest=False):
factory = BuildFactory()
sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'
for step in [
... | {
"content_hash": "1855a5723b4823eb6d6a54fbed85d801",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 153,
"avg_line_length": 34.53333333333333,
"alnum_prop": 0.5179260893546608,
"repo_name": "ethereum/ethereum-buildbot",
"id": "1d641eb8496188dbd27808ce062b54f0c2e67990",
"... |
import os
import requests
from flask import Flask, request, send_from_directory, Response
url_to_proxy = "https://lainon.life"
server = Flask(__name__)
@server.route("/")
def handle_root():
return send_from_directory("_site", "index.html")
@server.route("/<path:_>")
def handle_request(_):
path = request.p... | {
"content_hash": "495a23fbe4ce7594edf62ee4d2799ed8",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 63,
"avg_line_length": 26.075,
"alnum_prop": 0.6653883029721956,
"repo_name": "barrucadu/lainonlife",
"id": "a5436a622442809a030768026a7a40b1becc52f8",
"size": "1066",
"b... |
from django_seo_js import settings
from django_seo_js.backends import SelectedBackend
from django_seo_js.helpers import request_should_be_ignored
import logging
logger = logging.getLogger(__name__)
class EscapedFragmentMiddleware(SelectedBackend):
def process_request(self, request):
if not settings.ENABL... | {
"content_hash": "83d721c8d6c68e603b6dadb8d0eb99cd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 33.138888888888886,
"alnum_prop": 0.6630343671416596,
"repo_name": "skoczen/django-seo-js",
"id": "2ae9b6175bb101136c2d1c6c401c3083f379510f",
"size":... |
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.... | {
"content_hash": "eb2c41a82433d79f4503745b1099075b",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 29.80952380952381,
"alnum_prop": 0.6656017039403621,
"repo_name": "magneticstain/TrumpaTron",
"id": "a9d50d0e797a46eda045c485a95bd8fad9b9ac53",
"siz... |
from core import Dump
import json, re, psycopg2, datetime
db = psycopg2.connect("dbname=gazetteer")
cursor = db.cursor()
cursor.execute("SELECT code FROM places_featuretype;")
# NOV = novitiate ... and months occur in citation-notes a lot :(
months = "jan feb mar apr may jun jul aug sep oct nov dec".split(" ")
fcodes... | {
"content_hash": "f7164a453f0ed4c22fe0d612ed803f9b",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 89,
"avg_line_length": 35.09166666666667,
"alnum_prop": 0.5255283780574685,
"repo_name": "LibraryOfCongress/gazetteer",
"id": "eec9c0bdcfa8137468df4ab41f81cd81de43e9e9",
"... |
""" A little script illustrating how to use a (randomly initialized)
convolutional network to play a game of Pente. """
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.environments.twoplayergames.pente import PenteGame
from pybrain.rl.environments.twoplayergames.gomokuplayers.randomplayer import RandomGomokuP... | {
"content_hash": "a0b70aa77eb17ce7d8e683f6db3a141d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 100,
"avg_line_length": 36.94736842105263,
"alnum_prop": 0.8076923076923077,
"repo_name": "arnaudsj/pybrain",
"id": "9532875216b5f8996ed4ab44380d79bfdf4fa57d",
"size": "724... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('goals', '0059_auto_20150727_2159'),
]
operations = [
... | {
"content_hash": "2542b800ca515667e4ee3fea563638c6",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 114,
"avg_line_length": 37.096774193548384,
"alnum_prop": 0.5826086956521739,
"repo_name": "tndatacommons/tndata_backend",
"id": "b10e7d5dcfeb53740da4126c945bedcd04905acf",
... |
"""
Paver-enable template
Copyright (c) 2009, Damien Lebrun
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 code must retain the above copyright notice,
this list... | {
"content_hash": "d5f31b0c58e23ade2d9637a8799ddae5",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 82,
"avg_line_length": 41.19469026548673,
"alnum_prop": 0.6817400644468313,
"repo_name": "dinoboff/paver-templates",
"id": "867caa9567dec14bed9b3f9b7d51168bee2e2323",
"siz... |
from rest_framework.permissions import BasePermission
from olympia.devhub.utils import UploadRestrictionChecker
class IsSubmissionAllowedFor(BasePermission):
"""
Like is_submission_allowed_for_request, but in Permission form for use in
the API. If the client is disallowed, a message property specifiying ... | {
"content_hash": "09bd375d9e986ea1bdebaeccd54be907",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.7155612244897959,
"repo_name": "psiinon/addons-server",
"id": "a69a3d7bdcc7551636545ab14454c225c5edefb4",
"size":... |
from celery.task import task
from .models import Mapping
@task
def feedmapper_sync(mapping_id):
"Grab the requested Mapping and parse it."
try:
mapping = Mapping.objects.get(pk=mapping_id)
mapping.parse()
except Mapping.DoesNotExist:
logger = feedmapper_sync.get_logger()
l... | {
"content_hash": "6373771e17dcca4d1fa2312ea2f0d250",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 81,
"avg_line_length": 28.071428571428573,
"alnum_prop": 0.6870229007633588,
"repo_name": "richleland/django-feedmapper",
"id": "dd95b992633937eebf81cb397faa33d394a049e7",
... |
import sys
from SALib.analyze import dgsm
from SALib.sample import finite_diff
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
sys.path.append('../..')
# Read the parameter range file and generate samples
problem = read_param_file('../../SALib/test_functions/params/Ishi... | {
"content_hash": "639a631ed3358d03bcfe065503c91cda",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 84,
"avg_line_length": 35.93103448275862,
"alnum_prop": 0.727447216890595,
"repo_name": "t2abdulg/SALib",
"id": "a72d52a550cffc2fbc19f9b5e2a80a808a166b33",
"size": "1042",
... |
"""Advent of Code 2015 - Day 12."""
import json
import numbers
from pathlib import Path
def read_input():
"""Read input file."""
return Path(__file__).with_name('input.json').read_text()
def traverse_json(data, filter=None):
"""Recursively traverse JSON structure yielding all its elements."""
if fi... | {
"content_hash": "66127373f2dfe02916053c87fc42fa4a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 26.28,
"alnum_prop": 0.6415525114155252,
"repo_name": "UniqMartin/adventofcode-2015",
"id": "acc26b6e440c5fa59ca9d11d097f169cac222d2f",
"size": "1314... |
import pytest
@pytest.fixture(scope='session')
def celery_config():
return {
'broker_url': 'amqp://',
'result_backend': 'rpc'
}
| {
"content_hash": "a621199ca7edb31a546e7b82d3155fe6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 32,
"avg_line_length": 17.11111111111111,
"alnum_prop": 0.564935064935065,
"repo_name": "nathandaddio/puzzle_app",
"id": "1b441a284a80ac35682fbfe3a80db72d89b9aad7",
"size": ... |
import datetime
from enum import Enum
from unittest import TestCase
from asserts import assert_true, assert_false, assert_is_none, assert_equal, \
assert_raises
from htmlgen.attribute import (
html_attribute,
boolean_html_attribute,
int_html_attribute,
float_html_attribute,
time_html_attribute... | {
"content_hash": "90542ea2575baffa902c2d4f12e3655b",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 78,
"avg_line_length": 34.89247311827957,
"alnum_prop": 0.5888032871083718,
"repo_name": "srittau/python-htmlgen",
"id": "19af34a60540cbd4ed1cd3b3595dc00133192958",
"size"... |
"""pkgsinfo module tests."""
import httplib
import logging
import mox
import stubout
from google.apputils import app
from google.apputils import basetest
from tests.simian.mac.common import test
from simian.mac.munki.handlers import pkgsinfo
class MunkiPackageInfoPlistStrictTest(mox.MoxTestBase):
"""Test MunkiPa... | {
"content_hash": "861e5f4bc2a0528983aa883f4a8e1393",
"timestamp": "",
"source": "github",
"line_count": 673,
"max_line_length": 79,
"avg_line_length": 39.21693907875186,
"alnum_prop": 0.7008297654681166,
"repo_name": "sillywilly42/simian",
"id": "4ae1b2a2e42dde9d6670772a6b7bf0d8c7e0d0bd",
"size": "... |
"""
We are given the head node root of a binary tree, where additionally every
node's value is either a 0 or a 1.
Return the same tree where every subtree (of the given tree) not containing a 1
has been removed.
(Recall that the subtree of a node X is X, plus every node that is a descendant
of X.)
Example 1:
Input: ... | {
"content_hash": "8e0e8e76f401f9cff4357c99797cd52b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 79,
"avg_line_length": 21.640625,
"alnum_prop": 0.6548736462093863,
"repo_name": "algorhythms/LeetCode",
"id": "7a969e1f03107a24ef958c95ecaa494fbc927671",
"size": "1404",
... |
import os
import unittest
from argparse import Namespace
from contextlib import contextmanager
from datetime import datetime
from airflow.utils import cli, cli_action_loggers
class CliUtilTest(unittest.TestCase):
def test_metrics_build(self):
func_name = 'test'
exec_date = datetime.utcnow()
... | {
"content_hash": "e52e8e1bb8b58e95626419e3226010bc",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 79,
"avg_line_length": 28.329268292682926,
"alnum_prop": 0.6121394748170469,
"repo_name": "fenglu-g/incubator-airflow",
"id": "6a411faba7ed5deecefed6d141a8a23fd8626b08",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20170316_1029'),
]
operations = [
migrations.AlterField(
model_name='author',
name='name',
fie... | {
"content_hash": "7cb54777bbb7b12c9dbed4ad84aef9ef",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 91,
"avg_line_length": 25.82608695652174,
"alnum_prop": 0.5841750841750841,
"repo_name": "jbuisine/MediaLibrary-RestFullAPI",
"id": "d23945a8e79deee4ecdadb98c130252d7796b602"... |
from sqlalchemy.ext.declarative import declared_attr
from indico.core.db import db
from indico.core.db.sqlalchemy.principals import PrincipalPermissionsMixin
from indico.core.db.sqlalchemy.util.models import auto_table_args
from indico.util.decorators import strict_classproperty
from indico.util.string import format_r... | {
"content_hash": "e6e9900fcd0feefb11587b22d9b4482d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 29.155555555555555,
"alnum_prop": 0.6585365853658537,
"repo_name": "DirkHoffmann/indico",
"id": "36694fb2cea9971afd802d9214806e77f60f6bc4",
"size": "... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'SliderImage'
db.create_table('cmsplugin_nivoslider_sliderimage', (
('id', self.gf('django.db.mod... | {
"content_hash": "172a2bfd543f043fed1d1cba80beafc2",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 170,
"avg_line_length": 59.76470588235294,
"alnum_prop": 0.598261154855643,
"repo_name": "samirasnoun/django_cms_gallery_image",
"id": "e8b993517f3b5b57d317992367ca852ee4a28... |
import argparse
import codecs
import os
import re
import sys
from common import read_json_file
_NEWLINE_PATTERN = re.compile('[\n\r]')
def string_is_ascii(s):
try:
# This approach is better for compatibility
return all(ord(c) < 128 for c in s)
except TypeError:
return False
def load_constants(filen... | {
"content_hash": "16aa888dbc177be1ecec9afd10bace75",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 86,
"avg_line_length": 39.054054054054056,
"alnum_prop": 0.6110726643598616,
"repo_name": "twodee/blockly",
"id": "8a93fbbc71368a0532394ea7abc9400479942b44",
"size": "6482... |
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import get_appsettings, setup_logging
from models import DBSession, Base
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(example: "%s development.ini")' % (cmd... | {
"content_hash": "314e5807fe1ef10265a3b6f68bba04f5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 57,
"avg_line_length": 23.814814814814813,
"alnum_prop": 0.6796267496111975,
"repo_name": "stxnext/intranet-open",
"id": "fdb5b8f2b10fa6a0d0cc5746db82fe08a109db2b",
"size":... |
import sys
import time
from django.db import connection, transaction
from django.conf import settings
from django_comments.models import Comment
from django.core.management.base import BaseCommand, CommandError
from hcomments.models import HComment
class Command(BaseCommand):
help = "Import the standard comments... | {
"content_hash": "fc95cd5627770c2bd8c72fe40e7ac0e5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 94,
"avg_line_length": 34.205882352941174,
"alnum_prop": 0.6423043852106621,
"repo_name": "matrixise/hcomments",
"id": "033b6b1fb19b4d17949c104ee1f5fff6a34b43c8",
"size": "... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pants.base.build_environment import get_buildroot
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.... | {
"content_hash": "a1169c0b7dd0a6bf7f161759fe60ab68",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 99,
"avg_line_length": 42.81818181818182,
"alnum_prop": 0.6369426751592356,
"repo_name": "15Dkatz/pants",
"id": "911e66360b87f563df49f24252a3ca29643df989",
"size": "3444",
... |
from frysauce import app
from flask import render_template, request, flash
@app.route("/users/")
def home():
template_name = "home.html"
return render_template(template_name, users=users)
@app.route("/users/create", methods=['GET', 'POST'])
def create_user_form():
"""
Displays a form for creating a us... | {
"content_hash": "4c888eeef7169b38014996d9542be4a2",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 54,
"avg_line_length": 21.529411764705884,
"alnum_prop": 0.6530054644808743,
"repo_name": "chriskennard/lucky_flask",
"id": "83f50b5db224186b86a8e8d1410549fbaf0d9345",
"siz... |
from collections import defaultdict
class Solution(object):
# Op1: Sliding window O(n)
# coped from q159
def lengthOfLongestSubstringKDistinct(self, s, k):
start = end = 0
maxLen = 0
counter = 0
dic = defaultdict(int)
for end in range(len(s)):
if dic[s[... | {
"content_hash": "b0d437c3840f40b91c5eda1cb89acfd8",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 54,
"avg_line_length": 24.724137931034484,
"alnum_prop": 0.497907949790795,
"repo_name": "rx2130/Leetcode",
"id": "58d4abbe96a3b10ad5aa80e06396794042762dee",
"size": "717",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Hosts'
db.create_table(u'main_hosts', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key... | {
"content_hash": "7fd24209c6b4c263d1a89576d2b15496",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 187,
"avg_line_length": 64.36,
"alnum_prop": 0.5618396519577378,
"repo_name": "asmaps/nsupdate.info",
"id": "8e24b83fca166ef2d36861cc3bee61f6e375fcce",
"size": "4851",
"b... |
"""some functions that may be useful for various checkers
"""
import re
import sys
import string
import astroid
from astroid import scoped_nodes
from logilab.common.compat import builtins
BUILTINS_NAME = builtins.__name__
COMP_NODE_TYPES = astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GenExpr
PY3K = s... | {
"content_hash": "6051fe0bc0dd7bf67d7de59e48d2e6a3",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 98,
"avg_line_length": 35.62603305785124,
"alnum_prop": 0.5675346517427362,
"repo_name": "Titulacion-Sistemas/PythonTitulacion-EV",
"id": "f3a7d17625b4b69480be26f9336da7fd34... |
import logging
import os
import sys
logging.basicConfig(level=logging.ERROR)
top_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, top_dir)
import taskflow.engines
from taskflow.pattern... | {
"content_hash": "c8ccfacc3914e59c37ad43d559486f2d",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 79,
"avg_line_length": 29.4,
"alnum_prop": 0.6331065759637188,
"repo_name": "varunarya10/taskflow",
"id": "fd96d24a8e24db7ab79a2d9bf2ee851242a92603",
"size": "2867",
"bin... |
from flanker.mime.message.utils import to_unicode
def convert_to_unicode(charset, value):
#in case of unicode we have nothing to do
if isinstance(value, unicode):
return value
charset = _translate_charset(charset)
return to_unicode(value, charset=charset)
def _translate_charset(charset):
... | {
"content_hash": "2db2879c1f19f0b5fd5ba925f8deb337",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 69,
"avg_line_length": 25.15625,
"alnum_prop": 0.6459627329192547,
"repo_name": "duo-labs/isthislegit",
"id": "7ecded7ae0c841826fb4f53e3790a91ced41cbe7",
"size": "805",
"... |
from f5_heat.resources import f5_sys_save
from heat.common import exception
from heat.common import template_format
from heat.engine.hot.template import HOTemplate20150430
from heat.engine import rsrc_defn
from heat.engine import template
import mock
import pytest
save_defn = '''
heat_template_version: 2015-04-30
des... | {
"content_hash": "2a5d6e46e9e6a99270a6e63270c4b547",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 69,
"avg_line_length": 25.442105263157895,
"alnum_prop": 0.6975589573851882,
"repo_name": "F5Networks/f5-openstack-heat-plugins",
"id": "25d01a0fb2b572d934ba2e3f03b6e032d37a8... |
from django.utils.translation import ugettext_noop as _
LOG_STATUS_UPDATE = _('Update node status')
LOG_NODE_CREATE = _('Create compute node')
LOG_NODE_UPDATE = _('Update compute node')
LOG_DEF_UPDATE = _('Update node definition')
LOG_DEF_DELETE = _('Delete node definition')
LOG_IMG_IMPORT = _('Import image on nod... | {
"content_hash": "3d643fcd010a9d7eefc33126e3df54e3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 69,
"avg_line_length": 29.476190476190474,
"alnum_prop": 0.7075928917609047,
"repo_name": "erigones/esdc-ce",
"id": "84b2facf879f62b3e05929d4927604acacb13707",
"size": "619... |
from __future__ import print_function
import numba.unittest_support as unittest
from numba.compiler import compile_isolated, Flags
from numba import types, utils
enable_pyobj_flags = Flags()
enable_pyobj_flags.set("enable_pyobject")
force_pyobj_flags = Flags()
force_pyobj_flags.set("force_pyobject")
def is_in_mand... | {
"content_hash": "dcbb36f1f372b80a1aca888807f42f3d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 57,
"avg_line_length": 23.54054054054054,
"alnum_prop": 0.618828932261768,
"repo_name": "stefanseefeld/numba",
"id": "c32511aebdcf9808cddbd5e49be9b7e4223ce841",
"size": "87... |
from point_generator import SimplePointGenerator, ChessboardPointGenerator, HexagonPointGenerator
from edge_generator import ChessboardEdgeGenerator, CrossedChessboardEdgeGenerator, LimitedQuantityEdgeGenerator, LimitedRangeEdgeGenerator
from edge_cost_generator import DistanceEdgeCostGenerator, ThresholdDistanceFromCo... | {
"content_hash": "84ef2fea8293fbbc7365a88c593a1074",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 215,
"avg_line_length": 46.960629921259844,
"alnum_prop": 0.738430583501006,
"repo_name": "ppolewicz/ant-colony",
"id": "103485381484dfa2cd73c55ff1fec8b1aa341baa",
"size":... |
import logging
from django.core.management.base import BaseCommand, CommandError
from django.utils import six
from oscar.core import customisation
class Command(BaseCommand):
help = (
"Create a local version of one of Oscar's app so it can "
"be customised")
def add_arguments(self, parser):... | {
"content_hash": "b066c9a180b0b9501cbf695e792dfec8",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 80,
"avg_line_length": 32.93103448275862,
"alnum_prop": 0.6586387434554973,
"repo_name": "vicky2135/lucious",
"id": "93c9cd8255009d2e9170344830e3fe67700e0734",
"size": "955... |
import sys
import socket
import struct
EXTERNAL_NETID = 65535
__version__ = 'pna_parser_0.3.0-py'
# struct lengths with names
CHAR = 'c'
U_INT1 = 'B'
U_INT2 = 'H'
U_INT4 = 'I'
class PNALogParser(object):
"""This class parses a log file and returns the data contained within
that file."""
_header = {'v1a... | {
"content_hash": "85c88bcc6ee47b73334d3a290f2e76cb",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 76,
"avg_line_length": 39.51020408163265,
"alnum_prop": 0.5084366391184573,
"repo_name": "pcrowley/PNA",
"id": "9faaf8b0e9d491a2edd4a3da9e346eb6fd531d8b",
"size": "6430",
... |
"""Module to interact with objects in a Java Virtual Machine from a
Python Virtual Machine.
Variables that might clash with the JVM start with an underscore
(Java Naming Convention do not recommend to start with an underscore
so clashes become unlikely).
Created on Dec 3, 2009
:author: Barthelemy Dagenais
"""
from _... | {
"content_hash": "afde791a53086a7fa6d9ffc97be867e4",
"timestamp": "",
"source": "github",
"line_count": 1979,
"max_line_length": 79,
"avg_line_length": 37.77210712481051,
"alnum_prop": 0.611376436435633,
"repo_name": "jonahkichwacoders/py4j",
"id": "c00ef43b4d5fbc33eb3ae5b2429a1947d733f2db",
"size"... |
import datetime
import time
import re
import redis
from collections import defaultdict
from operator import itemgetter
from pprint import pprint
from utils import log as logging
from utils import json_functions as json
from django.db import models, IntegrityError
from django.db.models import Q, F
from django.db.models ... | {
"content_hash": "e0aa03d4fbff038445eb3b4440334c46",
"timestamp": "",
"source": "github",
"line_count": 1579,
"max_line_length": 289,
"avg_line_length": 44.585180493983536,
"alnum_prop": 0.5425,
"repo_name": "epiphany27/NewsBlur",
"id": "2bbb32876f95dc59209a482d622a346703859468",
"size": "70400",
... |
import sys
sys.path[0:0] = [""]
import unittest
from datetime import datetime
from mongoengine import *
__all__ = ("ValidatorErrorTest",)
class ValidatorErrorTest(unittest.TestCase):
def setUp(self):
connect(db='mongoenginetest')
def test_to_dict(self):
"""Ensure a ValidationError handles... | {
"content_hash": "6fb6aad467003579985fbb846d20ec05",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 31.044871794871796,
"alnum_prop": 0.5641131530043362,
"repo_name": "closeio/mongoengine",
"id": "9614d714f7918a84774379f91bacf9f6ecb518c9",
"size": ... |
import numpy as np
import sys
if len(sys.argv) < 3:
print("")
print("Usage:")
print(" "+argv[0]+" [file1.csv] [file2.csv]")
print("")
filename_ref = sys.argv[1]
filename_sweet = sys.argv[2]
#filename_ref = 'job_benchref_solution/'+filename
data_ref = np.loadtxt(filename_ref)
#print("Reference data... | {
"content_hash": "0a22c1a77c7ddef4c6f021c2ea9ce890",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 54,
"avg_line_length": 19.87142857142857,
"alnum_prop": 0.6455787203450755,
"repo_name": "schreiberx/sweet",
"id": "8aa53e20bad0ecabb45747463852af90a3c42d7f",
"size": "1416... |
"""Generate docs for the TensorFlow Python API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import inspect
import os
import six
from tensorflow.tools.common import public_api
from tensorflow.tools.common import traverse
from tensorf... | {
"content_hash": "6ade7c509db3ecf2fbe1e1cbc9b152ae",
"timestamp": "",
"source": "github",
"line_count": 486,
"max_line_length": 80,
"avg_line_length": 33.257201646090536,
"alnum_prop": 0.6306378766318134,
"repo_name": "sugartom/tensorflow-alien",
"id": "1fa698628814134d5347f4843388ac421563ad22",
"s... |
from io import StringIO
import os
import zipfile
import click
from click import option as opt
import cv2
import numpy as np
from tqdm import tqdm
import pandas as pd
import config
# RLE Encoding functions from https://www.kaggle.com/stainsby/fast-tested-rle
def rle_encode(mask_image):
pixels = mask_image.flatte... | {
"content_hash": "ea773bd8b06b5d2b6c4b8390366b16bd",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 36.067567567567565,
"alnum_prop": 0.6242038216560509,
"repo_name": "creafz/kaggle-carvana",
"id": "f41674cc0b4b58d6168659e32f48d7124f360d6b",
"size":... |
import os
from typing import Sequence, List, Tuple, BinaryIO, cast, Optional # noqa: F401
from aptly_api.base import BaseAPIClient, AptlyAPIException
class FilesAPISection(BaseAPIClient):
def list(self, directory: Optional[str] = None) -> Sequence[str]:
if directory is None:
resp = self.do_g... | {
"content_hash": "6ec944588317ed9b8182f3155eeac6c5",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 88,
"avg_line_length": 35.21621621621622,
"alnum_prop": 0.5610130468150422,
"repo_name": "gopythongo/aptly-api-client",
"id": "c71b9e6794230ebff48ad5e6162fee57c5e2a25f",
"s... |
"""Setup a regtest environment for testing and development.
This can be run from the command line.
main():
First, any existing regnet is destroyed.
A folder called regnet is created, containing folders for three nodes,
Alice, Bob, and Carol. For each node, bitcoind is started. The bitcoind nodes
are connected Alice -... | {
"content_hash": "857d0e04f5f696998be2880d6d79c4f8",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 81,
"avg_line_length": 29.68503937007874,
"alnum_prop": 0.5755968169761273,
"repo_name": "josephyzhou/Lightning-1",
"id": "7448be90b792bb927e14405c0f0d49d74a9d4cde",
"size... |
import random
from rlkit.data_management.replay_buffer import ReplayBuffer
class SplitReplayBuffer(ReplayBuffer):
"""
Split the data into a training and validation set.
"""
def __init__(
self,
train_replay_buffer: ReplayBuffer,
validation_replay_buffer: ReplayBuffe... | {
"content_hash": "59599fd9852946897c751539b8a0bc28",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 35.30434782608695,
"alnum_prop": 0.6408045977011494,
"repo_name": "vitchyr/rlkit",
"id": "a29e96f9cdfe6ff1af561013ae43c174c4b60ed0",
"size": "2436",
... |
from xhtml2pdf.context import pisaContext
from xhtml2pdf.default import DEFAULT_CSS
from xhtml2pdf.parser import pisaParser
from reportlab.platypus.flowables import Spacer
from reportlab.platypus.frames import Frame
from xhtml2pdf.xhtml2pdf_reportlab import PmlBaseDoc, PmlPageTemplate
from xhtml2pdf.util import pisaTem... | {
"content_hash": "5cbf1b815a71adaebb7049fa21e33e53",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 112,
"avg_line_length": 36.982658959537574,
"alnum_prop": 0.6023757424195061,
"repo_name": "carschar/xhtml2pdf",
"id": "176f3eae1ea3b38c420f29749819f61b2eea49cb",
"size": ... |
import sys
import os
from array import array
# parse command line arguments
file_name = sys.argv[1]
size_in_mb = int(sys.argv[2])
# output directory, defaults to current directory
output_dir = os.environ.get("OUTPUT_DIR", os.environ["PWD"])
# output file
output_file = open(os.path.join(output_dir, file_name), 'wb'... | {
"content_hash": "222d7de949c4aaa82d1e7562accb9808",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 27.695652173913043,
"alnum_prop": 0.7048665620094191,
"repo_name": "oodt-cloud/docker",
"id": "c701f2cd9132cca3f727eebe314b3bc3cb97453a",
"size": "95... |
"""Cloudmesh install util functions.
This file contains basic utility functions that must not need any
import from cloudmesh OR any other non-standard python
modules. Everything in this file must execute on a clean python 2.7.x
environment.
"""
import platform
from string import Template
import os
import sys
def g... | {
"content_hash": "3274ef5cf827e8b39ce61ec8437f822a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 71,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.55625,
"repo_name": "rajpushkar83/cloudmesh",
"id": "a09f362cfe61eb803bdb3a0337c6899eaa645ddf",
"size": "1440",
... |
print("Importing panda3d")
import panda3d
import subprocess
import os, sys
from os.path import isfile, isdir, realpath, dirname, join
THIS_DIR = realpath(dirname(__file__)) or "."
start_cwd = os.getcwd() or "."
print("Processing meta files")
os.chdir(THIS_DIR)
try:
subprocess.call([sys.executable, "process_meta_fi... | {
"content_hash": "af386167373c07be89d507845e3002cd",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 63,
"avg_line_length": 20.289473684210527,
"alnum_prop": 0.6977950713359273,
"repo_name": "tobspr/P3D-ECS",
"id": "c5d388953a632d5169df2c56a05d12015372d55c",
"size": "804",... |
from __future__ import annotations
import datetime
import os
import re
import signal
import threading
import time
import uuid
from multiprocessing import Value
from unittest import mock
from unittest.mock import patch
import psutil
import pytest
from airflow import settings
from airflow.exceptions import AirflowExce... | {
"content_hash": "6e5e71e6ee222f6a8c27b02173bcedb8",
"timestamp": "",
"source": "github",
"line_count": 816,
"max_line_length": 110,
"avg_line_length": 38.474264705882355,
"alnum_prop": 0.5953495779582736,
"repo_name": "apache/airflow",
"id": "ecfb750fd12f8360526ba841896aa41580ae74ef",
"size": "321... |
from collections import ChainMap
import os, argparse
defaults = {
'color': 'red',
'user': 'guest'
}
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--user')
parser.add_argument('-c', '--color')
namespace = parser.parse_args()
command_line_args = {k: v for k, v in vars(namespace).items() if v}
c... | {
"content_hash": "acc43f9e5f0700c329bb363d30e934d3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 67,
"avg_line_length": 26.705882352941178,
"alnum_prop": 0.6740088105726872,
"repo_name": "whyDK37/py_bootstrap",
"id": "1dc5035d2c787637df116b4185f043e573c98225",
"size": ... |
import time
from datetime import datetime
from openerp.osv import osv
from openerp.report import report_sxw
from openerp.tools import amount_to_text_en
class payroll_advice_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payroll_advice_report, self).__init__(cr, uid, na... | {
"content_hash": "f3b63d2772a1164ea3af4866c980476c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 141,
"avg_line_length": 38.83606557377049,
"alnum_prop": 0.5555086534402701,
"repo_name": "vileopratama/vitech",
"id": "c045772f009421b23b962b1c89c02812af827b48",
"size": "... |
from django.db import models
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.contrib.auth.models import User
from pytz import timezone
from time import gmtime, strftime
class Folder(models.Model):
color = models.TextField(max_length=20,blank=True)
user = models.ForeignKey(User)
... | {
"content_hash": "cb71614877a8508b1583b14bb3d4506c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 69,
"avg_line_length": 26.213333333333335,
"alnum_prop": 0.7131230925737538,
"repo_name": "leemac/JellyfishRss",
"id": "ace4fbe97d6d8848c3ae592860aa780b9a4c0d23",
"size": "... |
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, redirect
from rapidsms.models import Contact, Connection
from contact.forms import NewContactForm, FreeSearchForm
from django.core.paginator import Paginator, InvalidPage
from django.http import Http404, Http... | {
"content_hash": "f8be1b03dcb47bc396f542a782e1222c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 105,
"avg_line_length": 41.93421052631579,
"alnum_prop": 0.692187009727016,
"repo_name": "unicefuganda/edtrac",
"id": "a498b15bf1626c3b542b53ba819c04c8bd9522fd",
"size": "3... |
from random import randint
exec(open('parse.py').read())
exec(open('interpret.py').read())
exec(open('optimize.py').read())
exec(open('machine.py').read())
Leaf = str
Node = dict
def freshStr():
return str(randint(0,10000000))
def compileExpression(env, e, heap):
if type(e) == Node:
for label in e:
... | {
"content_hash": "1b943e48ed874f3284bc977e63fe0d78",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 92,
"avg_line_length": 28.03921568627451,
"alnum_prop": 0.5545454545454546,
"repo_name": "lapets/pylium",
"id": "df4554f9b3d2dd557c422b8b39fa52b4e8a53990",
"size": "1774",
... |
"""Tests for constraints.py."""
import unittest
from compiler.front_end import attributes
from compiler.front_end import constraints
from compiler.front_end import glue
from compiler.front_end import test_util
from compiler.util import error
from compiler.util import ir_util
def _make_ir_from_emb(emb_text, name="m.e... | {
"content_hash": "b20a91cdce15e95b2743a16bd90fc96f",
"timestamp": "",
"source": "github",
"line_count": 822,
"max_line_length": 80,
"avg_line_length": 47.42214111922141,
"alnum_prop": 0.5419050306559606,
"repo_name": "google/emboss",
"id": "9bf5a8e6cc51a55d5a88a8ee5262f5bf40494224",
"size": "39557"... |
import tensorflow as tf
import cv2
import numpy as np
class MultilayerConvolutionalNetwork:
"""
This class manages the deep neural network
that will be used by the agent to learn
and extrapolate the state space
"""
def __init__(self, input_width, input_height, nimages, nchannels):
self.... | {
"content_hash": "585b3c002276d8c1ff107cfa9279b227",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 89,
"avg_line_length": 36.544502617801044,
"alnum_prop": 0.5851002865329513,
"repo_name": "mimoralea/king-pong",
"id": "bc2a152002e92e8d55e206713a851690baa13195",
"size": ... |
"""
Flask-Snooze
--------------
Backend-agnostic REST API provider for Flask.
Links
`````
* `development version
<http://github.com/ahri/flask-snooze>`_
"""
from setuptools import setup
setup(
name='Flask-Snooze',
version='0.1.6',
url='http://github.com/ahri/flask-snooze',
license='MIT',
auth... | {
"content_hash": "3a053fc2f689894fdfb59b27b3ca922f",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 70,
"avg_line_length": 24.897959183673468,
"alnum_prop": 0.589344262295082,
"repo_name": "ahri/flask-snooze",
"id": "19b3a114fb42e3e9b2e9580964c5ccdfaf5ec4fa",
"size": "122... |
"""
"""
# Python 2.6 and newer support
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.builtins import (
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, roun... | {
"content_hash": "d0221114c6640022d74ca7279eac0c3b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 125,
"avg_line_length": 31.40740740740741,
"alnum_prop": 0.5787146226415094,
"repo_name": "sfinucane/deviceutils",
"id": "92d45d5492d34a39cc4caa8241a0a8cbb3a7e253",
"size"... |
class Polinomio(list):
def sum(self, other):
'''Return the sum of itself and other polynomial'''
if len(self) > len(other):
sol = self[:]
for x in range(len(other)): sol[x] += other[x]
else:
sol = other[:]
for x in range(len(self)): sol[x] += ... | {
"content_hash": "9cb9baa67b8a71d455880c33f46b4b48",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 63,
"avg_line_length": 30.128205128205128,
"alnum_prop": 0.5285106382978724,
"repo_name": "vicmagv/pis2-actividad02",
"id": "364ec3e3daf8829fce64724769f7fc2c968c9faa",
"siz... |
import os.path
import signal
import streams_property
from ducktape.services.service import Service
from ducktape.utils.util import wait_until
from kafkatest.directory_layout.kafka_path import KafkaPathResolverMixin
from kafkatest.services.kafka import KafkaConfig
from kafkatest.services.monitor.jmx import JmxMixin
from... | {
"content_hash": "71f6164007126c673d47144db068af42",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 171,
"avg_line_length": 43,
"alnum_prop": 0.5600359317297136,
"repo_name": "Ishiihara/kafka",
"id": "1d8ed270cc5eb81aa9e4e28602a46132f16b71b9",
"size": "20819",
"binary"... |
import ai
import time
import safe_path_generator as SPG
try:
import RPi.GPIO as GPIO
import motors
import input
import magnet
TEST_MODE = False
except ImportError:
TEST_MODE = True
import sys
import pygame
pygame.mixer.init()
COLOR_AI = 1
COORDS = [(0,0), (0,3), (0,6), (1,1), (1,3), (1,5), ... | {
"content_hash": "8c62bd1be391da72bde5621730d0edbc",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 198,
"avg_line_length": 40.843434343434346,
"alnum_prop": 0.5291208111784346,
"repo_name": "S7uXN37/NineMensMorrisBoard",
"id": "301c3e408c423ad7f482709823fe3e0cf0540488",
... |
"""Adamax for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.keras import backend_config
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.o... | {
"content_hash": "bc9e1f975b92c5d59dd66a521ce2f125",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 40.379746835443036,
"alnum_prop": 0.6542319749216301,
"repo_name": "ghchinoy/tensorflow",
"id": "6ea4a09fa4e4d21d65ea63c1482d8aaf7913fe7b",
"size": ... |
"""
dxf_helper.py
---------------
Manipulate DXF templates as plain text files rather
than strings inside a JSON blob
"""
import os
import json
import numpy as np
def get_json(file_name='../templates/dxf.json'):
"""
Load the JSON blob into native objects
"""
with open(file_name, 'r') as f:
t... | {
"content_hash": "6d5f737c826b569ea9dbfbe17dee6493",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 26.742857142857144,
"alnum_prop": 0.5548433048433048,
"repo_name": "mikedh/trimesh",
"id": "a13ad13a2ec08069a78652960e25c57e51d91b4d",
"size": "2808... |
from rest_framework import viewsets, permissions
from rest_framework.response import Response
from .models import Post
from .serializers import PostSerializer
from .permissions import IsAuthorOfPost
class PostViewSet(viewsets.ModelViewSet):
queryset = Post.objects.order_by('-created_at')
serializer_class = P... | {
"content_hash": "e6be656d8f5e71cdccad446c6de5a4dc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 33.4375,
"alnum_prop": 0.7355140186915888,
"repo_name": "tomaszzacharczuk/social-website-django-angular",
"id": "afa2095d3a4d40dad3de02c312989abe99c5a4... |
"""Tests for Fritz!Tools button platform."""
from unittest.mock import patch
import pytest
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
from homeassistant.components.fritz.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const impor... | {
"content_hash": "9571e443b62fb3fdafdee98bda1fb97c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 82,
"avg_line_length": 31.76,
"alnum_prop": 0.6943744752308985,
"repo_name": "toddeye/home-assistant",
"id": "a2bd61327318fa951a5aa58af936096f78b409d7",
"size": "2382",
"... |
"""Generate an updated requirements_all.txt."""
import difflib
import importlib
import os
from pathlib import Path
import pkgutil
import re
import sys
from homeassistant.util.yaml.loader import load_yaml
from script.hassfest.model import Integration
COMMENT_REQUIREMENTS = (
"Adafruit_BBIO",
"avea", # depends... | {
"content_hash": "f090ec488738f2179ee97a19e97d97ec",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 88,
"avg_line_length": 27.406649616368288,
"alnum_prop": 0.6092758491974617,
"repo_name": "kennedyshead/home-assistant",
"id": "4fd96cb1b04b4b6c57d97909088d359be5d626c3",
... |
from __future__ import absolute_import
import numpy as np
import sys
import six
from six.moves import map
from six.moves import range
class sparsearray(dict):
def __init__(self,input_array=[[]]):
#import pdb;pdb.set_trace()
dict.__init__(self)
a = np.atleast_2d(input_array)
self.dty... | {
"content_hash": "e694137e80581924ce58dc2aa8149ad1",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 94,
"avg_line_length": 34.388888888888886,
"alnum_prop": 0.501884760366182,
"repo_name": "metamorph-inc/smop",
"id": "e527a723224f073d51a21bc31480ed5ec045ad51",
"size": "3... |
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class SquaredDifference(function_node.FunctionNode):
"""Squared difference of input variables."""
def check_type_forward(self, in_types):
type_check.argname(in_types, ('x... | {
"content_hash": "52681ce802c462a893fa42b77544a6ed",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 63,
"avg_line_length": 29.681818181818183,
"alnum_prop": 0.6041347626339969,
"repo_name": "rezoo/chainer",
"id": "0f04c5c0de0ca960a187b3f8793907af9be805b7",
"size": "1306",... |
"""Functions for working with features in a raster dataset."""
import logging
import numpy as np
from rasterio._features import _shapes, _sieve, _rasterize, _bounds
from rasterio.dtypes import validate_dtype, can_cast_dtype, get_minimum_dtype
from rasterio.env import ensure_env
from rasterio.transform import IDENTI... | {
"content_hash": "e3d16d44a23a48ef4f56cfbe6dad3ca3",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 80,
"avg_line_length": 33.811074918566774,
"alnum_prop": 0.6535645472061657,
"repo_name": "brendan-ward/rasterio",
"id": "4a5c672c8dac506be1da613a6bb108790e90e0a3",
"size"... |
import functools
from stravalib import model
from stravalib.client import BatchedResultsIterator
from stravalib.tests.functional import FunctionalTestBase
class ResultIteratorTest(FunctionalTestBase):
def setUp(self):
super(ResultIteratorTest, self).setUp()
self.protocol = self.client.pro... | {
"content_hash": "8edbc4d084c84189e5f3fc08fb23e095",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 116,
"avg_line_length": 39.38181818181818,
"alnum_prop": 0.644506001846722,
"repo_name": "Wisees/stravalib",
"id": "d994b37d7fb825c499086cea6e5ea1db97828911",
"size": "2166... |
from __future__ import absolute_import
from math import asin, cos, degrees, log, pi, radians, sin, sinh, sqrt
import numpy as np
import auttitude as at
from auttitude.io import dcos_line, sphere_line
# maybe add option to build grid from projecting regular
# plane grid to sphere
class SphericalGrid(object):
"""... | {
"content_hash": "f795e8506ba873ce93b13f97c27b63ab",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 95,
"avg_line_length": 40.4367816091954,
"alnum_prop": 0.593992798938791,
"repo_name": "endarthur/autti",
"id": "6ae4c5c4de05eedf9e40c157337dd60f7ac76778",
"size": "10596"... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server import util
class TapiOamGetoamserviceInput(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (h... | {
"content_hash": "e93b3bed15ddc3a308b8e40496d52420",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 98,
"avg_line_length": 28.0625,
"alnum_prop": 0.6269487750556793,
"repo_name": "OpenNetworkingFoundation/ONFOpenTransport",
"id": "a91b822eb64aea1e53c0852193eeb17ac4379399",
... |
import sys
from cplex.callbacks import HeuristicCallback
from docplex.mp.callbacks.cb_mixin import *
class RoundDown(ModelCallbackMixin, HeuristicCallback):
def __init__(self, env):
HeuristicCallback.__init__(self, env)
ModelCallbackMixin.__init__(self)
@print_called('--> calling my_round_d... | {
"content_hash": "d81f010d21144fe15cf308ed1538804a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 94,
"avg_line_length": 32.65573770491803,
"alnum_prop": 0.6099397590361446,
"repo_name": "IBMDecisionOptimization/docplex-examples",
"id": "f8912846a9d37cd545e3d0b38e7859257d... |
from django.contrib import admin
from .models import Movies, Directors, ScheduledMovies
admin.site.register(Movies)
admin.site.register(Directors)
admin.site.register(ScheduledMovies)
| {
"content_hash": "d5a4d8fde8351617daadc26d25f78c74",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.8378378378378378,
"repo_name": "HenriqueLR/movie-book",
"id": "e333f46a37acabd1c495eb220881680d08d74a65",
"size": ... |
import unittest
from pywps import Process, Service, WPS, OWS
from pywps.app.basic import xpath_ns
from tests.common import client_for
import lxml.etree
class ExceptionsTest(unittest.TestCase):
def setUp(self):
self.client = client_for(Service(processes=[]))
def test_invalid_parameter_value(self):
... | {
"content_hash": "effabe8eae4f7b9f5df75f6b8b83a99b",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 92,
"avg_line_length": 38.659574468085104,
"alnum_prop": 0.6741882223445239,
"repo_name": "ricardogsilva/PyWPS",
"id": "0ba46191007a259cd66ef3e00334b15076fa9546",
"size": "... |
"""Useful functions for testing."""
from typing import Optional
import numpy as np
import pyspiel
def random_playout(state: pyspiel.State, seed: Optional[int] = None):
"""Plays random actions until the state is terminal."""
rng = np.random.RandomState(seed)
while not state.is_terminal():
state.apply_action... | {
"content_hash": "8fd2afc3f81d341d4be8010cf3b31f44",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 28.53846153846154,
"alnum_prop": 0.7331536388140162,
"repo_name": "deepmind/open_spiel",
"id": "64f77d9d78facb8f06086684d77c79205255442f",
"size": "9... |
import argparse
import os
import os.path
import tables
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'filenames', nargs='*', type=str, help='Files to fix.')
args = parser.parse_args()
for filename in args.filenames:
with tables.open_file... | {
"content_hash": "c57ad8e52f5c26e72cdc455a9177dccd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 28.68,
"alnum_prop": 0.599721059972106,
"repo_name": "jgosmann/plume",
"id": "ff662a3678a14f3b31564aa7957d3928be474664",
"size": "740",
"binary": f... |
import math
import random
from pandac.PandaModules import Vec3
from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal
from direct.task.Task import Task
from direct.interval.FunctionInterval import Wait
from direct.interval.IntervalGlobal import Func, LerpFunc, LerpPosInterval, LerpHpr... | {
"content_hash": "6951bec5e3201f3c4d0f3c2a5b0f08ff",
"timestamp": "",
"source": "github",
"line_count": 1099,
"max_line_length": 470,
"avg_line_length": 45.06369426751592,
"alnum_prop": 0.6493891973750631,
"repo_name": "ToontownUprising/src",
"id": "17e078bbf614c635f396c7ddc4b2948d535baee3",
"size"... |
from django.db.models import Q
from cyder.base.constants import IP_TYPE_4, IP_TYPE_6
from cyder.cydns.address_record.models import AddressRecord
from cyder.cydns.cname.models import CNAME
from cyder.cydns.mx.models import MX
from cyder.cydns.nameserver.models import Nameserver
from cyder.cydns.ptr.models import PTR
fr... | {
"content_hash": "6f122baa397ada3a7d26be4d8dbdeaf1",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 79,
"avg_line_length": 34.90582959641256,
"alnum_prop": 0.5996916752312436,
"repo_name": "drkitty/cyder",
"id": "7395b994095aaa4644df73512c6956757da1399e",
"size": "7784",... |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class QoRTsInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing QoRTs 0.3.17 on %s" % (node.alias))
node.ssh.execute('wget -c -P /opt/software/qorts https:/... | {
"content_hash": "b26b123820a17d6ef6546413b124ad76",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 130,
"avg_line_length": 61.5,
"alnum_prop": 0.7235772357723578,
"repo_name": "meissnert/StarCluster-Plugins",
"id": "e23caba8bd46bdbcedb9bf4c8409e9187fb19ca8",
"size": "984... |
from __future__ import print_function
import argparse
import getpass
import json
import os
import yaml
from elasticsearch.client import Elasticsearch
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--host', help='Elasticsearch host')
parser.add_argument('--port', type=int, help='Elas... | {
"content_hash": "f9b9e1e43816616975e3339c51424d54",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 119,
"avg_line_length": 45.02970297029703,
"alnum_prop": 0.5883905013192612,
"repo_name": "thomdixon/elastalert",
"id": "eeba7f1c165fdc45f56edbe99c4a5e99f515e373",
"size":... |
from Crypto.PublicKey import RSA
from Crypto import Random
def gen_key(nbits=1024):
random_generator = Random.new().read
key = RSA.generate(nbits, random_generator)
return key
def check_key(key):
print key.can_encrypt()
print key.can_sign()
print key.has_private()
def get_pubk(key):
ret... | {
"content_hash": "fe650828f2a110055adc225da83d93c8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 51,
"avg_line_length": 17.75609756097561,
"alnum_prop": 0.6510989010989011,
"repo_name": "ksmaheshkumar/My-Gray-Hacker-Resources",
"id": "55055f369c710760e23417347e2660cdbc48... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.