text stringlengths 4 1.02M | meta dict |
|---|---|
import json
import threading
import tornado.websocket
import shm
class SwitchWatcherThread(threading.Thread):
def __init__(self, lock, watchers, *args, **kwargs):
threading.Thread.__init__(self, *args, **kwargs)
self.lock = lock
self.watchers = watchers
def run(self):
switch_wa... | {
"content_hash": "d4fc71a02e8578ea7f642d9a978b89b3",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 101,
"avg_line_length": 31.66,
"alnum_prop": 0.5704358812381554,
"repo_name": "cuauv/software",
"id": "68ac83983e3d9d15067e964394d04a70cb5595ad",
"size": "1583",
"binary"... |
import os
import argparse
import sys
import m5
from m5.objects import *
# --------------------
# Define Command Line Options
# ====================
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--detailed", action="store_true")
parser.add_argument("-t", "--timing", action="store_true")
parser.add_ar... | {
"content_hash": "40a0cb21bb8615abe2cee63713247e33",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 81,
"avg_line_length": 32.17977528089887,
"alnum_prop": 0.5956703910614525,
"repo_name": "gem5/gem5",
"id": "46bcfbfe29d4f3155032497f36b52d64b3cebf0a",
"size": "10184",
... |
"""JavaScript tests for the Course Explorer components."""
__author__ = [
'John Orr (jorr@google.com)',
]
from tests.integration import integration
from tests.integration import pageobjects
class PolymerTests(integration.TestBase):
def test_explorer(self):
pageobjects.PolymerPageObject(self).load(
... | {
"content_hash": "c41487f5f81244f0664fd1e7881f442c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 26.1875,
"alnum_prop": 0.7088305489260143,
"repo_name": "andela-angene/coursebuilder-core",
"id": "3379246ecbbdda894a7e7ddd585b77773f8d8ea7",
"size":... |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm
from models import User, ROLE_USER, ROLE_ADMIN
from datetime import datetime
@lm.user... | {
"content_hash": "21798c51cd54829fec20ae82a958face",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 81,
"avg_line_length": 32.287581699346404,
"alnum_prop": 0.6089068825910932,
"repo_name": "hmdavis/flask-mega-tutorial",
"id": "bdf1874705ad70fc8c0c8558643195155a84b676",
... |
import pathlib
import pytest
@pytest.fixture
def test_dir():
return pathlib.Path(__file__).parent
| {
"content_hash": "37df83678a58b590111aee1f93b3fb53",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 40,
"avg_line_length": 13.125,
"alnum_prop": 0.7142857142857143,
"repo_name": "dopefishh/pympi",
"id": "fc8761b98f76d8a0ad0a0a92c9197cf27f7cf405",
"size": "105",
"binary":... |
"""The Windows firewall log file event formatter."""
from plaso.formatters import interface
from plaso.formatters import manager
class WinFirewallFormatter(interface.ConditionalEventFormatter):
"""Formatter for a Windows firewall log entry event."""
DATA_TYPE = u'windows:firewall:log_entry'
# TODO: Add more ... | {
"content_hash": "269e36f87e7e69c911ca861f9494d6de",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 27.208333333333332,
"alnum_prop": 0.607197549770291,
"repo_name": "8u1a/plaso",
"id": "06563ae649d773515bc00bb9b4f73243cb66127f",
"size": "1330",
"... |
"""Base class for robustness metrics."""
import abc
import gin
import six
@gin.configurable
def all_metrics():
# Only return the public classes.
return Metric.public_subclasses()
@six.add_metaclass(abc.ABCMeta)
class Metric(object):
"""Abstract base class for robustness metrics."""
@classmethod
def publ... | {
"content_hash": "86744135483fa144fe5934c9079b7d1f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 75,
"avg_line_length": 26.294117647058822,
"alnum_prop": 0.6875466070096943,
"repo_name": "google-research/rl-reliability-metrics",
"id": "d03af61f16c6adf73687f69973114442bcc... |
import collections
import logging
import numpy as np
import socket
import struct
import threading
import nengo
from pacman103.core.spinnman.sdp import sdp_message as sdp
from nengo_spinnaker.utils import fp
from nengo_spinnaker import assembler, utils
logger = logging.getLogger(__name__)
def stop_on_keyboard_inte... | {
"content_hash": "e03cd3780babb4ceb8454da8c4090f9b",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 82,
"avg_line_length": 34.100628930817614,
"alnum_prop": 0.5672261158244191,
"repo_name": "ctn-archive/nengo_spinnaker_2014",
"id": "88fb1431b49027eded01bcc55a5915e58786af06... |
from datetime import time
from pandas import Timedelta, Timestamp
from pandas.tseries.holiday import GoodFriday
from pytz import timezone
from catalyst.utils.calendars import TradingCalendar
from catalyst.utils.calendars.trading_calendar import (
HolidayCalendar, end_default
)
from catalyst.utils.calendars.us_hol... | {
"content_hash": "eaf7d2cfc0f09e50d77115383787c58c",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 28.821428571428573,
"alnum_prop": 0.6794712928541925,
"repo_name": "enigmampc/catalyst",
"id": "d4ffe10774d513ddc54d9fc2bf3ddab602afb4ec",
"size": "2... |
from django.conf.urls import url
from .views import ObtainExpiringAuthToken
urlpatterns = [
url(r'^login/', ObtainExpiringAuthToken.as_view(), name='login')
]
| {
"content_hash": "159125f93f3158e992a4e1d257bbf33d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.7454545454545455,
"repo_name": "asnelzin/sputniktask",
"id": "95b5b396366da1273dead4044460fc61148cda87",
"size": "... |
"""
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no
next right node, the next pointer should be set to NULL.
Initially, all next pointers are set to NULL.
Not... | {
"content_hash": "35ea11b353d5119df715b75ef4621cb7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 74,
"avg_line_length": 24.189655172413794,
"alnum_prop": 0.5787598004276551,
"repo_name": "shichao-an/leetcode-python",
"id": "8748cc72486ae1155918a8aaa40d03f179208f06",
"s... |
password = " "
while password!="123":#repeats until the string password contains the value "123"
password=input("What is the password? ")#receives user input
if password!="123":
print("That is incorrect")
#code after this is run only after the "while" statement is finished
#it is not repeated b... | {
"content_hash": "948689a9d076133ca75111cf1f7c177c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 81,
"avg_line_length": 34.18181818181818,
"alnum_prop": 0.7047872340425532,
"repo_name": "HuronComputerClub/HuronComputerClub.github.io",
"id": "d209290d9e3540e7635ab465d6081... |
'''
Miscellaneous algorithms for 2D contours and 3D triangularized meshes handling
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data'))
>>> os.ch... | {
"content_hash": "d5a7a847b87f556c9949a2a2b3c953d2",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 78,
"avg_line_length": 33.35493827160494,
"alnum_prop": 0.5903581012306838,
"repo_name": "wanderine/nipype",
"id": "be9a10e287145360eb9571490adf236fdae78052",
"size": "109... |
from django.conf.urls import include, url
from django.contrib import admin
from agenteIA import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
| {
"content_hash": "e9db89618e7452b707303f3df6f4f97e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 23.428571428571427,
"alnum_prop": 0.725609756097561,
"repo_name": "DiogoDantas/tourgastronomico",
"id": "e873d33bef7685b04b8dec2882786fb6f7f6ea8f",
"s... |
import argparse
import collections
import json
import os.path
import re
import sys
import pdl
def main(argv):
parser = argparse.ArgumentParser(description=(
"Converts from .pdl to .json by invoking the pdl Python module."))
parser.add_argument('--map_binary_to_string', type=bool,
... | {
"content_hash": "9917a095bf88100f61b4e2d0defca1d8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 35.96875,
"alnum_prop": 0.6255430060816681,
"repo_name": "zero-rp/miniblink49",
"id": "96048f793d85a8e0d233c81d88dbd3711a60f05b",
"size": "1336",
"... |
import pytest
import os
import time
import threading
import socket
import uuid
import urllib2
import json
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server.TServer import TServer
from Types.ttypes import TNetworkAddress
import S... | {
"content_hash": "831efe79be7b094f3bbf4abdacf3cf63",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 90,
"avg_line_length": 39.155361050328224,
"alnum_prop": 0.6757013524086286,
"repo_name": "tempbottle/Impala",
"id": "164612bfc5596e68dd137f790d4993cdd9c1428d",
"size": "1... |
import re
from django.forms import CharField, Form, Media
from django.http import HttpRequest
from django.middleware.csrf import (
CsrfViewMiddleware, _compare_salted_tokens as equivalent_tokens, get_token,
)
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.template.backends.dummy ... | {
"content_hash": "ed181d33917039dc6aa6be0e3a1a5096",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 92,
"avg_line_length": 39.104166666666664,
"alnum_prop": 0.6555673947789025,
"repo_name": "twz915/django",
"id": "dededfe390a109bbafdcfd1be4aa84e70e5bce5c",
"size": "3758",... |
import os
this_dir = os.path.realpath(os.path.dirname(__file__))
DATABASE_NAME = this_dir + '/.testing.db'
DATABASE_ENGINE = 'sqlite3'
INSTALLED_APPS=('psz',)
| {
"content_hash": "39db14166cc1861b16026e024b080fed",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.69375,
"repo_name": "JohnSpeno/python-secure-zone",
"id": "0b1d9ac0a22ef64c8c91c46b773dffa12bed9aed",
"size": "160... |
from netforce.model import Model, fields
import time
class SaleOrderPromotion(Model):
_name = "sale.order.promotion"
_fields = {
"sale_id": fields.Many2One("sale.order", "Sales Order", required=True, on_delete="cascade"),
"promotion_id": fields.Many2One("sale.promotion","Promotion",required=Tr... | {
"content_hash": "10bdf2896710a8005c67247e5caeb2dd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 100,
"avg_line_length": 34.9375,
"alnum_prop": 0.6654740608228981,
"repo_name": "nfco/netforce",
"id": "d31bb05aae7bcfd915261ec094d8ae08bbe3d851",
"size": "1664",
"binary... |
from __future__ import unicode_literals
import frappe, unittest, uuid
from frappe.model.delete_doc import delete_doc
from frappe.utils.data import today, add_to_date
from frappe import _dict
from frappe.utils import get_url
from frappe.core.doctype.user.user import get_total_users
from frappe.core.doctype.user.user i... | {
"content_hash": "429aeee5f58cbbe402791a0467a8d869",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 106,
"avg_line_length": 36.13422818791946,
"alnum_prop": 0.687778603268945,
"repo_name": "saurabh6790/frappe",
"id": "5bea76793463663e6ee841ea9c7edfbc83d72bd6",
"size": "1... |
from . import OpenMayaRender
from . import OpenMayaAnim
import _OpenMayaMPx
from . import OpenMaya
from . import OpenMayaUI
import weakref
from __builtin__ import property as _swig_property
from __builtin__ import object as _object
class MPxNode(_object):
def __disown__(self):
pass
def __ini... | {
"content_hash": "d87966722e1311395db7fc76c9efed7f",
"timestamp": "",
"source": "github",
"line_count": 7141,
"max_line_length": 80,
"avg_line_length": 15.102506651729449,
"alnum_prop": 0.5055773456841637,
"repo_name": "CountZer0/PipelineConstructionSet",
"id": "4f2292322feff6a7140269c0964ed5b44b4443... |
from voucherify import Client as voucherifyClient
voucherify = voucherifyClient(
application_id="c70a6f00-cf91-4756-9df5-47628850002b",
client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c"
)
def test_publishVoucher():
params = {
"channel": "Email",
"customer": {
"source_id"... | {
"content_hash": "284590d7e694abad6eafdd6af8619fa0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 32.05555555555556,
"alnum_prop": 0.6568457538994801,
"repo_name": "voucherifyio/voucherify-python-sdk",
"id": "d21d6ebdf515ed0fcfba3548f7ca0c96213f76ed... |
from enum import Enum
class OrderErrorCode(Enum):
CANNOT_CANCEL_FULFILLMENT = "cannot_cancel_fulfillment"
CANNOT_CANCEL_ORDER = "cannot_cancel_order"
CANNOT_DELETE = "cannot_delete"
CANNOT_REFUND = "cannot_refund"
CAPTURE_INACTIVE_PAYMENT = "capture_inactive_payment"
NOT_EDITABLE = "not_editab... | {
"content_hash": "49a03f86c38eadde1ae604a848e19680",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 69,
"avg_line_length": 37.30434782608695,
"alnum_prop": 0.7051282051282052,
"repo_name": "maferelo/saleor",
"id": "33b2c85f53074749aa9c1476d0b74f7c363759de",
"size": "858",... |
"""
Shortcuts for retrieving input from the user.
If you are using this library for retrieving some input from the user (as a
pure Python replacement for GNU readline), probably for 90% of the use cases,
the :func:`.prompt` function is all you need. It's the easiest shortcut which
does a lot of the underlying work lik... | {
"content_hash": "59f5f80aecbeab21615580b8d68d7089",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 147,
"avg_line_length": 39.735632183908045,
"alnum_prop": 0.6483222447208562,
"repo_name": "Sorsly/subtle",
"id": "5ca9ecd1be4d5acf9c97ef6e6fed1e09475d0d8d",
"size": "2765... |
from sklearn_explain.tests.skl_datasets import skl_datasets_test as skltest
skltest.test_class_dataset_and_model("BreastCancer" , "SVC_sigmoid_10")
| {
"content_hash": "ebefdf3fde65aa48b72461e0e9f61be8",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 75,
"avg_line_length": 37.5,
"alnum_prop": 0.7933333333333333,
"repo_name": "antoinecarme/sklearn_explain",
"id": "22cbb636fc2ae8c39e11cd000bcdece5ccc4ccf9",
"size": "150",
... |
import theano
import theano.tensor as tt
####################### Log Space Helpers ################################
eps, epsinv = 1e-20, 1e20
def safe_log(x):
return tt.log(tt.maximum(x, eps))
def safe_exp(x):
return tt.exp(tt.minimum(x, epsinv))
def logadd_simple(x, y):
return x + safe_log(1 + safe_ex... | {
"content_hash": "b26101119e6626d087f031fa21ff6b2b",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 80,
"avg_line_length": 30.650406504065042,
"alnum_prop": 0.5244031830238727,
"repo_name": "Richi91/rnn_ctc",
"id": "9765e87de4da26940f3743027be903a207909581",
"size": "377... |
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following automatically:
- fetch all translations using the tx tool
- post-process them into valid and committable format
- remove invalid control characters
- remove location tags (makes diffs less noisy)... | {
"content_hash": "3ccbd4f2e33bcb023598198866d47cff",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 121,
"avg_line_length": 36.137362637362635,
"alnum_prop": 0.6141097764938421,
"repo_name": "Voyacoin/Voyacoin",
"id": "efebf7044c04ce3e9f13da766e9ba63d1fabd656",
"size": "... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST,... | {
"content_hash": "72b7fe60565442bc663dca2dc2d60e62",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 197,
"avg_line_length": 42,
"alnum_prop": 0.6469622331691297,
"repo_name": "111pontes/ydk-py",
"id": "73b6fd4fabbcff38c818d97b2d6723eef90fd999",
"size": "1221",
"binary":... |
NODE, EDGE, ATTR = range(3)
class Node:
def __init__(self, name, attrs):
self.name = name
self.attrs = attrs
def __eq__(self, other):
return self.name == other.name and self.attrs == other.attrs
class Edge:
def __init__(self, src, dst, attrs):
self.src = src
self... | {
"content_hash": "0902493f44d586ee23553d54951ed689",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 21.40740740740741,
"alnum_prop": 0.527681660899654,
"repo_name": "jmluy/xpython",
"id": "e22a618bd60e90e40883b6fbd18294f53b946c55",
"size": "578",
... |
from pkg_resources import get_distribution
__version__ = get_distribution('pybar_fei4_interpreter').version
| {
"content_hash": "139b48592404cec582548354763f5ef3",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 64,
"avg_line_length": 55,
"alnum_prop": 0.7818181818181819,
"repo_name": "SiLab-Bonn/pyBAR_fei4_interpreter",
"id": "8c1c304ea31dd37c1a73fd8e6cfd60340e86193a",
"size": "236... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rango', '0002_auto_20161109_1934'),
]
operations = [
migrations.AddField(
model_name='category',
name='slug',
fi... | {
"content_hash": "ddb8d11794fc5c8191674262c0ba5ccc",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 46,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.5837837837837838,
"repo_name": "dnestoff/Tango-With-Django",
"id": "dfe9fae52a3674d242319e712ac41739f863eb8e",
"s... |
from enum import Enum
class FormTypes(Enum):
REGISTRATIONS = "registrations"
FormTypes.do_not_call_in_templates = True
| {
"content_hash": "4d52d7a87299aba5ae9413a1d5a8af0c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 15.875,
"alnum_prop": 0.7480314960629921,
"repo_name": "dracidoupe/graveyard",
"id": "bf0f263a15359ea22f80f92757544cc315ffbe05",
"size": "127",
"bin... |
import datetime, calendar, time, math, boto3
import os
from hurry.filesize import size
from dateutil.tz import tzlocal
from operator import attrgetter
# return the region for given bucket name
def get_location(client, name):
return client.get_bucket_location(Bucket=name)['LocationConstraint']
# Get number of flie... | {
"content_hash": "24bd4c939dac8f73438b6a3589e41564",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 142,
"avg_line_length": 42.16161616161616,
"alnum_prop": 0.6499760421657882,
"repo_name": "kimyong/s3bucket",
"id": "91c0dbc0c249a0ecc7aa4cbf0121b8815933bc9b",
"size": "419... |
import psutil
KILLPROCS = ("pre.exe","standard.exe")
for proc in psutil.process_iter():
if proc.name() in KILLPROCS:
proc.kill()
proc.wait(timeout=60) | {
"content_hash": "3adeb8ce86362ceb2ab9beac8ed0fb80",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6470588235294118,
"repo_name": "ucdavis-kanvinde-group/abaqus-pso-calibration",
"id": "dbfae040922a96692f1b542485a7c... |
import pickle
import functools
import tornado.web
from lp import *
from attrs import *
from task import *
def call(fn):
fn()
class viewer(tornado.web.RequestHandler, Attrs):
viewers = []
app = None
@classmethod
def observe(cls, model, point=r"/"):
cls.viewers.append((point, cls, dict(... | {
"content_hash": "0160ec66ed82411bc1b9df85a083d74a",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 96,
"avg_line_length": 27.8,
"alnum_prop": 0.539825282631038,
"repo_name": "Deerenaros/netpy",
"id": "1016220a9400302c992669ae841af5c353e0b21e",
"size": "3892",
"binary"... |
from yepes.forms.fields import *
from yepes.forms.inline_model import InlineModelForm
from yepes.forms.widgets import *
| {
"content_hash": "7a514f8b56df2d74f5353944fd11a6c9",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 52,
"avg_line_length": 40,
"alnum_prop": 0.825,
"repo_name": "samuelmaudo/yepes",
"id": "70f16b624f0709ef9ba7b6ce5ca80dd31491b10b",
"size": "144",
"binary": false,
"copi... |
"""Base specific data provider."""
import typing as t
from mimesis.providers import BaseDataProvider
__all__ = ["BaseSpecProvider"]
class BaseSpecProvider(BaseDataProvider):
"""Base provider for specific data providers."""
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
"""Initialize att... | {
"content_hash": "8f652752b0bfa19debd5bec979f0e193",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 62,
"avg_line_length": 28.533333333333335,
"alnum_prop": 0.6542056074766355,
"repo_name": "lk-geimfari/mimesis",
"id": "cb0cdd5db7f615ab472e346f7a52e9685878fd88",
"size": "... |
import os
import PythonQt
from PythonQt import QtCore, QtGui
from director.propertyset import PropertySet, PropertyAttributes, PropertyPanelHelper
from director import callbacks
class Icons(object):
Directory = int(QtGui.QStyle.SP_DirIcon)
Axes = ':/images/axes_icon.png'
Eye = ':/images/eye_icon.png'
EyeOff =... | {
"content_hash": "906bc81cc3ed00d27cdc06158a9c948d",
"timestamp": "",
"source": "github",
"line_count": 542,
"max_line_length": 111,
"avg_line_length": 31.29520295202952,
"alnum_prop": 0.6522815705695083,
"repo_name": "RobotLocomotion/director",
"id": "8cba1c6f27afeab28b901f95d385bd5f7c6d0ca8",
"si... |
'''Vector module
This module contains all Vector class definition
'''
import numpy as np
from numpy import linalg
class Vector():
'''Base class for Vector
*Exemple:*
```
v1 += 10 # Add 10 to all components
v1 += [10, 9, 8] # Add a different value to each component
dot_product = v1 @ v2 # Do... | {
"content_hash": "e8b8fe683ab729c4179c2b12dc2bff0b",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 66,
"avg_line_length": 21.352941176470587,
"alnum_prop": 0.5564738292011019,
"repo_name": "Echelon9/vulk",
"id": "f71a1681b5b81c75518631acd330dae93695bc40",
"size": "3267"... |
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.auth.models import AnonymousUser
from account.views import SignupView, LoginView
class SignupEnabledView(SignupView):
def is_open(self):
return True
class Si... | {
"content_hash": "019577f9e54cfceb6fe18d1eb916c89b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 27.394736842105264,
"alnum_prop": 0.7031700288184438,
"repo_name": "mgpyh/django-user-accounts",
"id": "91539ba8b88fa9fe4418caef349593c20ff089c3",
"s... |
"""Adapter between Gumbo and html5lib.
This exports one method, parse, with the same signature as html5lib.parse. It
takes the text to parse, and optionally an html5lib TreeBuilder to build the
tree, and gives back a DOM tree in that format. Example:
doc = parse(text, treebuilder='lxml')
"""
__author__ = 'jdtang... | {
"content_hash": "b86ca645791c6a9d285a4c999856a9af",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 82,
"avg_line_length": 35.92,
"alnum_prop": 0.6717149220489977,
"repo_name": "Sigil-Ebook/sigil-gumbo",
"id": "e3110479b2c9d8f90c767b301ee6bd5d0ae468f2",
"size": "5088",
... |
"""\
=============================
Shutdown the Selector service
=============================
StopSelector asks the Selector service to shutdown; either immediately, or when
triggered by anything being sent to any of its inboxes.
Example Usage
-------------
Receive data from myserver.com port 1500, save it to a f... | {
"content_hash": "63bc0fe90eda89f25284de18ff72abde",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 141,
"avg_line_length": 30.927835051546392,
"alnum_prop": 0.6443333333333333,
"repo_name": "sparkslabs/kamaelia",
"id": "d9007f551b4f3e0e43a341dff44b82daf25814a2",
"size": ... |
from django.shortcuts import render, HttpResponseRedirect
from apps.calc.measurement import measurement_obj
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
import json
import numpy as np
import apps.calc.measurement.calculus as calc
from apps.analysis.json import NumPyAran... | {
"content_hash": "fa64b9d1c03663de87c6913b0e14613c",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 167,
"avg_line_length": 49.14150943396226,
"alnum_prop": 0.6660107506239201,
"repo_name": "IT-PM-OpenAdaptronik/Webapp",
"id": "c9fb5b5e8cedb638dbde532e38f8a16af68a3075",
... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('servico', '0013_servicoevento'),
]
operations = [
migrations.AlterField(
... | {
"content_hash": "651589ef8f70c132c1e49a330579b66a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 146,
"avg_line_length": 27.1,
"alnum_prop": 0.6642066420664207,
"repo_name": "anselmobd/fo2",
"id": "b244fb444abbc45689be73dea175cf843e3125fb",
"size": "617",
"binary": f... |
import base64
import binascii
import sys
import shellfoundry.exceptions as exceptions
class PasswordModification(object):
HANDLING_KEYS = ["password", "github_password"]
def modify(self, value):
encryption_key = self._get_encryption_key()
encoded = self._decode_encode(value, encryption_key)
... | {
"content_hash": "c86913b7165517214798d43c0b482be1",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 30.444444444444443,
"alnum_prop": 0.5781021897810219,
"repo_name": "QualiSystems/shellfoundry",
"id": "9c899aab5c63ac42b0b09667e38841c5fd6d0bc5",
"si... |
"""Base Estimator class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import os
import tempfile
import numpy as np
import six
from tensorflow.core.framework import summary_pb2
from tensorflow.core.protobuf import config_pb2
from tensorfl... | {
"content_hash": "b442680109f14eb5184e788a07f21939",
"timestamp": "",
"source": "github",
"line_count": 896,
"max_line_length": 87,
"avg_line_length": 40.43638392857143,
"alnum_prop": 0.656150810079766,
"repo_name": "alivecor/tensorflow",
"id": "1554c271541eeaae2639b29e963a5fa38ad76f9a",
"size": "3... |
import sys
import contextlib
from collections import defaultdict
import progressbar
import logging
from ..errors import AngrAnalysisError
from . import registered_analyses
l = logging.getLogger("angr.analysis")
class AnalysisLogEntry(object):
def __init__(self, message, exc_info=False):
if exc_info:
... | {
"content_hash": "6b0b7b1bfed4d00edfe1fb49b714d7bf",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 118,
"avg_line_length": 33.40654205607477,
"alnum_prop": 0.5588194153028395,
"repo_name": "f-prettyland/angr",
"id": "1be273625f753066ec1aa2ae04864ba98896c152",
"size": "7... |
from __future__ import print_function
#
# Author: Henrique Pereira Coutada Miranda
# Tests for yambopy
# Run all the functions of the tutorial
#
import unittest
import sys
import os
import argparse
import subprocess
import filecmp
from yambopy import *
from qepy import *
import imp
###################################... | {
"content_hash": "1c7f60400a253e7126e993cec0996089",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 88,
"avg_line_length": 28.470967741935485,
"alnum_prop": 0.5678676637208249,
"repo_name": "henriquemiranda/yambo-py",
"id": "48cfc93eaf7e15d9d435196c2cc5401fe71f51e8",
"si... |
import unittest
import re2
class TestMatch(unittest.TestCase):
def test_const_match(self):
m = re2.match('abc', 'abc')
self.assertIsNotNone(m)
self.assertEqual(m.start(), 0)
self.assertEqual(m.end(), 3)
self.assertEqual(m.span(), (0, 3))
self.assertEqual(m.groups(), ... | {
"content_hash": "37a3e1ce156cc481798bd8982005ab3d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 70,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.5759036144578313,
"repo_name": "simudream/pyre2",
"id": "c61366f74c3137fd7325b8dcdd58ec07fdbeb1d8",
"size": "1245... |
"""Tasks built from "Learned Optimizers that Scale and Generalize"(losg) code.
paper: https://arxiv.org/pdf/1703.04813
code:
https://github.com/tensorflow/models/tree/master/research/learned_optimizer/problems
These tasks are similar to those used by the losg paper.
The main difference is that these contain different... | {
"content_hash": "9097f1ae5b29bdcf65576a1ccaf512a2",
"timestamp": "",
"source": "github",
"line_count": 579,
"max_line_length": 84,
"avg_line_length": 28.83419689119171,
"alnum_prop": 0.6337226714585206,
"repo_name": "google-research/google-research",
"id": "b9f9b88ab4e5439013f62b87893f66a6aacb914b",... |
import scipy
import numpy
from pyamg.gallery import linear_elasticity, poisson
from pyamg import smoothed_aggregation_solver, rootnode_solver
# Create test cases
trials = []
A,B = poisson((500,500), format='csr'), None
trials.append( ('Poisson',A,B) )
A,B = linear_elasticity((200,200), format='bsr')
trials.append( ('E... | {
"content_hash": "45035e157290ee116307e2d5a05a4133",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 92,
"avg_line_length": 34.08474576271186,
"alnum_prop": 0.6832421680755842,
"repo_name": "pombreda/pyamg",
"id": "9f6c671b9cad147ad6901c2b2b922fd2c3c2c471",
"size": "2050",... |
"""Radial Basis Function Representation"""
from rlpy.Tools import perms
from .Representation import Representation
import numpy as np
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = ["Alborz Geramifard", "Robert H. Klein", "Christoph Dann",
"William Dabney", "Jonathan P. Ho... | {
"content_hash": "a7bfd9a78a3f7e6f1096ef6ada59eec1",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 93,
"avg_line_length": 40.666666666666664,
"alnum_prop": 0.5812725757154765,
"repo_name": "MDPvis/rlpy",
"id": "aa2112ba9c61a286728bc733b595c63919526295",
"size": "7198",
... |
"""
Sqlite3 extensions
==================
* Define custom aggregates, collations and functions
* Basic support for virtual tables
* Basic support for FTS3/4
* Specify isolation level in transactions
Example usage of the Full-text search:
class Document(FTSModel):
title = TextField() # type affinities are ignore... | {
"content_hash": "d6555617ef31268c43b3f2ff4d993ebb",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 80,
"avg_line_length": 33.262230919765166,
"alnum_prop": 0.6014590810142967,
"repo_name": "fuzeman/peewee",
"id": "9ad004c7001976e26e0efb4f23a3e0d7b2c646d3",
"size": "1699... |
import asyncio
import logging
import pytest
import lightbus
import lightbus.creation
import lightbus.transports.redis.event
import lightbus.transports.redis.result
import lightbus.transports.redis.rpc
import lightbus.transports.redis.schema
from lightbus.exceptions import BusAlreadyClosed
from lightbus.transports.red... | {
"content_hash": "1b875e53a662498dd7527a1816be5670",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 71,
"avg_line_length": 27.36986301369863,
"alnum_prop": 0.7232232232232232,
"repo_name": "adamcharnock/lightbus",
"id": "ab7d06d1ac34284d8b44c0c61dc874d9269caf2e",
"size": ... |
"""Xcode-ninja wrapper project file generator.
This updates the data structures passed to the Xcode gyp generator to build
with ninja instead. The Xcode project itself is transformed into a list of
executable targets, each with a build step to build with ninja, and a target
with every source and resource file. This a... | {
"content_hash": "a01800f7d9aae992f61be3bd3a7bbabe",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 80,
"avg_line_length": 38.67193675889328,
"alnum_prop": 0.6690515126737531,
"repo_name": "SimtterCom/gyp",
"id": "0e5a70c714efcce1d231e07b14dc7edf8c53d063",
"size": "9941"... |
"""Tests for the help plugin."""
from dungeonbot.conftest import BaseTest
from dungeonbot.plugins.help import HelpPlugin
from unittest import mock
class HelpPluginUnitTests(BaseTest):
"""Test the help plugin."""
def test_help_topic_exists(self):
"""Ensure that the topic dict works."""
eve... | {
"content_hash": "a0257b1038c67d00e53306df65f74b41",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 70,
"avg_line_length": 31.818181818181817,
"alnum_prop": 0.6307142857142857,
"repo_name": "tlake/dungeonbot",
"id": "4d6e0014c058ca4b7cd94e644613b5ba6f3d7530",
"size": "140... |
'''
# =============================================================================
# FileName: factory.py
# Desc: a general factory which is used to generate other factories
# Author: ifkite
# Email: holahello@163.com
# HomePage: http://github.com/ifkite
# python version: 2.7.10
... | {
"content_hash": "7b6143187378d8a63e54f94d5f45cfaf",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.45,
"repo_name": "ifkite/spichi",
"id": "b97a0d8192d2f65526faa97df5fab8bc95c03009",
"size": "884",
"binary": fa... |
def extractLovelikeathousandarrowsWordpressCom(item):
'''
Parser for 'lovelikeathousandarrows.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('green plum fairy road', 'green ... | {
"content_hash": "b88104ef1ed8dbfe88c4548f946ca1f1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 160,
"avg_line_length": 46.4,
"alnum_prop": 0.6043103448275862,
"repo_name": "fake-name/ReadableWebProxy",
"id": "feeaf4a0b1dddda8fb74d026426cf89e74018e10",
"size": "1160",... |
import sys
import os
import os.path
import xml.dom.minidom
import argparse
class Config():
def __add_server(self, parent_node, settings, server_name):
try:
os.environ["TRAVIS_SECURE_ENV_VARS"]
except KeyError:
print "no secure env vars available, please declare it first"
... | {
"content_hash": "80f0294a44a97b629dfc1a32349859d2",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 105,
"avg_line_length": 36.01075268817204,
"alnum_prop": 0.6652732158853389,
"repo_name": "Fiware/cloud.SDC",
"id": "1d6840e376a3eacb4af25daa36eb91f22f32da9b",
"size": "339... |
"" # noqa
"""
mpipe 0.8
=========
Send message-pack messages to subprocess.
Mini RPC mostly used for testinng using hypothesis.
"""
import ctypes
import os
import signal
import sys
import time
from contextlib import contextmanager
from subprocess import PIPE, Popen, TimeoutExpired
try:
import umsgpack
except I... | {
"content_hash": "834e099cdeeadba6d6d38ccb72154e5e",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 83,
"avg_line_length": 26.9811320754717,
"alnum_prop": 0.5916083916083916,
"repo_name": "ganwell/rbtree",
"id": "5f0d4b5bd5ee3cdbac2f6cea83861e097ccecda1",
"size": "2980",... |
import os
from os import walk
templatePath = r'templates/controllerTemplate.txt'
writePath = r'/Source/Api/service-hmlFhirConverter/src/main/java/org/nmdp/hmlfhirconverter/controller'
class ControllerGenerator:
def get_template(self):
with open(templatePath, 'r') as fileReader:
return fileRe... | {
"content_hash": "f9edc45cbabe2c3102eff1f540549261",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 102,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6941624365482234,
"repo_name": "nmdp-bioinformatics/service-hmlFhirConverter",
"id": "dded94dd31891ea5fd7b22ad87a6... |
from imgurpython import ImgurClient
import config
CONFIG_FILE = "config.yaml"
def authenticate():
conf = config.read_file(CONFIG_FILE)
# Get client ID and secret from auth.ini
client = ImgurClient(conf.imgur.client_id, conf.imgur.client_secret)
# Authorization flow, pin example (see docs for other... | {
"content_hash": "34051f22759655463093509903fe81b2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 83,
"avg_line_length": 31.580645161290324,
"alnum_prop": 0.6782431052093973,
"repo_name": "FichteFoll/CodetalkIRCBot",
"id": "e5910d6d2616a9f4491eae99fbaab4ef197bf357",
"si... |
"""
@brief test log(time=2s)
@author Xavier Dupre
"""
import sys
import os
import unittest
import random
from tqdm import trange
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
from pyquickhelper.benchhelper import BenchMark
class ATestBenchMarkB_(BenchMark):
... | {
"content_hash": "3cecc2e65831efdd16f2e5381d1c23a3",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 102,
"avg_line_length": 27.56,
"alnum_prop": 0.5757135945815192,
"repo_name": "sdpython/pyquickhelper",
"id": "13281ff7dcf443f90b6d5ab8f8a195840fecd9cf",
"size": "2067",
... |
from pip.req import parse_requirements
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements("requirements.txt")
# reqs is a list of requirement
reqs = [str(ir.... | {
"content_hash": "9c5f6404a273ac6a15544b32e4d4dbf3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 32.72727272727273,
"alnum_prop": 0.6972222222222222,
"repo_name": "ResilientScience/wot",
"id": "a62e13b6d8ae097eb9963178ac822b17f26491d6",
"size": "... |
"""Buildgen vsprojects plugin.
This parses the list of libraries, and generates globals "vsprojects"
and "vsproject_dict", to be used by the visual studio generators.
"""
def mako_plugin(dictionary):
"""The exported plugin code for generate_vsprojeccts
We want to help the work of the visual studio generators.
... | {
"content_hash": "2da50fb7f32d4c0e24a572051654073d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 70,
"avg_line_length": 27.157894736842106,
"alnum_prop": 0.6763565891472868,
"repo_name": "tatsuhiro-t/grpc",
"id": "6cbd74df6679b48c49ad656c67cf952fe9137f6c",
"size": "256... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['ConstantTrend'] , ['Seasonal_Minute'] , ['SVR'] ); | {
"content_hash": "7c30e201aa6f15c81b9eb17142ea9cf1",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 88,
"avg_line_length": 40.25,
"alnum_prop": 0.7142857142857143,
"repo_name": "antoinecarme/pyaf",
"id": "6e686890e51229f211fcfffbd02e148a45522a6c",
"size": "161",
"binary"... |
from django.contrib import admin
from .models import Car, Refuelling, Cleaning, Service, Revision, Tax, Insurance, Tyre
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
#UserAdmin.list_display = ('email', 'first_name', 'last_name', 'is_active', 'date_joined', 'is_staff')
cl... | {
"content_hash": "cdd57c8cde02dc9f12b07cf001c3749d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 107,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.7431865828092243,
"repo_name": "cdDiaCo/myGarage",
"id": "e70be085aa7be8cf964a23ab5d237075f288c85c",
"size": "95... |
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import string
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOWEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Converts all characters in a given payloa... | {
"content_hash": "00ba60e5869055aaa7ba0cd23b5ed1f4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 150,
"avg_line_length": 27.232558139534884,
"alnum_prop": 0.5687446626814688,
"repo_name": "michaelhidalgo/7WCSQ",
"id": "5335148fe91f75cfd9237c135e5842dbf34089ce",
"size":... |
import gemstone
from gemstone.discovery.default import HttpDiscoveryStrategy
from gemstone.discovery.redis_strategy import RedisDiscoveryStrategy
class Service1(gemstone.MicroService):
name = "service.1"
port = 8000
discovery_strategies = [
RedisDiscoveryStrategy("redis://localhost:6379/0")
... | {
"content_hash": "f031d184f0aaddaeb0e57199fdc1c2ce",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 71,
"avg_line_length": 25.958333333333332,
"alnum_prop": 0.6821829855537721,
"repo_name": "vladcalin/gemstone",
"id": "a16a53a6de2d030e538f15a00af077e3026289cb",
"size": "6... |
from gym.envs.registration import register
import envs
register(
id='Spheres-v0',
entry_point='envs:SpheresEnv',
)
| {
"content_hash": "5bdb852a0d247b5c78b4e03351c0d21f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 17.714285714285715,
"alnum_prop": 0.7258064516129032,
"repo_name": "GoogleCloudPlatform/next18-ai-in-motion",
"id": "9b08a3147a2f8174faf18f696b984b3423b... |
"""Tests for the Insteon lock."""
from unittest.mock import patch
import pytest
from homeassistant.components import insteon
from homeassistant.components.insteon import (
DOMAIN,
insteon_entity,
utils as insteon_utils,
)
from homeassistant.components.lock import ( # SERVICE_LOCK,; SERVICE_UNLOCK,
D... | {
"content_hash": "0078b0e605c7cfaa016572cf12cbf14f",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 83,
"avg_line_length": 29.38532110091743,
"alnum_prop": 0.6721823290665001,
"repo_name": "nkgilley/home-assistant",
"id": "6f847543a9f014188a7bc852b6bf20d61f29d016",
"size... |
"""Example: Use setAngles Method"""
import qi
import argparse
import sys
import time
import almath
import os
def main(session):
"""
This example uses the setAngles method and setStiffnesses method
in order to control joints.
"""
# Get the service ALMotion.
motion_service = session.service("... | {
"content_hash": "4ee6007669121e6d636c8390798ef820",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 98,
"avg_line_length": 34.710144927536234,
"alnum_prop": 0.6342379958246347,
"repo_name": "LCAS/spqrel_tools",
"id": "3cc5d5971a25dea21c0e93e9fc948c11c335b1d0",
"size": "24... |
import datetime
from errno import ENOENT, EACCES, EPERM
class CpuAcctStat:
'Class for cpu metric for a docker container'
cpuacctPath = '/sys/fs/cgroup/cpuacct/docker/'
def __init__(self, containerId, containerName):
self.containerId = containerId
self.containerName = containerName
self.t... | {
"content_hash": "b7302deb99af690491a0006e1bb8d2bb",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 136,
"avg_line_length": 42.09375,
"alnum_prop": 0.5879732739420935,
"repo_name": "sofkaski/dockerstat",
"id": "127aa805679c79901cc85b5b4496b1ebb3b1d2b2",
"size": "4041",
... |
#
# Copyright 2017 the original author or authors.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | {
"content_hash": "1fd4c799cf5ccffdbed5b16c6e22ec49",
"timestamp": "",
"source": "github",
"line_count": 1723,
"max_line_length": 324,
"avg_line_length": 41.57457922228671,
"alnum_prop": 0.566177599709631,
"repo_name": "opencord/voltha",
"id": "e899eede5b0a0c78d3460a1cc347ebce719bc230",
"size": "716... |
from __future__ import print_function
import sys
import os
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
def test_load_glrm():
print("Importing iris_wheader.csv data...")
irisH2O = h2o.upload_file(pyunit_utils.locate("small... | {
"content_hash": "c36daf66b451fc6516e5df4f898b14f9",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 108,
"avg_line_length": 35.91489361702128,
"alnum_prop": 0.7085308056872038,
"repo_name": "michalkurka/h2o-3",
"id": "9f7dcc4c79d269ce70620b09a21902f1a94b6605",
"size": "16... |
'''The final estimator and result:
AdaBoostClassifier(algorithm='SAMME.R', base_estimator=None,
learning_rate=1.0, n_estimators=10, random_state=42)
Accuracy: 0.87885 Precision: 0.63898 Recall: 0.48850 F1: 0.55370 F2: 0.51265
Total predictions: 13000 True positives: 977 ... | {
"content_hash": "042e38a1e48dc3de372503b84e43b24b",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 133,
"avg_line_length": 42.60204081632653,
"alnum_prop": 0.7017964071856287,
"repo_name": "tommysiu/udacity-data-analyst",
"id": "a0411c7f2d7d651d89d2444a4329c2ea7e8f4b90",
... |
"""
A class that represents a unit symbol.
"""
# -----------------------------------------------------------------------------
# Copyright (c) 2018, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the LICENSE file, distributed with this software.
# -------... | {
"content_hash": "b95a1a3c5d4065ce0cb67a64416d34b0",
"timestamp": "",
"source": "github",
"line_count": 1110,
"max_line_length": 88,
"avg_line_length": 32.66936936936937,
"alnum_prop": 0.5721534346303395,
"repo_name": "yt-project/unyt",
"id": "5efc0bb701d4fc3cafc5bba6256873daa4aad6ac",
"size": "362... |
from telemetry.timeline import async_slice as async_slice_module
from telemetry.timeline import flow_event as flow_event_module
from telemetry.timeline import slice as slice_module
class TimelineEventContainer(object):
"""Represents a container for events.
"""
def __init__(self, name, parent):
self.parent ... | {
"content_hash": "07788789101876d53a9334b4950dc5b8",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 35.64556962025316,
"alnum_prop": 0.7056107954545454,
"repo_name": "endlessm/chromium-browser",
"id": "e82fd496bdcd83f134a06efa828dacf995c8cea5",
"si... |
import logging
from mendeley import Mendeley
from mendeley.exception import MendeleyException
__author__ = 'robodasha'
__email__ = 'damirah@live.com'
class MendeleyResolver(object):
FIELDS = ['id', 'title', 'type', 'abstract', 'source', 'year', 'authors',
'identifiers', 'keywords', 'link', 'month... | {
"content_hash": "97760bc31bb3647f8eb2cfe0690b923c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 38.567567567567565,
"alnum_prop": 0.5448493342676944,
"repo_name": "robodasha/research_papers",
"id": "762b6665e4cc6d2c439ea5188c5082c9be966f5e",
"si... |
def simple_generator_function():
yield 1
yield 2
yield 3
def withfor():
for value in simple_generator_function():
print(value)
def withnext():
our_generator = simple_generator_function()
print next(our_generator)
print next(our_generator)
print next(our_generator)
def main():
... | {
"content_hash": "9a88a492a21b6ed88c2ce125ab6e230f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 47,
"avg_line_length": 18.73913043478261,
"alnum_prop": 0.6194895591647331,
"repo_name": "juancarlosqr/datascience",
"id": "ed79fa51bc00934e6a8ba315a0abe7fb09c941b6",
"size... |
import _plotly_utils.basevalidators
class DtickrangeValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(
self,
plotly_name="dtickrange",
parent_name="layout.scene.yaxis.tickformatstop",
**kwargs
):
super(DtickrangeValidator, self).__init__(
... | {
"content_hash": "197a762cc0eb160d00128354b951622e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 75,
"avg_line_length": 31,
"alnum_prop": 0.49193548387096775,
"repo_name": "plotly/python-api",
"id": "3588faf2d8343745c52689a941c8c6178c2c5448",
"size": "744",
"binary":... |
from __future__ import unicode_literals
import os
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import (
CommonPasswordValidator, MinimumLengthValidator, NumericPasswordValidator,
UserAttributeSimilarityValidator, get_default_password_validators,
get_pass... | {
"content_hash": "0cdf9de8f3d772a9104a9d28a842f235",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 110,
"avg_line_length": 44.68181818181818,
"alnum_prop": 0.6738301119023398,
"repo_name": "yephper/django",
"id": "987ae8c80e44a5eb80cd963ff2b17a8712839b42",
"size": "7864... |
import functools
import sys
from oslo_log import log as logging
import six
from nova.compute import utils as compute_utils
import nova.conf
from nova import exception
from nova.image import glance
from nova import utils
from nova.virt.xenapi import vm_utils
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)
c... | {
"content_hash": "19787d8595ac883a9983b4f618ab1590",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 37.17948717948718,
"alnum_prop": 0.62,
"repo_name": "bigswitch/nova",
"id": "6e0454c3230b2f786fbb976983889a734f763b26",
"size": "3536",
"binary": f... |
"""SCons.Tool.dmd
Tool-specific initialization for the Digital Mars D compiler.
(http://digitalmars.com/d)
Coded by Andy Friesen (andy@ikagames.com)
15 November 2003
There are a number of problems with this script at this point in time.
The one that irritates me the most is the Windows linker setup. The D
linker do... | {
"content_hash": "d298101a8c631dba4f3343d1a4195bda",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 120,
"avg_line_length": 38.504464285714285,
"alnum_prop": 0.5950144927536232,
"repo_name": "cournape/numscons",
"id": "5f519b7f04b92ee6b427c733df5f69a070a2d131",
"size": "... |
from unittest.mock import patch
from unittest.mock import MagicMock
from cauldron.environ import logger
@patch('cauldron.environ.logger.log')
def test_header_zero(log: MagicMock):
"""Should log a level zero header without modification"""
logger.header('hello', level=0)
args = log.call_args[0]
assert ... | {
"content_hash": "90265a70a59022b6a158fe92f2224356",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 76,
"avg_line_length": 33.05555555555556,
"alnum_prop": 0.6666666666666666,
"repo_name": "sernst/cauldron",
"id": "b291a24dbf8105c60565fbe53e8b203b0da7dbed",
"size": "1785"... |
"""Script that generates the build.ninja for ninja itself.
Projects that use ninja themselves should either write a similar script
or use a meta-build system that supports Ninja output."""
from __future__ import print_function
from optparse import OptionParser
import os
import sys
import platform_helper
sys.path.ins... | {
"content_hash": "17fc2d5bf4cd790e3691ea202d60d207",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 121,
"avg_line_length": 33.739030023094685,
"alnum_prop": 0.5835443904442467,
"repo_name": "pombredanne/ninja",
"id": "431b03e337654faf59978b39b97abd6e1856c603",
"size": "... |
"""Openstack logging handler.
This module adds to logging functionality by adding the option to specify
a context object when calling the various log methods. If the context object
is not specified, default formatting is used. Additionally, an instance uuid
may be passed as part of the log message, which is intended ... | {
"content_hash": "0e8bb19ca2a155ee2b26922376640d8a",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 78,
"avg_line_length": 35.08148148148148,
"alnum_prop": 0.5892103040540541,
"repo_name": "savi-dev/heat",
"id": "94c85147ef077f3efd4078edeaac84caa7a98c1a",
"size": "19760"... |
class Figure:
def __init__(self, perimeter = 0):
self.setPerimeter(perimeter)
def __str__(self):
return "make string: " + str(self.p)
def __int__(self):
return self.p
def setPerimeter(self, perimeter):
self.p = perimeter
f = Figure(37)
print(f)
| {
"content_hash": "f7c480d9a7e74acd6cb6f6a700c04ab8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 44,
"avg_line_length": 19.8,
"alnum_prop": 0.569023569023569,
"repo_name": "dluschan/school",
"id": "3a11d1a0cacc432bf38196c74e5a806df9dd3d73",
"size": "297",
"binary": f... |
"""Multiple DB API backend support.
A DB backend module should implement a method named 'get_backend' which
takes no arguments. The method can return any object that implements DB
API methods.
"""
import functools
import logging
import threading
import time
from neutron.openstack.common.db import exception
from neu... | {
"content_hash": "f4c618f0211f613ffa9c4e27dbda7d44",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 36.40816326530612,
"alnum_prop": 0.5866965620328849,
"repo_name": "gopal1cloud/neutron",
"id": "7f71d6a2b6812934914e07da445df10d2370b828",
"size": "... |
from domino._impl.custommetrics.paths.api_metric_values_v1.post import ApiForpost
class ApiMetricValuesV1(
ApiForpost,
):
pass
| {
"content_hash": "b9497a470609b652653127d2698fc242",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 81,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.7664233576642335,
"repo_name": "dominodatalab/python-domino",
"id": "901637fbdf54f0b63a9779c886830892db1f2bea",
"s... |
import sys
import re
import string
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
... | {
"content_hash": "2d024a9f258c2350830c872a5ae94893",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 95,
"avg_line_length": 30.455555555555556,
"alnum_prop": 0.6446552353155782,
"repo_name": "brebory/google-python-exercises",
"id": "0c2fc48303daeb09ccb2bffdb44a2dd6a129b8e7",... |
import getdns, sys
try:
ulabel = getdns.alabel_to_ulabel('xn--p1acf')
# Next line contains a utf-8 string
alabel = getdns.ulabel_to_alabel('рус')
ulabel1 = getdns.alabel_to_ulabel('xn--vermgensberatung-pwb')
# Next line contains a utf-8 string
alabel1 = getdns.ulabel_to_alabel('vermögensberatun... | {
"content_hash": "44cbcee23d7027b98b14ef3a71e75a78",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 26.294117647058822,
"alnum_prop": 0.6912751677852349,
"repo_name": "getdnsapi/getdns-python-bindings",
"id": "719ae5c3535452d6568a0387f8c24639de954f21"... |
from __future__ import unicode_literals
from functools import wraps
from indico.core.settings import SettingsProxyBase
from indico.core.settings.util import get_all_settings, get_setting
from indico.modules.categories import Category
from indico.modules.categories.models.settings import CategorySetting
def _categor... | {
"content_hash": "f4a5d3b283db69a437c5b563d1142643",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 108,
"avg_line_length": 34.29347826086956,
"alnum_prop": 0.6532488114104595,
"repo_name": "mvidalgarcia/indico",
"id": "d28f86d114df4216af0b35149e885889fa75946e",
"size": "... |
import httplib
import json
import logging
from os import environ
from oauth2_client.credentials_manager import CredentialManager, ServiceInformation
from orangecloud_client import URL_API
from orangecloud_client.files import Files
from orangecloud_client.folders import Folders
from orangecloud_client.freespace import... | {
"content_hash": "d53eda365d23515f97ecac363cf37c99",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 139,
"avg_line_length": 33.184615384615384,
"alnum_prop": 0.6184515530829856,
"repo_name": "antechrestos/orangecloud-client",
"id": "7205ab179a76b051405f86d5b7b08406cb7fffdf"... |
from django.conf import settings
from django.db import models
from django.db import connection, DEFAULT_DB_ALIAS
class Square(models.Model):
root = models.IntegerField()
square = models.PositiveIntegerField()
def __unicode__(self):
return "%s ** 2 == %s" % (self.root, self.square)
class Person(... | {
"content_hash": "fb5acab88ce7b52b4b2ec072db64c481",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 262,
"avg_line_length": 40.97530864197531,
"alnum_prop": 0.653510093401627,
"repo_name": "Smarsh/django",
"id": "e3137f2710c4423496404196040a68b81b40e6ea",
"size": "3319",
... |
from .. import Variable
from ..conventions import cf_encoder
from ..core import indexing
from ..core.utils import FrozenOrderedDict, close_on_error, Frozen
from ..core.pycompat import iteritems, bytes_type, unicode_type, OrderedDict
from .common import AbstractWritableDataStore
from .netCDF4_ import _nc4_group, _nc4_v... | {
"content_hash": "502f8dcd2409c0742e12db257628f4f5",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 32.79338842975206,
"alnum_prop": 0.6171875,
"repo_name": "kjordahl/xray",
"id": "a33d8f9ed0b3be3b74ce37cae217f20b3685f872",
"size": "4020",
"binar... |
from datetime import date
class EntityTable(object):
"""
Stores entities that are later read by the Interpreter. During parsing,
entities are set based on their given tags from the Seq2Seq model and are
stored in this class.
"""
def __init__(self):
""" Creates a EntityTabl... | {
"content_hash": "802d3c11f2df997444b0ec0f9ca07965",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 81,
"avg_line_length": 22.854166666666668,
"alnum_prop": 0.5986022485566697,
"repo_name": "furioustiles/HooperHub",
"id": "cc6b0d96e06d27802a6e65aceb8cab137e96a632",
"size... |
import tarfile
import sys
version = sys.argv[1]
tar = tarfile.open(f"dist/bioscrape-{version}.tar.gz")
for member in tar.getmembers():
print(member)
tar.close()
| {
"content_hash": "0a806a11a41bf74a9577d08af731f23b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 54,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.7272727272727273,
"repo_name": "ananswam/bioscrape",
"id": "5a6a8178025fba628f70cf55478aa7bda444a5f2",
"size": "16... |
import sqlite3
import sys
from ..dependency import Dependency
from .. import DbConnection
from .documenttablecreator import DocumentTableCreator
class DocumentManager(Dependency):
"""Creates a DocumentManager
DocumentManager will call :func:`recommender.document.DocumentTableCreator.init_database`
:par... | {
"content_hash": "e03fa46dc57ea2b2d3dbd9008c489eb6",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 93,
"avg_line_length": 28.25,
"alnum_prop": 0.5470337594231399,
"repo_name": "dustywind/bachelor-thesis",
"id": "380169987052992a3fdd839f2fb7c96b87c6b61b",
"size": "3052",... |
from txgoogleapi.unauth_requester import UnauthRequester
from txgoogleapi.api_key_requester import ApiKeyRequester
from txgoogleapi.oauth_requester import OAuthRequester
from txgoogleapi.api import Google
| {
"content_hash": "d4871091f223b6c85a7f791e26fdc834",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 57,
"avg_line_length": 51.25,
"alnum_prop": 0.8829268292682927,
"repo_name": "iksteen/txgoogleapi",
"id": "4b6479af2e0c85b7893750c3717a27c0259653be",
"size": "205",
"binar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.