text stringlengths 4 1.02M | meta dict |
|---|---|
from django.views.generic import TemplateView
class IndexView(TemplateView):
template_name = 'ng/index.html'
| {
"content_hash": "35926db33d5db63ea327fe1610bf6650",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 28.5,
"alnum_prop": 0.7807017543859649,
"repo_name": "XeryusTC/18xx-accountant",
"id": "b78eb588b521c049763b2d4b3e59639b510aa9c0",
"size": "138",
"b... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Switch',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=... | {
"content_hash": "f0cff30264d5ed4df20d0b92bb2041d3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 114,
"avg_line_length": 55.46153846153846,
"alnum_prop": 0.5839112343966713,
"repo_name": "lindseypack/NIM",
"id": "268ed7edd23bd0b37ecca1f5d19cf48c81f9857c",
"size": "2187... |
"""Support for monitoring a Smappee appliance binary sensor."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassis... | {
"content_hash": "3bc921402e7f7a166bb3a13ca5d94563",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 93,
"avg_line_length": 34.16483516483517,
"alnum_prop": 0.6080733354776455,
"repo_name": "mezz64/home-assistant",
"id": "88d46e3689d22649bd0c0d5eb3d8ed7a236cdcac",
"size":... |
import sys
import sqlite3
import random
import xml.etree.ElementTree as etree
import urllib.parse
def get_files_info(sqlite_filename, number_of_files):
with sqlite3.connect(r'file:///' + sqlite_filename + '?mode=ro', uri=True) as conn:
c = conn.cursor()
c.execute('SELECT COUNT(*) FROM images')
... | {
"content_hash": "dccd6fe5d9088fcbfc51a1390db60c4b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 114,
"avg_line_length": 38.94444444444444,
"alnum_prop": 0.6412268188302425,
"repo_name": "agavrilov/HomeImageRSSLinux",
"id": "d2816ec010976aae4b26530ec894525bc733c8ff",
... |
import os
import re
from . import compat
class RmoqStorageBackend(object):
"""
Base backend for rmoq backends. All storage backends for rmoq must inherit this
backend if it is to be used with rmoq.
"""
def get(self, prefix, url):
"""
Fetches a request response from storage. Shoul... | {
"content_hash": "637538487093369c8cba5fb7d67df7be",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 94,
"avg_line_length": 33.403669724770644,
"alnum_prop": 0.6212578961823675,
"repo_name": "relekang/rmoq",
"id": "a92394df5963af73602c047781f2f6c1fd280c58",
"size": "3665"... |
import tq
import redis
import argparse
#-------------------------------------------------------------------------------
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--host",
default='localhost',
help="hostname of the redis instance")
parser.add_argument("--port",
type=int,
default... | {
"content_hash": "046bcbe3ac8ed439aba7eb43b51d44b7",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 22.170731707317074,
"alnum_prop": 0.49064906490649063,
"repo_name": "johansten/tq",
"id": "8725dfff01af7b0608812e1678432fadcfcfbd1e",
"size": "928",
... |
"Test multicall, coverage 33%."
from idlelib import multicall
import unittest
from test.support import requires
from tkinter import Tk, Text
class MultiCallTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
cls.root = Tk()
cls.root.withdraw()
cls.mc = ... | {
"content_hash": "33ff06387bc4736142c497bf40ea2658",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 65,
"avg_line_length": 26.05,
"alnum_prop": 0.6285988483685221,
"repo_name": "huguesv/PTVS",
"id": "68156a743d7b9b63050082b6cde0655a20211672",
"size": "1042",
"binary": f... |
import json
from datetime import datetime as dt
from operator import itemgetter
import pendulum
from flask_appbuilder.fieldwidgets import (
BS3PasswordFieldWidget,
BS3TextAreaFieldWidget,
BS3TextFieldWidget,
Select2Widget,
)
from flask_appbuilder.forms import DynamicForm
from flask_babel import lazy_ge... | {
"content_hash": "8230e34293e18b3c5858e7640bc29862",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 108,
"avg_line_length": 38.83916083916084,
"alnum_prop": 0.647731364782139,
"repo_name": "mrkm4ntr/incubator-airflow",
"id": "24850100e534d9a94cd184277a25dea5ba0a0913",
"s... |
"""
Analyzer functions
"""
import sys
import os.path
from copy import deepcopy
# rebind in explore
anames = list()
states = list() # state's index here is its state number in lists, graph below
initial = 0 # always, keep as well as runstarts (below) for backward compat.
accepting = list()
frontier = list() # unex... | {
"content_hash": "836041c16d98ce4c625d33fbde07d608",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 103,
"avg_line_length": 41.50625,
"alnum_prop": 0.6063845806354464,
"repo_name": "nfredrik/pyModelStuff",
"id": "87865c8548a033bf4533b9a53faf98b512c32e9c",
"size": "6641",... |
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa:... | {
"content_hash": "a29c3d888d9947512fc8500a15af6750",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 129,
"avg_line_length": 33.458333333333336,
"alnum_prop": 0.5803237858032378,
"repo_name": "onshape-public/onshape-clients",
"id": "5bee1404de6eea35cae736a8a9b7f1aaadb03f2b"... |
import pickle
import types
import sys
import StringIO
import warnings
from copygenerators import GeneratorSnapshot, copy_generator, Generatorcopy
warnings.simplefilter("always", PendingDeprecationWarning)
__all__ = ["dump",
"pickle_generator",
"load",
"unpickle_generator",
... | {
"content_hash": "6161ae2a55478d3d5397945ce1495545",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 180,
"avg_line_length": 40.95918367346939,
"alnum_prop": 0.6641753861484804,
"repo_name": "tonyroberts/generator_tools",
"id": "15019fd5f2c5275ae2700c089106ad8bb53e10ad",
... |
from django import forms
from app.libs.utils import make_api_key
# api form base
class ApiForm(forms.Form):
client = forms.RegexField('^[A-Za-z0-9_]+$')
key = forms.CharField()
version = forms.RegexField('^1$')
def clean_key(self):
client = self.cleaned_data['client']
... | {
"content_hash": "21d0db79cfd7412c93aaf9631d401c3f",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 60,
"avg_line_length": 26.829787234042552,
"alnum_prop": 0.56304520222046,
"repo_name": "pistatium/houkago_app",
"id": "ca1383ad261ed499bd2a2ff0d145a9dc337aa78f",
"size": "... |
"""Stack implementation in Python."""
from src.linked_list import LinkedList
class Stack(object):
"""Implementation of Stack.
public methods:
push(value) - Adds a value to the stack.
The parameter is the value to be added to the stack.
pop() - Removes a value from the stack and returns that val... | {
"content_hash": "d2343eb20b9dd887a8937feffb21a470",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.6184971098265896,
"repo_name": "clair3st/Data-Structures",
"id": "38ee943b3be650c4cd2f320ff5fab768503c598e",
"siz... |
"""The command to restore a backup of a Cloud SDK installation."""
from googlecloudsdk.calliope import base
class Restore(base.SilentCommand):
"""Restore the Cloud SDK installation to its previous state.
This is an undo operation, which restores the Cloud SDK installation on the
local workstation to the state... | {
"content_hash": "a266c571567b28e0d75c206ef52bae81",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 34.375,
"alnum_prop": 0.7369696969696969,
"repo_name": "flgiordano/netcash",
"id": "b7b47f436e3fcf1ae24a2e747bdb89306b795dc7",
"size": "1421",
"bin... |
"""Definition of targets run distribution package tests."""
import os.path
import sys
sys.path.insert(0, os.path.abspath('..'))
import python_utils.jobset as jobset
def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={},
flake_retries=0, timeout_retries=0):
"""Creates jobspec... | {
"content_hash": "a409c29b7a0bd2534a4cf571fa6a12d8",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 86,
"avg_line_length": 36.73770491803279,
"alnum_prop": 0.5759036144578313,
"repo_name": "royalharsh/grpc",
"id": "90bbde83cf4f3ca80a39a56b86b3c35ef7e120f8",
"size": "1275... |
"""Parse the input."""
import re
from tokenizer import Tokenizer
from matrix import Matrix
from utils import color_output
class Parser(object): # noqa
"""Input parser: parse token arguments."""
def __init__(self, vals):
"""Initialize Parser.
:tokens: lexed argument inputs.
"""
... | {
"content_hash": "e2317a03100a1d0168f7cd36223fbac1",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 74,
"avg_line_length": 41.93023255813954,
"alnum_prop": 0.3718801996672213,
"repo_name": "Habu-Kagumba/mini_matlab",
"id": "02002197ba314c99bb05f9e295dfe2adba4fc4be",
"siz... |
from __future__ import print_function
from mongoengine import StringField, Document
from cloudmesh_common.tables import array_dict_table_printer
import json
from cloudmesh.config.cm_config import get_mongo_db, get_mongo_dbname_from_collection, DBConnFactory
class ExperimentBase(Document):
cm_kind = StringField(de... | {
"content_hash": "fbf7747fd03fa168a0a84e9ff0c9b066",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 100,
"avg_line_length": 27.92929292929293,
"alnum_prop": 0.5490054249547921,
"repo_name": "rajpushkar83/cloudmesh",
"id": "e23e007d55c16dbb8eff5c7e0ad292e30e299ea3",
"size"... |
"""Test the wallet accounts properly when there are cloned transactions with malleated scriptsigs."""
import io
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
)
from test_framework.messages import CTransaction, COIN
class TxnMallTest(BitcoinTestFrame... | {
"content_hash": "5c0fb998f8bfa23490b48300035d42f4",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 160,
"avg_line_length": 43.58273381294964,
"alnum_prop": 0.6242984483327831,
"repo_name": "alecalve/bitcoin",
"id": "bdbbb3e530bb90f904dae358c872865bd7f5abf5",
"size": "62... |
from numba import jit
@jit
def pairwise_minmax(x, y):
"""
Simple implementation of the minmax distance metric
for two (non-sparse) vectors.
Parameters
----------
x : array [n_features]
y : array [n_features]
Input vectors between which minmax will between
calculate. Does no... | {
"content_hash": "18b4bce1983adb550fc8b7998fa014ae",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 55,
"avg_line_length": 22.235294117647058,
"alnum_prop": 0.4947089947089947,
"repo_name": "mikekestemont/ruzicka",
"id": "1e33b27afcced3889663ca0ad2d06d1bd174ec3c",
"size":... |
'''
Harvester for the DigitalCommons@University of Nebraska - Lincoln for the SHARE project
Example API call: http://digitalcommons.unl.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UnlHarvester(OAIHarvester):
short_name... | {
"content_hash": "5b887d12c2739e036f624f23db52c750",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 94,
"avg_line_length": 34.55555555555556,
"alnum_prop": 0.7282958199356914,
"repo_name": "erinspace/scrapi",
"id": "b0e9993877b744826ae200939e0486f2e706912a",
"size": "622"... |
import logging
import os
import sys
def _SetupPaths():
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append('/usr/local') # to import autotest libs
_SetupPaths()
from autotest.cros import constants
import pyauto
class ChromeosUtils(pyauto.PyUITest):
"""Utils for ChromeOS."""
... | {
"content_hash": "80793240011b731b38cd949276503f49",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 24.31578947368421,
"alnum_prop": 0.6731601731601732,
"repo_name": "meego-tablet-ux/meego-app-browser",
"id": "c079c8cc318fe5757e25a7e84b9a37cfe666d0d0"... |
import argparse
import os
# [START healthcare_create_resource_attribute_definition]
def create_resource_attribute_definition(
project_id: str,
location: str,
dataset_id: str,
consent_store_id: str,
resource_attribute_definition_id: str,
):
"""Creates a RESOURCE attribute definition. A RESOURCE... | {
"content_hash": "4dc180306a71d93aa0b79e9ba5d69ce0",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 112,
"avg_line_length": 33.67359667359668,
"alnum_prop": 0.6614187812557881,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "cb96acbc2dee28e7cbd10f29ac7a1ffa0... |
class CallbackModule(object):
"""
this is an example ansible callback file that does nothing. You can drop
other classes in the same directory to define your own handlers. Methods
you do not use can be omitted.
example uses include: logging, emailing, storing info, etc
"""
def on_any(s... | {
"content_hash": "a61a196f779581b9ef201c8b50451f04",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 144,
"avg_line_length": 23.04054054054054,
"alnum_prop": 0.6217008797653959,
"repo_name": "dlab-berkeley/collaboratool-archive",
"id": "54a2b254fc7050043a19ae4f059595f250e5f2... |
import argparse
import datetime
import json
import logging
from socket import gaierror
from socket import getfqdn
from socket import gethostbyname
from typing import List
from typing import NamedTuple
from typing import Optional
import a_sync
from dateutil import parser
from pytimeparse import timeparse
from requests ... | {
"content_hash": "3a889a62109ae40d5800550de68f7e94",
"timestamp": "",
"source": "github",
"line_count": 834,
"max_line_length": 118,
"avg_line_length": 36.99760191846523,
"alnum_prop": 0.6770158154005704,
"repo_name": "Yelp/paasta",
"id": "4eb8645d0ece59d9b31d4168c5119146f8d7dbb2",
"size": "31456",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('msgs', '0002_auto_20150102_1007'),
]
operations = [
migrations.AddField(
model_name='message',
name='status',
fi... | {
"content_hash": "150d9bf92545822e8f38ac8b32a7626b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 172,
"avg_line_length": 28,
"alnum_prop": 0.5958646616541353,
"repo_name": "rapidpro/chatpro",
"id": "0f202dea7f4c278aeb0e7337249b660a1add849b",
"size": "556",
"binary": ... |
import markdown
def load_page(name):
try:
body=open("pages/"+name+".md").read().decode("utf-8")
except:
body=u'Empty Page'
body_html=markdown.markdown(body).encode('utf-8')
return dict(name=name,body=body,body_html=body_html)
def load_words():
try:
words=open("pages/Index... | {
"content_hash": "86e60c01a8160c3c2d1fa1336c16ceeb",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 23.2,
"alnum_prop": 0.596551724137931,
"repo_name": "xsank/bottle",
"id": "855d11a2a262982441ea352f306a7a06119202d1",
"size": "580",
"binary": fals... |
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa:... | {
"content_hash": "d7a28c8b44738b4d92eeffc1ab6c8545",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 109,
"avg_line_length": 32.854304635761586,
"alnum_prop": 0.5692400725660149,
"repo_name": "onshape-public/onshape-clients",
"id": "fd3a153b1993afe86d8cce7a21275bf076d3a428"... |
import ast
from py4j.java_gateway import *
# Spark imports
from pyspark.conf import SparkConf
from pyspark.context import SparkContext
from pyspark.sql import *
from pyspark.sql.functions import UserDefinedFunction
from sparklingml.transformation_functions import *
# Hack to allow people to hook in more easily
try:
... | {
"content_hash": "36b102376c55c1fdef3e601548141a03",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 78,
"avg_line_length": 39.891666666666666,
"alnum_prop": 0.6335909755588051,
"repo_name": "sparklingpandas/sparklingml",
"id": "db3211758f15ff4d545169f0d03098e3ab19eecf",
... |
"""
Offer state listening automation rules.
For more details about this automation rule, please refer to the documentation
at https://home-assistant.io/docs/automation/trigger/#state-trigger
"""
import asyncio
import voluptuous as vol
from homeassistant.core import callback
import homeassistant.util.dt as dt_util
fro... | {
"content_hash": "55bba4cf7d256a3568771cfe1abd8c18",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 33.54237288135593,
"alnum_prop": 0.6154623547246084,
"repo_name": "MungoRae/home-assistant",
"id": "8ad5c40bb80d27979443748615824c438b64e7ef",
"size... |
"""SQLAlchemy models for Social Auth"""
import base64
import six
import json
from sqlalchemy.exc import IntegrityError
from sqlalchemy.types import PickleType, Text
from sqlalchemy import Column, Integer, String
from sqlalchemy.schema import UniqueConstraint
from social.storage.base import UserMixin, AssociationMixin... | {
"content_hash": "968b221d5974673aa7d7c353efd2c8b9",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 77,
"avg_line_length": 31.07239819004525,
"alnum_prop": 0.6193388670452891,
"repo_name": "garrett-schlesinger/python-social-auth",
"id": "f1934c43405bf8dca60ec80eca0381c6ce0... |
from openstack.network.v2 import qos_policy as _qos_policy
from openstack.tests.functional import base
class TestQoSPolicy(base.BaseFunctionalTest):
QOS_POLICY_ID = None
IS_SHARED = False
IS_DEFAULT = False
RULES = []
QOS_POLICY_DESCRIPTION = "QoS policy description"
def setUp(self):
... | {
"content_hash": "ef0cf742e4fcdb2820b1d990e5614bff",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 70,
"avg_line_length": 36.984375,
"alnum_prop": 0.648077735530207,
"repo_name": "dtroyer/python-openstacksdk",
"id": "df081b8ed8d6aa159314e31e3ac5cff78a331239",
"size": "29... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import logging
import os
import unittest
import time
from airflow import models, settings, AirflowException
from airflow.exceptions import AirflowSkipExc... | {
"content_hash": "73d4c7ba150981c0e6fa33605aee39b5",
"timestamp": "",
"source": "github",
"line_count": 1095,
"max_line_length": 94,
"avg_line_length": 35.80639269406392,
"alnum_prop": 0.5754692919812283,
"repo_name": "aminghadersohi/airflow",
"id": "4c2a15f4fa0f77aa68465f3b37682516cb243562",
"size... |
"""HintApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"content_hash": "41c4925ba467bcec90dc31573f3f975c",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 38.608695652173914,
"alnum_prop": 0.6959459459459459,
"repo_name": "abhi98khandelwal/HINT",
"id": "310d499ecb943505385d830b2b71143056d286c5",
"size":... |
import binascii
from malwareconfig import crypto
from malwareconfig.common import Decoder
from malwareconfig.common import string_printable
class BlueBanana(Decoder):
decoder_name = "BlueBanana"
decoder__version = 1
decoder_author = "@kevthehermit"
decoder_description = "Decoder for Blue Banana"
... | {
"content_hash": "c0126bd488dd56508543ef08ffda2d79",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 86,
"avg_line_length": 29.738095238095237,
"alnum_prop": 0.5804643714971978,
"repo_name": "kevthehermit/RATDecoders",
"id": "74843d1f22015db82433b11e987faa9fd157a5c1",
"siz... |
'''
@author: FangSun
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import functools
_config_ = {
'timeout' : 1000,
'noparallel' : True
}
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
'''
def test()
This ... | {
"content_hash": "a40940b3881946f1686fc35a3c144608",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 59,
"avg_line_length": 24.870967741935484,
"alnum_prop": 0.5914396887159533,
"repo_name": "zstackio/zstack-woodpecker",
"id": "adce1ef07d7010eb2ddf30097cd8e4bf2614aac3",
"s... |
from infcommon.factory import Factory
from infcommon.docker_compose.docker_compose import DockerComposeService
def docker_compose_service(base_dir=None, docker_compose_file_name=None):
return Factory.instance('docker_compose_service', lambda: DockerComposeService(base_dir, docker_compose_file_name))
| {
"content_hash": "d0e4543893fef46cb512c9a347724b56",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 123,
"avg_line_length": 51.833333333333336,
"alnum_prop": 0.8102893890675241,
"repo_name": "aleasoluciones/infcommon",
"id": "16ce40272b45ec1dc6e62dbf84336360c1038014",
"siz... |
import os
import argparse
import threading
from inputs import get_gamepad
import cereal.messaging as messaging
from common.realtime import Ratekeeper
from common.numpy_fast import interp, clip
from common.params import Params
from tools.lib.kbhit import KBHit
class Keyboard:
def __init__(self):
self.kb = KBHit... | {
"content_hash": "9ee47bd493de4eb02da79ac52636c07b",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 153,
"avg_line_length": 38.279661016949156,
"alnum_prop": 0.6393624086783263,
"repo_name": "commaai/openpilot",
"id": "b31dab83fe1f4442ddbafcf3421840658343e587",
"size": "... |
"""
Gmail
Access Gmail mailboxes including sending user email.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iter... | {
"content_hash": "46439c59873fdc160a6c3fb74ce0b805",
"timestamp": "",
"source": "github",
"line_count": 8286,
"max_line_length": 764,
"avg_line_length": 55.44593289886556,
"alnum_prop": 0.6004070305272895,
"repo_name": "CanopyIQ/gmail_client",
"id": "26349e35abe51441d3b94caf031521f650a14542",
"size... |
"""
Sensors on Zigbee Home Automation networks.
For more details on this platform, please refer to the documentation
at https://home-assistant.io/components/sensor.zha/
"""
import logging
from homeassistant.core import callback
from homeassistant.components.sensor import DOMAIN
from homeassistant.const import (
T... | {
"content_hash": "e9226df640044bb2592d1b3a39e66ef5",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 77,
"avg_line_length": 30.321243523316063,
"alnum_prop": 0.6481544771018455,
"repo_name": "jamespcole/home-assistant",
"id": "56ce97c87a066b85081650a4cf3291d6f46e4b32",
"s... |
import pymic as mic
import numpy as np
# load the library with the kernel function (on the target)
device = mic.devices[0]
library = device.load_library(("libdouble_it.so",))
stream = device.get_default_stream()
na = np.arange(1, 33)
a = stream.bind(na)
print "input:"
print "--------------------------------------"
... | {
"content_hash": "d49cd8f88ad44c5e4b08bd9b14b760b4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 59,
"avg_line_length": 20.08,
"alnum_prop": 0.6055776892430279,
"repo_name": "01org/pyMIC",
"id": "4b375435697fae85d39963c8f1de2c60caf35c69",
"size": "2066",
"binary": fa... |
import pygtk
pygtk.require('2.0')
import gtk
from utils.Form import FormBuilder
from datetime import datetime
from dateutil.relativedelta import relativedelta
class FiltroFecha:
def __init__(self, on_aceptar_handler):
self.on_aceptar_handler = on_aceptar_handler
builder = gtk.Builder()
bui... | {
"content_hash": "194ea8ba11f33a8c96a68a6883a67831",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 36.78787878787879,
"alnum_prop": 0.658154859967051,
"repo_name": "hey-mx/ventas_pygtk",
"id": "819fd9f36676549ef56eca4e33e3f2b5df26af6c",
"size": "12... |
from django.shortcuts import get_object_or_404, render_to_response
from django.template.context import RequestContext
from dnd.menu import MenuItem
from dnd.menu import menu_item, submenu_item
from dnd.dnd_paginator import DndPaginator
from dnd.filters import ( RaceFilter, RaceTypeFilter )
from dnd.models import (Ru... | {
"content_hash": "ade056f9a456275f32f6203401058d57",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 110,
"avg_line_length": 45.782051282051285,
"alnum_prop": 0.5183422010641277,
"repo_name": "dndtools/dndtools",
"id": "8b3cb255635c0f3a54d7259a2da1b7836a4f5701",
"size": "... |
import os
import re
from testrunner.local import testsuite
from testrunner.objects import testcase
from testrunner.outproc import webkit
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
class TestLoader(testsuite.JSTestLoader):
@property
def excluded_d... | {
"content_hash": "287d2b8ff8500f446b74fa382b669c05",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 80,
"avg_line_length": 30.413333333333334,
"alnum_prop": 0.6611135466900482,
"repo_name": "arangodb/arangodb",
"id": "500f44656b9e365d0b17223727ba8d1222d62da8",
"size": "38... |
from configparser import ConfigParser, ExtendedInterpolation
import os
class ConfigEvnParser:
"""
ConfigEvnParser is a class used to read configs from config files and environment variables.
The default config path is at './config/config.properties'
and to change the default path one can change the env... | {
"content_hash": "e772442a09d46d123293e1a0c3dde358",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 138,
"avg_line_length": 42.5,
"alnum_prop": 0.683710407239819,
"repo_name": "liufuyang/lifeinweeks",
"id": "8699921ce558cdbb111f2fbe442840f87d065c08",
"size": "2210",
"bi... |
"""Sample of a reticle top level Component."""
import gdsfactory as gf
from gdsfactory.types import Component
def mzi_te_pads1(**kwargs) -> Component:
c = gf.c.mzi_phase_shifter_top_heater_metal(delta_length=40)
c = gf.routing.add_fiber_single(c)
c = c.rotate(-90)
c = gf.routing.add_electrical_pads_t... | {
"content_hash": "c1343aa045e49decd8d085531433aff9",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 88,
"avg_line_length": 34.53846153846154,
"alnum_prop": 0.6581291759465479,
"repo_name": "gdsfactory/gdsfactory",
"id": "b94ceddb09bfdb3ccddd196b036f6eeb3d836530",
"size": ... |
"""Test Alexa capabilities."""
from unittest.mock import patch
import pytest
from homeassistant.components.alexa import smart_home
from homeassistant.components.climate import const as climate
from homeassistant.components.lock import STATE_JAMMED, STATE_LOCKING, STATE_UNLOCKING
from homeassistant.components.media_pl... | {
"content_hash": "af6f69e503416e7b3452ad52f7d7f4da",
"timestamp": "",
"source": "github",
"line_count": 868,
"max_line_length": 87,
"avg_line_length": 33.29032258064516,
"alnum_prop": 0.6083194905869325,
"repo_name": "GenericStudent/home-assistant",
"id": "d24849e100601c5c4d88cb60b24bdc77eefc3c78",
... |
"""Tests for ops which manipulate lists of tensors."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np # pylint: disable=unused-import
from tensorflow.python.client imp... | {
"content_hash": "c71169aa7ea7ee5a801420e44fa7adf2",
"timestamp": "",
"source": "github",
"line_count": 1562,
"max_line_length": 80,
"avg_line_length": 44.2887323943662,
"alnum_prop": 0.643793636797294,
"repo_name": "ghchinoy/tensorflow",
"id": "3c35b9767e9a1434bd7a4c5c06d10a63845b8b00",
"size": "6... |
from __future__ import absolute_import
from setuptools import setup
setup(
setup_requires=['pbr'],
pbr=True,
)
| {
"content_hash": "f422de37e6c3f1cfc4b5a7ee231f9711",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 17.142857142857142,
"alnum_prop": 0.6916666666666667,
"repo_name": "mfalesni/mgmtsystem",
"id": "a88539e8933eabed0de16c1c3cb8a1717e34679e",
"size": "1... |
"""Futures for long-running operations returned from Google Cloud APIs.
These futures can be used to synchronously wait for the result of a
long-running operation using :meth:`Operation.result`:
.. code-block:: python
operation = my_api_client.long_running_method()
result = operation.result()
Or asynchrono... | {
"content_hash": "0615b5af46077d1eb94fc39ad6c1e4d7",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 88,
"avg_line_length": 36.52818991097923,
"alnum_prop": 0.6456539398862713,
"repo_name": "martbhell/wasthereannhlgamelastnight",
"id": "b17f753b41315d31e2b0db35ef3613eaa7aca... |
from collections import Counter
from model import Model
import random
P = 0.2
SEED = 144144
random.seed(SEED)
class RandomP(Model):
"""
Class: RandomP
--------------
Each neighbor of the node has a probability p of infecting the node. If more
than one neighbor "infects" the node, then the node does not chan... | {
"content_hash": "75f8136473590cfd6a0d4b134f0d5368",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 31.743589743589745,
"alnum_prop": 0.6680129240710824,
"repo_name": "visemet/pandemaniac-modelsim",
"id": "f2f1851038e4104351e043ee3cd79d5a944c5da8",
... |
import os, shutil
import sys
import glob
import csv
from collections import OrderedDict
def extractText(fileCsvPath):
results = {}
textReader = csv.reader(open(fileCsvPath, encoding='utf-8'))
for row in textReader:
fileName=row[2]
baseName=os.path.basename(fileName).split(os.extsep, 1)[0]
... | {
"content_hash": "a4f0a0139984f2cf52b0ae935a7b5e0d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 172,
"avg_line_length": 38.433734939759034,
"alnum_prop": 0.6905956112852665,
"repo_name": "mondhs/kaldi-liepa-train",
"id": "a9185661cc37978ec6f8ac7c83586b9424170c8d",
"si... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
im... | {
"content_hash": "972db7692318963d986e5617e1b25660",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 105,
"avg_line_length": 19.4,
"alnum_prop": 0.6675257731958762,
"repo_name": "sebgoa/client-python",
"id": "b7f41ea0b77fba2b119bc0387355b79f3191e304",
"size": "793",
"bin... |
import RPi.GPIO as GPIO
from timeit import default_timer as timer
import ctypes
import logging
from signal import pause
logger = logging.getLogger(__name__)
c_uint8 = ctypes.c_uint8
class Flags_bits(ctypes.LittleEndianStructure):
_fields_ = [
("A", c_uint8, 1), # asByte & 1
("B", c_uint8, 1), ... | {
"content_hash": "728974af48c61560c1407f3a74164a7c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 94,
"avg_line_length": 34.47517730496454,
"alnum_prop": 0.607899609133923,
"repo_name": "MiczFlor/RPi-Jukebox-RFID",
"id": "1528b625fdd9241ecbc4eedd94f77bb071b1768a",
"siz... |
import os
def GetListOfFiles(dirpath):
list_of_files = os.listdir(dirpath)
all_files = []
for file in list_of_files:
full_path = os.path.join(dirpath, file)
if os.path.isdir(full_path):
all_files = all_files + GetListOfFiles(full_path)
else:
all_files.append... | {
"content_hash": "6286d5c2f772de45fd6faeb7915e122f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.6073446327683616,
"repo_name": "msbeta/apollo",
"id": "1c6ad5585c52e6fa27aeed57e79a341943fe9b92",
"size": "1115",... |
'''OpenGL extension VERSION.GL_3_0
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_3_0 to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_3_0.txt
'''
from OpenGL import platform, constant, arrays
fro... | {
"content_hash": "7ce294de751042646bad520965e4f3a8",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 103,
"avg_line_length": 37.644067796610166,
"alnum_prop": 0.7978388113462405,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "ab0b713b70f8c153f3eb9f0633ea744e7e8b7916"... |
from oslo_config import cfg
import six
from sahara import context
from sahara import exceptions as ex
from sahara.i18n import _
from sahara.utils.openstack import base as b
from sahara.utils.openstack import cinder as cinder_client
from sahara.utils.openstack import neutron as neutron_client
from sahara.utils.openstac... | {
"content_hash": "1b046d2c863d93cbb07e479b09e38ab3",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 78,
"avg_line_length": 33.0880829015544,
"alnum_prop": 0.5974005637331663,
"repo_name": "tellesnobrega/sahara",
"id": "563cfe45f806c77cff0aa0b755e4c1f4a8e505ca",
"size": "... |
__version__ = '1.3.7'
__author__ = 'Adrian Sampson <adrian@radbox.org>'
import beets.library
from beets.util import confit
Library = beets.library.Library
config = confit.LazyConfig('beets', __name__)
| {
"content_hash": "c71f9cd0b9bf58fb01f39eef5df3fc6c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7058823529411765,
"repo_name": "accesso/beets",
"id": "d4f4c5db83e4a3e63fc810e02500acedb6a6d8e0",
"size": "851",
... |
from __future__ import division
import math
import numpy as np
np.set_printoptions(precision=3, suppress=True)
import rospy
import roslib
roslib.load_manifest('vehicle_core')
import tf.transformations as tft
from vehicle_core.path import trajectory_tools as tt
from auv_msgs.msg import NavSts
from diagnostic_msgs.m... | {
"content_hash": "eebf73e559ce3ed97311a3cb06ad23c8",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 125,
"avg_line_length": 30.517094017094017,
"alnum_prop": 0.600476123792186,
"repo_name": "decabyte/vehicle_core",
"id": "d3d0deb1af9f4f065d1aefd51cc26b0891dd4f82",
"size"... |
from app.bot import BaseConverter
import apiai
import json
class ApiAiConverter(BaseConverter):
def __init__(self,client_access_token):
self.ai = apiai.ApiAI(client_access_token)
self.request = self.ai.text_request()
self.request.land = 'en'
@staticmethod
def getAction(respons... | {
"content_hash": "680dc2f0578223a16314338d47ca7116",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 59,
"avg_line_length": 26.64516129032258,
"alnum_prop": 0.6089588377723971,
"repo_name": "VikasSherawat/hotdesk",
"id": "885813a4da964ea87a4ecc25c6052c193029682a",
"size": ... |
from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.template.defaultfilters import urlize, linebreaks
from django.contrib.markup.templatetags.markup import markdown, restructuredtext
from pubman... | {
"content_hash": "28d5e8f20e1ad3e942c5842a263f58e6",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 87,
"avg_line_length": 33.875,
"alnum_prop": 0.5880996309963099,
"repo_name": "nathangeffen/django-pubman",
"id": "030277547ff882dc5e468ec2f0da092bc7e11bc8",
"size": "2168"... |
"""GAX/GAPIC module for managing Speech API requests."""
from google.cloud.gapic.speech.v1beta1.speech_client import SpeechClient
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import RecognitionAudio
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import RecognitionConfig
from google.cloud.grpc.speech... | {
"content_hash": "b2eafebbcfe013a56991f87cc4c12399",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 80,
"avg_line_length": 50.69512195121951,
"alnum_prop": 0.5645898484484003,
"repo_name": "Fkawala/gcloud-python",
"id": "05636a22806cd1d2e800bed580ca172fd91eab1e",
"size":... |
"""core functionalities of feets"""
__all__ = [
"FeatureNotFound",
"DataRequiredError",
"FeatureSpaceError",
"FeatureSpace",
"FeatureSet",
]
# =============================================================================
# IMPORTS
# ================================================================... | {
"content_hash": "b56333ca39535e9d591d4e5937e53783",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 79,
"avg_line_length": 29.654580152671755,
"alnum_prop": 0.5483621854688204,
"repo_name": "carpyncho/feets",
"id": "e2255c094c35367cd7149427b427f1b24869bbb4",
"size": "168... |
"""Tests for carfac.python.sai."""
import os
import unittest
import numpy as np
import sai as pysai
_TEST_DATA_DIR = "../test_data"
def LoadMatrix(filename, rows, columns):
"""Reads a matrix with shape (rows, columns) matrix from a text file."""
matrix = np.loadtxt(os.path.join(_TEST_DATA_DIR, filename))
as... | {
"content_hash": "6003dacc6672ba1c4d9c9dfa4eace23a",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 80,
"avg_line_length": 38.51933701657459,
"alnum_prop": 0.6303786574870912,
"repo_name": "google/carfac",
"id": "7e62c41c45ca16f92faee1f0678bd12f8443722b",
"size": "7735",... |
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 = 7, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "87dea85b011649ad7827fc515fd22c64",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 170,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.7111111111111111,
"repo_name": "antoinecarme/pyaf",
"id": "1f28d498d26b5e5a20fa219a58cd99a2dc098885",
"size": "270... |
""" A collection of utility methods
:Authors: Sana dev team
:Version: 1.1
"""
import os, sys, traceback
import time
import logging
import cjson
from django.conf import settings
LOGGING_ENABLED = 'LOGGING_ENABLE'
LOGGING_START = 'LOGGING_START_TIME'
def trace(f):
"""Decorator to add traces to a method.
"""... | {
"content_hash": "ffbc5814005c9a93106ead237d725428",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 78,
"avg_line_length": 24.483870967741936,
"alnum_prop": 0.6284584980237155,
"repo_name": "rryan/sana.mds",
"id": "0c22cf23c0c0468ce79717df2071e184aaf07b75",
"size": "1518"... |
import re
import os
import json
from langconv import *
#输入Unicode编辑,输出Unicode
def big2simple(line):
#转换繁体到简体
line = Converter('zh-hans').convert(line)
return line
urm_name_map = None
def load_url(path):
ret = {}
dir = "./Uploads/Article/crawl_images"
for line in open(path):
line = line.strip()
if not line... | {
"content_hash": "e4a818e7e2f1785135a7fc811eef6251",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 50,
"avg_line_length": 21.771929824561404,
"alnum_prop": 0.6655922643029815,
"repo_name": "willdonetang/taisi360",
"id": "bc8493a0095192c0e06d61f80ee1e97090cf2848",
"size":... |
from __future__ import print_function
from future.utils import tobytes
import utils
import proto
def print_verbose(security_ctx, data):
if (security_ctx.verbose):
print("++++ " + data + " ++++")
def custom_config_request(security_ctx, info, version):
# Form protobuf request packet from custom-config... | {
"content_hash": "e5d5c0eb941f745c54d88c8178cf54c2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 102,
"avg_line_length": 38.88461538461539,
"alnum_prop": 0.7171117705242335,
"repo_name": "www220/esp-idf",
"id": "d5d291326e0dee45cbb29e4d0af3913644c0a136",
"size": "1708"... |
import ctypes
testCount = int(raw_input())
for testId in range(testCount):
value = int(raw_input())
flipped = ~value & 0xFFFFFFFF
print flipped
| {
"content_hash": "2e9a029be4f63a154e714b8d7433f401",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 33,
"avg_line_length": 22.428571428571427,
"alnum_prop": 0.6815286624203821,
"repo_name": "lilsweetcaligula/Online-Judges",
"id": "a8adccd758871d695716eca3d968df98b8389093",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('contact', '0003_delete_contact'),
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
... | {
"content_hash": "178cc74a16ff6d9a722a349345fc1088",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 26.541666666666668,
"alnum_prop": 0.5572998430141287,
"repo_name": "Busaka/esl",
"id": "fdb41388dbd51873ad76a66ac8e4194e4ce9adde",
"size": "707",
... |
import unittest
from cssqc.parser import CSSQC
from cssqc.qualityWarning import QualityWarning
class Test_bangFormat(unittest.TestCase):
def parseBefore(self, data):
c = CSSQC({"bangFormat": 'before'})
c.parse(data)
return c
def parseAfter(self, data):
c = CSSQC({"bangForma... | {
"content_hash": "a064b404036da57923604e49ee556282",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 47,
"avg_line_length": 28.193548387096776,
"alnum_prop": 0.5646453089244852,
"repo_name": "matematik7/CSSQC",
"id": "fc953e7bf272305550cf8dd5ebf16a6657d3d705",
"size": "213... |
import time
import hashlib
import hmac
try:
import simplejson as json
except ImportError:
import json # type: ignore # noqa: F401
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import urlencode
from libcloud.common.base import ConnectionUserAndKey, JsonResponse
from libcloud.common.types im... | {
"content_hash": "8a94ddd4a7ac13593f2535289fc4f95d",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 88,
"avg_line_length": 31.192307692307693,
"alnum_prop": 0.6279284833538841,
"repo_name": "mistio/libcloud",
"id": "825574ddad0565bb5527463e1d754723a806bee2",
"size": "402... |
on_failure = (False, True, False, False, False) | {
"content_hash": "1946c37e4fe2bb025f05df85120d210f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 47,
"avg_line_length": 47,
"alnum_prop": 0.7021276595744681,
"repo_name": "StanczakDominik/PythonPIC",
"id": "68dfeea2a76e41f77de05c6dfd636719845cd105",
"size": "135",
"bi... |
import re
import cffi
import subprocess
import logging
l = logging.getLogger('cffier')
l.setLevel(logging.DEBUG)
def find_good_bsearch(known_good, questionable):
ffi = cffi.FFI()
l.debug("bsearch - trying %d good and %d questionable", len(known_good), len(questionable))
try:
ffi.cdef('\n'.join(kn... | {
"content_hash": "f6e7334537ade29f02f9fe09fc43e39b",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 138,
"avg_line_length": 35.925925925925924,
"alnum_prop": 0.5910652920962199,
"repo_name": "chubbymaggie/pyvex",
"id": "ad69221d26edf2adfe160335394c1430110a8f5e",
"size": "... |
"""Unit tests for core.domain.takeout_service."""
from __future__ import annotations
import datetime
import json
import logging
from core import feconf
from core import utils
from core.constants import constants
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import feedback_... | {
"content_hash": "eb9c4dea8771c1a6505f700b625dcad4",
"timestamp": "",
"source": "github",
"line_count": 2002,
"max_line_length": 108,
"avg_line_length": 43.223276723276726,
"alnum_prop": 0.5799174881259173,
"repo_name": "oppia/oppia",
"id": "47074b7993499b9665a5a0c64e29c07040a1565e",
"size": "87138... |
from __future__ import unicode_literals
from blinker import Namespace
_signals = Namespace()
process_args = _signals.signal('process-args', """
Executed right after `_process_args` of an `RH` instance has been called.
The *sender* is the RH class, the current instance is passed in *rh*.
The return value of `_proce... | {
"content_hash": "c292aca58d83d69a410b764523ab136d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 75,
"avg_line_length": 38.166666666666664,
"alnum_prop": 0.7343522561863173,
"repo_name": "OmeGak/indico",
"id": "ca945ba38511b1325b1c5dddc8aaf558db7cd36d",
"size": "1588",... |
"""Illustrates a mixin which provides a generic association
via a individually generated association tables for each parent class.
The associated objects themselves are persisted in a single table
shared among all parents.
This configuration has the advantage that all Address
rows are in one table, so that the definit... | {
"content_hash": "dd4ce312779c91a9f3e2619c7b014a85",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 78,
"avg_line_length": 25.15573770491803,
"alnum_prop": 0.6177908113391984,
"repo_name": "sqlalchemy/sqlalchemy",
"id": "2e412869f08224d9d96396db703a87f83dcd48c0",
"size":... |
from django.db import connection
from api.base.exceptions import (Conflict, EndpointNotImplementedError,
InvalidModelValueError,
RelationshipPostMakesNoChanges)
from api.base.serializers import (DateByVersion, HideIfRegistration, IDField,
... | {
"content_hash": "952010b55366e4163867dc19359e412b",
"timestamp": "",
"source": "github",
"line_count": 1307,
"max_line_length": 173,
"avg_line_length": 38.82861514919664,
"alnum_prop": 0.6166821021103864,
"repo_name": "cwisecarver/osf.io",
"id": "3f2d5a9ffcc3bd19da2b7211a1d1aa5745180bfa",
"size": ... |
from __future__ import unicode_literals, division, absolute_import
import logging
import re
from urllib import quote
from flexget import plugin
from flexget import validator
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.soup import get_soup
from flexget.utils.search import torrent... | {
"content_hash": "ed59080342c33244bc14d1e60a96106e",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 120,
"avg_line_length": 40.82332155477032,
"alnum_prop": 0.4901757119362936,
"repo_name": "voriux/Flexget",
"id": "cf044f92d53db85cf60fb6bcfbf0bcd57cdb6cfb",
"size": "1155... |
import requests
url = 'http://address/path'
headers = {
'header': 'qvalue',
'content-length': '7',
}
params = {
'a': ['foo', 'bar'],
'b': 'baz',
}
response = requests.request(
method='GET',
url=url,
headers=headers,
params=params,
)
print(response.text)
| {
"content_hash": "da317673866a7543a015b9364887cdba",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 28,
"avg_line_length": 13.227272727272727,
"alnum_prop": 0.5601374570446735,
"repo_name": "tdickers/mitmproxy",
"id": "af8f7c81b9112e187c0423effbe776c30ebe4356",
"size": "2... |
from IMAP import IMAPRepository
from offlineimap import folder, imaputil
from offlineimap.imapserver import IMAPServer
class GmailRepository(IMAPRepository):
"""Gmail IMAP repository.
Uses hard-coded host name and port, see:
http://mail.google.com/support/bin/answer.py?answer=78799&topic=12814
"""
... | {
"content_hash": "19cbb7c0ba28d8f674f0614020fa31d5",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 32.93333333333333,
"alnum_prop": 0.6204453441295547,
"repo_name": "alexissmirnov/donomo",
"id": "4793db7798f13cdf7fdd69cd194318d286189840",
"size": "... |
from os.path import dirname, realpath, exists
from setuptools import setup
import sys
author = u"Paul Müller"
authors = ["Philipp Rosendahl", author]
name = 'fcswrite'
description = 'Write .fcs files (flow cytometry)'
year = "2016"
long_description = """
This package provides basic functionalities for writing flow cy... | {
"content_hash": "1f4d4a06e01b1937b9e79ba94a29d4ea",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 30.565217391304348,
"alnum_prop": 0.6173541963015647,
"repo_name": "ZELLMECHANIK-DRESDEN/fcswrite",
"id": "47b0a2c31fc6a59295bad8a5f998c0085df3fdfa",
... |
from __future__ import unicode_literals
import datetime
import time
import sys
from email.header import Header
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from django.conf import settings
from django.core import signals
from django.core import signing
from django.c... | {
"content_hash": "97d624ca2e4606b84fad2f9bcc965b5a",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 97,
"avg_line_length": 34.11353711790393,
"alnum_prop": 0.6116231438812084,
"repo_name": "IRI-Research/django",
"id": "f38c4918cdafc8b0284fbf22b5be6aba4b73d44e",
"size": "... |
import datetime
import pandas as pd
from rqalpha.utils.py2 import lru_cache
def _to_timestamp(d):
return pd.Timestamp(d).replace(hour=0, minute=0, second=0, microsecond=0)
class TradingDatesMixin(object):
def __init__(self, dates):
self._dates = dates
def get_trading_dates(self, start_date, en... | {
"content_hash": "7a17f78e92228fd35254158399e25a19",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 102,
"avg_line_length": 32.93589743589744,
"alnum_prop": 0.6091864538731023,
"repo_name": "xclxxl414/rqalpha",
"id": "f5e4555b134e967eb68265c428dcf4d3e57b444c",
"size": "31... |
"""
Abstract defintions that enable task sandboxing.
"""
__all__ = ["Sandbox", "SandboxTask"]
import os
import sys
from abc import ABCMeta, abstractmethod, abstractproperty
from contextlib import contextmanager
from fnmatch import fnmatch
from collections import OrderedDict
import luigi
import six
from law.config ... | {
"content_hash": "c511c50a727c7602841f8f9c8e5ee83a",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 101,
"avg_line_length": 34.42673107890499,
"alnum_prop": 0.6129847046166799,
"repo_name": "riga/law",
"id": "1dd16497364e4811b50420e419e232bba7fccc96",
"size": "21397",
... |
from msrest.serialization import Model
class TopLevelDomainAgreementOption(Model):
"""Options for retrieving the list of top level domain legal agreements.
:param include_privacy: If <code>true</code>, then the list of agreements
will include agreements for domain privacy as well; otherwise,
<code>... | {
"content_hash": "5fcec9b3f108c49c63e3a6e459a9f653",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 31.555555555555557,
"alnum_prop": 0.6795774647887324,
"repo_name": "rjschwei/azure-sdk-for-python",
"id": "332c7df7ddc1e990d967143a781b6820649c202d",
... |
from gi.repository import Gio # pylint: disable=E0611
from locale import gettext as _
import logging
logger = logging.getLogger('spindl')
from spindl_lib.PreferencesDialog import PreferencesDialog
class PreferencesSpindlDialog(PreferencesDialog):
__gtype_name__ = "PreferencesSpindlDialog"
def finish_initia... | {
"content_hash": "ad2f19d2eee1a890152372d134f10abd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 36.45454545454545,
"alnum_prop": 0.7319201995012469,
"repo_name": "Snesi/spindl",
"id": "699c79d8437e8b924b9341ebbc8b6e03bf865464",
"size": "1716",
... |
import collections as _collections
import fnmatch as _fnmatch
import importlib as _importlib
import os as _os
import shutil as _shutil
import sys as _sys
from plano import *
class _Project:
def __init__(self):
self.name = None
self.source_dir = "python"
self.included_modules = ["*"]
... | {
"content_hash": "7c921c1803788e54b19e57ae4dba9109",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 126,
"avg_line_length": 31.462046204620464,
"alnum_prop": 0.6151264030210847,
"repo_name": "ssorj/transom",
"id": "0285eedc776eeb03c135330e48a47da8df25ac49",
"size": "1032... |
'''
Offline utility tests
'''
from unittest import TestCase
from scutils.argparse_helper import ArgparseHelper
import argparse
from mock import MagicMock
import sys
# from http://stackoverflow.com/questions/4219717/how-to-assert-output-with-nosetest-unittest-in-python
from contextlib import contextmanager
from StringI... | {
"content_hash": "105001db05f5d55830697503a5601fa2",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 106,
"avg_line_length": 31.506849315068493,
"alnum_prop": 0.611304347826087,
"repo_name": "istresearch/scrapy-cluster",
"id": "8892402d31d779e069f6a8ac8b16d3b0b3b45039",
"s... |
"""
The Email Cleanse Package.
This package contains tools for dealing with some of the common issues
surrounding email consistency.
"""
| {
"content_hash": "3063d8d767d747980ab23bff1b627ccb",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 70,
"avg_line_length": 23,
"alnum_prop": 0.782608695652174,
"repo_name": "sergedomk/email_cleanse",
"id": "00ca7ac1e6ea95347ff547382332c4eabcfce913",
"size": "138",
"binar... |
class Create:
method = 'POST'
slug = False
class Update:
method = 'PATCH'
slug = True
class BulkUpdate:
method = 'PUT'
slug = False
class Fetch:
method = 'GET'
slug = True
class List:
method = 'GET'
slug = False
class Delete:
method = 'DELETE'
slug = True
| {
"content_hash": "a5a5f535e820a232490f3ca759898fa5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 21,
"avg_line_length": 11.214285714285714,
"alnum_prop": 0.5668789808917197,
"repo_name": "saurabh1e/SuperFlaskSeed",
"id": "dc0f8692b71d446c54def71c95937296674361cb",
"siz... |
import torch
from collections import defaultdict
from os.path import join
from torch.autograd import Variable
from ibeis.algo.verif.torch import netmath
import tensorboard_logger
# from ibeis.algo.verif.torch import gpu_util
class FitHarness(object):
def __init__(harn, model, train_loader, vali_loader=None, test_... | {
"content_hash": "42952cf9e26e1ca058bae78016e23f2d",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 120,
"avg_line_length": 34.44094488188976,
"alnum_prop": 0.5626428898033836,
"repo_name": "Erotemic/ibeis",
"id": "bdb0cd9e12b61339502d71ed06aab3f7d45db7c6",
"size": "8748... |
"""
couch models go here
"""
from __future__ import absolute_import
from datetime import datetime
import logging
import re
from django.utils import html, safestring
from restkit.errors import NoMoreData
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import... | {
"content_hash": "68c1add7fb6d4fbaf70139f8f1bbd1a6",
"timestamp": "",
"source": "github",
"line_count": 1968,
"max_line_length": 143,
"avg_line_length": 35.6885162601626,
"alnum_prop": 0.5896347974656511,
"repo_name": "gmimano/commcaretest",
"id": "076081ca2f3a822002ee52c5eff949be87e48895",
"size":... |
"""
A simple description of flat fuel costs for the SWITCH-Pyomo model that
serves as an alternative to the more complex fuel_markets with tiered
supply curves. This is mutually exclusive with the fuel_markets module.
SYNOPSIS
>>> from switch_mod.utilities import define_AbstractModel
>>> model = define_AbstractModel(... | {
"content_hash": "bfeb680eb8a915abba0c5905221d29f0",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 77,
"avg_line_length": 34.322916666666664,
"alnum_prop": 0.6558421851289833,
"repo_name": "bmaluenda/SWITCH-Pyomo-Chile",
"id": "aab538651d64a7838182de8c7cb71062071379e3",
... |
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set the GPIO Pin mode
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(9, GPIO.OUT)
GPIO.setup(10, GPIO.OUT)
# Turn all motors off
GPIO.output(7, 0... | {
"content_hash": "342cdf09e8d0cb149b7c929fca63fd96",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 50,
"avg_line_length": 19.125,
"alnum_prop": 0.7189542483660131,
"repo_name": "CamJam-EduKit/EduKit3",
"id": "54d54f28a0fdf69b2047c98da60bcf93ed489d89",
"size": "674",
"b... |
import sys
import os.path
import unittest
#sys.path.append
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append( os.path.join(os.path.dirname(this_dir),'bin') )
from cocagne.paxos.essential import ProposalID
from cocagne.paxos import essential
import test_essential
def PID(proposalID):
if propo... | {
"content_hash": "d6274555585888811f5af2ad922372fc",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 115,
"avg_line_length": 28.919254658385093,
"alnum_prop": 0.6935137457044673,
"repo_name": "cocagne/paxos",
"id": "4f7375408cec8553b3630fdb8c9882a799861a42",
"size": "4679... |
from _common import *
from ..generators.gen import make_coll, generate, get_dims
from ..generators import gen as generator
'''
some global definitions
'''
NEPOCH = 50
VERSION = 4
MODELDIR = environ.get('MODELDIR', 'models/') + '/particles/'
BASEDIR = environ['BASEDIR']
OPTIMIZER = 'Adam'
_APOSTLE = None
train_opts ... | {
"content_hash": "5e4288783d1e416086f9040c7b7fbb77",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 102,
"avg_line_length": 34.770833333333336,
"alnum_prop": 0.5895745955662073,
"repo_name": "sidnarayanan/BAdNet",
"id": "cf400d132c1383ea09d32639f4d6a13e2dbf567d",
"size":... |
import os
import re
from wic import msger
from wic.pluginbase import SourcePlugin
from wic.utils.oe.misc import *
class BootimgPartitionPlugin(SourcePlugin):
name = 'bootimg-partition'
@classmethod
def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir,
bootimg_dir, k... | {
"content_hash": "32ccf2f3f00f177c56d2a19215f41606",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 78,
"avg_line_length": 35.422222222222224,
"alnum_prop": 0.5486198243412798,
"repo_name": "wwright2/dcim3-angstrom1",
"id": "564118ad8ba8f53ae5dfe298825be3a4c10e874a",
"siz... |
'''
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": "e19ae69a1abb8b606a96b5a7adb205ab",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 124,
"avg_line_length": 37.46733668341709,
"alnum_prop": 0.6103809012875536,
"repo_name": "unlimitedcoin-dev/unlimited-core",
"id": "d2af4f43202fb9f2f18d532e8c087d3dc5baef0a... |
"""
Copyright 2018 Google LLC
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | {
"content_hash": "d5d473192f6d1b86c59c0730886cbd42",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 80,
"avg_line_length": 44.175,
"alnum_prop": 0.6604414261460102,
"repo_name": "brain-research/conv-sv",
"id": "3aa8ad0384c14d542e495f1d9dac2cbc194da10d",
"size": "3534",
... |
from corehq.apps.reports.standard import CustomProjectReport, ProjectReportParametersMixin, DatespanMixin
from corehq.const import USER_DATE_FORMAT, USER_MONTH_FORMAT
from dimagi.utils.couch.database import get_db
class PathIndiaKrantiReport(CustomProjectReport, ProjectReportParametersMixin, DatespanMixin):
name =... | {
"content_hash": "82523ae69a6f28cf3b335e146cf5b454",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 125,
"avg_line_length": 43.42068965517242,
"alnum_prop": 0.5184243964421855,
"repo_name": "puttarajubr/commcare-hq",
"id": "32532ad66b28fa9b42c52bcd1c2f21dda566c867",
"siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.