text stringlengths 4 1.02M | meta dict |
|---|---|
test.assert_equals(compute_sum(1), 1)
test.assert_equals(compute_sum(2), 3)
test.assert_equals(compute_sum(3), 6)
test.assert_equals(compute_sum(4), 10)
test.assert_equals(compute_sum(10), 46)
test.assert_equals(compute_sum(12), 51)
| {
"content_hash": "1e7f250b3904d7e84fe64eb9de1dc7a2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 38.833333333333336,
"alnum_prop": 0.7424892703862661,
"repo_name": "RevansChen/online-judge",
"id": "70c78848ce2f93e2cf1b501fa870a7d6e19e2c96",
"size"... |
from django.contrib.auth.views import login, logout
from django.core.urlresolvers import resolve, reverse
from django.test import TestCase
from accounts.forms import UserForm, UserEditFrom, UserResisterFrom
from accounts.models import User
from accounts.views import register_user, edit_user, view_user_data
class Url... | {
"content_hash": "1c316c263445aeb7fa1958a998c23c34",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 91,
"avg_line_length": 34.0990990990991,
"alnum_prop": 0.6457067371202113,
"repo_name": "hayashizakitakaaki/Introduction_mysite",
"id": "0c84b26974637fb983a39326ed8c86b33afb... |
"""CoreML frontend."""
from __future__ import absolute_import as _abs
import numpy as np
import tvm
from .. import symbol as _sym
from .._base import string_types
from .common import SymbolTable
__all__ = ['from_coreml']
def NeuralNetworkImageScaler(op, insym, symtab):
# this changes the symbol
biases = np.... | {
"content_hash": "353974f9af8d97c51c50f22484467d80",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 97,
"avg_line_length": 37.799019607843135,
"alnum_prop": 0.6348722604072105,
"repo_name": "mlperf/training_results_v0.6",
"id": "7dfd54317b5542af9f15db32cda7dd9386e4ab63",
... |
import django.contrib.postgres.indexes
from django.db import migrations
import saleor.account.models
class Migration(migrations.Migration):
dependencies = [
("account", "0052_customerevent_app"),
]
operations = [
migrations.RemoveIndex(
model_name="user",
name="a... | {
"content_hash": "f903dca02a90dda231cbd5322ffd0b7f",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 82,
"avg_line_length": 30.652173913043477,
"alnum_prop": 0.5014184397163121,
"repo_name": "mociepka/saleor",
"id": "9714086a8c6d57b4d30306a958f536a7ebc03bcb",
"size": "1459... |
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
im... | {
"content_hash": "76a1ab0979ea5b9c8dcaf23f6a9133ff",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 481,
"avg_line_length": 33.964467005076145,
"alnum_prop": 0.5957256015543267,
"repo_name": "grafeas/client-python",
"id": "f70019c95c7be20517b76954cfb0e4af80ac4c4a",
"size... |
""" Message Parsing
Template-specific Message Parsers are defined here.
@copyright: 2013-2020 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal... | {
"content_hash": "fe291a14066a5148b80dd9d4a44c9af6",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 97,
"avg_line_length": 44.93172690763052,
"alnum_prop": 0.38130139435109045,
"repo_name": "flavour/eden",
"id": "a8befa9be09358a3199e88378bf04ae0a9da34b9",
"size": "11257"... |
"""
tests.test_file - nose tests for ende.File module
project : Ende
version : 0.1.0
status : development
modifydate : 2015-05-06 19:30:00 -0700
createdate : 2015-05-05 05:36:00 -0700
website : https://github.com/tmthydvnprt/ende
author : tmthydvnprt
email : [email protected]
m... | {
"content_hash": "d8e705e62ed4631ca6c4edd83b5198c8",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 114,
"avg_line_length": 34.83076923076923,
"alnum_prop": 0.6074793875147232,
"repo_name": "tmthydvnprt/ende",
"id": "f50874d241d8f43bd9404a042e8aabd451afe215",
"size": "67... |
'''OpenGL extension EXT.swap_control_tear
This module customises the behaviour of the
OpenGL.raw.GLX.EXT.swap_control_tear to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/swap_control_tear.txt
'''
from OpenGL import platform... | {
"content_hash": "da57505556c5c6d523f9ada53cf28687",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 33.78260869565217,
"alnum_prop": 0.7902187902187903,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "127710ad9314a8fa0ce945acd8f3525c53c33a19",
... |
"""
Views which allow users to create and activate accounts.
"""
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.translation import ugett... | {
"content_hash": "77ddf2cd9db73dcbf7ca55614ba23b30",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 117,
"avg_line_length": 43.8,
"alnum_prop": 0.5972222222222222,
"repo_name": "Woseseltops/signbank",
"id": "0c1269a920cbd8904bd460e086d7d6dc988da430",
"size": "10512",
"... |
import nibabel as nib
import numpy as np
from nilabels.tools.aux_methods.utils_rotations import get_small_orthogonal_rotation
from nilabels.tools.aux_methods.utils_path import get_pfi_in_pfi_out, connect_path_tail_head
from nilabels.tools.aux_methods.utils_nib import modify_image_data_type, \
modify_affine_transfo... | {
"content_hash": "43bf022c5ac432b025ea0fd78d365036",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 129,
"avg_line_length": 44.397260273972606,
"alnum_prop": 0.6201789571120024,
"repo_name": "SebastianoF/LabelsManager",
"id": "cf92bec6d20ec163dab02a89a48253852700dd43",
"... |
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from keystoneclient import exceptions
from horizon import messages
from horizon import tables
from openstack_dashboard import a... | {
"content_hash": "b4299881f5eb28723f1b902a89a646dd",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 79,
"avg_line_length": 33.49090909090909,
"alnum_prop": 0.6071299312341658,
"repo_name": "JioCloud/horizon",
"id": "60ce476df17ae128e41389061202adf84dc58b4c",
"size": "616... |
from __future__ import unicode_literals, print_function
from jsontowidget import widget_from_json
class Survey(object):
def __init__(self, json_survey, **kwargs):
super(Survey, self).__init__(**kwargs)
self.survey_file = json_survey
self.questionnaires = {}
self.prev_questionnaires... | {
"content_hash": "75508b2c581e9133ce747f363fdbb966",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 81,
"avg_line_length": 33.81609195402299,
"alnum_prop": 0.5943235893949694,
"repo_name": "Kovak/KivySurvey",
"id": "a926f9e948cb38f504a0eddcfaffb7526ddd704c",
"size": "588... |
from wdl.types import *
class CoercionException(Exception): pass
class EvalException(Exception): pass
def assert_type(value, types): return value.type.__class__ in types
def coerce(value, wdl_type):
if isinstance(wdl_type, WdlArrayType):
return WdlArray.coerce(value, wdl_type.subtype)
if isinstance(... | {
"content_hash": "dd34d2b2b2e89ad1850ceada6d9f1f87",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 127,
"avg_line_length": 45.03235294117647,
"alnum_prop": 0.6330089478152962,
"repo_name": "broadinstitute/pywdl",
"id": "82a7b71aa1c3101813d14072d800eb52121cd580",
"size":... |
"""
Run the maze game
"""
import argparse
import sys
from mazegame import *
def main():
parser = argparse.ArgumentParser(description='Play different types of maze games')
parser.add_argument('-r','--random',help='Play the random game',action='store_true')
parser.add_argument('-f','--file',help='Pla... | {
"content_hash": "42d8c59a118f63e3aa00c9e96aeb9ba9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 32.41463414634146,
"alnum_prop": 0.6403310759969902,
"repo_name": "pythonhacker/pyconindia2017concurrency",
"id": "cd8494440521ffded0c40d316cce18f783e... |
from twisted.python import log
from tastypie import authorization
from django.conf.urls import *
import json, os
from ....libs import LisaFactorySingleton, LisaProtocolSingleton
from ....ConfigManager import ConfigManagerSingleton
from tastypie import resources as tastyresources
from tastypie.utils import trailing_slas... | {
"content_hash": "204a0526a7753b4b3bd0b953abb9cb3a",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 148,
"avg_line_length": 40.69827586206897,
"alnum_prop": 0.5190990609334181,
"repo_name": "Seraf/LISA",
"id": "24de8f980fee24cb928afd03ecf4c108f4735de8",
"size": "14163",
... |
"""
Test signal reporting when debugging with linux core files.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class LinuxCoreThreadsTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
mydir = TestBase.compute_mydir(__file__)... | {
"content_hash": "4019bf71336b1170a990c27949dc2e8d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 93,
"avg_line_length": 37.04477611940298,
"alnum_prop": 0.6188557614826753,
"repo_name": "endlessm/chromium-browser",
"id": "6e34c914ae289c40028922ad696a60aa938062b3",
"siz... |
'''
Created on 16/03/2011
@author: team A
'''
import time
from sys import stdout
import os.path
import csv
import os
class StreamWatcher:
def __init__(self, _sched ,
_downloader,
_storagewrapper ,
_config,_downmeasure):
self.... | {
"content_hash": "c5acb74c409669538575a403905e7419",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 119,
"avg_line_length": 43.941520467836256,
"alnum_prop": 0.49653979238754326,
"repo_name": "ArthurWulfWhite/team-Mea-peer2peer",
"id": "25c3f7793826cd4169e129954d877cda3444... |
from __future__ import unicode_literals
from decimal import Decimal
import random
from .. import BaseProvider
from .. import date_time
localized = True
class Provider(BaseProvider):
city_suffixes = ['Ville', ]
street_suffixes = ['Street', ]
city_formats = ('{{first_name}} {{city_suffix}}', )
street_... | {
"content_hash": "1f8d87efa5287f2ad36524a79f678315",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 111,
"avg_line_length": 28.07,
"alnum_prop": 0.5910224438902744,
"repo_name": "jaredculp/faker",
"id": "614a6f57a9438b0237a442993b2ca646459cbc2e",
"size": "2822",
"binar... |
"""
http://www.spoj.com/problems/ONP/
4. Transform the Expression
Problem code: ONP
Transform the algebraic expression with brackets into
RPN form (Reverse Polish Notation). Two-argument operators:
+, -, *, /, ^ (priority from the lowest to the highest), brackets ( ).
Operands: only letters: a,b,...,z.
Assume th... | {
"content_hash": "5340cd44f68ff2c31c7850d29b230c9b",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 86,
"avg_line_length": 20.92,
"alnum_prop": 0.624282982791587,
"repo_name": "CreaturePhil/Faith",
"id": "5d63d8a9f9eaae9bf754a247bf13ac3e9900c905",
"size": "2092",
"bina... |
from books.tests.pagination import PaginationTestCase as pagination
from books.tests.meta import MetaTestCase as meta
from books.tests.json_builder import JSONBuilderTestCase as builder
from books.tests.api import ApiTestCase as api
from books.tests.book_store import BookStoreTestCase
from books.tests.resource_methods ... | {
"content_hash": "eedec6465f070b4c462994cf65eb426c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 85,
"avg_line_length": 60.111111111111114,
"alnum_prop": 0.8632162661737524,
"repo_name": "laginha/yard",
"id": "f44675f94ac51ea5f16714d77fcc5f92dcb5263d",
"size": "585",
... |
from cointk.backtest import backtest
from cointk.strategies import NaiveStrategy
import random
random.seed(1)
strategy = NaiveStrategy(n_prices=1000, threshold=0.8)
backtest(strategy)
| {
"content_hash": "3f225c7c34bffb20c9e6b6620ba137f0",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 54,
"avg_line_length": 23.25,
"alnum_prop": 0.8225806451612904,
"repo_name": "CoinTK/CoinTK",
"id": "671dc4dbfd1f4b9f0957950766d1c6d10faf910a",
"size": "186",
"binary": fa... |
"""
Challenge 12:
- Write an application that will create a route in mailgun so that when an
email is sent to <YourSSO>@apichallenges.mailgun.org it calls your
Challenge 1 script that builds 3 servers.
- Assumptions:
Assume that challenge 1 can be kicked off by accessing
http://cldsrvr.com/challenge1
- We h... | {
"content_hash": "145c4c5aaf390dbc2e00d340928fbf27",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 25.3,
"alnum_prop": 0.7529644268774703,
"repo_name": "theneykov/rax-api-scripts",
"id": "74aeb3ec84f198596de5005140977c6d5a0a2c5a",
"size": "1122",
... |
"""
A connection to a hypervisor through libvirt.
Supports KVM, LXC, QEMU, UML, and XEN.
"""
import contextlib
import errno
import functools
import glob
import mmap
import os
import random
import shutil
import socket
import sys
import tempfile
import threading
import time
import uuid
from xml.dom import minidom
imp... | {
"content_hash": "b13f3548c05538c9a16b2d4a8195628d",
"timestamp": "",
"source": "github",
"line_count": 6425,
"max_line_length": 79,
"avg_line_length": 43.57463035019455,
"alnum_prop": 0.5432926023424189,
"repo_name": "luzheqi1987/nova-annotation",
"id": "90a725e1fabfc28a88d187b09e8f1316b86b3620",
... |
from typing import AsyncIterator
from aiogen.utils import AsyncTestCase
from aiogen.agenerator import agenerator, async_yield, async_yield_from
from aiogen.abuiltins import anext
@agenerator
async def ay(start) -> AsyncIterator:
r1 = await async_yield(start)
r2 = await async_yield(r1)
return r2
@agenera... | {
"content_hash": "8672b7ef0c26dd96e7b08aa1a89e17a7",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 71,
"avg_line_length": 30.56923076923077,
"alnum_prop": 0.5915953699043784,
"repo_name": "germn/aiogen",
"id": "4e2ea23a1a6c290e235adf90461755fc473e7104",
"size": "3974",
... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
#
# In the current iteration, there is a client object that can be loaded from
# the filesystem into the database and its settings loaded from the database.
# There are no... | {
"content_hash": "4485c448838d455c939cd9b81df5fa6a",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 115,
"avg_line_length": 37.625,
"alnum_prop": 0.7212993724621631,
"repo_name": "sunil07t/e-mission-server",
"id": "13f17984a131118b479da3b6558a4509ec34032b",
"size": "2709"... |
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 field 'FancyBoxPlugin.target_image_title'
db.add_column('cmsplugin_fancyboxplugin', 'target_image_title', self.gf('... | {
"content_hash": "8933674701f2275235ac8d129eddcc29",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 210,
"avg_line_length": 84.51470588235294,
"alnum_prop": 0.5597703149469289,
"repo_name": "MegaMark16/django-cms-fancybox",
"id": "52a248fab067e9fbf885e0a1f0359bb87c72a2ed",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('map', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='map',
table=None,
),
]
| {
"content_hash": "eac44780666e07023bbaafdaf19144e3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 40,
"avg_line_length": 17.941176470588236,
"alnum_prop": 0.5737704918032787,
"repo_name": "sebastianlan/wedfairy-api",
"id": "20ffa8f6b672bcedc220bab9f575be6b2f6da6ec",
"si... |
import os
from django import template
register = template.Library()
@register.simple_tag
def get_altair_scripts(dashboard_slug):
path = "dashboards/" + dashboard_slug + "/altair_scripts"
scripts = os.listdir("templates/" + path)
includes = []
for script in scripts:
includes.append(path + "/" ... | {
"content_hash": "14924b760fe7266df4a6ff53bd4f472f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 25,
"alnum_prop": 0.6771428571428572,
"repo_name": "synw/django-chartflo",
"id": "7e44a21990f0ce2954cdd2c0eaf1445be7abda4f",
"size": "374",
"binary... |
from django import VERSION
from django.core.management.commands.loaddata import Command as LoadDataCommand
# Because this command is used (instead of default loaddata), then settings have been imported
# and we can safely import MT modules
from wagtail_modeltranslation import settings as mt_settings
from wagtail_model... | {
"content_hash": "0ca45b5c085462dcdd14f8dc59a8c2c1",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 97,
"avg_line_length": 42.42622950819672,
"alnum_prop": 0.6418083462132921,
"repo_name": "tomdyson/wagtail-modeltranslation",
"id": "b22d1d67a650b3d5a2713a561a6799b5877054f1"... |
from __future__ import division
def find_combinations(total, a, b, c, d):
counter = 0
for i in range()
return counter
def sum(i, j):
return i + j
def substract(i, j):
return i - j
def multiply(i, j):
return i * j
def divide(i, j):
return i / j
#print find_combinations(42, 3, 8, 9,... | {
"content_hash": "89f0d41d0fb6cb84d40b201bd1f23279",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 41,
"avg_line_length": 12.92,
"alnum_prop": 0.5851393188854489,
"repo_name": "agodi/Algorithms",
"id": "c19b922170e7cfdb96fd9e2bf083f767db2d15cc",
"size": "323",
"binary"... |
from pytest import raises
import pytest
parametrize = pytest.mark.parametrize
from simple_web_generator import metadata
from simple_web_generator.window import Window
from simple_web_generator.main import main, get_windows
import click
from click.testing import CliRunner
import yaml
class TestMain:
@parametriz... | {
"content_hash": "d6214cd50d8ae5e75c91eb000102dec6",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 143,
"avg_line_length": 35.03030303030303,
"alnum_prop": 0.6557093425605537,
"repo_name": "Slepice1/simple-web-generator",
"id": "dd4d3d274bcfce5acdcaec3b8fffbe4d9a781fad",
... |
import re
import datetime
import struct
import dateutil
from HTMLParser import HTMLParser
from lxml.html.diff import tokenize, fixup_ins_del_tags, htmldiff_tokens
from lxml.etree import ParserError, XMLSyntaxError
import lxml.html, lxml.etree
from lxml.html.clean import Cleaner
from itertools import chain
from django.u... | {
"content_hash": "f58ce4f51b38cd494ee40b9f1e6da5c1",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 124,
"avg_line_length": 36.33030303030303,
"alnum_prop": 0.576695304028693,
"repo_name": "huihoo/reader",
"id": "25d92768022370611667a7fa0ad71ba72232066d",
"size": "11989"... |
import sys
from . import defaults
class OxyioSettings(object):
def __init__(self):
# Apply the defaults to this
self.apply_attrs(defaults)
def load_module(self, name):
# The sys.modules hack below breaks the import
from importlib import import_module
settings_module ... | {
"content_hash": "ed79b33d475290a56bd6ca59328a1e53",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 25.391304347826086,
"alnum_prop": 0.6438356164383562,
"repo_name": "oxyio/oxyio",
"id": "9b597e66b2ad06f8b8df894846b844aebbea977c",
"size": "709",
... |
import pytest
from lcs.agents.acs2er.ACS2ER import ACS2ER
from lcs.agents.acs2er.Configuration import Configuration
class TestACS2ER:
@pytest.fixture
def cfg(self):
return Configuration(
classifier_length=2,
number_of_possible_actions=2,
er_buffer_size=100,
... | {
"content_hash": "5e7ac6e1e2ed49986e47ec9f3069d34c",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 92,
"avg_line_length": 26.6875,
"alnum_prop": 0.5690866510538641,
"repo_name": "ParrotPrediction/pyalcs",
"id": "25dcf110cabdb176990aa5d939ad61d33b22bd51",
"size": "1708",
... |
import _plotly_utils.basevalidators
class TickangleValidator(_plotly_utils.basevalidators.AngleValidator):
def __init__(
self, plotly_name="tickangle", parent_name="mesh3d.colorbar", **kwargs
):
super(TickangleValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | {
"content_hash": "8b2d4489f64e5c014a18528e6e202cec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 33,
"alnum_prop": 0.6153846153846154,
"repo_name": "plotly/plotly.py",
"id": "1a0c0043b8c74e3805219621ef0b2d22bdbfd7a4",
"size": "429",
"binary": f... |
import inspect
import os
import glob
import argparse
import importlib
from crawlers.base import BaseCrawler
def build_args():
parser = argparse.ArgumentParser()
parser.add_argument(nargs='+', default='', dest='paths', type=str)
parser.add_argument('--width', dest='width', default=1024, type=int)
pars... | {
"content_hash": "a0f13326998c0417f27111b802bd38f0",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 84,
"avg_line_length": 26.54054054054054,
"alnum_prop": 0.6242362525458248,
"repo_name": "altnight/individual-sandbox",
"id": "d62cdd00649cf24ca22661177d3be40788b14bed",
"s... |
"""Int value conversion.
This module is a utility for reasoning about intervals when computing filter selectivities,
and generating parameters for pagination. Since integers are the easiest type to deal with
in this context, when we encounter a different type we represent it as an int, do all the
computation in the in... | {
"content_hash": "7e74e0c80afb302532db442794f4eef4",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 100,
"avg_line_length": 41.409356725146196,
"alnum_prop": 0.6744810055076966,
"repo_name": "kensho-technologies/graphql-compiler",
"id": "4572e302b21703a8e19ff6e09dafba54183... |
import DNANode
class DNASignText(DNANode.DNANode):
COMPONENT_CODE = 7
def __init__(self):
DNANode.DNANode.__init__(self, '')
self.letters = '' | {
"content_hash": "e0d620e42520123d4059f7405970ae6e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 21.875,
"alnum_prop": 0.5771428571428572,
"repo_name": "DedMemez/ODS-August-2017",
"id": "206fe9a7dff7291364962b2207646e3ad0ffe461",
"size": "260",
... |
from __future__ import absolute_import, unicode_literals
import json
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView, View
from braces.views import CsrfExemptMixin, JsonRequestResponseMixin, JSONResponseMixin
from django.contrib.auth.mixins im... | {
"content_hash": "143fb09b216a78af1f1e9c0f45afff41",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 85,
"avg_line_length": 33.391304347826086,
"alnum_prop": 0.7194010416666666,
"repo_name": "Tuteria/Recruitment-test",
"id": "204f7f630511b1f04a5b0964189a5e1b0bd590cf",
"siz... |
"""
Django settings for opencomap project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | {
"content_hash": "55e41fdc3d54a610dc5d361d1ed69bc3",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 78,
"avg_line_length": 29.095890410958905,
"alnum_prop": 0.7231638418079096,
"repo_name": "nagyistoce/geokey",
"id": "62ee9445396f04726051d75fdbcb7725b6644806",
"size": "4... |
from __future__ import print_function
import os
from setuptools import setup
NAME = 'conda_rpms'
DIR = os.path.abspath(os.path.dirname(__file__))
def extract_packages():
packages = []
root = os.path.join(DIR, NAME)
offset = len(os.path.dirname(root)) + 1
for dpath, dnames, fnames in os.walk(root):
... | {
"content_hash": "fc0f309b6491247b4b8b5d200865efc8",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 68,
"avg_line_length": 29.463414634146343,
"alnum_prop": 0.5807119205298014,
"repo_name": "pelson/conda-rpms",
"id": "0b428729a6f0fb61bcfff5b3202bbe8ef327e640",
"size": "24... |
''' Provide helper methods for IMOSChecker class
'''
import datetime
import numpy as np
import re
from numpy import amax
from numpy import amin
from compliance_checker.base import BaseCheck
from compliance_checker.base import Result
from compliance_checker.cf.util import units_convertible
CHECK_VARIABLE = 1
CHECK_... | {
"content_hash": "f1569d5eefc80fc6d1b333b1ed9c1272",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 133,
"avg_line_length": 34.906103286384976,
"alnum_prop": 0.5926025554808338,
"repo_name": "petejan/compliance-checker",
"id": "121b521b0b044527199111dd1cb31110e4d5ac67",
... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow and Renderer
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.SetAlphaBitPlanes(1)
iren = vtk.vtkRenderWindowInteractor()
iren.Se... | {
"content_hash": "b6ae1085514148c22060ec7e1853f4b5",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 68,
"avg_line_length": 27.464788732394368,
"alnum_prop": 0.7384615384615385,
"repo_name": "hlzz/dotfiles",
"id": "18f0ce87dcbdd449158b4f444c11da5a971d5773",
"size": "1973",... |
def positions_count_for_all_ballot_items_doc_template_values(url_root):
"""
Show documentation about positionsCountForAllBallotItems
"""
required_query_parameter_list = [
{
'name': 'voter_device_id',
'value': 'string', # boolean, integer, long, string
... | {
"content_hash": "4aaa84f39194b1a3bec5fc80372722af",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 116,
"avg_line_length": 42.171052631578945,
"alnum_prop": 0.4630265210608424,
"repo_name": "jainanisha90/WeVoteServer",
"id": "45a193bbf6e900e82c34bf73274772ec19816638",
"s... |
"""This example lists all creative groups.
Tags: creativeGroups.list
"""
__author__ = ('[email protected] (Jonathon Imperiosi)')
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_help=False)
argpars... | {
"content_hash": "1501c1bf41b90c4fb419f1c58418a3cf",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 28.0188679245283,
"alnum_prop": 0.6713804713804714,
"repo_name": "vanant/googleads-dfa-reporting-samples",
"id": "a52dee6cee7c0582c9addec6858cb0e7f8dac... |
from Bio import SeqIO
import sys
seen_names = []
output_file = sys.argv[1] + "_dedup"
outh = open(output_file, "w")
for record in SeqIO.parse(sys.argv[1], "fasta"):
if record.id in seen_names:
continue
else:
seen_names.append(record.id)
outh.write(">" + str(record.id) + "\n" + str(reco... | {
"content_hash": "227a0fc2ba8b6ceba102add17bcc3e53",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 24.928571428571427,
"alnum_prop": 0.6045845272206304,
"repo_name": "Tancata/phylo",
"id": "953f1753211479fb1221be30a7595724ef71b620",
"size": "349",
... |
"""
NBtrain.py -
Model generator for langid.py
Marco Lui, January 2013
Based on research by Marco Lui and Tim Baldwin.
Copyright 2013 Marco Lui <[email protected]>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the follow... | {
"content_hash": "5cface19d99162d5ac89b8ed42d760f9",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 123,
"avg_line_length": 35.88785046728972,
"alnum_prop": 0.6608506944444444,
"repo_name": "wikiteams/github-gender-studies",
"id": "89a6acdc05599643c5a69a782d6197fddc4a675e"... |
r"""A backend module to load and dump (Java) properties files.
- Format to support: Java Properties file, e.g.
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html
- Requirements: None (built-in)
- Development Status :: 4 - Beta
- Limitations:
- Key and value separator of white spaces is not sup... | {
"content_hash": "9c4c74d68ab3180f576c724ea1c4f1db",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 76,
"avg_line_length": 29.115384615384617,
"alnum_prop": 0.618229854689564,
"repo_name": "ssato/python-anyconfig",
"id": "ceef40cb0a0ea816926f716c0a641cafbdce79a0",
"size"... |
from flask import Flask
from flask.ext.cors import CORS
from views.root import root
from apis.root import api_root
app = Flask(__name__)
app.register_blueprint(root)
app.register_blueprint(api_root)
app.config['CORS_ALLOW_HEADERS'] = "Content-Type"
cors = CORS(app)
@app.after_request
def add_header(response):
r... | {
"content_hash": "088b75df9a812a580d61dd11e6b367cf",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 61,
"avg_line_length": 23.181818181818183,
"alnum_prop": 0.703921568627451,
"repo_name": "supistar/OandaOrderbook",
"id": "c105f667600a3ec555513d82a7bb32fed8190a06",
"size"... |
"""Interface for consistency group snapshots extension."""
from six.moves.urllib import parse
from manilaclient import api_versions
from manilaclient import base
from manilaclient.openstack.common.apiclient import base as common_base
RESOURCES_PATH = '/cgsnapshots'
RESOURCE_PATH = '/cgsnapshots/%s'
RESOURCE_PATH_ACT... | {
"content_hash": "8f177bf99a35cef85613af753280d834",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 34.71508379888268,
"alnum_prop": 0.5992919214676536,
"repo_name": "sniperganso/python-manilaclient",
"id": "08c6a179b2f63ece2a02eda609326a5788e8af75",... |
"""
.. dialect:: firebird+kinterbasdb
:name: kinterbasdb
:dbapi: kinterbasdb
:connectstring: firebird+kinterbasdb://user:password@host:port/path/to/db[?key=value&key=value...]
:url: https://firebirdsql.org/index.php?op=devel&sub=python
Arguments
----------
The Kinterbasdb backend accepts the ``enable_... | {
"content_hash": "1c4fa4e76959f39dcfd881f3caa0f48b",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 102,
"avg_line_length": 31.96923076923077,
"alnum_prop": 0.6191851138915624,
"repo_name": "monetate/sqlalchemy",
"id": "102222de0acb9485103d508f796794a75f53df28",
"size": ... |
from dcbase.models import UserProfile
from django.forms import ModelForm
class UserProfileForm(ModelForm):
class Meta:
model = UserProfile
fields = ['language', 'timezone']
| {
"content_hash": "6708ed07b1191b37be4916e079f1e56c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 24.375,
"alnum_prop": 0.7128205128205128,
"repo_name": "tctimmeh/dc-django-base",
"id": "57316b2bb185025f47280c38227355e448cb34d4",
"size": "195",
"... |
from django.http import Http404, JsonResponse
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404, redirect
from django.utils.decorators import method_decorator
from django.utils.text import slugify
from django.vie... | {
"content_hash": "bb8a869d4238604264527bca6dca0c43",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 74,
"avg_line_length": 35.21084337349398,
"alnum_prop": 0.61830624465355,
"repo_name": "JosmanPS/tsebaoth-christian-academy",
"id": "d528e977f9cd76690ba6f569a4b4f29c7b88c9cc... |
import os
from subliminal import download_best_subtitles, save_subtitles
from subliminal.video import Episode
from subliminal.core import search_external_subtitles
from babelfish.language import Language
class Subtitler:
def __init__(self, languages, providers):
self.languages = languages
self.... | {
"content_hash": "c49b5f192cb24879996889c20d77085c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 103,
"avg_line_length": 31.375,
"alnum_prop": 0.6788844621513944,
"repo_name": "rkohser/gustaf2",
"id": "f7f43d3dbe815e422dee5f434812cd2cbacb19e4",
"size": "1255",
"binar... |
def getIncreaseAUCDict():
assertEviD = getAssertionDict()
increaseAucL = ["contVal", "numericVal", "numOfSubjects", "objectDose", "precipDose", "evidenceVal", "object", "precip"]
for attr in increaseAucL:
assertEviD[attr] = None
return assertEviD
## inhibits, substrate of
def getAssertionDi... | {
"content_hash": "3ad59a958b143632ee8f751a2141699b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 159,
"avg_line_length": 40.294117647058826,
"alnum_prop": 0.6583941605839416,
"repo_name": "dbmi-pitt/DIKB-Micropublication",
"id": "5c84e88b9a930b4602ca38a1b27b11a35f20d8b8"... |
import io
import unittest
from unittest.mock import patch
from kattis import k_amultiplicationgame
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Ru... | {
"content_hash": "8018ff270b8cd5886c7204b9338b88e1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 33.111111111111114,
"alnum_prop": 0.5209731543624161,
"repo_name": "ivanlyon/exercises",
"id": "5b3c7f20c7d58ae2ae85ad07a23fe7503b8e1477",
"size": "1... |
from django.contrib import admin
from django.contrib import messages
from django.forms import widgets
from django.forms.utils import flatatt
from django.db.models import JSONField
from django.templatetags.static import static
from django.utils.html import format_html
from django.utils.timezone import now
from django.ut... | {
"content_hash": "4fbcc8b2d0901a0138df62a8269bb3f0",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 124,
"avg_line_length": 48.08860759493671,
"alnum_prop": 0.6425375098710187,
"repo_name": "jrief/djangocms-cascade",
"id": "72a40e01fab9ec77f74bfc5404ce6bede53ec91b",
"size... |
from django.contrib.auth.models import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **kwargs):
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.set_p... | {
"content_hash": "dbe17ee43be654cbe732f01b2248404e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 31.736842105263158,
"alnum_prop": 0.6533996683250415,
"repo_name": "mongkok/defocus",
"id": "b7018631d32906f0a9742ca0dc8aa952059b680a",
"size": "603"... |
"""
This module is inspired by the open-sourced project Changes:
https://github.com/dropbox/changes
"""
from __future__ import absolute_import
import os
import os.path
from contextlib import contextmanager
from subprocess32 import Popen, PIPE, check_call
from easyci.utils import contextmanagers
class CommandError(... | {
"content_hash": "27413d312b4ef5e37aa54eca5f4fc999",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 115,
"avg_line_length": 28.364532019704434,
"alnum_prop": 0.5830149357415769,
"repo_name": "naphatkrit/easyci",
"id": "61d7527ff3961ad47881f00ed8bd6153a1a23da6",
"size": "... |
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import ren... | {
"content_hash": "52224b09c19e4d1eaa9cbe56b0f20bc3",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 92,
"avg_line_length": 37.216,
"alnum_prop": 0.6444539982803096,
"repo_name": "grangier/django-11599",
"id": "e35e1fb80ed6982a353f9e78f4899a406c80e458",
"size": "4652",
... |
from __future__ import absolute_import
try:
from django.conf.urls import url, include
except ImportError:
# for Django version less than 1.4
from django.conf.urls.defaults import url, include # NOQA
from raven.contrib.django.resolver import RouteResolver
included_url_conf = (
url(r'^foo/bar/(?P<para... | {
"content_hash": "f010ae2e868b1af28d2c06901d95495d",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 71,
"avg_line_length": 27.285714285714285,
"alnum_prop": 0.6553228621291448,
"repo_name": "johansteffner/raven-python",
"id": "3960161940a7b49abda3291d379bba39f57ab215",
"s... |
import yaml
class Event(yaml.YAMLObject):
yaml_tag = u'!Event'
def __init__(self):
pass
#self.Id = Id
#self.metadata = metadata
#self.application = application
#self.payload = payload
#self.parameters = parameters
# def validate(self):
#
# self... | {
"content_hash": "7fd0ae93533ac83ab737c3d675d12685",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 113,
"avg_line_length": 40.54320987654321,
"alnum_prop": 0.5624238733252132,
"repo_name": "ClockworkOrigins/m2etis",
"id": "7db065af28ffc9bc04307749efccb91faa60d4b8",
"size... |
import ConfigParser
import base64
import json
import urllib2
import sys
parser = ConfigParser.SafeConfigParser()
parser.read('/root/env.conf')
fuel_ip = dict(parser.items('fuel'))['fuel_ip']
interface = dict(parser.items('fuel'))['interface']
create_new_run = dict(parser.items('testrail'))['create_new_run']
suite_id ... | {
"content_hash": "27af1bddd5485260240c284ef1c0db55",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 175,
"avg_line_length": 40.252066115702476,
"alnum_prop": 0.6039421004003696,
"repo_name": "vortex610/mos",
"id": "5e0b85f3118ceb23e153c0b0c3b69380bd66008f",
"size": "9741... |
from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.rst")) as fd:
long_description = fd.read()
setup(
name="pyoffers",
url="https://github.com/Stranger6667/pyoffers",
version="0.7.0",
li... | {
"content_hash": "35d71fdf94773d19488e3aa699133ba0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 70,
"avg_line_length": 35.142857142857146,
"alnum_prop": 0.6321138211382114,
"repo_name": "Stranger6667/pyoffers",
"id": "aeddf8413e6852678efd04b1794fc84a694f6c27",
"size":... |
from .default_file_handler import * | {
"content_hash": "101d82b9d263ea388417736215b079ba",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 35,
"avg_line_length": 35,
"alnum_prop": 0.8,
"repo_name": "vinoth3v/In",
"id": "7d9c06e5dd1f16c544753e7c8a2a9392371b084f",
"size": "35",
"binary": false,
"copies": "1",... |
""" Defines convenience pyparsing constructs and token converters.
Based on sparser.py by Tim Cera [email protected].
"""
#------------------------------------------------------------------------------
# Imports:
#------------------------------------------------------------------------------
from pyparsing impo... | {
"content_hash": "c8d912beb44a4e3f35f3ac455bf2b0ad",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 79,
"avg_line_length": 29.85542168674699,
"alnum_prop": 0.4943502824858757,
"repo_name": "rwl/pylon",
"id": "9dc0f7325f9896434ae2c1471608971b78905232",
"size": "5705",
"... |
import requests
import time
from io import BytesIO
from picamera import PiCamera
# Create an in-memory stream
print('Raspberry Pi laundry camera started')
stream = BytesIO()
# Setup the camera
# Rotate 90 degrees
# ROI is 0.6, 0.22, 0.2, 0.2
camera = PiCamera()
camera.resolution = (1280, 1024)
camera.rotation = 90
c... | {
"content_hash": "9912d1b138e536073f8a456476653bde",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 52,
"avg_line_length": 20.761904761904763,
"alnum_prop": 0.6811926605504587,
"repo_name": "kenahrens/iot-laundry",
"id": "355c2b93a804eba6fdf6c755d2fc20d4d1cdca80",
"size":... |
__author__ = 'Tom Schaul, [email protected]'
from pybrain.utilities import abstractMethod
class Environment(object):
""" The general interface for whatever we would like to model, learn about,
predict, or simply interact in. We can perform actions, and access
(partial) observations.
"""
... | {
"content_hash": "35120e425e6f9f64a709177b9697e978",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 84,
"avg_line_length": 32.705882352941174,
"alnum_prop": 0.6223021582733813,
"repo_name": "rbalda/neural_ocr",
"id": "8897b3c17d831cf88f7fa77947d7d25ac43ed096",
"size": "16... |
"""This example updates a campaign by setting its status to PAUSED.
To get campaigns, run get_campaigns.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication in... | {
"content_hash": "f56645984bea8f3ac83b4188bf92de27",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 27.23913043478261,
"alnum_prop": 0.6855546687948922,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "f93143e3b27190e7ecde63f1bd8f377a4618a09d",... |
from matplotlib import pyplot
from shapely.geometry import Polygon
from shapely import affinity
from descartes.patch import PolygonPatch
from figures import SIZE, BLUE, GRAY, set_limits, add_origin
fig = pyplot.figure(1, figsize=SIZE, dpi=90)
triangle = Polygon([(1, 1), (2, 3), (3, 1)])
# 1
ax = fig.add_subplot(121... | {
"content_hash": "c8d7beb36f98e5969633aaa09fb3491a",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 66,
"avg_line_length": 26.434782608695652,
"alnum_prop": 0.6620065789473685,
"repo_name": "jdmcbr/Shapely",
"id": "e2ecf7abe8dad4cac66fbe25240616ebb5d6045d",
"size": "1216"... |
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
import warnings
from google.api_core import gapic_v1, grpc_helpers, operations_v1
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: i... | {
"content_hash": "e49d21e9d38338d8cbed6eda60c26a62",
"timestamp": "",
"source": "github",
"line_count": 708,
"max_line_length": 112,
"avg_line_length": 44.932203389830505,
"alnum_prop": 0.6418647051427134,
"repo_name": "googleapis/python-retail",
"id": "b8d625eaa70544c43eae6feffff0b0c5a8b1c315",
"s... |
import os
import sys
import json
import logging
import six
import unittest2
from st2client import models
LOG = logging.getLogger(__name__)
FAKE_ENDPOINT = 'http://127.0.0.1:8268'
RESOURCES = [
{
"id": "123",
"name": "abc",
},
{
"id": "456",
"name": "def"
}
]
class... | {
"content_hash": "8fdf6c577fa012200cbb38cf2d83199b",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 96,
"avg_line_length": 22.934782608695652,
"alnum_prop": 0.5748815165876777,
"repo_name": "tonybaloney/st2",
"id": "9f40ff0329d430af1804eacfe775c8d82f0d313b",
"size": "2890... |
import numpy as np
import torch
import torchvision.models as models
from torch import nn as nn
from rlkit.pythonplusplus import identity
from rlkit.torch.core import PyTorchModule
class PretrainedCNN(PyTorchModule):
# Uses a pretrained CNN architecture from torchvision
def __init__(
self,
... | {
"content_hash": "28c4aa6389129ab9d647f312d93c7117",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 91,
"avg_line_length": 35.86153846153846,
"alnum_prop": 0.5634920634920635,
"repo_name": "vitchyr/rlkit",
"id": "4e4aee3d21ec2108984cc0f17a5b04bc19859726",
"size": "4662",... |
import rospy
from sensor_msgs.msg import LaserScan
class laser_reader:
def __init__(self):
self.laser_sub = rospy.Subscriber("/scan",
LaserScan,
self.callback)
def callback(self, data):
min_range = data.rang... | {
"content_hash": "ca0b09355cac001cf2dea846b7802589",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 56,
"avg_line_length": 23.73913043478261,
"alnum_prop": 0.5128205128205128,
"repo_name": "LCAS/teaching",
"id": "22f60393b0a1630917d17a4f129699cf3cd2c8b5",
"size": "569",
... |
from ..rman_constants import RFB_PREFS_NAME
import bpy
def get_addon_prefs():
try:
addon = bpy.context.preferences.addons[RFB_PREFS_NAME]
return addon.preferences
except:
# try looking for all variants of RFB_PREFS_NAME
for k, v in bpy.context.preferences.addons.items():
... | {
"content_hash": "1a787e6c21f7fb52606b0502e433a7b7",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 29.257142857142856,
"alnum_prop": 0.625,
"repo_name": "prman-pixar/RenderManForBlender",
"id": "dad83defdfa445b4421d1fec8590dd30cc2c91de",
"size": "1... |
import sys
sys.path.append('../../../src/')
import cgmap as cg
import mdtraj as md
from mdtraj.core.element import Element
import md_check as check
############################### config #####################################
input_traj = "dppc.trr"
input_top = "dppc.pdb"
input_maps = ["mapping_bead_1_dppc",
... | {
"content_hash": "461e65aa82e060096c5aa099ac7783da",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 80,
"avg_line_length": 34.03529411764706,
"alnum_prop": 0.5737988247493951,
"repo_name": "uchicago-voth/cgmap",
"id": "a7eb44f8d896a497397ec46575e7c3c7a6ba636a",
"size": "3... |
# coding=utf-8
from django.db import models
from plugins.arduino.models import Arduino, set_command
MODEL = 'OnOffSwitch'
class OnOffSwitch(models.Model):
"""
Модель переключателей с двумя состояниями (on/off).
"""
CONTAINER = 'home'
TYPE = 'OnOffSwitch'
WIDGET_TYPE = 'positioned'
nam... | {
"content_hash": "67c8f29eae0d3bac99282b54cf832eff",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 55,
"avg_line_length": 24.210526315789473,
"alnum_prop": 0.5927536231884057,
"repo_name": "sug4rok/Servus",
"id": "73fb830ed7de406785db01e8747635f9422466d3",
"size": "1499"... |
import torch as T
import numpy as np
from . import core
class Model(T.nn.Module):
def __init__(self, hidden_size):
super().__init__()
self.in_features = T.nn.Linear(6, hidden_size)
d = .2 * (self.in_features.in_features) ** -.5
T.nn.init.uniform_(self.in_features.weight, -d, d)
... | {
"content_hash": "7e782713a06b25d855a6a995292fa779",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 101,
"avg_line_length": 36.19101123595506,
"alnum_prop": 0.5650419124495498,
"repo_name": "DouglasOrr/Snippets",
"id": "7bbdceba6beffcfc2ad7b788adb1d3eb18550779",
"size": "... |
import ConfigParser
import string, os, sys
class Secret(object):
apiKey = "apiKey"
secretKey = "secretKey"
def __init__(self):
cf = ConfigParser.ConfigParser()
cf.read("secret.ini")
#read by type
self.apiKey = cf.get("baidu_secret", "apikey")
self.secretKey = cf.get("baidu_secret", "secretkey")
| {
"content_hash": "6f8b19b5600c1c3516af56ec686b9bcd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 18.705882352941178,
"alnum_prop": 0.6729559748427673,
"repo_name": "fuzhouch/amberalertcn",
"id": "4dff6bbf74e94ade8a50143cc7e975dfdd90abcf",
"size":... |
from numpy import sin, cos, deg2rad, transpose, dot, arcsin, arctan2, zeros,\
ndarray, array, rad2deg, pi
from premat import premat
def precess(ra0, dec0, equinox1, equinox2, fk4=False, radian=False):
# '''NAME:
# PRECESS
# PURPOSE:
# Precess coordinates from EQUINOX1 to EQUINOX2... | {
"content_hash": "daa61235d31d578cabae5c3ec7507f5a",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 95,
"avg_line_length": 38.775193798449614,
"alnum_prop": 0.5833666533386646,
"repo_name": "plasidu/phoenix4iraf",
"id": "882ab7ac030e15edb68d7664d079d54681dfa83b",
"size":... |
_version = (0, 0, 1)
_name = 'Paste.py'
import ConfigParser
import os
import sys
from common import exception
from lib import logger
def version():
return '.'.join(map(str, _version))
def version_tuple():
return _version[:]
def full_version():
return _name + '/' + version()
Raise = object()
_global_filename = ... | {
"content_hash": "84af45aa36a20100693694a3695c569a",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 99,
"avg_line_length": 25.378995433789953,
"alnum_prop": 0.662108672184239,
"repo_name": "jackyyf/paste.py",
"id": "dc92ca46b23b47b1b3870c2093e70efbd6207785",
"size": "560... |
from tweepy.api import API
from celery.decorators import task
@task()
def update_twitter_profile(user):
a = API()
try:
profile = user.get_profile()
twitter_user = a.get_user(user_id=profile.twitter_profile.twitter_id)
except:
twitter_user = None
if twitter_user:
pr... | {
"content_hash": "8abae56de104b058bfa244f485240fa0",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6345177664974619,
"repo_name": "fxdgear/beersocial",
"id": "0188584a71d54bc26d6215cfc6c91db5110f0112",
"size": "7... |
"""Classes and methods to describe contract Providers."""
class Provider(object):
"""A Pact provider."""
def __init__(self, name):
"""
Create a new Provider.
:param name: The name of this provider. This will be shown in the Pact
when it is published.
:type name: s... | {
"content_hash": "f230ace53bd0a3b087eb82d8eb671b24",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 24,
"alnum_prop": 0.5638888888888889,
"repo_name": "pact-foundation/pact-python",
"id": "543f0152dbd56dd40046b2846dba485a3eb4e9f1",
"size": "360",
... |
from django.conf.urls.defaults import *
urlpatterns = patterns('aquaticore.about.views.',
(r'^$', 'index'),
)
| {
"content_hash": "6730b47aa66ee2c9b900cb693bcfe931",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 28,
"alnum_prop": 0.55,
"repo_name": "rockerBOO/aquaticore",
"id": "44d033be87979c73ba966541e70d95f66ef03a8a",
"size": "140",
"binary": false,
"co... |
"""Support for MQTT climate devices."""
import logging
import voluptuous as vol
from homeassistant.components import climate, mqtt
from homeassistant.components.climate import (
PLATFORM_SCHEMA as CLIMATE_PLATFORM_SCHEMA,
ClimateDevice,
)
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE... | {
"content_hash": "500d456602f8ae7f4ad46ea4c05b6eff",
"timestamp": "",
"source": "github",
"line_count": 876,
"max_line_length": 88,
"avg_line_length": 35.60730593607306,
"alnum_prop": 0.6140997691715825,
"repo_name": "qedi-r/home-assistant",
"id": "4b163c523fa6d6ee41b7b1eec2950a035a20b7a4",
"size":... |
"""
bottle plugin of template
~~~~~~~~~~~~~~~~
template for bottle.
[DEPRECATED]
please using TemplatePlugin replace it.
:copyright: 20150904 by [email protected].
"""
import sys
PY3=sys.version>"3"
import inspect
import bottle
import logging
logger = logging.getLogger(__name__)
# ... | {
"content_hash": "6f057e135b6d0cd6aabf89775b8653a3",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 63,
"avg_line_length": 21.982142857142858,
"alnum_prop": 0.6190089358245329,
"repo_name": "raptorz/bottle-plugins",
"id": "0ec5b0c6403b5b1beac35d231df2c75df62ab7a4",
"size"... |
import requests
import xmltodict
import sqlite3
#create db and tables
conn = sqlite3.connect('ordanotkun.db')
c = conn.cursor()
try:
#save speech/speaker/session/speech start/speech end
c.execute('''CREATE TABLE ordanotkun(
speech_text text,
speaker text,
session text,
speech_start text,
speech_end tex... | {
"content_hash": "267c0eb78dc21c845bd6b482d9ecaa56",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 86,
"avg_line_length": 24.553571428571427,
"alnum_prop": 0.6727272727272727,
"repo_name": "bjornlevi/5thpower",
"id": "217bfa6502e3e9c7d7847e59677a5d079022e109",
"size": "1... |
'''
================================================================================
This confidential and proprietary software may be used only
as authorized by a licensing agreement from Thumb o'Cat Inc.
In the event of publication, the following notice is applicable:
Copyright (C) 2013 - 2014 Thumb o'Cat... | {
"content_hash": "2e523855b731cfa34208e4fb5aa78c2e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 97,
"avg_line_length": 29.227272727272727,
"alnum_prop": 0.5171073094867807,
"repo_name": "luuvish/libvio",
"id": "a330655529ea748e2cf1ca14eab9bfbc1a68bed9",
"size": "2597"... |
import mimetypes
def guess_kind_from_filename(filepath):
"""Return a document kind (image, audio...) guessed from a filename. If
no kind can be guessed, returns None."""
if filepath:
content_type, encoding = mimetypes.guess_type(filepath)
return guess_kind_from_content_type(content_type)
... | {
"content_hash": "834f770c0cb1a6c8e02a4bf8f67362ef",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 35.36842105263158,
"alnum_prop": 0.6502976190476191,
"repo_name": "Lcaracol/ideasbox.lan",
"id": "6626ff35c8c121719cfecf4268770053a9dfe367",
"size": ... |
import requests
from .Backup import Backup
from .BackupContainer import BackupContainer
from .Bridge import Bridge
from .BridgeCreate import BridgeCreate
from .BridgeCreateSetting import BridgeCreateSetting
from .CPUInfo import CPUInfo
from .CPUStats import CPUStats
from .CloudInit import CloudInit
from .Cluster impo... | {
"content_hash": "467fb52f6311ac826071ed4c6c558a38",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 86,
"avg_line_length": 39.77142857142857,
"alnum_prop": 0.8708692528735632,
"repo_name": "g8os/grid",
"id": "20b8d034f0fdca4d362dc874c1fd1d9f844ae8cf",
"size": "5568",
"... |
from sqlalchemy.orm import relationship
from emonitor.extensions import db
from .alarmtype import AlarmType
import yaml
class AlarmSection(db.Model):
"""
AlarmSection class for sections of alarm type :py:class:`emonitor.modules.alarms.alarmtype.AlarmType`
"""
__tablename__ = 'alarmsections'
__... | {
"content_hash": "2225a9f696c3433b78c484452b7a10d3",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 105,
"avg_line_length": 34.13414634146341,
"alnum_prop": 0.6120042872454448,
"repo_name": "sambandi/eMonitor",
"id": "92e92094f941c7de5a96742e27912adb2626eca3",
"size": "27... |
"""Python client API for CouchDB.
>>> server = Server('http://localhost:5984/')
>>> db = server.create('python-tests')
>>> doc_id = db.create({'type': 'Person', 'name': 'John Doe'})
>>> doc = db[doc_id]
>>> doc['type']
'Person'
>>> doc['name']
'John Doe'
>>> del db[doc.id]
>>> doc.id in db
False
>>> del server['pytho... | {
"content_hash": "3a36c5bee88a5b6708686cfd1c0dc9e4",
"timestamp": "",
"source": "github",
"line_count": 943,
"max_line_length": 80,
"avg_line_length": 33.787910922587486,
"alnum_prop": 0.5570271797125101,
"repo_name": "kocolosk/couchdb-python",
"id": "b6d3186036689180efd53f190e484b0a61b88a94",
"siz... |
"""Contains a collection of util functions for model construction.
"""
import numpy
import tensorflow as tf
from tensorflow import logging
from tensorflow import flags
import tensorflow.contrib.slim as slim
def SampleRandomSequence(model_input, num_frames, num_samples):
"""Samples a random sequence of frames of size... | {
"content_hash": "4478f08bd13776c341020f91a6b02acc",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.6725903614457831,
"repo_name": "mwoodson1/youtube-8m-competition",
"id": "3890c5cc5fff4022b4822ac0ece32a3c3a3de3e1"... |
import os
from tempfile import TemporaryFile
from dateparser.data.languages_info import language_locale_dict
def to_string(data):
result = ''
language_column_width = 18
for language in sorted(data):
result += language
locales = data[language]
if locales:
result += ' ' ... | {
"content_hash": "f7de00572b79c0d48b7966a799056b1e",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 104,
"avg_line_length": 31.565217391304348,
"alnum_prop": 0.5365013774104683,
"repo_name": "scrapinghub/dateparser",
"id": "1b72c850fea07c3271436b8150456003e62ada56",
"size... |
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import codecs
import os
import re
import urllib2
import urlparse
from xml.dom.minidom import Document
# Path to the XML file with signatures
MSSQL_XML = os.path.abspath("../../xml/banner/mssql.xml... | {
"content_hash": "bd1c1eaa7f731c5006179688f44f71c1",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 160,
"avg_line_length": 37.77777777777778,
"alnum_prop": 0.6133333333333333,
"repo_name": "JeyZeta/Dangerous",
"id": "65ec692dab3abb24a12cc34f797aafbc490b6b5f",
"size": "5... |
import ta_synckvstore_declare
from splunktaucclib.rest_handler.endpoint import (
field,
validator,
RestModel,
DataInputModel,
)
from splunktaucclib.rest_handler import admin_external, util
from splunk_aoblib.rest_migration import ConfigMigrationHandler
util.remove_http_proxy_env_vars()
fields = [
... | {
"content_hash": "bd4148901f886cd6a821d9a6f520734f",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 63,
"avg_line_length": 20.454545454545453,
"alnum_prop": 0.5252525252525253,
"repo_name": "georgestarcher/TA-SyncKVStore",
"id": "5bb3bddcda51dbce45db9eef16a73bf046743884",
... |
"""
Try to detect a D compiler from the list of supported compilers::
def options(opt):
opt.load('compiler_d')
def configure(cnf):
cnf.load('compiler_d')
def build(bld):
bld.program(source='main.d', target='app')
Only three D compilers are really present at the moment:
* gdc
* dmd, the ldc compiler having a... | {
"content_hash": "3c898ee2fa0416f07e2c6ab9661f5dcb",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 97,
"avg_line_length": 27,
"alnum_prop": 0.6953703703703704,
"repo_name": "MarekIgnaszak/econ-project-templates",
"id": "43bb1f646ab9b757d5f0fd719c3c5236dcf07119",
"size": ... |
from __future__ import unicode_literals
from mcfw.rpc import returns, arguments
from rogerthat.bizz.maps import gipod, reports, services
from rogerthat.bizz.maps.poi import map as poi_map
from rogerthat.rpc import users
from rogerthat.rpc.rpc import expose
from rogerthat.to.maps import GetMapResponseTO, GetMapRequestT... | {
"content_hash": "022e10280f0f96ff55f65280fb3ab77a",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 112,
"avg_line_length": 39.94736842105263,
"alnum_prop": 0.7378129117259552,
"repo_name": "our-city-app/oca-backend",
"id": "f2439327b86c9e8d53eeab98340f77948452bbb0",
"si... |
import random, sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from math import sqrt
inside = 0
piresults = {}
errorsize = {}
pi = np.pi
points = []
print ("\n" * 20)
print("****Welcome to Monte Carlo PI Simulator***")
print("Note: Simulating less than 1... | {
"content_hash": "941042e3bdb3c061244775bd240bcaf5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 109,
"avg_line_length": 25.415730337078653,
"alnum_prop": 0.6180371352785146,
"repo_name": "eenchev/MontePI",
"id": "7fd4461a476229382be755102c40901f8e75c3ed",
"size": "228... |
"""Execution contexts for the native backend."""
from collections.abc import Sequence
from concurrent import futures
import os
import os.path
import signal
import stat
import subprocess
import sys
import time
from typing import Optional
from absl import logging
import grpc
import lzma # pylint: disable=g-bad-import-... | {
"content_hash": "9141b9ee962e22f499465f643c9b722b",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 108,
"avg_line_length": 42.4065335753176,
"alnum_prop": 0.7102199777454421,
"repo_name": "tensorflow/federated",
"id": "52df5baa897a8524a28869f0a313f2e06dc3f7d8",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.