text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import subprocess
import sys
def SplitArgsIntoSections(args):
sections = []
while len(args) > 0:
if not '--' in args:
# If there is no '--' left, everything remaining is an entire section.
dashes = len(args)
else:
dashes = args.index('--')
... | {
"content_hash": "fcf990d1537f9cb13309fc7c8393a4ca",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 83,
"avg_line_length": 26.163636363636364,
"alnum_prop": 0.5927727588603197,
"repo_name": "Xperia-Nicki/android_platform_sony_nicki",
"id": "6f017fc385704dce8d3081529dafc52f1... |
import sys, os
import re
# Our testing module
import svntest
from svntest.verify import SVNUnexpectedStdout, SVNUnexpectedStderr
from svntest.verify import SVNExpectedStderr
from svntest.main import write_restrictive_svnserve_conf
from svntest.main import server_has_partial_replay
# (abbreviation)
Skip = svntest.test... | {
"content_hash": "505aa9ebd8d4c5fa556bb3c4664618e1",
"timestamp": "",
"source": "github",
"line_count": 1026,
"max_line_length": 81,
"avg_line_length": 40.58674463937622,
"alnum_prop": 0.5722827914125163,
"repo_name": "YueLinHo/Subversion",
"id": "ae6a7e022dfdcea3d2b84181ff4c97640c1b2045",
"size": ... |
import json
import time
import logging
import functools
import httplib as http
from urllib2 import unquote
import bleach
from flask import request
from modularodm import Q
from framework.auth.decorators import collect_auth
from framework.auth.decorators import must_be_logged_in
from website import settings
from web... | {
"content_hash": "fd890dd38c6ca07e43a65ff3c6475bbd",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 120,
"avg_line_length": 34.820689655172416,
"alnum_prop": 0.6385422856011091,
"repo_name": "GageGaskins/osf.io",
"id": "2bd36b44eb33f713988a8cb4a8352b4eb7bc3b43",
"size": ... |
"""Auto-generated file, do not edit by hand. AZ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_AZ = PhoneMetadata(id='AZ', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[148]\\d{2,3}', possible_number_pattern... | {
"content_hash": "abc7fadf69d1a60c0aef97237966d196",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 141,
"avg_line_length": 84.58333333333333,
"alnum_prop": 0.7408866995073892,
"repo_name": "xHeliotrope/injustice_dropper",
"id": "ab8308bd28ac64def732a813c816b410cca05456",
... |
import librosa
# import re
# import pydub
# import os
__all__ = [
'Reader'
]
class Reader:
"""
Read input audio file
file_name: 'path/to/file/filename.mp3'
"""
def __init__(self, file_name):
self.file_name = file_name
pass
def read_audio_file(self,length):
"""
... | {
"content_hash": "ac9cc5475758573e39b9a94137dc7af0",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 120,
"avg_line_length": 32.146067415730336,
"alnum_prop": 0.5456134218804614,
"repo_name": "aixiwang/audio_feature_sender",
"id": "8eb25389733b286c03d1143cc9214fb0dac80085",
... |
import pandas as pd
from bokeh.io import curdoc
from bokeh.layouts import row
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import RadioButtonGroup
from bokeh.plotting import figure
x=[3,4,6,12,10,1,5,6,3,8]
y=[7,1,3,4,1,6,10,4,10,3]
label=['Red', 'Orange', 'Red', 'Orange','Red', 'Orange','Red', ... | {
"content_hash": "8748e7bd0db3993966759600e7da7fb6",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 89,
"avg_line_length": 32.75,
"alnum_prop": 0.6969465648854962,
"repo_name": "timsnyder/bokeh",
"id": "91e545d4c5ffe1bde61bc51930c84e94ce560392",
"size": "1349",
"binary"... |
import os
import sys
import subprocess
import argparse
import textwrap
# Append the src dir
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src'))
import passes
# TODO: This should not be hard coded.
PIPELINES = ["PreSpecialize", "HighLevel", "EarlyLoopOpt", "MidLevelOpt", ... | {
"content_hash": "abfda043652fc04e78828bf922887985",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 157,
"avg_line_length": 42.46491228070175,
"alnum_prop": 0.6740342904358604,
"repo_name": "adrfer/swift",
"id": "ae1efc29af070dc9acf5a555dcd47d442638e791",
"size": "4864",... |
from ._azure_digital_twins_management_client import AzureDigitalTwinsManagementClient
__all__ = ['AzureDigitalTwinsManagementClient']
| {
"content_hash": "6c8dfbcc739fc5351c5dd8638d5142a0",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 85,
"avg_line_length": 67,
"alnum_prop": 0.835820895522388,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c42c1ad6def42c3273163cb6bee808a85ada17b9",
"size": "602",
"bi... |
import unittest
from conans.test.utils.tools import TestClient, TestServer
from conans.paths import CONANFILE
from conans.util.files import load
import os
from nose_parameterized import parameterized
class VersionRangesMultiRemoteTest(unittest.TestCase):
def setUp(self):
self.servers = {"default": TestSe... | {
"content_hash": "89be62a1400859e0588cd4916958ea78",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 103,
"avg_line_length": 46.58389261744966,
"alnum_prop": 0.5742688373433222,
"repo_name": "lasote/conan",
"id": "de8a8acbfed4293de2fdaceb398bac1526b007d8",
"size": "6941",... |
import klampt
from klampt.trajectory import Trajectory
def configToDrivers(robot,q):
"""Converts a configuration of the robot's drivers to a configuration of the robot"""
n = robot.numLinks()
assert n == len(q),"Configuration does not match robot model, %d vs %d"%(nd,len(q))
nd = robot.numDrivers()
... | {
"content_hash": "bf301cb7055081b1334f21d5b933358b",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 89,
"avg_line_length": 30.645833333333332,
"alnum_prop": 0.6430999320190347,
"repo_name": "arocchi/Klampt",
"id": "f5195662a1e62c77f191f4b1f9f9ca0fdd8293c9",
"size": "1471"... |
from collections import defaultdict
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import UserPassesTestMixin
from django.conf import settings
from django.core.mail import send_mail
from django.db.models import Subquery
from django.urls import reverse... | {
"content_hash": "bfbc03a7cf1067cc038b266600dad686",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 113,
"avg_line_length": 35.933734939759034,
"alnum_prop": 0.6804694048616932,
"repo_name": "manhhomienbienthuy/pythondotorg",
"id": "517c1419a41eb124dce5f06dbee36ad9e5c20981... |
import logging
import os
from framework.bizz.i18n import get_user_language
from framework.consts import TEMPLATE_PATH, JINJA_ENVIRONMENT
from framework.errors.plugins import PluginNotFoundException
from framework.i18n_utils import translate
from framework.plugin_loader import get_branding_plugin
from google.appengine.... | {
"content_hash": "c587842eca4f522c0537fe88fd4d525d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 108,
"avg_line_length": 32.49295774647887,
"alnum_prop": 0.6657997399219766,
"repo_name": "rogerthat-platform/gae-plugin-framework",
"id": "ed8505ec779d0a83b76dd51f2bfa6bf5e2... |
"""TensorFlow Eager execution prototype.
EXPERIMENTAL: APIs here are unstable and likely to change without notice.
To use, at program startup, call `tfe.enable_eager_execution()`.
@@metrics
@@list_devices
@@num_gpus
@@py_func
@@defun
@@make_template
@@implicit_gradients
@@implicit_value_and_gradients
@@gradients_f... | {
"content_hash": "a3617779cdd783dc97601279dc1069a7",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 124,
"avg_line_length": 35.785714285714285,
"alnum_prop": 0.8287868707030384,
"repo_name": "benoitsteiner/tensorflow-xsmm",
"id": "ca6430253b67d825290b6a376ba3f29b3ae67577",... |
from os import environ, remove, path
import subprocess
jenkins_scripts = environ.get("JENKINS_SCRIPTS")
aws_access_key = environ.get("AWS_ACCESS_KEY")
aws_secret_key = environ.get("AWS_SECRET_KEY")
domain_name=environ.get('Domain_Name')
state=environ.get('State')
city=environ.get('City')
legal_name=environ.get('Legal... | {
"content_hash": "7e0c3d19b2ce2681b3e064aa232cd015",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 257,
"avg_line_length": 54.297872340425535,
"alnum_prop": 0.7394200626959248,
"repo_name": "TopherGopher/aws-infra.jenkins-scripts",
"id": "9d4931596e5f4bb9b9b9c758a102f61845... |
"""Tests for the IMPALA loss function."""
from acme.adders import reverb as adders
from acme.jax.losses import impala
from acme.utils.tree_utils import tree_map
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import reverb
from absl.testing import absltest
class ImpalaTest(absltest.TestCase... | {
"content_hash": "659bd491c9d994beb86d9570cdb236fb",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 27.850574712643677,
"alnum_prop": 0.6545604622368965,
"repo_name": "deepmind/acme",
"id": "b8f2739680c77d9aae4108694bcea39e80da3a90",
"size": "3039",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scraper', '0004_serie_last_updated'),
]
operations = [
migrations.AlterField(
model_name='serie',
name='last_updated',
... | {
"content_hash": "8ca75d144224414e6da4cddd705367c4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 54,
"avg_line_length": 21.5,
"alnum_prop": 0.5968992248062015,
"repo_name": "pieromarini/fmovies",
"id": "2529d435380a2b4642949b88690ab1c5256d21f1",
"size": "460",
"binar... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Measure',
fields=[
('id', models.AutoField(auto_cre... | {
"content_hash": "cb7673683d53dc851e47331431d3aff8",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 114,
"avg_line_length": 25.47826086956522,
"alnum_prop": 0.5546075085324232,
"repo_name": "paulojoao/fixed_income",
"id": "dec8901d58f404e1dd9ab6553465a79c6ab09fc3",
"size"... |
from django.conf import settings
from rest_framework.authtoken.models import Token as DefaultTokenModel
from .utils import import_callable
# Register your models here.
TokenModel = import_callable(
getattr(settings, 'REST_AUTH_TOKEN_MODEL', DefaultTokenModel))
| {
"content_hash": "3fd53b3632101cb43d5fe775cb1148ae",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 70,
"avg_line_length": 26.9,
"alnum_prop": 0.7992565055762082,
"repo_name": "maxim-kht/django-rest-auth",
"id": "a132f9c032456624f487ef0c0d182a117ef3b596",
"size": "269",
... |
"""
Python implementation of common model fitting operations to
analyse protein folding data. Simply automates some fitting
and value calculation. Will be extended to include phi-value
analysis and other common calculations.
Allows for quick model evaluation and plotting.
Also tried to make this somewhat abstract and... | {
"content_hash": "f44ec21f477fcd2213260bcc0f029153",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 88,
"avg_line_length": 22,
"alnum_prop": 0.6962566844919786,
"repo_name": "quantumjot/PyFolding",
"id": "7f726e78a1f5b628ab004cc26f42eee3e9ba2d12",
"size": "1895",
"binar... |
from .convdeconv import build_network
from .convdeconv import curr_layer, curr_stacks, curr_flags, curr_model
from .utils import get_loss
from .api import curr_batchsize,curr_filters,curr_width,curr_height,curr_depth
__all__ = [
build_network, curr_layer, curr_stacks, curr_flags,
curr_model, get_loss, ... | {
"content_hash": "fb16adff15ba829de57b5077305b0e35",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 92,
"avg_line_length": 47.875,
"alnum_prop": 0.7493472584856397,
"repo_name": "guoxuesong/deepstacks",
"id": "6d8944bf7dafd56aabedb850bab46edb7005163d",
"size": "383",
"bi... |
from .utils import (
compare_version, convert_port_bindings, convert_volume_binds,
mkbuildcontext, tar, exclude_paths, parse_repository_tag, parse_host,
kwargs_from_env, convert_filters, create_host_config,
create_container_config, parse_bytes, ping_registry, parse_env_file,
version_lt, version_gte,... | {
"content_hash": "e1b35612aec4be78eb985c3dc00ba3bc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 49.6,
"alnum_prop": 0.7540322580645161,
"repo_name": "olsaki/docker-py",
"id": "e27700e4dabad4502bbbb4f264bc5e4c8b1eb132",
"size": "496",
"binary":... |
import sys
import unittest
from buildozer import BuildozerCommandException
from buildozer.scripts import client
from unittest import mock
class TestClient(unittest.TestCase):
def test_run_command_called(self):
"""
Checks Buildozer.run_command() is being called with arguments from command line.
... | {
"content_hash": "50203434e8c72db4f778458da1d57f0c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 89,
"avg_line_length": 35.69230769230769,
"alnum_prop": 0.6637931034482759,
"repo_name": "rnixx/buildozer",
"id": "7c24bd5e5beb1eab0a297e0172823d1fb87d751a",
"size": "928",... |
"""Spam verification tests"""
from types import SimpleNamespace
from akismet import AkismetError
import pytest
from django.contrib.contenttypes.models import ContentType
from channels.constants import POST_TYPE, COMMENT_TYPE
from channels.factories.models import PostFactory, CommentFactory
from channels.models import... | {
"content_hash": "94422a71c0e082a3fa0d66a909849847",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 94,
"avg_line_length": 33.203252032520325,
"alnum_prop": 0.6778893241919687,
"repo_name": "mitodl/open-discussions",
"id": "385f3fb24f49916f302a1a28215601042e4825bc",
"siz... |
import json
import glob
import itertools
import logging
import math
import os
import re
import warnings
from pathlib import Path
import xml.etree.cElementTree as ET
from collections import defaultdict
from io import StringIO
import collections
import numpy as np
from monty.io import zopen, reverse_readfile
from monty.... | {
"content_hash": "21b5fa18c029fe0a68e42a6696f4edb8",
"timestamp": "",
"source": "github",
"line_count": 4476,
"max_line_length": 139,
"avg_line_length": 41.665549597855225,
"alnum_prop": 0.5119440199469155,
"repo_name": "dongsenfo/pymatgen",
"id": "2bb7193d1aff9b225fac2d032053b71d17754645",
"size":... |
"""
Base classes representing defects.
"""
import logging
from abc import ABCMeta, abstractmethod
from functools import lru_cache
import numpy as np
from monty.json import MontyDecoder, MSONable
from pymatgen.core.composition import Composition
from pymatgen.core.structure import PeriodicSite, Structure
from pymatg... | {
"content_hash": "afa8392e17b66fbb815ec15902013f5c",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 118,
"avg_line_length": 34.909470752089135,
"alnum_prop": 0.607181328545781,
"repo_name": "richardtran415/pymatgen",
"id": "d068cae89358c36d05f1d9f2a3b8c6e96a93709e",
"siz... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from ..elements import Attribute
from ..elements.elementbase import LogicElement
from ..tags.context import ContextElementBase, DataSetter
from .. import logic
from ..urlmapper import URLMapper, Missing... | {
"content_hash": "ba78f664b9be4a526e3e4ad83b850d73",
"timestamp": "",
"source": "github",
"line_count": 1034,
"max_line_length": 213,
"avg_line_length": 33.845261121856865,
"alnum_prop": 0.5552920333752429,
"repo_name": "moyaproject/moya",
"id": "a4a94de479ad444e62d5c5754fb01c753297dfe3",
"size": "... |
"""Functionality to build scripts, as well as signature hash functions.
This file is modified from python-fujicoinlib.
"""
from collections import namedtuple
import struct
import unittest
from typing import List, Dict
from .key import TaggedHash, tweak_add_pubkey
from .messages import (
CTransaction,
CTxOut... | {
"content_hash": "05b2e336342d40a65078c123c8f81030",
"timestamp": "",
"source": "github",
"line_count": 895,
"max_line_length": 201,
"avg_line_length": 33.23575418994413,
"alnum_prop": 0.5981980770523768,
"repo_name": "fujicoin/fujicoin",
"id": "57db3ee6770db70470faf794941291d765f53a8c",
"size": "2... |
"""
Handles all requests relating to volume replication.
"""
import functools
from oslo_config import cfg
from cinder.db import base
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
from cinder import policy
from cinder import volume as cinder_volume
from cinde... | {
"content_hash": "743ecfdc6febea0feb80976b4b2e9ba6",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 78,
"avg_line_length": 36.76,
"alnum_prop": 0.5867791077257889,
"repo_name": "abusse/cinder",
"id": "49d9fa3d03d0ac0ed548d958f33d1561138158f8",
"size": "4278",
"binary":... |
from django.conf import settings
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_dirs, find_file, read_text_file
from subprocess import Popen, PIPE
import os
import posixpath
import re
import sys
#... | {
"content_hash": "a4bbaf686e5dc28ffbdc8bde20d8f144",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 82,
"avg_line_length": 38.36538461538461,
"alnum_prop": 0.5540517961570594,
"repo_name": "adieu/django-mediagenerator",
"id": "1af870bb5155e118a378aeb301afd5d1d1bb9d14",
"... |
import json
import os
import mock
from oslo_policy import policy as common_policy
import six
from six.moves.urllib import request as urlrequest
from testtools import matchers
from keystone import exception
from keystone.policy.backends import rules
from keystone.tests import unit as tests
from keystone.tests.unit.ksf... | {
"content_hash": "c32aba5af3a68a4ca2b78a0963552c07",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 78,
"avg_line_length": 39.8671875,
"alnum_prop": 0.6051342347638644,
"repo_name": "jamielennox/keystone",
"id": "30df0b2bd917cb2d30b230e0a004c5606df7d9cd",
"size": "10849"... |
import sublime
import sublime_plugin
# This may fail
sublime.load_settings()
# This is safe
sublime.arch()
def plugin_loaded():
# Also safe
sublime.load_settings()
class Listener(sublime_plugin.EventListener):
def __init__(self):
# Again, unsafe
sublime.run_command()
def on_load(s... | {
"content_hash": "00800292d3590cb1677f979b92a62b6e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 55,
"avg_line_length": 17.289473684210527,
"alnum_prop": 0.6514459665144596,
"repo_name": "packagecontrol/package_reviewer",
"id": "f5252fe9b844ac053d1438ee6e98434dd64c5804",... |
"""The Package that contains all the news commands for the disim department"""
import telegram
from telegram.ext import ConversationHandler
from libs import utils
def disim(bot, update):
"""Defining the command to retrieve 5 news
Now we store the last 10 news into the database,
the comparison to send noti... | {
"content_hash": "ba9e2d223fd495bd13c07eaf987af482",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 93,
"avg_line_length": 43.703125,
"alnum_prop": 0.6371111905613157,
"repo_name": "UnivaqTelegramBot/UnivaqInformaticaBot",
"id": "d11ae504a22dc07e30a322398446b0f5ee1e868b",
... |
import math
class Point:
def __init__(self, label, x=0.0, y=0.0):
self.label = label
self.x = x
self.y = y
def distance(self, other):
dx = self.x - other.x
dy = self.y - other.y
return math.sqrt(dx ** 2 + dy ** 2)
def __eq__(self, other):
if type(ot... | {
"content_hash": "08fa4b4c6e3cffb357bfa7559c947f49",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 26.26086956521739,
"alnum_prop": 0.5364238410596026,
"repo_name": "lcabrini/prog-python",
"id": "2b46c448c8c4a7227e06b9949f1f722355c4a9c1",
"size": "... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 12, transform = "Difference", sigma = 0.0, exog_count = 0, ar_order = 0); | {
"content_hash": "610aa3f87b0fce1ef3e108f156d548e9",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 170,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.7111111111111111,
"repo_name": "antoinecarme/pyaf",
"id": "f9ac93a2c81a68061db685e8c91fc5a5421784af",
"size": "270... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from apps.canvas_auth.models import User
from canvas.knobs import SUGGESTED_USERS
from canvas.models import UserInfo
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
... | {
"content_hash": "3f82b012f61abbc86bde675e0357e427",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 49,
"avg_line_length": 25.205128205128204,
"alnum_prop": 0.5818921668362157,
"repo_name": "drawquest/drawquest-web",
"id": "78ffc7cafed1ac0be9a0bf3b056b338a8451adf4",
"size... |
import rethinkdb as r
class Access(object):
def __init__(self, user_id, project_id, project_name):
self.user_id = user_id
self.project_id = project_id
self.project_name = project_name
self.dataset = ""
self.permissions = ""
self.status = ""
self.birthtime = ... | {
"content_hash": "ad11a8e05e423cd331d5fec37f98551e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 28,
"alnum_prop": 0.5796703296703297,
"repo_name": "materials-commons/materialscommons.org",
"id": "6a4a90ec97a1bda4edaa79d06ceb6389d8e8a287",
"size"... |
"""Main.py is the top level script.
Loads the Bottle framework and mounts controllers. Also adds a custom error
handler.
"""
from google.appengine.api import memcache, urlfetch
# import the Bottle framework
from server.lib.bottle import Bottle, request, response, template
import json, logging, StringIO, urllib2
from... | {
"content_hash": "65a0c3d210a8a19a34e58d97193884c7",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 124,
"avg_line_length": 37.97945205479452,
"alnum_prop": 0.6928764652840397,
"repo_name": "psydrake/darkcoinBalance",
"id": "224376f7be4f89cdde745c898d0d212889e844a5",
"si... |
import struct
class StructField:
'''
Descriptor representing a simple structure field
'''
def __init__(self, format, offset):
self.format = format
self.offset = offset
def __get__(self, instance, cls):
if instance is None:
return self
else:
r ... | {
"content_hash": "c31559452efce88765d2d0a2d77bc93d",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 81,
"avg_line_length": 32.06956521739131,
"alnum_prop": 0.5192516268980477,
"repo_name": "huawei-cloud/compass-adapters",
"id": "b89b702171e76ff8de622249154ffdfb346532af",
... |
import os
import sys
import struct
import logging
import time
import subprocess
import argparse
import socketserver
import threading
import hashlib
import queue
from urllib.parse import urlparse
# Global variable use to sync between log and request services.
runner = None
# INADDR_ANY as default
HOST = ''
PORT_LOG = ... | {
"content_hash": "1add4c1e927ba724970fef323147421a",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 83,
"avg_line_length": 28.555900621118013,
"alnum_prop": 0.5741163675910821,
"repo_name": "zephyrproject-rtos/zephyr",
"id": "6fb777fdb6385e119582a33daaaf38cf7baf87fa",
"s... |
"""Lists all the apks for a given app."""
import argparse
from apiclient.discovery import build
import httplib2
from oauth2client import client
SERVICE_ACCOUNT_EMAIL = (
'ENTER_YOUR_SERVICE_ACCOUNT_EMAIL_HERE@developer.gserviceaccount.com')
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_... | {
"content_hash": "ae6f4891da88dce481427f69f7df3bfd",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 31.032258064516128,
"alnum_prop": 0.6954261954261954,
"repo_name": "hyogij/android-play-publisher-api",
"id": "a98612cb16b1136d40d171627023449a31303d6e... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pipeline_task.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue ... | {
"content_hash": "1e13f669489c1d4d361ff1c258771721",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.57142857142857,
"alnum_prop": 0.6223067173637515,
"repo_name": "Reriiru/test_task",
"id": "e55269b36e1afcdbccd7bbef7c7f531c2ac56915",
"size": "811... |
import copy
import datetime
import cryptography
from cursive import exception as cursive_exception
import ddt
import glanceclient.exc
from glanceclient.v1 import images
from glanceclient.v2 import schemas
from keystoneauth1 import loading as ks_loading
import mock
from oslo_utils.fixture import uuidsentinel as uuids
i... | {
"content_hash": "45a03087a4f9f5be52e6ba91600ad2cd",
"timestamp": "",
"source": "github",
"line_count": 2010,
"max_line_length": 79,
"avg_line_length": 42.939303482587064,
"alnum_prop": 0.5865968392269546,
"repo_name": "mikalstill/nova",
"id": "c4608aff95b4560410be4418c43ad5b53c65bc32",
"size": "86... |
import sys, os
# Find common code relative in file system. Not using packages for test stuff.
sys.path.insert(
0,
os.path.normpath(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
".."
)
)
)
from test_common import (
executeReferenceChecked,
my_prin... | {
"content_hash": "97c8e3d0cb6486957b63fdc9f1a8bf58",
"timestamp": "",
"source": "github",
"line_count": 848,
"max_line_length": 79,
"avg_line_length": 16.42688679245283,
"alnum_prop": 0.548600143575018,
"repo_name": "tempbottle/Nuitka",
"id": "0b8a5c313f1dc4d4f2bc81c0da8a62949ec14582",
"size": "146... |
from sys import stdin
from sys import stdout
import tensorflow as tf
import os
from tnn_Ziyuan import tnn
import argparse
import json
import numpy as np
from dataset import Dataset
from utils import *
from data_pipeline import *
from function_test import *
def parse_args():
description = "Generative Adversarial Ne... | {
"content_hash": "4b14789b1242ce09332d48a13d562d58",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 119,
"avg_line_length": 31.17543859649123,
"alnum_prop": 0.5579628587507034,
"repo_name": "pxzhang94/GAN",
"id": "c6e54f9b60b22448f67c08b98bd7ffe2067da76d",
"size": "7108"... |
class LshBase(object):
def run(self, docuemnt):
raise NotImplementedError("Subclasses should implement run()") | {
"content_hash": "c77ac21bf23df526a81cbf5cf7b4998f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 70,
"avg_line_length": 30.75,
"alnum_prop": 0.7154471544715447,
"repo_name": "singhj/locality-sensitive-hashing",
"id": "c7a30e2548744461112af0d49fa607c0e5b1efd9",
"size": "... |
"""
A fake server that "responds" to API methods with pre-canned responses.
All of these responses come from the spec, so if for some reason the spec's
wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
###################################... | {
"content_hash": "e5d0fa268f157314d147692db85cf400",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 78,
"avg_line_length": 33.4,
"alnum_prop": 0.5372112917023096,
"repo_name": "Mercador/python-keystoneclient",
"id": "0bb61851aefbd0884b3614ff38d75494fefb5679",
"size": "64... |
import httplib
import json
import requests
# conn = httplib.HTTPSConnection("http://0.0.0.0:5100")
base = "/api/v0.1/87b7188171a6f6eed3ce7591ec175fe0e088e43cb282fa21a13a54d07826a073/admin"
headers = {"Accept": "application/json"}
def file_create(data={}):
conn = httplib.HTTPConnection("0.0.0.0", 5100)
conn.re... | {
"content_hash": "760cf0bad9c603110b1a0a2d9e39d6fe",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 98,
"avg_line_length": 31.854368932038835,
"alnum_prop": 0.6464492532764401,
"repo_name": "wd15/corr",
"id": "f4b49bdae23567b476ce4fcb55e7f1ba54b66710",
"size": "3281",
... |
from django.db import migrations
import ia_storage.fields
import ia_storage.storage
class Migration(migrations.Migration):
dependencies = [
('calaccess_raw', '0021_auto_20210614_1604'),
]
operations = [
migrations.AlterField(
model_name='rawdatafile',
name='clean_... | {
"content_hash": "4f7753061ad898c92fbacd3a1a741b4a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 346,
"avg_line_length": 46.78260869565217,
"alnum_prop": 0.6914498141263941,
"repo_name": "california-civic-data-coalition/django-calaccess-raw-data",
"id": "e900fd9aefdb4487... |
"""Support for Spider thermostats."""
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_T... | {
"content_hash": "e72b69a572ca59a78c847c71757552b3",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 83,
"avg_line_length": 27.56934306569343,
"alnum_prop": 0.6449563145353455,
"repo_name": "titilambert/home-assistant",
"id": "015606286e2bf787c8d54730e8146b6cbfe58141",
"s... |
import pybasis
import pyam
fp = open('orbitals.dat')
orbitals = pybasis.nlj_orbital.ParseOrbitalPNStream(fp, True)
for orb in orbitals:
print(orb)
for orb in orbitals:
print(orb.Key())
| {
"content_hash": "6e49c944f02f62fb3b769b9b1e0faa0e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 61,
"avg_line_length": 17.818181818181817,
"alnum_prop": 0.7244897959183674,
"repo_name": "kc9jud/ShellCorretta",
"id": "1e138cb342906d3504eb031c6eb32be95bf75322",
"size": ... |
"""
:mod:`lentaurlparser` - Lenta.ru URL parser plugin
==================================================
.. note::
This module requires `lxml library <http://lxml.de/>'_
"""
from __future__ import unicode_literals
__docformat__ = "restructuredtext en"
import codecs
import urllib2
import re
import gzip
try:
... | {
"content_hash": "4ce28c6d9a0c7cccd88454a0147747c2",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 97,
"avg_line_length": 25.77386934673367,
"alnum_prop": 0.5578085396763501,
"repo_name": "tetra5/gooby",
"id": "130cef0c7bd0c5432c573309092102e90f9afafa",
"size": "5177",
... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
class RPCServerError(Exception):
"""Exception for errors originating from the server."""
class RPCClientError(Exception):
"""Exception for errors originating from the client."""
| {
"content_hash": "4b5872b4a042c74651f06b22d013e908",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 27.181818181818183,
"alnum_prop": 0.745819397993311,
"repo_name": "compas-dev/compas",
"id": "764fbb72fc63717e5154fd91ad6fe94b4e8c81bb",
"size": "299... |
"""This is a Wind River Linux driver implementation."""
from condoor.drivers.generic import Driver as Generic
from condoor import pattern_manager
from condoor.exceptions import CommandError
class Driver(Generic):
"""This is a Driver class implementation for Wind River Linux."""
platform = 'Windriver'
in... | {
"content_hash": "75c1ac588c9283cea4c8819daf33ed59",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 85,
"avg_line_length": 31.564102564102566,
"alnum_prop": 0.6376929325751421,
"repo_name": "kstaniek/condoor",
"id": "b97d04581ac09942644c6dff5b69ed21555f72ad",
"size": "123... |
import subscription
| {
"content_hash": "e4beacda66d782faef14e6c5ef750ea0",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.9,
"repo_name": "vileopratama/vitech",
"id": "f3e4a281e550b65d711d3902db061924ecdd925c",
"size": "120",
"binary": false,
"copi... |
from django.conf import settings
from django.template.defaultfilters import floatformat # noqa
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard import usage
from openstack_dashboard.usage import base
class GlobalUsag... | {
"content_hash": "a5caac3dd6fc5da45898b2110c7fc08d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 34.339622641509436,
"alnum_prop": 0.6120879120879121,
"repo_name": "neudesk/neucloud",
"id": "1901d211b2be2b3a916903d276a1965670c644d1",
"size": "262... |
import ConfigParser
import contextlib
import logging
import os
import psutil
import re
import unittest
from mock import patch
from mock.mock import MagicMock
from monasca_setup.detection.plugins.ovs import Ovs
LOG = logging.getLogger('monasca_setup.detection.plugins.ovs')
class ps_util_get_proc:
cmdLine = ['/... | {
"content_hash": "81b95d8938316f52fba586d23c57729f",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 84,
"avg_line_length": 48.101960784313725,
"alnum_prop": 0.534240991358226,
"repo_name": "sapcc/monasca-agent",
"id": "f54155299d94f30cf627a785745a4bdc85f07ae0",
"size": "... |
def validate_cross_validation(rounds,train_to_test_ratio):
# the number of turns must be exactly equal to the number
# of "parts" you'll split your data into
res = rounds * (1 - train_to_test_ratio)
# comparando floats na marra.
assert ( abs(res - 1) < 0.0001 )
| {
"content_hash": "97744ab1c44f809cda22048d9c23cb22",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 33.625,
"alnum_prop": 0.7026022304832714,
"repo_name": "queirozfcom/spam-filter",
"id": "f69e3610be2bc32ecd47ad9e6d3f08a8eae376ec",
"size": "269",
"... |
from djoser.compat import get_user_email, get_user_email_field_name
from djoser.email import ActivationEmail, PasswordResetEmail
def send_activation_email(user, request):
to = [get_user_email(user)]
ActivationEmail(request, {'user': user}).send(to)
def send_password_reset_email(user, request):
to = [get... | {
"content_hash": "3cef592e83d7809a325932ae18f826f9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 33,
"alnum_prop": 0.7297979797979798,
"repo_name": "creimers/graphene-auth-examples",
"id": "0e58c504f89052b8223431751b1f95d25c697b27",
"size": "396"... |
from django.utils import timezone
import celery
from celery.schedules import crontab
from .models import Cron
@celery.task(name='run_task')
def run_task(pk):
cron = Cron.objects.get(pk=pk)
cron.content_object.run()
@celery.decorators.periodic_task(name="cron", run_every=crontab())
def cron():
now = ti... | {
"content_hash": "981f3d14dbf125917d5d098d187ffc2f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 25.454545454545453,
"alnum_prop": 0.6928571428571428,
"repo_name": "josesanch/djmodelcron",
"id": "042de66e84cf36ebcbccefc980ee23929e6a56d7",
"size":... |
__all__ = ['qpt_plot', 'qpt_plot_combined', 'qpt']
from qutip.tensor import tensor
from qutip.superoperator import spre, spost, mat2vec, vec2mat
from numpy import hstack, real, imag
import scipy.linalg as la
from qutip.visualization import matrix_histogram, matrix_histogram_complex
try:
import matplotlib.pyplot a... | {
"content_hash": "98c6ac3bff9414c2f09b3280c6e72a85",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 78,
"avg_line_length": 26.994897959183675,
"alnum_prop": 0.5964845964845965,
"repo_name": "qutip/qutip",
"id": "4bbbcb799e5c52d98ece0377eb611184f80facbd",
"size": "5291",
... |
from tempest.api.network import base
from tempest import test
class NetworksApiDiscovery(base.BaseNetworkTest):
@test.attr(type='smoke')
@test.idempotent_id('cac8a836-c2e0-4304-b556-cd299c7281d1')
def test_api_version_resources(self):
"""Test that GET / returns expected resources.
The ver... | {
"content_hash": "c9f7d5ce929d5d407dc7bbc8e7462b73",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 69,
"avg_line_length": 37.30769230769231,
"alnum_prop": 0.6474226804123712,
"repo_name": "Tesora/tesora-tempest",
"id": "9cf93f6d2eaf0fedfbbb0b241f7f1ca320e2a309",
"size": ... |
from django.conf.urls import patterns, url
#from feedz.syndication import PostFeed
urlpatterns = patterns(
'feedz.views',
url(r'^$', 'index', name='feed-index'),
#url('^tag/(?P<tag_value>.+)$', 'tag', name='feed-tag'),
url(r'^sources/$', 'source_list', name='feed-source-list'),
#url('^search$', 's... | {
"content_hash": "183c2f8958af5c34a3dc226df42a4db0",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 31.52173913043478,
"alnum_prop": 0.6193103448275862,
"repo_name": "indexofire/gork",
"id": "5916a3365602c0ae3562a6238f1f088d0d6919fe",
"size": "749",... |
from django.db import models
def get_default_importance_value():
return Importance.objects.get_or_create(code=3)[0].id
class Importance(models.Model):
id = models.AutoField(primary_key=True, verbose_name=u'ID')
code = models.IntegerField(verbose_name=u'Код')
name = models.CharField(max_length=16, ve... | {
"content_hash": "64f129d60fe940c938525a7b6724fca9",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 92,
"avg_line_length": 34.435483870967744,
"alnum_prop": 0.6332552693208431,
"repo_name": "lensvol/anibirthday",
"id": "32e6528f94c771be406cf36f62938cb94d108350",
"size": "... |
from django.contrib import admin
from static_page.models import StaticPage, StaticPageAdmin
admin.site.register(StaticPage, StaticPageAdmin)
| {
"content_hash": "c6cd6d62b310a74dd7387188119e7976",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 58,
"avg_line_length": 35.5,
"alnum_prop": 0.852112676056338,
"repo_name": "mseln/klufweb",
"id": "a8e46079de25cf716703dd7b3d037195c0c3de6a",
"size": "142",
"binary": fals... |
"""
An ndarray subclass for working with arrays of strings.
"""
from functools import partial, total_ordering
from operator import eq, ne
import re
import numpy as np
from numpy import ndarray
import pandas as pd
from toolz import compose
from zipline.utils.compat import unicode
from zipline.utils.functional import i... | {
"content_hash": "a3cd7c1b9c9ff5e8be7af20cbe6d6f20",
"timestamp": "",
"source": "github",
"line_count": 827,
"max_line_length": 79,
"avg_line_length": 33.48004836759371,
"alnum_prop": 0.5720528748916498,
"repo_name": "humdings/zipline",
"id": "396d0a94fb728c50cda40e987945c2e31c6599e9",
"size": "276... |
import sys
import getopt
import json
def getErrorMessage(error):
error_type = type(error).__name__
message = error.__str__()
if error_type == 'ServerError':
message = error.data
return message
def main(argv):
tests_filepath = None
endpoint = None
user = None
password = None
... | {
"content_hash": "163b2ac3f62f3ba14e66ccc0b6e190c7",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 157,
"avg_line_length": 43.56730769230769,
"alnum_prop": 0.5272566762304127,
"repo_name": "rsutormin/kb_sdk",
"id": "95d0b7f22c360308fd76087c944e23294b2286f3",
"size": "45... |
"""
Adaptive numerical evaluation of SymPy expressions, using mpmath
for mathematical functions.
"""
from __future__ import print_function, division
import math
import mpmath.libmp as libmp
from mpmath import (
make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec)
from mpmath import inf as mpmath_inf... | {
"content_hash": "694a63c30072c8f9072f80c74b040e68",
"timestamp": "",
"source": "github",
"line_count": 1424,
"max_line_length": 99,
"avg_line_length": 33.48384831460674,
"alnum_prop": 0.5361674461525555,
"repo_name": "Sumith1896/sympy",
"id": "b98ee7f9a6c849a28b6cd712f0d3968b86433f88",
"size": "47... |
"""Test zellij/defuzz.py"""
import itertools
import math
from zellij.defuzz import Defuzzer
from zellij.postulates import all_pairs
from hypothesis import given, example
from hypothesis.strategies import integers, lists, tuples
from .hypo_helpers import f
def test_it():
dfz = Defuzzer()
assert dfz.defuzz(... | {
"content_hash": "53b4863182c2a1b678d23d261b68017b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 31.840579710144926,
"alnum_prop": 0.5848884842967683,
"repo_name": "nedbat/zellij",
"id": "f98ab79a6b9e7e1b38423ab32c331849e8f6082b",
"size": "2197",... |
"""Unparse meta AST node into a dict"""
# pylint: disable=invalid-name
from synr import Transformer
class MetaUnparser(Transformer):
"""Python AST Visitor to unparse meta AST node into a dict"""
def transform(self, node):
method = "transform_" + node.__class__.__name__
visitor = getattr(self... | {
"content_hash": "7cde12fe115fbcb1060d8a90f02426cc",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 33.41379310344828,
"alnum_prop": 0.6542827657378741,
"repo_name": "dmlc/tvm",
"id": "b1472ccdc7589f197bd8417383b1005cacddd133",
"size": "1754",
"bi... |
worlds["world"] = "/home/zacharydubois/render/worlds/world"
worlds["nether"] = "/home/zacharydubois/render/worlds/world_nether"
worlds["end"] = "/home/zacharydubois/render/worlds/world_the_end"
worlds["hoth"] = "/home/zacharydubois/render/worlds/hoth"
worlds["amp"] = "/home/zacharydubois/render/worlds/amp"
worlds["oldw... | {
"content_hash": "395f50a47688384167c044ac3c90a6ae",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 183,
"avg_line_length": 34.45862884160756,
"alnum_prop": 0.5959110867178924,
"repo_name": "ZacharyDuBois/MC-Render-Settings",
"id": "d5107a45e3c7394c522ce704fffbdf07b1f6e84d... |
from feti.models.address import Address
from haystack import indexes
__author__ = 'Rizky Maulana Nugraha "lucernae" <lana.pcfre@gmail.com>'
__date__ = '24/04/15'
class AddressIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
town = indexes.CharFiel... | {
"content_hash": "81552aa5698df9ac86aeb9c681b4b994",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 28.5,
"alnum_prop": 0.6789473684210526,
"repo_name": "cchristelis/feti",
"id": "7124dd76a369330955170480f071e2291c986d3f",
"size": "585",
"binary":... |
import sys
import numpy as np
from sklearn.datasets import make_classification
from sklearn.metrics import zero_one_loss
from sklearn.neighbors import KNeighborsClassifier
def inline(inputfile, outputfile):
# data = np.loadtxt(sys.stdin)
data = np.loadtxt(inputfile, delimiter=',')
if np.ndim(data) == 1:
... | {
"content_hash": "395584c038241224d1087b59098a9934",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 74,
"avg_line_length": 32.48571428571429,
"alnum_prop": 0.5699208443271768,
"repo_name": "aravart/poolmate",
"id": "d90848a682859017adc06770865659234d27425c",
"size": "1137... |
from pyfuzzy_toolbox import transformation as trans
from pyfuzzy_toolbox import preprocessing as pre
from pyfuzzy_toolbox import intensifiers as ints
import nose
import test_preprocessing as tpre
# expected prior polarity value for 'nice': 0.48759
positive_unigram = pre.Unigram()
positive_unigram.position = 14
positiv... | {
"content_hash": "0183615959fc138e3a0dd1ffd21da194",
"timestamp": "",
"source": "github",
"line_count": 626,
"max_line_length": 104,
"avg_line_length": 48.89297124600639,
"alnum_prop": 0.5337014408468651,
"repo_name": "matheuscas/pyfuzzy_toolbox",
"id": "51d59172ca03fe1961b8d07fc9cf0be0008c7c82",
"... |
import sys
from optparse import OptionParser
from twisted.python import log
from twisted.internet import reactor, ssl
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
class EchoClientProtocol(WebSocketClientProtocol):
def sendHello(self):
sel... | {
"content_hash": "a3f20247ba118158260a97890640511e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 105,
"avg_line_length": 25.851063829787233,
"alnum_prop": 0.6765432098765433,
"repo_name": "oberstet/autobahn-python",
"id": "c1b0baf63491a960aacfdb727e635d751dbbc95b",
"si... |
from __future__ import absolute_import, unicode_literals
import inspect
def _user_attributes(cls):
defaults = dir(type(str('defaults'), (object,), {})) # gives all inbuilt attrs
return [
item[0] for item in inspect.getmembers(cls) if item[0] not in defaults]
def choices(cls):
"""
Decorator... | {
"content_hash": "c5ad025e9cc1cc2169f00886589dfd61",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 83,
"avg_line_length": 23.743243243243242,
"alnum_prop": 0.6215139442231076,
"repo_name": "shashisp/junction",
"id": "435df71b292c9436b2c0cab89bfdeb737a50c91a",
"size": "17... |
'''
Implements the RTS Target backstore and storage object classes.
This file is part of LIO(tm).
Copyright (c) 2011-2014 by Datera, Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://... | {
"content_hash": "7cf98dfa7c5782549bb5859299969555",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 95,
"avg_line_length": 39.863498483316484,
"alnum_prop": 0.5368167406467977,
"repo_name": "roidayan/rtslib",
"id": "a80670e24e40ddad811dfa463748fbf555050d7b",
"size": "394... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungro... | {
"content_hash": "1f27202b6b023e355adde67c01602eef",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 130,
"avg_line_length": 49.140625,
"alnum_prop": 0.7170111287758346,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a156ea8af4dfa506296d5b2c4022ac99ea4eec1f",
"size": "3... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers
from google.api_core import gapic_v1
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # ty... | {
"content_hash": "2e333b657a8e8aa3f74ac86d9d5b5953",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 115,
"avg_line_length": 44.247232472324725,
"alnum_prop": 0.6031190059211075,
"repo_name": "googleads/google-ads-python",
"id": "95c9e68bb19faf6f090c106c47cd7af1d9ef9c81",
... |
import os
import random
import time
#Intel MRAA library
import mraa
import alsaaudio
import wave
import random
from creds import *
import requests
import json
import re
from memcache import Client
# Button = 2
# LED 1 = 3
# LED 2 = 4
#Settings
button = mraa.Gpio(2) #GPIO Pin with button connected
led_record = mraa.... | {
"content_hash": "508d4bc5ca4b87ee888e5cbff8dfb195",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 131,
"avg_line_length": 25.310126582278482,
"alnum_prop": 0.6066516629157289,
"repo_name": "pedrominatel/intel-edison-alexa",
"id": "fb1a38dac5996bcdaa3d6759386e990d58bd676b... |
import h5py
import condor
import copy
import numpy as np
import condor.utils.linalg as linalg
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
# Detector (pnCCD)
pixelsize = 4*75e-6
nx,ny = (1024//4,1024//4)
detector_distance = 300e-3
# Source
photon_energy = 3500 # [eV]
p... | {
"content_hash": "9e73cb76ddb6cab472e9077478a107f1",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 102,
"avg_line_length": 30.63953488372093,
"alnum_prop": 0.6743833017077799,
"repo_name": "daurer/phasing-tutorial",
"id": "ffd1f32c55d27350d72e4c565f0f3cea5f2ff55e",
"size... |
import re
import operator
def bitvec2indices(bitvec):
indices = []
for i,bit in enumerate(bitvec):
if bit: indices.append(i)
return indices
def indices2bitvec(indices,len):
bitvec=[0]*len
for index in indices: bitvec[index] = 1
return bitvec
# Thanks to Tim Peters
def powerset(seq):
... | {
"content_hash": "6523cf259c7b7db11fe77bda0685d838",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 73,
"avg_line_length": 33.45360824742268,
"alnum_prop": 0.6030816640986133,
"repo_name": "ronaldahmed/robot-navigation",
"id": "b88f5e0d8c27d795eb8202e27d0f29c7def34bae",
"... |
import logging
import traceback
from myuw.dao.library import get_account_info_for_current_user
from myuw.logger.timer import Timer
from myuw.logger.logresp import log_api_call
from myuw.views.api import ProtectedAPI
from myuw.views.error import handle_exception
logger = logging.getLogger(__name__)
class MyLibInfo(Pr... | {
"content_hash": "b978477d58620090f87e14b9a2aac87a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 66,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.6633771929824561,
"repo_name": "uw-it-aca/myuw",
"id": "76b495d1a839567b8d05ae8908b61af2bbdb928a",
"size": "1000",... |
"""
ORM for UserRole table
"""
from redidropper.main import db
from redidropper.database.crud_mixin import CRUDMixin
class UserRoleEntity(db.Model, CRUDMixin):
""" Stores the user-role mapping """
__tablename__ = 'UserRole'
id = db.Column("urID", db.Integer, primary_key=True)
user_id = db.Column("us... | {
"content_hash": "6c963ba2caace2fcafd36099ab636f1e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 33.88235294117647,
"alnum_prop": 0.5703125,
"repo_name": "indera/redi-dropper-client",
"id": "658ca81e463226764aa27d479b152a343028baf0",
"size": "115... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20210823_1454'),
]
operations = [
migrations.RemoveField(
model_name='userprofile',
name='reviewer_name',
),
]
| {
"content_hash": "a47a2c75aa9c8739f1ef5620eb5bbccb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 45,
"avg_line_length": 19.266666666666666,
"alnum_prop": 0.5709342560553633,
"repo_name": "mozilla/addons-server",
"id": "ba0c062b225398ba656b80ae158df29aaf3fa5eb",
"size":... |
import yappsrt
import spitfire.compiler.parser
# SpitfireScanner uses the order of the match, not the length of the match to
# determine what token to return. I'm not sure how fragille this is long-term,
# but it seems to have been the right solution for a number of small problems
# allong the way.
_restrict_cache = ... | {
"content_hash": "fa8f51faf59f1f40ce052b52a9abdbe1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 112,
"avg_line_length": 37.40909090909091,
"alnum_prop": 0.6658566221142163,
"repo_name": "funic/spitfire",
"id": "a138b8fcf7cce81aca0c74732788c08fcbf1c0d3",
"size": "2469"... |
from __future__ import print_function
import os
def debug_print(*args):
if 'ASP_DEBUG' in os.environ:
for arg in args:
print(arg, end='')
print()
| {
"content_hash": "6b56d78327084a85310839ac8bf0896e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 37,
"avg_line_length": 22.375,
"alnum_prop": 0.5754189944134078,
"repo_name": "richardxia/asp-multilevel-debug",
"id": "350013e4a0106e938b636098b2a96f41b31c9306",
"size": "2... |
from __future__ import division
from libtbx.utils import escape_sh_double_quoted, gzip_open, bz2_open
from libtbx import easy_run
from libtbx.str_utils import show_string
from cStringIO import StringIO
import os
def for_reading(file_name, mode="r", gzip_mode="rb"):
assert mode in ["r", "rb"]
assert gzip_mode in ["... | {
"content_hash": "a6fde4332bf9facb60af299e225323f6",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 69,
"avg_line_length": 34.50877192982456,
"alnum_prop": 0.6410777834265379,
"repo_name": "hickerson/bbn",
"id": "7fc87b7c2db71f892195ab894e74ff4285ac3f9a",
"size": "1967",
... |
from .bivincularpatt import BivincularPatt, CovincularPatt, VincularPatt
from .meshpatt import MeshPatt
from .patt import Patt
from .perm import Perm
__all__ = [
"Patt",
"Perm",
"MeshPatt",
"BivincularPatt",
"VincularPatt",
"CovincularPatt",
]
| {
"content_hash": "fb3d97a082467fa72a782fc526ce2bbe",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 20.692307692307693,
"alnum_prop": 0.6877323420074349,
"repo_name": "PermutaTriangle/Permuta",
"id": "bd04bbfac8f6ef02ab75e929502c6e844e6cd31b",
"size... |
from color import Color
class Trend(object):
def __init__(self, response, shortener, method = 'get'):
self.response = response
self.method = method
self.color = Color()
def _text(self, text):
return self.color.PLAIN + text
def _time(self, created_at):
return self.... | {
"content_hash": "5455fb45d8eca34b060d21ef2f59a921",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 25.3,
"alnum_prop": 0.5810276679841897,
"repo_name": "nerocrux/wayterm",
"id": "c92e2a4b3e4b38dcd9e97a6e58a2000674089d88",
"size": "553",
"binary":... |
import logging
import warnings
from typing import TYPE_CHECKING, Dict, Mapping, Optional
from monai.config import IgniteInfo
from monai.utils import is_scalar, min_version, optional_import
Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events")
Checkpoint, _ = optional_impor... | {
"content_hash": "876b4dbfd442193081729aed97460884",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 119,
"avg_line_length": 48.042345276872965,
"alnum_prop": 0.6271611634687098,
"repo_name": "Project-MONAI/MONAI",
"id": "6b733e428c811e636ebdd413c1da6b8965934546",
"size":... |
"""
Copyright (c) 2015 RasDom by Aeondave
See the file 'LICENSE' for copying permission
"""
import time
import RPi.GPIO as GPIO
from lib import settings
from Switch import Switch
from Component import Component
class Relay(Switch):
def __init__(self):
Switch.__init__(self)
self.sleeptime = setti... | {
"content_hash": "ae3b2edf7b6114c1987505e7f872cdaa",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 47,
"avg_line_length": 24.78048780487805,
"alnum_prop": 0.5610236220472441,
"repo_name": "AeonDave/RasDom",
"id": "91d3ad97268a01b0a235ec63a7b8b1bd30a2bd0d",
"size": "2055"... |
import tomviz.operators
class BinaryOpen(tomviz.operators.CancelableOperator):
def transform(self, dataset, structuring_element_id=0, radius=1,
object_label=1, background_label=0):
"""Perform morphological opening on segmented objects with a given
label by a spherically symmetri... | {
"content_hash": "328ff8ccbdd0926d7c0b96d51bd1d648",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 41.10344827586207,
"alnum_prop": 0.5411073825503355,
"repo_name": "OpenChemistry/tomviz",
"id": "a92caad39bcbbd3df89d5d7230ce91ef0882f629",
"size": "... |
"""
Django权限
"""
from rest_framework import serializers
from django.contrib.auth.models import Permission
class PermissionInfoSerializer(serializers.ModelSerializer):
"""
权限信息序列化
"""
app_model = serializers.SerializerMethodField()
def get_app_model(self, obj):
return "{}.{}".format(obj.co... | {
"content_hash": "89aaa3ae4c17e59813d9b77bcdc397ce",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 81,
"avg_line_length": 24.57894736842105,
"alnum_prop": 0.6702355460385439,
"repo_name": "codelieche/codelieche.com",
"id": "711f27f8dc787e10e6a56a8b41b9ce31ebeb2d1d",
"siz... |
"""Tests for lite.py functionality related to TensorFlow 2.0."""
import os
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from tensorflow.lite.python.interpreter import Interpreter
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
... | {
"content_hash": "83c821fc4e99458548884c9421c27a84",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 79,
"avg_line_length": 34.987124463519315,
"alnum_prop": 0.6432777232580962,
"repo_name": "tensorflow/tensorflow-pywrap_saved_model",
"id": "a7257b43e656543b5a20b06dbeff1218... |
class Solution:
# @param {integer} numRows
# @return {integer[][]}
def generate(self, numRows):
result = []
self.generateResult(numRows, result)
return result
def generateResult(self, numRows, result):
if numRows == 0:
return
if... | {
"content_hash": "2dbd178e1be9a6862e248eecb24a3ba5",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 50,
"avg_line_length": 27.366666666666667,
"alnum_prop": 0.48112058465286234,
"repo_name": "shootsoft/practice",
"id": "262bdfe5fe0debbeda038faf818a8b943db912e5",
"size": "... |
from novaclient import base
class FloatingIP(base.Resource):
def delete(self):
"""
Delete this floating ip
"""
self.manager.delete(self)
class FloatingIPManager(base.ManagerWithFind):
resource_class = FloatingIP
def list(self):
"""
List floating ips for a... | {
"content_hash": "a04f71a2ecbb0a6ef8caea08dd01bc5c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 26.125,
"alnum_prop": 0.5617224880382775,
"repo_name": "metacloud/python-novaclient",
"id": "25f5a7437380cb27734bd966407c3efb4e55e4ca",
"size": "1743... |
"""
Least Angle Regression algorithm. See the documentation on the
Generalized Linear Model for a complete discussion.
"""
from __future__ import print_function
# Author: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux
#
# License: BSD 3 ... | {
"content_hash": "6cabf7661fc5fda5db7ec978557a14d1",
"timestamp": "",
"source": "github",
"line_count": 1444,
"max_line_length": 81,
"avg_line_length": 37.74307479224377,
"alnum_prop": 0.5747417478578375,
"repo_name": "ltiao/scikit-learn",
"id": "8fa0a021bcc32e8a569d6193d79f9f90017bfb9d",
"size": "... |
"""Base64 content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode arbitrary 8-bit data using the three 8-bit bytes in four 7-bit
characters encoding known as Base64.
It is used in the MIME standards for email to attach images, audio, and tex... | {
"content_hash": "57e4c4a1d91c8fe937a4643e37b62399",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 78,
"avg_line_length": 31.417391304347827,
"alnum_prop": 0.6908386382507612,
"repo_name": "thonkify/thonkify",
"id": "667ff569d25b7730653435b8e7225f2f62484b5a",
"size": "3... |
from unittest import TestCase, main
import eventlet
from eventlet import Queue
from eventlet import pools
class IntPool(pools.Pool):
def create(self):
self.current_integer = getattr(self, 'current_integer', 0) + 1
return self.current_integer
class TestIntPool(TestCase):
def setUp(self):
... | {
"content_hash": "1c9475eee044dcac7d1c426c73c1c504",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 86,
"avg_line_length": 28.681614349775785,
"alnum_prop": 0.566916823014384,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "77a8d04d4321088aa9d197c8e172f16829ce78a9... |
"""
SLA (Service-level agreement) is set of details for determining compliance
with contracted values such as maximum error rate or minimum response time.
"""
import abc
import jsonschema
import six
from rally.common.i18n import _
from rally.common.plugin import plugin
def _format_result(criterion_name, success, d... | {
"content_hash": "ea54dc1bc5c51c4de94a0cb878147b92",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 79,
"avg_line_length": 31.704918032786885,
"alnum_prop": 0.5920372285418821,
"repo_name": "gluke77/rally",
"id": "a63778b39906637d8177d50cc285d05e08c89d9b",
"size": "6433"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.