text stringlengths 4 1.02M | meta dict |
|---|---|
""" The instance type extra specs extension"""
from webob import exc
from nova import db
from nova import quota
from nova.api.openstack import extensions
from nova.api.openstack import faults
from nova.api.openstack import wsgi
class FlavorExtraSpecsController(object):
""" The flavor extra specs API controller ... | {
"content_hash": "2af722eb1300e34e9fdc53247ac371cf",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 78,
"avg_line_length": 34.908256880733944,
"alnum_prop": 0.5802890932982917,
"repo_name": "xushiwei/nova",
"id": "2d897a1dae308f697942e4075b9ccde0dcc99ec1",
"size": "4499"... |
"""The tests for Select device conditions."""
from __future__ import annotations
import pytest
import voluptuous_serialize
from homeassistant.components import automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.select import DOMAIN
from homeassistant.c... | {
"content_hash": "878f7d909bf0ce8acdd280593a806e56",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 105,
"avg_line_length": 32.62992125984252,
"alnum_prop": 0.556949806949807,
"repo_name": "nkgilley/home-assistant",
"id": "7c1dc443e5626cdb246bbc9a3f633cbd756d466c",
"size... |
import config
import httplib
import urllib
import base64
import sys
import requests
# #### HTTP Headers + Encoding the URL
def vision(filepath):
file = open(filepath, 'rb').read()
files = {'file': file}
headers = {
'Content-Type': 'application/octet-stream',
'Ocp-Apim-Subscription-Key': c... | {
"content_hash": "1c2be30ba53f15a019439f892658aaec",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 25.5,
"alnum_prop": 0.5994397759103641,
"repo_name": "therealAJ/torch",
"id": "68e22c170eb45eac8ce47d0e63d8e9a567483950",
"size": "1071",
"binary":... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "f3444b39ea4decd6fc4c87023fdee27c",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 126,
"avg_line_length": 33.79831932773109,
"alnum_prop": 0.7033814022874192,
"repo_name": "ucrcsedept/galah-interact-python",
"id": "43bd33a4a2361c8e0442f0b6db9383976f8382ee... |
from unittest import TestCase
import os
import pytest
import numpy as np
from pyspark.sql.types import ArrayType, DoubleType
from bigdl.orca import init_orca_context, stop_orca_context
from bigdl.orca.data import SparkXShards
from bigdl.orca.data.image.utils import chunks
from bigdl.orca.learn.utils import convert_pr... | {
"content_hash": "910251d99a5ce3e8aec8ac23f498f86e",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 100,
"avg_line_length": 45.875621890547265,
"alnum_prop": 0.5856197809348227,
"repo_name": "intel-analytics/BigDL",
"id": "8a215e9a568c14d8260472426f173b40fc07fbb0",
"size... |
import asyncio
import LeagueStats
import psycopg2
from discord.ext.commands import Bot
import botinfo
# import mysql.connector
# import MySQLdb
import pymysql.cursors
mid_bot = Bot(command_prefix="!")
try:
# cnx = MySQLdb.connect(host='127.0.0.1', user=botinfo.user, password=botinfo.password, database=botinfo.dbn... | {
"content_hash": "cec804dc9304fda3fc5026e4718a872d",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 140,
"avg_line_length": 34.09090909090909,
"alnum_prop": 0.5287619047619048,
"repo_name": "MarkFranciscus/DevMIDbot",
"id": "6572dd6103ed6be4aa1a112190703ed92f405c58",
"si... |
from twisted.application.service import ServiceMaker
TwistedProcmon = ServiceMaker(
"Twisted Process Monitor",
"twisted.runner.procmontap",
("A process watchdog / supervisor"),
"procmon")
| {
"content_hash": "fdb3d3f6e4f13f248643be30a8cee5b5",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 52,
"avg_line_length": 26.75,
"alnum_prop": 0.7009345794392523,
"repo_name": "timkrentz/SunTracker",
"id": "2cd0d96acd009fc5dc12788dda5a0d3db1c13cec",
"size": "288",
"bina... |
import sys
import os
class Mock(object):
def __init__(self, *_):
pass
@classmethod
def __getattr__(cls, _):
return cls()
modules = ['Foundation', 'AppKit', 'PyObjCTools']
sys.modules.update((module, Mock()) for module in modules)
# If extensions (or modules to document with autodoc) are ... | {
"content_hash": "9564f6c7a13441bed0a85bc407e1474f",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 79,
"avg_line_length": 31.035019455252918,
"alnum_prop": 0.7004764292878636,
"repo_name": "jaredks/rumps",
"id": "a4b8ac3b703ac59e6ba20ec02281726c7853d570",
"size": "8394"... |
"""COCO-style evaluation metrics.
Implements the interface of COCO API and metric_fn in tf.TPUEstimator.
COCO API: github.com/cocodataset/cocoapi/
"""
import json
import os
import sys
from absl import logging
import numpy as np
import tensorflow as tf
from tensorflow_examples.lite.model_maker.third_party.efficientdet... | {
"content_hash": "34e9eb286021d82743d879c51805b23a",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 90,
"avg_line_length": 38.29323308270677,
"alnum_prop": 0.6253681523659925,
"repo_name": "tensorflow/examples",
"id": "92d87dbece92a9c88eda6af1a5bff57a482064a0",
"size": "... |
from ccxt.pro.base.exchange import Exchange
import ccxt.async_support
from ccxt.pro.base.cache import ArrayCache
class luno(Exchange, ccxt.async_support.luno):
def describe(self):
return self.deep_extend(super(luno, self).describe(), {
'has': {
'ws': True,
'wat... | {
"content_hash": "a5132ed7ca6c2fd8313cad2b09de294b",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 155,
"avg_line_length": 39.52173913043478,
"alnum_prop": 0.5144283659135144,
"repo_name": "ccxt/ccxt",
"id": "0fc89c5d97e1b8e07ff99da8fc1139eca711fa86",
"size": "11998",
... |
import xml.sax
class PartXMLHandler(xml.sax.ContentHandler):
def __init__(self):
self.currentData = ''
self.isStructure = False
self.row_name = ''
self.type = ''
def startElement(self, tag, attributes):
self.currentData = tag
if tag == 'table_structure... | {
"content_hash": "c199540d169e3109ef62b0f6906b9600",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 62,
"avg_line_length": 33.22222222222222,
"alnum_prop": 0.560200668896321,
"repo_name": "igemsoftware/HFUT-China_2015",
"id": "ae8d8832bffa39c87ccf0b4706e3e21f9ce05bda",
"s... |
from time import time
from traceback import format_exc
from urllib import unquote
from uuid import uuid4
from hashlib import sha1
import hmac
import base64
from eventlet import Timeout
from swift.common.swob import Response, Request
from swift.common.swob import HTTPBadRequest, HTTPForbidden, HTTPNotFound, \
HTTPU... | {
"content_hash": "7158f8bfe888c80ad1b8e101cabb52a9",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 79,
"avg_line_length": 44.02910602910603,
"alnum_prop": 0.5571819813013504,
"repo_name": "citrix-openstack-build/swift",
"id": "c871a293af98c7fa8e157df27433a165b7777e03",
... |
"""Department - the department in the laboratory.
"""
from Products.Archetypes.public import *
from Products.Archetypes.references import HoldingReference
from Products.CMFCore.utils import getToolByName
from bika.lims.config import PROJECTNAME
from bika.lims.content.bikaschema import BikaSchema
from AccessControl impo... | {
"content_hash": "5ca70b2108971c9d6ae1435923a8260b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 94,
"avg_line_length": 35.67741935483871,
"alnum_prop": 0.6717902350813744,
"repo_name": "hocinebendou/bika.gsoc",
"id": "5013ed51750d399bde20d68f6bc35cf2c2b6bac8",
"size":... |
"""Tools to parse and validate a MongoDB URI."""
from urllib import unquote_plus
from pymongo.common import validate
from pymongo.errors import (ConfigurationError,
InvalidURI,
UnsupportedOption)
SCHEME = 'mongodb://'
SCHEME_LEN = len(SCHEME)
DEFAULT_PORT = 27... | {
"content_hash": "73c1906c62b230c2a0b01ab8402eda56",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 79,
"avg_line_length": 33.17628205128205,
"alnum_prop": 0.582069365278717,
"repo_name": "otherness-space/myProject002",
"id": "dc7359fab8964fe17042b36763f72b2c3984498a",
"... |
def test_cached_property():
from planar.util import cached_property
class Thingy(object):
not_cached_calls = 0
cached_calls = 0
@property
def not_cached(self):
"""Nay"""
self.not_cached_calls += 1
return 'not cached'
@cached_property... | {
"content_hash": "d82d5dae226f4c36a20eb167ef2daf7a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 47,
"avg_line_length": 25.177777777777777,
"alnum_prop": 0.5922330097087378,
"repo_name": "wrightjb/bolt-planar",
"id": "48f6d1bbaf9fd61a42634dc21687b3a8a379e95e",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coding', '0009_auto_20170906_1228'),
]
operations = [
migrations.AlterField(
model_name='codeuserstatus',
name='remaining_ti... | {
"content_hash": "53d14889d12f9430893d2b5a47744dd5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 61,
"avg_line_length": 22.444444444444443,
"alnum_prop": 0.6089108910891089,
"repo_name": "garrykevin-ep/Skillet",
"id": "c5e4b2158b0fbd077a41b574dc0942c13928d633",
"size":... |
"""
``numpy.linalg``
================
The NumPy linear algebra functions rely on BLAS and LAPACK to provide efficient
low level implementations of standard linear algebra algorithms. Those
libraries may be provided by NumPy itself using C versions of a subset of their
reference implementations but, when possible, high... | {
"content_hash": "39f4b2214ed5e4cf50e8538242e4e1bf",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 23.10126582278481,
"alnum_prop": 0.6915068493150685,
"repo_name": "jorisvandenbossche/numpy",
"id": "55560815d00535f5fa8203e4a68881038fb11690",
"size... |
"""Support for testing internet speed via Speedtest.net."""
from __future__ import annotations
from datetime import timedelta
import logging
import speedtest
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
... | {
"content_hash": "404dc6acf93875a8cfda206da01e7a20",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 88,
"avg_line_length": 33.921052631578945,
"alnum_prop": 0.6110680113783294,
"repo_name": "sander76/home-assistant",
"id": "b049b3a2d2c37ac1e89b834c5480524725e06d53",
"siz... |
import abc
from neutron_lib.api.definitions import agent as apidef
from neutron_lib.api import extensions as api_extensions
from neutron_lib import exceptions
from neutron_lib.plugins import directory
from neutron.api import extensions
from neutron.api.v2 import base
class Agent(api_extensions.APIExtensionDescripto... | {
"content_hash": "301cdde3c2196330d989ede72444b2f3",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 29.2027027027027,
"alnum_prop": 0.6316520129569644,
"repo_name": "openstack/neutron",
"id": "99f79a9ca3c7ee8316ec408d913d5b5415f5b4e1",
"size": "2752... |
import collections
import envy.logger as log
import envy.static as static
import os
import os.path
import shutil
import stat
config = collections.namedtuple('config',
['location', 'plugins'])
class ConfigurationException(Exception):
pass
# TODO: Create catchable exceptions for these failures
def ensure_e... | {
"content_hash": "bd8eac508e5ba8e26888e1dfbd63ee63",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 82,
"avg_line_length": 28.045045045045047,
"alnum_prop": 0.653389013813042,
"repo_name": "jerluc/envy",
"id": "2835a42fe6a3c718a65e8913bede77faf5caed66",
"size": "3138",
... |
"""
This is part of HashBruteStation software
Docs EN: http://hack4sec.pro/wiki/index.php/Hash_Brute_Station_en
Docs RU: http://hack4sec.pro/wiki/index.php/Hash_Brute_Station
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Api for work with DB
"""
import time
impor... | {
"content_hash": "36a804e7188b6d48b1090882178998ed",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 120,
"avg_line_length": 33.63529411764706,
"alnum_prop": 0.5140492013524542,
"repo_name": "hack4sec/hbs-cli",
"id": "411adc5225f3d0198dc8733ad06b0f9afa142f34",
"size": "86... |
import unittest
from nose.plugins.attrib import attr
import os
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SSHSession
from jnpr.junos import Device
from jnpr.junos.utils.fs import FS
from jnpr.junos.exception import RpcError
from mock import patch, MagicMock, call
from lx... | {
"content_hash": "46fc46f2117e7f42a92b42eaeee80b55",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 88,
"avg_line_length": 37.734177215189874,
"alnum_prop": 0.5257184390025719,
"repo_name": "Juniper/py-junos-eznc",
"id": "475bc8ecba6b66e0932740c0060f1533533c3729",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Mineral',
fields=[
('id', models.AutoField(auto_cre... | {
"content_hash": "63191f70d6b583f4ec6b783f74136ad0",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 114,
"avg_line_length": 47.54054054054054,
"alnum_prop": 0.5656623081296192,
"repo_name": "squadran2003/filtering-searching-mineral-catalogue",
"id": "a48f01777c2eedd37e8af2c... |
class QuadratureSettings:
overall_quadrature_points: int = 1
quadrature_method: str = "midpoint"
distribute_quad_points_based_on_arc_length: bool = False
function_name: str
def __init__(self, overall_quadrature_points, quadrature_method, distribute_quad_points_based_on_arc_length, function_name):
... | {
"content_hash": "ec8e94438905fc862bb4c61e9b5df4cb",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 128,
"avg_line_length": 52.81818181818182,
"alnum_prop": 0.7314974182444062,
"repo_name": "schreiberx/sweet",
"id": "4454ca2a9fbb0bb8035812edd8eeea1a04f7a797",
"size": "581... |
import logging
import json
import uuid
from quokka.core.models.subcontent import SubContentPurpose
from quokka.core.models.channel import Channel, ChannelType
from quokka.core.models.config import Config, Quokka
from quokka.core.models.content import License
from quokka.core.models.custom_values import CustomValue
fro... | {
"content_hash": "a299ef9b8e5171fad592b6b12c7e5873",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 78,
"avg_line_length": 33.26139817629179,
"alnum_prop": 0.5335831124920041,
"repo_name": "alexandre/quokka",
"id": "c52b6bf2e8ec65ea03422e8874c8584da5250d75",
"size": "109... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import clip_ops
from tensorflow.python.ops import embedding_ops... | {
"content_hash": "22257143ff36c44f44a293a25460f53f",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 93,
"avg_line_length": 35.46762589928058,
"alnum_prop": 0.6393509127789047,
"repo_name": "xiangdal/TrajectoryNet",
"id": "d487b020e7448e449cf205b35be555b9bb934118",
"size"... |
import socket
class udpserver():
def __init__(self):
AMOUNT_BYTES = 1024
BROADCAST_PORT_SEND = 9001 # Porta que o cliente estará escutando
BROADCAST_PORT_RECV = 9000 # Porta que o cliente irá enviar mensagem
BROADCAST_LISTEN = '' # Interface que será utilizada, se você pôr 127.255.255.255,... | {
"content_hash": "90d4f16aff8962483a2573347b8d465c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 130,
"avg_line_length": 45.25,
"alnum_prop": 0.6729281767955801,
"repo_name": "fabtrompet/bomberman",
"id": "4fd57b349cd1883d018843f8c003f97d1e6a1770",
"size": "936",
"bi... |
from nova import availability_zones
from nova import db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common import log as logging
from nova import utils
LOG = logging.getLogger(__name__)
class Service(base.NovaPersistentObject,... | {
"content_hash": "d58db7c38e8ed773a6a8ecf275292598",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 75,
"avg_line_length": 39.13125,
"alnum_prop": 0.6078901134004153,
"repo_name": "vmthunder/nova",
"id": "693755ee5616642909b79d519f2040d8365a14e0",
"size": "6866",
"bina... |
import os
import shutil
import sys
import numpy as np
import subprocess
from astropy.io import fits
import pyfits
param = {}
execfile(sys.argv[1])
def make_folder_list(i):
t = [i+d+'/' for d in sorted(os.listdir(i)) if d[:2] == '20' and os.path.exists(i+d+'/'+param['field_name'])]
return t
def make_cat_fold... | {
"content_hash": "5602e514edbb3607a33014d2148550ca",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 162,
"avg_line_length": 30.771428571428572,
"alnum_prop": 0.5911482513153823,
"repo_name": "xparedesfortuny/Phot",
"id": "d41b8e5064885086972b4fe3e6b5a4a46d31ec6c",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0012_auto_20170730_1559'),
]
operations = [
migrations.CreateModel(
name='Category',
... | {
"content_hash": "8bda6ed8dc14c52e3df15974d7d74f7e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 128,
"avg_line_length": 32.25806451612903,
"alnum_prop": 0.567,
"repo_name": "crowd-course/scholars",
"id": "0807a8157cdc8bb9fed3a173a7ecef6c6fcd6960",
"size": "1073",
"b... |
from osc_lib import utils
class Display(object):
"""Provide functions for display resource"""
# get columns used for listing resource(multiple records)
# Resource inherit Display must override this field to specify
# the columns which should be used when display resource list.
# Return Examples: ... | {
"content_hash": "da7560e928eda156ce9006972dbc5677",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 38.76086956521739,
"alnum_prop": 0.6298373527762199,
"repo_name": "Huawei/OpenStackClient_VBS",
"id": "8f6844bb26aa711644d052f3af0a75f107ba39c5",
"si... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
module: k8s_auth
short_description: Authenticate to Kubernetes cluste... | {
"content_hash": "21d6638ccaaae4a0fa7d168dc3de7f2a",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 122,
"avg_line_length": 33.93939393939394,
"alnum_prop": 0.6221428571428571,
"repo_name": "SergeyCherepanov/ansible",
"id": "b1ea7c23862649492b57dc584d99d78e538e9661",
"si... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = patterns('ti.views',
url(r'^$', 'home', name='home'),
url(r'^login$', 'login_view', name='login'),
url(r'^logout$', 'logout_view', name='logout'),
url(r'^overvie... | {
"content_hash": "fdad0ef7df26caa212b780ca6fb69c19",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 102,
"avg_line_length": 54.05263157894737,
"alnum_prop": 0.6163583252190847,
"repo_name": "FrankGrimm/text-insights",
"id": "047be8356f5fa714eedc2d3926e85a802a36f768",
"siz... |
from msrest.service_client import ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.servers_operations import ServersOperations
from .operations.firewall_rules_operations import FirewallRulesOperations
from .operations.virt... | {
"content_hash": "313f94bca84e0dfa43aa39810a5a2672",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 211,
"avg_line_length": 52.333333333333336,
"alnum_prop": 0.7532255430344602,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "011bb63cb449fed5c50ec699f98923312dc872e3... |
"""Tests for util module."""
import os
import stat
from absl.testing import absltest
import mock
from cauliflowervest.client import util
MOUNT_OUTPUT_NOMINAL = """
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk0s4 on /Volumes/Untitled 2 (hfs, local, journaled)
map -hos... | {
"content_hash": "cc7f177ea69689de33455ae27b8bfc58",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 80,
"avg_line_length": 31.616161616161616,
"alnum_prop": 0.6921192758253462,
"repo_name": "maximermilov/cauliflowervest",
"id": "0e968078512da64c0f5a97d61fe1d27f0c04f508",
... |
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
... | {
"content_hash": "30122e711ba4b1b97ffb386df89bd855",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 129,
"avg_line_length": 28.78125,
"alnum_prop": 0.743756786102063,
"repo_name": "zhkzyth/better-mosquitto",
"id": "7ec4b03f855f3a6044347c93d978c2fb5d9f25ae",
"size": "944",... |
import htmls
from django.test import TestCase
from django.test.client import RequestFactory
from unittest import mock
from django_cradmin.viewhelpers import formview
class TestDelete(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_get(self):
class SimpleDeleteView(formvie... | {
"content_hash": "dca8ba1249357f3f1bf46c451f71f35a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 82,
"avg_line_length": 36,
"alnum_prop": 0.6111111111111112,
"repo_name": "appressoas/django_cradmin",
"id": "731ef32950350f572bfaed2844883b4bde7daa5d",
"size": "2016",
"... |
"""Tests for broadcast_util."""
from tensorflow_probability.python.internal import broadcast_util as bu
from tensorflow_probability.python.internal import test_util
class BroadcastUtilTest(test_util.TestCase):
@test_util.numpy_disable_test_missing_functionality('tf.unsorted_segment_sum')
@test_util.jax_disable_... | {
"content_hash": "421b30adbc9aa28236ad41665124abce",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 37.357142857142854,
"alnum_prop": 0.6080305927342257,
"repo_name": "tensorflow/probability",
"id": "175af5aee19fb5ae32ec42b5afe7b11ad03fc110",
"size"... |
"""Implementation of sample attack."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from scipy.misc import imread
from scipy.misc import imsave
import tensorflow as tf
tf.flags.DEFINE_string(
'master', '', 'The addres... | {
"content_hash": "ec50c3c5a0ab59910bb5ff63a370733b",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 78,
"avg_line_length": 28.870967741935484,
"alnum_prop": 0.6800744878957169,
"repo_name": "cihangxie/cleverhans",
"id": "1ab1ddc10cdb8e10ad0448762043bdd448a38c29",
"size": ... |
import unittest
import unreal_engine as ue
class TestPlugin(unittest.TestCase):
def test_find(self):
uep = ue.find_plugin('UnrealEnginePython')
self.assertEqual(uep.get_name(), 'UnrealEnginePython')
def test_enabled(self):
uep = ue.find_plugin('UnrealEnginePython')
self.assertTrue(uep.is_... | {
"content_hash": "b088b46c87bdae6365563df8f3a7acf9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 59,
"avg_line_length": 20.8125,
"alnum_prop": 0.7057057057057057,
"repo_name": "Orav/UnrealEnginePython",
"id": "9f3e5762397f0674536925d8fbd17de9e8ffb3f3",
"size": "333",
... |
import cgi
import os
import datetime
import HTMLParser
import json
import logging
import re
import ushlex as shlex
import urllib
from bson.objectid import ObjectId
from django.conf import settings
from django.contrib.auth import authenticate, login as user_login
from django.core.urlresolvers import reverse, resolve, g... | {
"content_hash": "3198ecb244926c449c79ac092596659d",
"timestamp": "",
"source": "github",
"line_count": 3814,
"max_line_length": 325,
"avg_line_length": 38.39407446250655,
"alnum_prop": 0.5378085840133848,
"repo_name": "Lambdanaut/crits",
"id": "b7f3d5809519370acbc4314aaf1383f8f29d4e10",
"size": "1... |
"""So much practical programming involves string manipulation, which
Python readily accomodates. Still, there are dozens of basic and
common capabilities missing from the standard library, several of them
provided by ``strutils``.
"""
from __future__ import print_function
import re
import sys
import uuid
import zlib
... | {
"content_hash": "902fc822c6a0ccb3f5215aeebc9f8470",
"timestamp": "",
"source": "github",
"line_count": 973,
"max_line_length": 137,
"avg_line_length": 33.789311408016445,
"alnum_prop": 0.5867019496912735,
"repo_name": "markrwilliams/boltons",
"id": "96ae4f9f33477be8239746b7ae81d813f8d61244",
"size... |
"""Helper functions for model."""
import lingvo.compat as tf
from lingvo.core import py_utils
def ComputeSplits(batch_size, num_splits):
"""Creates a tensor of size num_splits of number of values per split.
Assigns each split floor(batch_size/num_splits) and round-robins
the remainder (if any) to each split.
... | {
"content_hash": "4286947dc2dd22cc3153fe01e2167561",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 80,
"avg_line_length": 30,
"alnum_prop": 0.6595015576323987,
"repo_name": "tensorflow/lingvo",
"id": "25fd346029139f129f8eccb74222276dcc32b57d",
"size": "3899",
"binary"... |
from re import compile
from math import pi, log, tan, ceil
import json
from shapely.wkb import loads
from shapely.geometry import asShape
from ... import getTile
from ...Core import KnownUnknown
from .ops import transform
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$')
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?... | {
"content_hash": "b7297ec26a39eb93ce7f1be29daa23e1",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 144,
"avg_line_length": 37.50381679389313,
"alnum_prop": 0.6130673722776308,
"repo_name": "jbants/TileStache",
"id": "6bbde69fdcf87b49d6f08b4a83d4527770cf9543",
"size": "4... |
from dogbot.cqsdk.utils import reply
import getopt
from config import config
import shlex
from dogbot.models import *
def alias_command(bot, message):
"""#alias [-h] [-d 原命令] [命令]
-h : 打印本帮助
-d 命令 : 要操作的命令
命令 : 命令的别名
例:
#alias -d #conne 圆爹 (然后就可以使用 圆爹 狗蛋 的语法了)
#alias... | {
"content_hash": "bbf6d79d340483d4626108abf2e15508",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 89,
"avg_line_length": 24.580838323353294,
"alnum_prop": 0.5490864799025579,
"repo_name": "moondropx/dogbot",
"id": "647f0d8913645497dfb6e03d4db93e2b785d158a",
"size": "44... |
import torch
from torch.utils.data import DataLoader, TensorDataset
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
import os
import os.path as osp
from tqdm import tqdm
import argparse
import time
import numpy as... | {
"content_hash": "70b1d948bcd35c18cfd18a09d642d518",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 239,
"avg_line_length": 34.962825278810406,
"alnum_prop": 0.5996810207336523,
"repo_name": "snap-stanford/ogb",
"id": "430ab498cd5d1f12f12f7707a8e8484ef6b0025e",
"size": "... |
from django.core import checks
from django.db.backends.base.validation import BaseDatabaseValidation
from django.utils.version import get_docs_version
class DatabaseValidation(BaseDatabaseValidation):
def check(self, **kwargs):
issues = super().check(**kwargs)
issues.extend(self._check_sql_mode(**... | {
"content_hash": "4ab58dfa3812bf2f5c72dc9e89c190f0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 89,
"avg_line_length": 42.31884057971015,
"alnum_prop": 0.5099315068493151,
"repo_name": "ar4s/django",
"id": "41e600a856e16a25d01aa0584801275a62236510",
"size": "2920",
... |
import unittest
import os
from tempfile import mkstemp
class OutputTestCase(unittest.TestCase):
def assertXhtml(self, txt, out):
# result from CZT must be unicode string
self.assertEquals(unicode, type(out))
# for backward compatibility, tests assertEqals could be strings
if isins... | {
"content_hash": "1cbc782ee65c9f095faff46367626ba1",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 322,
"avg_line_length": 44.520833333333336,
"alnum_prop": 0.644361254094525,
"repo_name": "andrejtokarcik/python-czechtile",
"id": "4c0cc8f4245d65511510ae4e11b0191aa2f6b342",... |
from symbol_helper import SymbolHelper
import copy
import inspect
class TreeWalker:
name = None
def __init__(self, function_dictionary):
self.my_symbol_helper = SymbolHelper(function_dictionary)
self.symbol_helper = self.my_symbol_helper
self.debug = False
self.debug_scope = ... | {
"content_hash": "ff7c513606f0bb64cd99ced0ec171337",
"timestamp": "",
"source": "github",
"line_count": 1363,
"max_line_length": 151,
"avg_line_length": 48.9002201027146,
"alnum_prop": 0.4757167934464599,
"repo_name": "unl-nimbus-lab/phriky-units",
"id": "0793c7f41baa7ca58d09e1abe61c8533f38805b8",
... |
import argparse
from rpi_doorman_gammu import DoormanGammu
def setup_args():
ap = argparse.ArgumentParser(prog='rpi-doorman-gammu',
description='RPi.Doorman Gammu is using adafruit magnetic contact switch (door sensor), will permanently sense for door status and its changes. Notify via cell phone call... | {
"content_hash": "52e5520efeafd8023f19dec6adf6047a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 207,
"avg_line_length": 40.806451612903224,
"alnum_prop": 0.658498023715415,
"repo_name": "ricco386/rpi-doorman-gammu",
"id": "52b4eb447b8484cbb4f7e56098477c19cb038e9e",
"s... |
"""Functions to visualize matrices of data."""
import itertools
import colorsys
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy.spatial import distance
from scipy.cluster import hierarchy
from .axisgrid import Grid
from .palett... | {
"content_hash": "60d8a29b78af7034aa906c22eaa196b0",
"timestamp": "",
"source": "github",
"line_count": 900,
"max_line_length": 96,
"avg_line_length": 37.766666666666666,
"alnum_prop": 0.5892321270962048,
"repo_name": "aashish24/seaborn",
"id": "8d999401f41d7ab21b18b84a600bdd76a70b2292",
"size": "3... |
"""
Middleware that displays everything that is printed inline in
application pages.
Anything printed during the request will get captured and included on
the page. It will usually be included as a floating element in the
top right hand corner of the page. If you want to override this
you can include a tag in your t... | {
"content_hash": "6a49446b26e72744e45f63405eca2a10",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 80,
"avg_line_length": 36.608695652173914,
"alnum_prop": 0.5983768804433888,
"repo_name": "santisiri/popego",
"id": "c971895aff156758d53c3ff7b528ac0dd53022d4",
"size": "52... |
import paho.mqtt.client as mqtt
class mqttHandler:
"""Send MQTT 'push' messages to your LEDScreen """
def __init__(self,server="test.mosquitto.org",channel="ledbot/"):
self.channel = channel
self.client= mqtt.Client()
self.client.on_connect = self.on_connect
self.client.on_message = self.send_new_message
s... | {
"content_hash": "1b0d9ea2c15e2e4ad0f2888ef9f5c583",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 66,
"avg_line_length": 29.636363636363637,
"alnum_prop": 0.6901840490797546,
"repo_name": "marqsm/LED-bot",
"id": "866505d062b3e38c63b1e5ccca8bdf1f860edf4d",
"size": "978",... |
from copengl import *
| {
"content_hash": "9e0ec8b2888189ba1aabf5cb15e24a91",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 21,
"avg_line_length": 11.5,
"alnum_prop": 0.7391304347826086,
"repo_name": "fdkz/libcopengl",
"id": "ac4c8de14cf86a09ffe9f58c61c021e6e4f281b3",
"size": "23",
"binary": fa... |
import httplib
import logging as log
session_map = {}
HASH_HEADER = 'Floodlight-Verify-Path'
def request(url, prefix="/api/v1/data/controller/", method='GET',
data='', hashPath=None, host="127.0.0.1:8080", cookie=None):
headers = {'Content-type': 'application/json'}
if cookie:
headers['C... | {
"content_hash": "ce88f17ff57433afc1db1f5634aa0ef7",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 33.29032258064516,
"alnum_prop": 0.6056201550387597,
"repo_name": "xinwu/horizon",
"id": "8b040f3f5d3f5acbafda7f4d4a05e7fc59c5bd03",
"size": "2064",
... |
from __future__ import print_function
import sys, os
import cgi
import xml.etree.ElementTree as ET
#
#
def log(text):
print("LOG: ", text, file=sys.stderr)
#
# construct data stores
typesPrimitive = [] # class == primitive
typesEnumerated = [] # no descriptor, choice count > 0
typesRestricted = [] # no descript... | {
"content_hash": "bc5daa93b1381580073db02536ceebc5",
"timestamp": "",
"source": "github",
"line_count": 1150,
"max_line_length": 141,
"avg_line_length": 36.100869565217394,
"alnum_prop": 0.5418874650737066,
"repo_name": "ChugR/qpid-proton-tools",
"id": "e2fa02be99dbedd924309d5621440d29210be977",
"s... |
from django.apps import AppConfig
class ExtendedSignalsConfig(AppConfig):
name = 'extended_signals'
| {
"content_hash": "a28fcc953cabd93b9ad6aea8a2fe3c1b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 21.2,
"alnum_prop": 0.7830188679245284,
"repo_name": "biljettshop/django_extended_signals",
"id": "6420bcb3ccf34989b5e962fb81afe196b6122b3a",
"size": ... |
import multiprocessing
import os
import sys
from distutils.dir_util import mkpath
from py4j.java_gateway import JavaObject
from pyspark.rdd import RDD
from bigdl.util.common import DOUBLEMAX
from bigdl.util.common import JTensor
from bigdl.util.common import JavaValue
from bigdl.util.common import callBigDlFunc
from ... | {
"content_hash": "089797f273bcd10c44d57b1239bdd416",
"timestamp": "",
"source": "github",
"line_count": 1121,
"max_line_length": 554,
"avg_line_length": 35.504906333630686,
"alnum_prop": 0.6135021733122283,
"repo_name": "yiheng/BigDL",
"id": "c67279270a5c9789921c032fb0c62f26b515bc11",
"size": "4038... |
import json
import urllib
from tempest.common import rest_client
from tempest import config
CONF = config.CONF
class RegionClientJSON(rest_client.RestClient):
def __init__(self, auth_provider):
super(RegionClientJSON, self).__init__(auth_provider)
self.service = CONF.identity.catalog_type
... | {
"content_hash": "1cf63725fe0bf9c6189f5c5f9df9ccba",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 74,
"avg_line_length": 32.93846153846154,
"alnum_prop": 0.5693601120971509,
"repo_name": "cloudbase/lis-tempest",
"id": "c0787656c057838eeeb457f0e3242f0d6d79f62a",
"size": ... |
import os
import time
import json
import re
import urllib2
import threading
from multiprocessing import Process
from crike_django.settings import MEDIA_ROOT
import urllib
try:
input = raw_input
except NameError:
pass
try:
import urllib.request
#import urllib.parse
except ImportError:
import urll... | {
"content_hash": "86d848909df1282f67ec12ec5f098d39",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 125,
"avg_line_length": 29.273333333333333,
"alnum_prop": 0.5537462992484627,
"repo_name": "crike/crike",
"id": "384d640d6bf199e11c633db0b0d95f953a9446f2",
"size": "8797",... |
"""
Helper routines for reading & writing MRS data in various formats.
Except for the map of internal data types to numpy type strings (which
doesn't require an import of numpy), this code is deliberately ignorant of
numpy. It returns native Python types that are easy to convert into
numpy types.
"""
# Python modules... | {
"content_hash": "25dc9a79ba82b41bac344ee58a269731",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 82,
"avg_line_length": 33.740112994350284,
"alnum_prop": 0.5869055592766242,
"repo_name": "beOn/hcpre",
"id": "5afa384689fe5382ea61dbc21bd14586067c67da",
"size": "11944",
... |
import json
from util import filelist
import re
if __name__ == "__main__":
datalist = filelist.findfiles("./dataset/exp/msapi", ".txt")
for data in datalist:
f = open(data, 'r')
line = f.readline()
segment = re.split('[|]', line)
print(len(segment), segment[0])
data = ... | {
"content_hash": "024ea5f7ebb535b5d6116aed6895b702",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 64,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.5754560530679934,
"repo_name": "elecun/pyface",
"id": "155a0ca60ee3156de98f25eb73d20ccd96985f99",
"size": "626",
... |
import mock
from oslo_config import cfg
from webob import exc
from neutron.common import constants
from neutron.db import api as db_api
from neutron.db import external_net_db
from neutron.db import l3_db
from neutron.db import l3_gwmode_db
from neutron.db import models_v2
from neutron.extensions import l3
from neutron... | {
"content_hash": "5ccd9c9e0895ae0b56ab41d686f4955a",
"timestamp": "",
"source": "github",
"line_count": 427,
"max_line_length": 77,
"avg_line_length": 42.91569086651054,
"alnum_prop": 0.5753888130968622,
"repo_name": "Stavitsky/neutron",
"id": "291c88fcb66309f40724362c670f240a4c2c1085",
"size": "18... |
from __future__ import print_function
import sys
# This is not required if you've installed pycparser into
# your site-packages/ with setup.py
sys.path.extend(['.', '..'])
from pycparser import c_parser, c_ast, parse_file
# A visitor with some state information (the funcname it's
# looking for)
#
class FuncCallVisi... | {
"content_hash": "23899e896c475b5c4eb7650b51bf6524",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 24.945945945945947,
"alnum_prop": 0.6359696641386782,
"repo_name": "songjiguo/C3-IDL-Compiler",
"id": "b0f33ba98c0ced72b16b0d747ec103b28ab59d5b",
"si... |
import math
from dragon.vm.tensorflow.framework import dtypes
from dragon.vm.tensorflow.ops import random_ops
__all__ = ['xavier_initializer',
'xavier_initializer_conv2d',
'variance_scaling_initializer']
def xavier_initializer(uniform=True, seed=None, dtype=dtypes.float32):
return variance... | {
"content_hash": "da12f5c286056de0b87a55944a3fa59f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 85,
"avg_line_length": 41.032786885245905,
"alnum_prop": 0.5705153815421494,
"repo_name": "neopenx/Dragon",
"id": "f2f673c491092f7d9cadc0331f5ac889ad2b56ba",
"size": "2696"... |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1, s, t 2, s, t 3, s, t 4.1, s, t 4.2, s, q"
tags = "FlipX"
import pyglet
import cocos
from cocos.director import director
from cocos.actions import *
from cocos.layer import *
class BackgroundLaye... | {
"content_hash": "7f21bbc7a75d2bcb93d63c1ba8b6ba7e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 74,
"avg_line_length": 27.657894736842106,
"alnum_prop": 0.6117982873453853,
"repo_name": "shadowmint/nwidget",
"id": "e67905d5bc2c8af2f43a185e4efca56ea6c0a4aa",
"size": "1... |
from __future__ import print_function
import subprocess
import os
from sys import stdout, exit
from time import sleep
import json
# Custom modules
from modules import string_ops as c
from modules import cfg, argparser
def update_cache_file(outfile, input):
outfile = "{}/{}".format(cfg.tabCacheDir, outfile)
c.... | {
"content_hash": "638ab7786db432908740c0f22e3ee6d0",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 94,
"avg_line_length": 33.79775280898876,
"alnum_prop": 0.676529255319149,
"repo_name": "ryran/upvm",
"id": "fabd842f7a7cc525ffdbf91e717346c86c7ea3bb",
"size": "3893",
"b... |
"""Word completion for IPython.
This module is a fork of the rlcompleter module in the Python standard
library. The original enhancements made to rlcompleter have been sent
upstream and were accepted as of Python 2.3, but we need a lot more
functionality specific to IPython, so this module will continue to live as an... | {
"content_hash": "df1685b54ef35e0e5fb3cf7a2b329b0a",
"timestamp": "",
"source": "github",
"line_count": 1275,
"max_line_length": 104,
"avg_line_length": 35.98980392156863,
"alnum_prop": 0.5633621722928063,
"repo_name": "fzheng/codejam",
"id": "4c793b43c17f70ee7f865db6c6232945a1e62094",
"size": "459... |
import mosquitto
import os
import sys
import time
import redis
import datetime
import textwrap
import json
# globals
global debug
global mqttc
global run
global r_server
# mqtt
broker = "winter.ceit.uq.edu.au"
port = 1883
serverPort = 55671
# connect
def connect():
global mqttc
global r_server
try:
mqttc.r... | {
"content_hash": "adad220e57cd62f65d36c5c61bf99c4a",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 211,
"avg_line_length": 24.305555555555557,
"alnum_prop": 0.6631428571428571,
"repo_name": "DavidWrigley/Gumball",
"id": "df463f7827166fb5a05ae68aebcf813c236ec8e4",
"size"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.synapse import SynapseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-synapse
# USAGE
python kusto_pool_data_connections_create_or_update.py
Before run the sample, please set the values of the clie... | {
"content_hash": "31d0e23a913b9bd9c39736a21322e25a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 199,
"avg_line_length": 39.15909090909091,
"alnum_prop": 0.7069065583284968,
"repo_name": "Azure/azure-sdk-for-python",
"id": "2ddef8a2cf50b1f0adaac8774e530e491217e74a",
"s... |
import socket, threading, string
debug = True
_connector = None
_running = True
_host = '0.0.0.0'
_port = 2222
_maxClient = 99
_recvBuffer = 1024
def printd(aString):
if debug:
print aString
class talkToClient(threading.Thread):
def __init__(self, clientSock, addr):
self.clientSock = client... | {
"content_hash": "4be9f3aad8b49f10887b4c35773a84b1",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 27.61111111111111,
"alnum_prop": 0.5694164989939637,
"repo_name": "khoteevnd/stepic",
"id": "385884105f1a3452238aa7435d1980ed62ed08bb",
"size": "1516... |
from gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class GpuProcessExpectations(GpuTestExpectations):
def SetExpectations(self):
# Accelerated 2D canvas is not available on Linux due to driver instability
self.Fail('GpuProcess.canvas2d', ['... | {
"content_hash": "fab3d1ba8b02de80775e1a442f0594cf",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 38.648648648648646,
"alnum_prop": 0.6496503496503496,
"repo_name": "axinging/chromium-crosswalk",
"id": "97375eb47c3ced35058892e09fef558a436237f5",
"... |
from django.forms import Form
from django.forms import CharField
from django.forms import DecimalField
from django.utils.translation import ugettext as _
from django.forms import ValidationError
from apps.asset.models import ColdStorage
from apps.asset import control
class ColdStorageAdd(Form):
address = CharField(... | {
"content_hash": "31f67cd459ba9cc54afeee30a974ddb2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 30.072727272727274,
"alnum_prop": 0.7007255139056832,
"repo_name": "F483/bitcoin-bounties.com",
"id": "6898536e050df1a57ee7811d7dc602544c721891",
"si... |
import json
import os
import re
import sys
import dcos.util as util
import six
from dcos import mesos
from dcos.util import create_schema
import pytest
from ..fixtures.node import slave_fixture
from .common import assert_command, assert_lines, exec_command, ssh_output
def test_help():
with open('tests/data/hel... | {
"content_hash": "53b1c50f63f6668b322ce2012bd580de",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 79,
"avg_line_length": 31.74688796680498,
"alnum_prop": 0.5974382433668801,
"repo_name": "sis-tools/dcos-cli",
"id": "9061c14ad44d2ffe8706cbd9f513bc1508d262d5",
"size": "7... |
"""
A collection of commands used in this workflow
"""
import json, sys, time, uuid, os, pickle
from datetime import datetime
from numbers import Number
import click
from botocore.exceptions import ClientError
#---------------------CONFIG-----------------------------
# Override these next 2 functions to change the t... | {
"content_hash": "4eaf6131bd1c17f6a28bc09144c8f6fe",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 115,
"avg_line_length": 31.764044943820224,
"alnum_prop": 0.6156703218960028,
"repo_name": "maxrothman/aws-alfred-workflow",
"id": "44e4e0ed30a60ab0e33e0ad4f529c8ab273a79ce"... |
import pytest
from time import sleep
@pytest.fixture(autouse=True)
def delay():
# put a small delay in before every test,
# otherwise tkinter can get upset by the constant
# creating and destroying of apps
sleep(0.1)
| {
"content_hash": "3c3c7b9e5215b3dff790287df4882ecf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 26.22222222222222,
"alnum_prop": 0.711864406779661,
"repo_name": "lawsie/guizero",
"id": "2ebe23cb5b0ddf637abe3112bd002597644fa06d",
"size": "236",
... |
from typing import Any, Optional, TYPE_CHECKING
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credential... | {
"content_hash": "a248a9998292c8e1d3f41ba5823ee117",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 129,
"avg_line_length": 52.582089552238806,
"alnum_prop": 0.7320465512347432,
"repo_name": "Azure/azure-sdk-for-python",
"id": "646214481c402c936d829f8da349008a241c3b09",
... |
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from .models import Action
class ContentTypeSerializer(serializers.ModelSerializer):
class Meta:
model = ContentType
class StrRelatedField(serializers.Field):
def to_representation(self, value):
... | {
"content_hash": "69d35b274878c1bfc360016caa2415a7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 73,
"avg_line_length": 31,
"alnum_prop": 0.6947004608294931,
"repo_name": "thelabnyc/django-social-timeline",
"id": "bcfa331b3c184c5aa58afec66714c049c1131088",
"size": "868... |
from collections import defaultdict
from http import HTTPStatus
from typing import Callable
from typing import Tuple
from intezer_sdk import consts
from intezer_sdk.analysis import FileAnalysis
from intezer_sdk.analysis import UrlAnalysis
from intezer_sdk.api import IntezerApi
from intezer_sdk.endpoint_analysis import... | {
"content_hash": "f7610b2c2372b5e47a04868c8948da3c",
"timestamp": "",
"source": "github",
"line_count": 738,
"max_line_length": 120,
"avg_line_length": 35.8739837398374,
"alnum_prop": 0.6216052880075543,
"repo_name": "demisto/content",
"id": "97585759de0e6067252dd620ef9bbce95d7f7b1a",
"size": "2647... |
'''Fetch a bunch of URLs and store them permanently on-disk.
Uses requests-cache and a sqlite database. Does rate-throttling.
Usage:
./url_fetcher.py path-to-list-of.urls.txt
'''
import fileinput
import os
import requests
import requests_cache
import time
import sys
class NotInCacheError(Exception):
pass
... | {
"content_hash": "b1a8e8a4425dd47e126fd8a2055390ae",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 86,
"avg_line_length": 28.938271604938272,
"alnum_prop": 0.5998293515358362,
"repo_name": "nypl-spacetime/oldnyc",
"id": "bcfd38e95727a33b345bbcfa66373180d4220c42",
"size":... |
from django.core.cache import cache
from django.http import HttpRequest
from django.test import TestCase
from django.test.utils import override_settings
#CONTENTIOUS
from contentious.compat import get_request_context
from .api import BasicEditAPI
class APITest(TestCase):
""" Tests for the BasicEditAPI. """
... | {
"content_hash": "04d25701aef9f964f52f77e452d2196a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 39.5,
"alnum_prop": 0.667433831990794,
"repo_name": "potatolondon/contentious",
"id": "63124f72a9c5657435fbea260a6c6737721764ea",
"size": "1749",
"... |
import random
import math
import numpy as np
import networkx as nx
import cPickle as pkl
from scipy.spatial.distance import cosine
from experiment_util import weighted_choice
from dag_util import get_roots
from interactions import InteractionsUtil as IU
from experiment_util import get_number_and_percentage, \
exp... | {
"content_hash": "84e093882bbc8cacd8d2f950d25a0b95",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 85,
"avg_line_length": 35.86143187066975,
"alnum_prop": 0.5425038639876353,
"repo_name": "xiaohan2012/lst",
"id": "d0e6a503ebc79c0609b76e20ca8865f307106980",
"size": "1555... |
"""API for Home Connect bound to HASS OAuth."""
from asyncio import run_coroutine_threadsafe
import logging
import homeconnect
from homeconnect.api import HomeConnectError
from homeassistant import config_entries, core
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, TIME_SECONDS, UNIT_PERCENTAGE
from homeass... | {
"content_hash": "a1bb103aded04dd66e0bb95d75a70291",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 93,
"avg_line_length": 38.53763440860215,
"alnum_prop": 0.6213727678571429,
"repo_name": "titilambert/home-assistant",
"id": "f768e28be9238f5d99c97fbf3bd6569dedf67214",
"s... |
import multiprocessing.connection as connection
import sys
import os
class Client:
def message(args):
address = ('localhost', 6000)
conn = connection.Client(address, authkey='s'.encode(encoding='UTF-8'))
msg = {}
msg['pid'] = os.getppid()
msg['args'] = sys.argv[1:]
c... | {
"content_hash": "acdeb9c4e4683803c7e52fbcf01a747e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 26.8,
"alnum_prop": 0.5771144278606966,
"repo_name": "Gazolik/shell_player",
"id": "d4b8d6d868003dc4ab688f974cf2f02b1ca1b451",
"size": "422",
"bina... |
__all__ = [
'Body',
'Header',
'Message',
'Property',
'WsId'
]
#
# Package definition for com.raytheon.uf.common.message
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ---... | {
"content_hash": "86c4855df52b89d84ca1975b0ed80d08",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 23.555555555555557,
"alnum_prop": 0.46226415094339623,
"repo_name": "mjames-upc/python-awips",
"id": "e4ad2b5d6ee59c3013545e46e879751f9cff8488",
"siz... |
import re
from unittest import TestCase
from ptime import Format, FormatError
class TestFormat(TestCase):
def test_qualifiers(self):
regexp = Format('').regexp
self.assertEqual(
regexp, re.compile(r'^$', re.IGNORECASE | re.UNICODE))
def test_escaping(self):
regexp, attrs ... | {
"content_hash": "43a9de4b256cabc12337711344cff08e",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 75,
"avg_line_length": 31.5625,
"alnum_prop": 0.6257425742574257,
"repo_name": "lun/ptime",
"id": "05261d9c414ff8dbff334fa7c04fc4afbbbfaf08",
"size": "1515",
"binary": fa... |
import getopt
import re
from lib.builds.build_query import BuildQuery
import lib.logger
import ConfigParser
import os
import collections
#class to parse the inputs either from command line or from a ini file
#command line supports a subset of
# configuration
# which tests
# ideally should accept a regular expression
... | {
"content_hash": "af64c24188fb69760d693699a4777025",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 118,
"avg_line_length": 37.752997601918466,
"alnum_prop": 0.5146414279362256,
"repo_name": "couchbaselabs/litmus",
"id": "9b69d64146f2f4d48ed407f411fe5165e07661b1",
"size"... |
import redis
import os
import dice
# import some_api_lib
# import ...
# Example of your code beginning
# Config vars
token = os.environ['TELEGRAM_TOKEN']
# Your bot code below
bot = dice.initialize(token)
# some_api = some_api_lib.connect(some_api_token)
# ...
| {
"content_hash": "a5eb02c9e744b622ca20fe9fa168d851",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 49,
"avg_line_length": 19.533333333333335,
"alnum_prop": 0.6416382252559727,
"repo_name": "DanAmador/telegram-dice-bot",
"id": "64f78f87e9639e0954c32d1b32e067079141a3cb",
"... |
from libcloud.utils import deprecated_warning
from libcloud.compute.drivers.rimuhosting import *
deprecated_warning(__name__)
| {
"content_hash": "65e6b5a81c7c16cd7139fc3c6902607a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 50,
"avg_line_length": 31.75,
"alnum_prop": 0.8188976377952756,
"repo_name": "cloudkick/libcloud",
"id": "f55ed823ffbbdfe858229f2a134ba9fd944a53ee",
"size": "909",
"binary... |
from sqlalchemy import *
from migrate import *
from sqlalchemy.dialects.sqlite import \
BLOB, BOOLEAN, CHAR, DATE, DATETIME, DECIMAL, FLOAT, \
INTEGER, NUMERIC, SMALLINT, TEXT, TIME, TIMESTAMP, VARCHAR
meta = MetaData()
projects = Table('projects', meta,
Column('id', INTEGER, ... | {
"content_hash": "e6bb2240dadc4b8977b3edcfed9ceaaa",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 70,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.6730769230769231,
"repo_name": "macterra/galton",
"id": "82876f24f7b4717b921c2ffdf11e588c309bdd12",
"size": "832"... |
""" A bunch of util functions to build Seq2Seq models with Caffe2."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
from future.utils import viewitems
import caffe2.proto.caffe2_pb2 as caffe2_pb2... | {
"content_hash": "834d73b158546ca3894ee7438dfe9721",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 80,
"avg_line_length": 30.31044776119403,
"alnum_prop": 0.5745519007287768,
"repo_name": "xzturn/caffe2",
"id": "d0702880c1ec7efbaa007f5ed3fe95dda2d25c3a",
"size": "20378"... |
import serial
import time
import datetime
import sys
import paddle.v2 as paddle
from PIL import Image
import numpy as np
import cv2
from vgg import vgg_bn_drop
def multilayer_perceptron(img):
hidden1 = paddle.layer.fc(input=img, size=128, act=paddle.activation.Relu())
hidden2 = paddle.layer.fc(input=hidden1, size=6... | {
"content_hash": "1d3a7e866c06103cd8fce65fc3c4e363",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 83,
"avg_line_length": 25.8,
"alnum_prop": 0.5979563072586328,
"repo_name": "sorting4peach/sorting4peach",
"id": "c00b76497fe8c02bc2cfd77ff0f96380a312864e",
"size": "2838"... |
"""
celery.contrib.rdb
==================
Remote debugger for Celery tasks running in multiprocessing pool workers.
Inspired by http://snippets.dzone.com/posts/show/7248
**Usage**
.. code-block:: python
from celery.contrib import rdb
from celery import task
@task()
def add(x, y):
result = x... | {
"content_hash": "ef53603f523d6e2a4b1eb2222e2c5ede",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 76,
"avg_line_length": 28.56875,
"alnum_prop": 0.586304966090571,
"repo_name": "mozilla/firefox-flicks",
"id": "43cc6a42191e9d41b3f4b51b2170a9f780965950",
"size": "4595",
... |
LISTENING_ADDRESS = '127.0.0.1'
# Webserver port, if port is in use another random port will be selected
LISTENING_PORT = 8000
# Url path to access OmniDB, default is empty
CUSTOM_PATH = ''
# Number of seconds between each prompt password request. Default: 30 minutes
PWD_TIMEOUT_TOTAL = 1800
# Security par... | {
"content_hash": "7f94cabbfce72d3de7c64f32cbcfcef7",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 110,
"avg_line_length": 30.723076923076924,
"alnum_prop": 0.6464697045568353,
"repo_name": "OmniDB/OmniDB",
"id": "3db475beca588d976382d07b2b9b89e5e6cb7285",
"size": "2092"... |
import os
import re
import sys
total = 0.0
count = 0
BASE_DIRECTORY = os.getcwd()
EXTENDED = ""
TYPE = "text"
excluded_directories = ["develop_scripts", "tests", "docs", "demo"]
excluded_files = ["__init__.py", "setup.py", "custom_assertions.py", "conftest.py"]
expected_html_tags = ["<table>", "<html>"]
expected_par... | {
"content_hash": "cc9c9a8946b30d9da1fd82452dd3b56d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 116,
"avg_line_length": 33.57446808510638,
"alnum_prop": 0.5506970849176173,
"repo_name": "DrimTim32/py_proj_lights",
"id": "1a61fd8ac1eb88230e2dadc2cbfd2982ee575fe3",
"siz... |
"""Utilities for reading LSA-SAF product files.
This module contains some functions for reading the data products produced by
the Land Surface Analysis Satellite Applications Facility (http://landsaf.meteo.pt).
The data products are distributed in HDF5 format and therefore the module requires
the PyTables package... | {
"content_hash": "d16aaba08f4cd9903fd45f49e612d410",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 106,
"avg_line_length": 44.89655172413793,
"alnum_prop": 0.6504096262160778,
"repo_name": "sahg/SAHGutils",
"id": "c40d2e5960fd81f8be91a83cad040abce409be5d",
"size": "7812... |
{
'!langcode!': 'en-us',
'!langname!': 'English (US)',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'"User Exception" debug mode. ': ... | {
"content_hash": "c5e6f3f93d9be63891441cd10c452ac1",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 823,
"avg_line_length": 55.132635253054104,
"alnum_prop": 0.722072742236713,
"repo_name": "xiang12835/python_web",
"id": "0d5dcf5c5fc24c8dede82f10c1245113f5c20674",
"size"... |
"""Base class for api services."""
import base64
import contextlib
import datetime
import logging
import pprint
import six
from six.moves import http_client
from six.moves import urllib
from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
from apitools.base.py import... | {
"content_hash": "267b9ec3bbcba44a444a01abc3fb1734",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 79,
"avg_line_length": 39.535367545076284,
"alnum_prop": 0.6257849500087704,
"repo_name": "kevinli7/apitools",
"id": "1d490c3100f2faedcad6b989246604a0f0c24e8a",
"size": "2... |
from EXOSIMS.SurveySimulation.tieredScheduler_SLSQP import tieredScheduler_SLSQP
import astropy.units as u
import astropy.constants as const
import numpy as np
import time
import copy
class tieredScheduler_DD_SLSQP(tieredScheduler_SLSQP):
"""tieredScheduler_DD_SLSQP - tieredScheduler Dual Detection SLSQP
Thi... | {
"content_hash": "fa39be91f7c6d127fba59e38708c6778",
"timestamp": "",
"source": "github",
"line_count": 889,
"max_line_length": 88,
"avg_line_length": 44.503937007874015,
"alnum_prop": 0.4523809523809524,
"repo_name": "dsavransky/EXOSIMS",
"id": "02d53b1382caf85e2e1835e1df32524d69c3448e",
"size": "... |
from django.shortcuts import render
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse_lazy
urlpatterns = patterns(
'',
url(r'^login/$', 'authenticateapp.views.log_in', name='log_in'),
url(
r'^logout/$',
'django.contrib.auth.views.logout',
... | {
"content_hash": "9ccbc4ba075c1fa0bd2a48a552d54884",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 68,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.6163265306122448,
"repo_name": "panioglovadim/first",
"id": "5178554b305a98a2bfc45805ab063f5e374ac1f7",
"size": "4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.