text stringlengths 4 1.02M | meta dict |
|---|---|
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import random
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
wd.implicitly_wait(10)
wd.get("http://localhost/lit... | {
"content_hash": "2442cada76e1e4add1f6201bb31f3889",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 88,
"avg_line_length": 35.628571428571426,
"alnum_prop": 0.6672012830793905,
"repo_name": "limemadness/selenium_training",
"id": "10b3d50e5938fafabd3e81423ec7d913110ae0bb",
... |
class Novel:
def __init__(self, vndb_id, name, characters=None):
self.vndb_id = vndb_id
self.name = name
self.characters = characters
class Character:
def __init__(self, vndb_id, name, novels=None):
self.vndb_id = vndb_id
self.name = name
self.novels = novels
... | {
"content_hash": "5f5af5093bd0ddde85a9efa0ac538225",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 55,
"avg_line_length": 24.63157894736842,
"alnum_prop": 0.5833333333333334,
"repo_name": "apsun/VNaaS",
"id": "ab68f918afad69cf6204c30c55eb9f4e2adaf879",
"size": "468",
"... |
r'''
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | {
"content_hash": "04aeeb896ec1f5a43f53fac5079ffec8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 72,
"avg_line_length": 40.1875,
"alnum_prop": 0.76049766718507,
"repo_name": "leasual/nogotofail",
"id": "8316ac6085274b618de08042e49598b27c3f7867",
"size": "643",
"binar... |
from zipline.finance.commission import PerShare
from powerline.utils import tradingcalendar_eex
from powerline.exchanges.exchange import Exchange
__author__ = "Warren"
class EexExchange(Exchange):
"""
Implementing abstractproperties for the EEX exchange
"""
@property
def benchmark(self):
... | {
"content_hash": "0d2ce3ac8d9d14f15eb06e3f7c6cd85f",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 24.43243243243243,
"alnum_prop": 0.629424778761062,
"repo_name": "grundgruen/powerline",
"id": "28560f01e8ef35307deb630fbeb1eb2f319c4239",
"size": "9... |
"""This file implements the Spreadsheet Tab Controller, to manages tabs:
StandardWidgetTabController
"""
from __future__ import division
from ast import literal_eval
import copy
import gc
import os.path
from PyQt4 import QtCore, QtGui
from vistrails.core.db.locator import FileLocator, _DBLocator as DBLocator
from vi... | {
"content_hash": "6169140aa72138aacb3bffca9acc5f34",
"timestamp": "",
"source": "github",
"line_count": 793,
"max_line_length": 91,
"avg_line_length": 40.16141235813367,
"alnum_prop": 0.5680105501130369,
"repo_name": "hjanime/VisTrails",
"id": "21aa5291f0dbc55b7f31283e0c7a79e3e4193ad8",
"size": "33... |
import inspect
from yass.models import PluginMeta, PluginBase
import yass.plugins
def iter_plugins(predicate=None):
base_predicate = lambda cls: isinstance(cls, PluginMeta) and cls != PluginBase
_predicate = base_predicate
if predicate is not None and hasattr(predicate, '__call__'):
_predicate =... | {
"content_hash": "36fd024fb258516d9eb4c19f4f5dd4e5",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 82,
"avg_line_length": 31.6,
"alnum_prop": 0.7257383966244726,
"repo_name": "mrnfrancesco/yass",
"id": "c40831354f3b3d1f29dc78ad72e93a0b01fc6147",
"size": "1142",
"binary... |
import collections, operator
from ..jvm import arraytypes as arrays
from ..jvm import scalartypes as scalars
from ..jvm import mathops, jvmops
from ..treelist import TreeList
from .. import flags, dalvik
# The two main things we need type inference for are determining the types of
# primative values and arrays. Luck... | {
"content_hash": "87ddd59e1eed02987a888ba0f727e952",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 94,
"avg_line_length": 38.0431654676259,
"alnum_prop": 0.6174357034795764,
"repo_name": "ajinabraham/enjarify",
"id": "1ff7d7ef8768d3110b6c6e1ad1bed44b2f1e2a04",
"size": "... |
import platform
# Platform identification constants.
UNKNOWN = 0
RASPBERRY_PI = 1
BEAGLEBONE_BLACK = 2
def platform_detect(plat=platform.platform()):
"""Detect if running on the Raspberry Pi or Beaglebone Black and return the
platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN."""
... | {
"content_hash": "bb51bc8a503c8beee72676063a888274",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 33.44444444444444,
"alnum_prop": 0.7209302325581395,
"repo_name": "hastrolaptecos/domuspi_servidor",
"id": "154e4b1db121743e00f4b4d0da4ed13ef9d9a3b7",
... |
from geolocation.google_maps import GoogleMaps
from geolocation.distance_matrix import const
if __name__ == "__main__":
origins = ['rybnik', 'oslo']
destinations = ['zagrzeb']
google_maps = GoogleMaps(api_key='your_google_maps_key')
items = google_maps.distance(origins, destinations).all() # default... | {
"content_hash": "dc80c52cdf6aa3623110140f5c4681b2",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 109,
"avg_line_length": 40.06666666666667,
"alnum_prop": 0.6292845257903494,
"repo_name": "brendanebers/geolocation-python",
"id": "bc20623e35ef4ae8a34d0c6217d3d457741a8b8d",... |
"""Functions for tasks and a few general async tasks."""
import json
import logging
import re
import warnings
from dataclasses import dataclass
from datetime import timedelta
from typing import Callable, List
from django.conf import settings
from django.core import mail as django_mail
from django.core.exceptions impo... | {
"content_hash": "3af2b047f5691efcab53c5d848145031",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 120,
"avg_line_length": 31.59908883826879,
"alnum_prop": 0.6401384083044983,
"repo_name": "inventree/InvenTree",
"id": "f3e0258053f7ab3c6075a5a2c1e1b196cfe3eca6",
"size": ... |
"""The kodi component."""
import asyncio
import logging
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_SSL,
CONF_USERNAME,
EVENT... | {
"content_hash": "89394f5098da95b679296b84c57892aa",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 87,
"avg_line_length": 27.35,
"alnum_prop": 0.6449725776965265,
"repo_name": "titilambert/home-assistant",
"id": "dedb0ab09c4fed029d764cb4b98586b3a62bf92d",
"size": "2735"... |
from demand import Demand
from spot import Spot | {
"content_hash": "b21e07a078148af3b04eb06dd5503764",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 25,
"avg_line_length": 23.5,
"alnum_prop": 0.851063829787234,
"repo_name": "vinod-iref/awfleet",
"id": "49eaca31e2c18266b32666fc186841882635e415",
"size": "47",
"binary": ... |
class Node(object):
def __init__(self, data):
self.data = data;
self.left = None;
self.right = None;
def insert(self,data):
newNode = Node(data);
if data < self.data :
if self.left is None:
self.left = newNode;
e... | {
"content_hash": "4ddefec21780d602c7ac9471f7c295b8",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 70,
"avg_line_length": 25.837209302325583,
"alnum_prop": 0.45724572457245727,
"repo_name": "rahularora/python-trees",
"id": "21997669210dc3e75da260e2769bb3bb52df5c68",
"siz... |
"""
Support for August lock.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/lock.august/
"""
from datetime import timedelta
from homeassistant.components.august import DATA_AUGUST
from homeassistant.components.lock import LockDevice
from homeassistant.c... | {
"content_hash": "197168136c912a231e62f8d99a534198",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 76,
"avg_line_length": 28.182926829268293,
"alnum_prop": 0.6360882734746863,
"repo_name": "persandstrom/home-assistant",
"id": "7aec3c78690231c5550eb2d6e399122311cb3cdb",
"... |
from c2cgeoportal_admin.views.layertree import itemtypes_tables
itemtypes_tables.update({
'lu_int_wms': 'lux_layer_internal_wms',
'lu_ext_wms': 'lux_layer_external_wms',
})
| {
"content_hash": "5503864ee52e6fb7192659412b21720a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 63,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.7359550561797753,
"repo_name": "Geoportail-Luxembourg/geoportailv3",
"id": "4d2f60b0ce980d6bac25296af887ce7f574f32e7... |
import socket
import time
import os
import sys
import subprocess
def send(message):
ANY = '0.0.0.0'
SENDERPORT=1501
MCAST_ADDR = '224.168.2.9'
MCAST_PORT = 8946
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.bind((ANY,SENDERPORT))
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MU... | {
"content_hash": "428adc6da112784f7791f37beac23882",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 209,
"avg_line_length": 32.01923076923077,
"alnum_prop": 0.6096096096096096,
"repo_name": "NickGeek/WiN",
"id": "56cf8f0b0da7ba5928edb6a4d5a6e4397a28062c",
"size": "3330",... |
import logging
from django.conf import settings
from django.utils.functional import cached_property
from waldur_core.core.utils import serialize_instance
from waldur_mastermind.marketplace import models, processors
from waldur_mastermind.marketplace_remote import utils
from waldur_mastermind.marketplace_remote.tasks ... | {
"content_hash": "a21df68315bd20e86fc1d87902f908b0",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 81,
"avg_line_length": 33.839080459770116,
"alnum_prop": 0.6769701086956522,
"repo_name": "opennode/nodeconductor-assembly-waldur",
"id": "3266ef8932c08b827fb8d44efa71382f314... |
from bluesky.examples import *
from bluesky.broker_examples import *
from bluesky.broker_callbacks import LiveImage
from bluesky.tests.utils import setup_test_run_engine
from matplotlib import pyplot as plt
from xray_vision.backend.mpl.cross_section_2d import CrossSection
import numpy as np
import filestore.api as fsap... | {
"content_hash": "452d2a860877ca3476438afd449c5046",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 90,
"avg_line_length": 31.7,
"alnum_prop": 0.6961093585699264,
"repo_name": "sameera2004/bluesky",
"id": "553d703b0c5a8419254bfaddc12fcc8c7dc6b3af",
"size": "951",
"binar... |
"""
Player.py - File for defining a Player class.
"""
import logging
import numpy as np
from monopoly.Constants import CARD_WIDTH, MAX_LEVEL, MAX_HOUSE_LEVEL, MAX_DOUBLES, JAIL_COST, NUM_PROPERTIES, INIT_CASH
from monopoly.Constants import COLOR_COUNTS, COLOR_PROPERTIES, PROPERTY_PRICES, PROPERTY_NAMES, SPACE
from mo... | {
"content_hash": "414550e1d0fc3b6ad6c2409a70700938",
"timestamp": "",
"source": "github",
"line_count": 656,
"max_line_length": 126,
"avg_line_length": 42.65243902439025,
"alnum_prop": 0.5186561829878484,
"repo_name": "tmthydvnprt/Monopoly",
"id": "50c1e7e252188b3481ad06cf0ee119a869c43730",
"size":... |
from django.conf.urls import url
from . import views
app_name = 'testApp'
urlpatterns = [
url(r'^socialgraph/$', views.socialgraph, name='socialgraph'),
url(r'^inputgroundtruth/$', views.inputgroundtruth, name='inputgroundtruth'),
url(r'^improvedsocialgraph/$', views.improvedsocialgraph, name='improvedsocialgrap... | {
"content_hash": "7cf7f33215928577f6c524a4d9e2c1b3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 87,
"avg_line_length": 41.72727272727273,
"alnum_prop": 0.7320261437908496,
"repo_name": "indervirbanipal/profiling",
"id": "eb0b5e84ccd93cb909b77f2773b53e3dd22f321a",
"siz... |
import copy
from cStringIO import StringIO
from fnmatch import fnmatch
import gzip
import hashlib
import mimetypes
import os
import boto
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import app_config
GZIP_FILE_TYPES = ['.html', '.js', '.json', '.css', '.xml']
class FakeTime:
... | {
"content_hash": "f0a53178686a79f864ff399d76922432",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 93,
"avg_line_length": 27.3125,
"alnum_prop": 0.5775171624713958,
"repo_name": "stlpublicradio/ferguson-project",
"id": "59df4302df5b14523e9c86904a97fddc11d70340",
"size":... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "8738993c0df17041438a91c8571b6564",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 203,
"avg_line_length": 56.32310838445808,
"alnum_prop": 0.6788178055333672,
"repo_name": "mpatacchiola/naogui",
"id": "60478bb4efc8ba6b85ce6adadaa6bbccac5d0c00",
"size": ... |
"""Example of hemodynamic reponse functions.
=========================================
Plot the hemodynamic reponse function (hrf) model in SPM together with
the hrf shape proposed by G.Glover, as well as their time and
dispersion derivatives.
Requires matplotlib.
The hrf is the filter that couples neural responses ... | {
"content_hash": "25133145b0935401d3ccf0782b0be8b4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 96,
"avg_line_length": 36.8125,
"alnum_prop": 0.6073853989813243,
"repo_name": "bthirion/nistats",
"id": "6b1a96a65b77809ed0a7e81f0093eed0ef9576af",
"size": "2356",
"bina... |
from django.shortcuts import render
def get_featured_photosets(request):
return render(request, template_name="myapp/show_photos.html")
| {
"content_hash": "4528647817760bd1184b925a28bb9773",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 66,
"avg_line_length": 28.4,
"alnum_prop": 0.7816901408450704,
"repo_name": "arkanister/django-flickr-gallery",
"id": "9eeea68d1b367b6561bde2f03c832ac3f3a7ad8e",
"size": "14... |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
np.random.seed(seed=1960)
#get_ipython().magic('matplotlib inline')
df = pd.DataFrame()
lTimeVar = 'Time'
lSignalVar = 'Signal'
N = 10000
df[lTimeVar + '_Hourly'] = pd.date_range('2000-1-1', periods=N, freq='1h')
df['Hour'] = df[lTimeVar ... | {
"content_hash": "78ffb331afa1eb128606f7c64277e94d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 152,
"avg_line_length": 28.47945205479452,
"alnum_prop": 0.6060606060606061,
"repo_name": "antoinecarme/pyaf",
"id": "d91e819cbe8c28b18922daff2930095a1cf18990",
"size": "20... |
from __future__ import unicode_literals
import base64
import json
import datetime
from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from django.utils import timezone
from ..compat import urlparse, parse_qs, urlencode, get_user_model
from ..models import get_application_mod... | {
"content_hash": "a78529d7292552508c6ade4330c0a28c",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 110,
"avg_line_length": 39.63848396501458,
"alnum_prop": 0.6052883200941453,
"repo_name": "svetlyak40wt/django-oauth-toolkit",
"id": "8b3a34b91b51136cc79bf0d4bafd1bcd05919ed... |
"""The deferred instance delete extension."""
import webob
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
author... | {
"content_hash": "ec652350042bc0f38ef8b21fae8ca68e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 37.52307692307692,
"alnum_prop": 0.6457564575645757,
"repo_name": "fajoy/nova",
"id": "14b608677cdc153ad5bdb33f6b1890c3834f4262",
"size": "3069",
"... |
"""Support for THOMSON routers."""
from __future__ import annotations
import logging
import re
import telnetlib
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST, CON... | {
"content_hash": "46301a3dcb39c56202df03032e31235f",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 88,
"avg_line_length": 33,
"alnum_prop": 0.5883222468588323,
"repo_name": "w1ll1am23/home-assistant",
"id": "4af21ec8e1609d63ab00ebd0896614b050cfdb1b",
"size": "4059",
"... |
from __future__ import unicode_literals
import six
import copy
import time
import json
import logging
import threading
import tornado.ioloop
import tornado.httputil
import tornado.httpclient
import pyspider
from six.moves import queue
from requests import cookies
from tornado.curl_httpclient import CurlAsyncHTTPClien... | {
"content_hash": "30ff37b4f31d729956d5fea9be8e4381",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 97,
"avg_line_length": 35.92827004219409,
"alnum_prop": 0.5310628302994715,
"repo_name": "EnderCheng/pyspider",
"id": "ee0c6918f608dcc65511fd18b4ec8b4b45a8f492",
"size": "... |
import _plotly_utils.basevalidators
class CmidValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="cmid", parent_name="cone", **kwargs):
super(CmidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=... | {
"content_hash": "cfa7d51dee84e2e791d68298ae2dcce2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 37.53846153846154,
"alnum_prop": 0.5922131147540983,
"repo_name": "plotly/python-api",
"id": "52fa2830678f837c637d297965709af98c7daa50",
"size": "488... |
from django.test import TestCase
from test_app.models import Widget
from hippocampus.models import *
class LogVisitTestCase(TestCase):
def setUp(self):
pass
def test_track_with_object_id(self):
self.fail()
def test_track_with_slug(self):
self.fail()
def test_no_track_with_ip... | {
"content_hash": "1fba5cb33de4eceb2ec78284e9c84f18",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 43,
"avg_line_length": 20.413793103448278,
"alnum_prop": 0.6283783783783784,
"repo_name": "marinho/hippocampus",
"id": "4a6c6fcff2a7ddd09aa591721a8450f79d4b9251",
"size": "... |
import time
import smtplib
import random, string
#setup the random, random, random maker
def randomword(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
# Reset the variables (maybe not needed)
oldAmountOfLines = 0
numNewLines = 0
emailNoFlood = 0
# Pull initial figures, set this t... | {
"content_hash": "0503fe47bd2c94a796907cf98573bc52",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 113,
"avg_line_length": 32.745098039215684,
"alnum_prop": 0.7086826347305389,
"repo_name": "thiscodedbox/TerrariaPythonEmail",
"id": "a4352da9dd1b51010b457889d86b78dea9bacff... |
from django.conf.urls import url
from login import views
urlpatterns = [
url(r'^$', views.index, name='home'),
] | {
"content_hash": "52265314bc12d840f7869e6ed68419fb",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 41,
"avg_line_length": 19.5,
"alnum_prop": 0.6837606837606838,
"repo_name": "kantanand/insmartapps",
"id": "7a69b967fd4fe272f88237f204dac1419991d4fb",
"size": "117",
"bina... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
__version__ = '0.2.2'
setup(
name='redmsg',
version=__version__,
description='Simple Redis messaging with playback support',
long_description='Simple Redis messaging with playback support',
author='Ivo T... | {
"content_hash": "ba8e71e71ddd0a38c309106d051fab64",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 29.475,
"alnum_prop": 0.5988125530110263,
"repo_name": "ivotkv/redmsg",
"id": "a81f0ab6df2d1865598d2bfc54e10082337b8d96",
"size": "2329",
"binary":... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'Post', fields ['article_content_success']
db.create_index(u'djangofeeds_post',... | {
"content_hash": "307e912007b685f1e4ef04ac8843a3ef",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 163,
"avg_line_length": 73.42222222222222,
"alnum_prop": 0.5585653753026635,
"repo_name": "chrisspen/django-feeds",
"id": "b158dc8dc1a87f3479be3806940da30e45a0e437",
"size"... |
'''
This program is free software; you can redistribute it and/or modify
it under the terms of the Revised BSD License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.... | {
"content_hash": "ecde5db96c116ec1a004ae24c32caeef",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 219,
"avg_line_length": 51.078512396694215,
"alnum_prop": 0.6943612976296416,
"repo_name": "GameMaker2k/PyBiorhythm",
"id": "0471838cd6f4ae0ccf8b61c527ba053307175697",
"si... |
import unittest
import cara
from tests.generics_test_capnp import GenericStruct, GenericIface
class GenericsTest(unittest.TestCase):
def test_struct_templates(self):
struct = GenericStruct[cara.Text]
field = struct.__fields__['field']
assert field.type == struct
instance = struct... | {
"content_hash": "b624cea08d94a0431c160664f54db926",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 38.22222222222222,
"alnum_prop": 0.6156976744186047,
"repo_name": "chainreactionmfg/cara",
"id": "261a40f5ff6c9ae37e31ea4c04582973664dcec6",
"size": ... |
import json
from . import statuses
class JSONAPIError(Exception):
""" Exception class for JSONAPI.
.. versionadded:: 0.6.9
.. versionchanged:: 0.8.4
Use JSON-API Specification http://jsonapi.org/format/#errors
Error codes are from 0 to 32767.
Error codes 32000 - 32767 are reserved fro js... | {
"content_hash": "7a520efe913f6db3bf0ab5cd5355aa15",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 79,
"avg_line_length": 25.7578125,
"alnum_prop": 0.6342129208371247,
"repo_name": "pavlov99/jsonapi",
"id": "a8399ca4a3297f205b088865ee962b9af2b2ce51",
"size": "3297",
"... |
"""Tests for Bigtable Ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib import bigtable
from tensorflow.contrib.bigtable.ops import gen_bigtable_ops
from tensorflow.contrib.bigtable.ops import gen_bigtable_test_ops
from tensorf... | {
"content_hash": "42627e0474e4b6774b62fc0d208f7806",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 80,
"avg_line_length": 39.79457364341085,
"alnum_prop": 0.6521866173176195,
"repo_name": "aselle/tensorflow",
"id": "e36f7f32c61b50047c0d9137427f2a24462b1c9a",
"size": "10... |
from __future__ import absolute_import, unicode_literals
import six
import sys
import django
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.compat import import_module, OrderedDict
from debug_toolbar.panels import Panel
class VersionsPanel(Panel):
""... | {
"content_hash": "360e4484cb39b9543d4eeee6c2639c94",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 30.733333333333334,
"alnum_prop": 0.5587852494577007,
"repo_name": "jean/sentry",
"id": "f818dfea413c4b4792314b55c4aaa98fc42b1aa6",
"size": "2305",
... |
import re
from oslo.config import cfg
from scrapnfving.utils import launchpad
CONF = cfg.CONF
opts = [
cfg.StrOpt('pattern_reviews',
default="http[s]?://review.openstack.org/(?:#/c/)?([0-9]+)",
help='Regex pattern for searching review topics')
]
CONF.register_opts(opts, 'gerrit')
... | {
"content_hash": "f05a7e1bc6c9b5f2978019cf445da327",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 28.741935483870968,
"alnum_prop": 0.6105499438832772,
"repo_name": "sbauza/gerrit-dashboard-nfv",
"id": "d859863f7fc94525ba14fdc233b2f7d8b66a1f6e",
"... |
from contact_form.signals import contact_form_valid, contact_form_invalid
from django.core.mail import send_mail
def sendmail_callback(sender, **kwargs):
if kwargs['event'] == 'CONTACT_FORM_VALID_MESSAGE':
send_mail(kwargs['subject'], kwargs['message'], kwargs['sender_email'], 'from@adress.com')
contact_... | {
"content_hash": "bf8a3cc0f2eb539214802f040d3dae17",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 98,
"avg_line_length": 34.5625,
"alnum_prop": 0.7251356238698011,
"repo_name": "dlancer/django-crispy-contact-form",
"id": "2856f91568416c85cb65535baac43781ec80307e",
"size... |
import numpy as np
import numpy.ma as ma
from numpy import random
import matplotlib.pyplot as plt
from scipy import stats
class PoissonProcess(object):
def __init__(self, tau):
self.tau = tau
def nextEvent(self):
return random.exponential(self.tau, 1)[0]
def eventsByTime(self, maxT):
... | {
"content_hash": "b35461a8b719975fa1478bc9de5c073a",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 49,
"avg_line_length": 24.285714285714285,
"alnum_prop": 0.5682352941176471,
"repo_name": "stephenhelms/WormTracker",
"id": "2fff6a6764c910f0dbcdbaff8e6db8dadb2acd03",
"siz... |
import pandas as pd
import math
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import preprocessing
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix
from sklearn.pipeline import P... | {
"content_hash": "a95bef6537b3e6f3e26d2363c50dfaae",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 29.232876712328768,
"alnum_prop": 0.6752577319587629,
"repo_name": "rupendrab/py_unstr_parse",
"id": "9bf1826d13ce3cc97f675955eef466673e633b57",
"si... |
from __future__ import absolute_import, division, print_function
import sys
from fnmatch import fnmatchcase
import pytest
travis_lines = [
'travis_fold:start:*',
'travis_fold:end:*',
]
def test_travis_fixture_registered(testdir):
testdir.runpytest('--fixtures').stdout.fnmatch_lines([
'travis',... | {
"content_hash": "201b231fa0685e14f7f32a3687a2c5fe",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 30.464912280701753,
"alnum_prop": 0.6443996544773971,
"repo_name": "abusalimov/pytest-travis-fold",
"id": "e7a60c1579fca189c4ee2bcdd9cf9060c02cbea2",
... |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def weights_and_distributions(ip,port):
htable = h2o.upload_file(h2o.locate("smalldata/gbm_test/moppe.csv"))
htable["premiekl"] = htable["premiekl"].asfactor()
htable["moptva"] = htable["moptva"].asfactor()
htable["zon"] = htable["zon"]
... | {
"content_hash": "100d1a8bec7523ebb7acd24960e4f9d9",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 131,
"avg_line_length": 39,
"alnum_prop": 0.6905393457117595,
"repo_name": "bospetersen/h2o-3",
"id": "66c2595506465ecfacc54f17cb2c162a3f01bcd6",
"size": "1131",
"binary"... |
import os
def read_source(filename):
path = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename)
with open(path, encoding='utf8') as f:
return f.read()
header = read_source('ome.h')
source = read_source('runtime.c')
main = read_source('main.c')
| {
"content_hash": "4bfef8a5addc15f4d7e1b904ac9b5853",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 77,
"avg_line_length": 27.7,
"alnum_prop": 0.6570397111913358,
"repo_name": "shaurz/ome",
"id": "a99099ea802424c4dee7dc9643a36c17763ebe16",
"size": "277",
"binary": false... |
""" Defines the valid modes. Currently we just use strings to identify them.
"""
from __future__ import absolute_import
NULLABLE = "NULLABLE"
REQUIRED = "REQUIRED"
REPEATED = "REPEATED"
MODE_SET = set([NULLABLE, REQUIRED, REPEATED])
def check_mode(value, expected_mode):
if value is None:
return expected... | {
"content_hash": "1259794563f225eaac824f2ae65b3ff0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 76,
"avg_line_length": 24.61111111111111,
"alnum_prop": 0.6817155756207675,
"repo_name": "Khan/tinyquery",
"id": "d025f8ea0a9e3acea249b70a1fd43eb0f62c53e3",
"size": "443",
... |
"""Fix incompatible renames
Fixes:
* sys.maxint -> sys.maxsize
"""
# Author: Christian Heimes
# based on Collin Winter's fix_import
# Local imports
from .. import fixer_base
from ..fixer_util import Name, attr_chain
MAPPING = {"sys": {"maxint" : "maxsize"},
}
LOOKUP = {}
def alternates(... | {
"content_hash": "28a3837a9dbfd0eeb1cbf813373b851b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 81,
"avg_line_length": 32.78260869565217,
"alnum_prop": 0.5278514588859416,
"repo_name": "babyliynfg/cross",
"id": "ca7e059a91619d693ca46c4a5c0890a673ecdcad",
"size": "2262... |
import os
import h5py
import numpy as np
import fabio
import glob
import sys
from .types import dataType
from ..utils.listtools import move
class alignDest(object):
"""Interface for storing Elastix alignment results (list of image stacks)."""
def __init__(self, dest, names, extension, stackdim=None, overwri... | {
"content_hash": "f8f33276a63424a95c7806c7c695f15c",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 88,
"avg_line_length": 36.78902953586498,
"alnum_prop": 0.5463929349696066,
"repo_name": "woutdenolf/spectrocrunch",
"id": "5a99adefc764286e0019b7e4319e9aae9105065c",
"siz... |
import uuid
from .model import Node, PrivateLink
from framework.mongo.utils import from_mongo
from modularodm import Q
from modularodm.exceptions import ValidationValueError
from website.exceptions import NodeStateError
from website.util.sanitize import strip_html
def show_diff(seqm):
"""Unify operations between ... | {
"content_hash": "eb86dc111fcf264144814c962cebd2ba",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 99,
"avg_line_length": 25.945054945054945,
"alnum_prop": 0.6283354510800508,
"repo_name": "SSJohns/osf.io",
"id": "f2687c1a60b5aabb063be4612f6a369083bf9b4a",
"size": "4746... |
"""Module to convert from Ibis expression to SQL string."""
import base64
import datetime
import ibis
from ibis.backends.base.sql import compiler
try:
import ibis.common.exceptions as com
except ImportError:
import ibis.common as com
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import... | {
"content_hash": "65b56ea88ac59d6a634732feb4cbb22d",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 97,
"avg_line_length": 31.814035087719297,
"alnum_prop": 0.64530715782508,
"repo_name": "ibis-project/ibis-bigquery",
"id": "662b62a894d6a3e90db22d65045db4eaa7ff9609",
"si... |
"""Auto-generated file, do not edit by hand. YT metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_YT = PhoneMetadata(id='YT', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{1,2}', possible_number_pattern='\\... | {
"content_hash": "80f5529a17cf509b5a6be647c2dff549",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 150,
"avg_line_length": 68.41666666666667,
"alnum_prop": 0.7235079171741778,
"repo_name": "vicky2135/lucious",
"id": "60fdea480ca2bdccdf38b74dc3164909243970d0",
"size": "82... |
from msrest.serialization import Model
class JobUpdateParameter(Model):
"""The set of changes to be made to a job.
:param priority: The priority of the job. Priority values can range from
-1000 to 1000, with -1000 being the lowest priority and 1000 being the
highest priority. If omitted, it is set ... | {
"content_hash": "26c6723121a3cf66f11c0521e455b542",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 110,
"avg_line_length": 48.63636363636363,
"alnum_prop": 0.6915887850467289,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "9a139738ed8243340d33c09e4ec88b76db57c8e7",
"s... |
from os import environ
from setuptools import Extension, find_packages, setup
# Opt-in to building the C extension by setting the
# ENABLE_DJB_HASH_CEXT environment variable
if environ.get('ENABLE_DJB_HASH_CEXT'):
ext_modules = [
Extension('cdblib._djb_hash', sources=['cdblib/_djb_hash.c']),
]
else:
... | {
"content_hash": "18f38054fe7c8ba1a65aa474b23e5d8f",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 27.923076923076923,
"alnum_prop": 0.6519742883379247,
"repo_name": "pombredanne/python-pure-cdb",
"id": "a14eed720316069ef8bc7e29034e7f5144267801",
"... |
""" Data Dictionary CSV Validator
@author: Victor Meyerson
"""
import os
import csv
# Header columns for data dictionary
FIELD_NAME = "Variable / Field Name"
FORM = "Form Name"
FIELD_TYPE = "Field Type"
FIELD_LABEL = "Field Label"
CHOICES = "Choices, Calculations, OR Slider Labels"
TEXT_TYPE = "Text Validation Type ... | {
"content_hash": "f8f6eb6ed6e16b8f366959e95194a9a8",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 78,
"avg_line_length": 32.327354260089685,
"alnum_prop": 0.5334997919267582,
"repo_name": "victorSRI/redcap_rdf",
"id": "0e6d920c6e4dc7ae78f0a34bdf745384ccaf3cb3",
"size":... |
"""
Module providing the :class:`TemplatePlugin` and
:class:`IncludePlugin` classes.
"""
from circular.template.tpl import _compile, register_plugin
from circular.template.expression import parse
from circular.template.context import Context
from .tag import TagPlugin
class TemplateLoader:
"""
T... | {
"content_hash": "78c268cffa4d397c5196d49f378b78f1",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 90,
"avg_line_length": 30.259541984732824,
"alnum_prop": 0.5890514631685166,
"repo_name": "jonathanverner/circular",
"id": "122629c20834c45b7b598c76f5e5d45eb409025c",
"siz... |
import webapp2
class MapRedirectPage(webapp2.RequestHandler):
def get(self):
self.redirect('/m/', permanent=True)
app = webapp2.WSGIApplication(
[('/m', MapRedirectPage)])
| {
"content_hash": "b608a679c6e77cd22d55017c015bfee9",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 46,
"avg_line_length": 23.75,
"alnum_prop": 0.6894736842105263,
"repo_name": "yamasa/imakoko-iphone",
"id": "b18ad298b4ba6cfe790688b6f9a600f33b899f1a",
"size": "236",
"bin... |
STORAGE = 'thumbor.storages.mysql_storage'
MYSQL_STORAGE_SERVER_HOST = 'localhost'
MYSQL_STORAGE_SERVER_PORT = 3306
MYSQL_STORAGE_SERVER_DB = 'thumbor_tests'
MYSQL_STORAGE_SERVER_USER = 'root'
MYSQL_STORAGE_SERVER_PASSWORD = ''
MYSQL_STORAGE_SERVER_TABLE = 'images'
| {
"content_hash": "9ded325e8bc4dde0cd0f850c94dcc74e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 33.375,
"alnum_prop": 0.7640449438202247,
"repo_name": "figarocms/thumbor",
"id": "dfc59ef6171d8b6d032ab82b1fa1805b44004d85",
"size": "518",
"binary... |
import os
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderGenerateConfig(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["generate_config", "--help-all"])
def test_generate_config(self):
"""Is the config file pr... | {
"content_hash": "274cc7d0eb27d97c4b80a551fae3db16",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 64,
"avg_line_length": 28,
"alnum_prop": 0.6333333333333333,
"repo_name": "jupyter/nbgrader",
"id": "2753256e2928828384af931d2d3c4500e82d1da0",
"size": "840",
"binary": f... |
from pycket import values
from rpython.rlib import jit
class W_CType(values.W_Object):
errorname = "ctype"
_attrs_ = []
def __init__(self):
raise NotImplementedError("abstract base class")
def basetype(self):
raise NotImplementedError("abstract base class")
def scheme_to_c... | {
"content_hash": "bd4946f2b2c323c9042ed9773df880d5",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 64,
"avg_line_length": 23.36521739130435,
"alnum_prop": 0.5831782657238556,
"repo_name": "pycket/pycket",
"id": "e776969f0361c97f639ffe2ce62d13af3fbbbbb7",
"size": "2735",... |
from iscclib.meta import MetaID
from elasticsearch import Elasticsearch
from elasticsearch import helpers
es = Elasticsearch()
def action_generator(id_bits, shinglesize):
for data in helpers.scan(
es, index="iscc_meta_data", query={"query": {"match_all": {}}}
):
mid = MetaID.from_meta(
... | {
"content_hash": "65ec40921e13b739bad8cff21472f7ec",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 88,
"avg_line_length": 29.8125,
"alnum_prop": 0.5555555555555556,
"repo_name": "coblo/isccbench",
"id": "80f394ac46958718e724262c95cfb3d826015d3c",
"size": "1455",
"binar... |
from django import forms
import bleach
from core.models import FinetoothUser
class CommentForm(forms.Form):
content = forms.CharField(
label="", widget=forms.Textarea(attrs={'rows': 6})
)
def clean_content(self) -> str:
return bleach.clean(self.cleaned_data.get('content'))
class Signup... | {
"content_hash": "2d7732e654590838deec3bc5568dc926",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 28.93548387096774,
"alnum_prop": 0.6577480490523969,
"repo_name": "zackmdavis/Finetooth",
"id": "ddb14699c9761d02f778079a52d2d68a2f2192cf",
"size": "... |
import _plotly_utils.basevalidators
class VisibleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="visible", parent_name="layout.scene.annotation", **kwargs
):
super(VisibleValidator, self).__init__(
plotly_name=plotly_name,
pare... | {
"content_hash": "a0bed46bb08a82629f788657e44cbef1",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 84,
"avg_line_length": 33.714285714285715,
"alnum_prop": 0.5995762711864406,
"repo_name": "plotly/python-api",
"id": "078b08361a6a9e3f17ff9853d94e0179127c5d4f",
"size": "47... |
from __future__ import absolute_import
from collections import Mapping, MutableMapping
from celery.app.utils import Settings, bugreport
from celery.tests.case import AppCase, Mock
class TestSettings(AppCase):
"""
Tests of celery.app.utils.Settings
"""
def test_is_mapping(self):
"""Settings ... | {
"content_hash": "73be89b38b8789c4d71696fabcc87e8f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 26.7,
"alnum_prop": 0.6903870162297129,
"repo_name": "sivaprakashniet/push_pull",
"id": "dc7e3811042bbae3502eb818d4e3edd5abdfb650",
"size": "801",
... |
from avatar.app import app
app_wsgi = app.wsgifunc()
| {
"content_hash": "6010ec13bf6a0cf7f11d46c579f6906f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 26,
"avg_line_length": 18,
"alnum_prop": 0.7407407407407407,
"repo_name": "mozillazg/random-avatar",
"id": "4399da4bc47bbc4cd9f4ddd224b2bfa2f193630a",
"size": "101",
"bina... |
from aiohttp import web
from .views import index, game
def setup_routes(app: web.Application):
app.router.add_get('/', index)
app.router.add_get('/games', game.index, name='games')
| {
"content_hash": "8b86063db69479b084d156cc18f9ac6b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 24,
"alnum_prop": 0.6927083333333334,
"repo_name": "aaront/puckdb",
"id": "57d56e7f4ef24d1ccf2e6adf3d9f6a265de21bbc",
"size": "192",
"binary": false... |
"""Checks if stability of an object moved backwards."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from gwv import schema
from gwv import validator
from nwv.validators import stability_validator
class StabilityValidatorTest(validator.... | {
"content_hash": "c151002f28d426eb92afa2e04f662ec9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 68,
"avg_line_length": 35.21951219512195,
"alnum_prop": 0.7195290858725761,
"repo_name": "openweave/openweave-wdlc",
"id": "0d9fd1211de0ee587c7b6e71ea0834e5565679cc",
"size... |
"""Support for tasks, coroutines and the scheduler."""
__all__ = ['Task',
'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',
'wait', 'wait_for', 'as_completed', 'sleep', 'async',
'gather', 'shield', 'ensure_future', 'run_coroutine_threadsafe',
]
import concurrent.future... | {
"content_hash": "17deb143fbcc48778ca89e6e44dc2bec",
"timestamp": "",
"source": "github",
"line_count": 739,
"max_line_length": 80,
"avg_line_length": 34.631935047361296,
"alnum_prop": 0.5876606884695034,
"repo_name": "MalloyPower/parsing-python",
"id": "35c945c4368e457e3159919839dff5f0aaaa5623",
"... |
from __future__ import unicode_literals
import mock
import pytest
import pypi_cli as pypi
@pytest.mark.usefixtures('mock_api')
class TestStat:
def test_missing_package_arg(self, runner):
result = runner.invoke(pypi.cli, ['stat'])
assert result.exit_code > 0
def test_with_package(self, runner... | {
"content_hash": "57213f05dd63337d165f5333835c9ad0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 112,
"avg_line_length": 36.05555555555556,
"alnum_prop": 0.6540832049306625,
"repo_name": "alex/pypi-cli",
"id": "aa15218f47b968c58d4cf1fd8ef470c5e6e6551c",
"size": "2620",... |
"""使用用户名加密API Key"""
import sys
import getpass
from itertools import cycle
__all__ = ['encrypt', 'decrypt']
if sys.version_info.major == 2:
from base64 import encodestring, decodestring
def encrypt(s):
"""
(py2) encrypt with xor cycle username
:param s: str
:return: str
... | {
"content_hash": "f885fa678a43ededcc06edd598949f4e",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 116,
"avg_line_length": 29.75438596491228,
"alnum_prop": 0.4492924528301887,
"repo_name": "hellflame/qiniu_manager",
"id": "7476e692727dbc5835faa8d71c580b9b22974f10",
"size... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from binascii import a2b_hex, b2a_hex
from hashlib import sha256
from struct import pack
def check_array_result(object_array, to_match, expected):
"""
Pass in array of JSON objects, a dictionary with key/value pa... | {
"content_hash": "8ab620de7f70e1a65ad178927b7ad509",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 237,
"avg_line_length": 34.56497175141243,
"alnum_prop": 0.5845047401111474,
"repo_name": "marlengit/hardfork_prototype_1_mvf-bu",
"id": "d487212b74619b7b689a4e76044f9ebac8b... |
'''
exception.py
changelog
2013-12-07[12:46:58]:created
custom defined exceptions and errors
@info yinyong,osx-x64,UTF-8,192.168.1.104,py,/Users/yinyong/work/ursa2/src
@author yanni4night@gmail.com
@version 0.0.1
@since 0.0.1
'''
class ConfigurationError(Exception):
'''
ConfigurationError
'''
... | {
"content_hash": "95dff7fc99fe7375318046b28167d904",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 75,
"avg_line_length": 18.934782608695652,
"alnum_prop": 0.6061997703788748,
"repo_name": "yanni4night/ursa2",
"id": "537a43d4fe43a9399ab553ded8801388631a2faa",
"size": "91... |
import horizon
from horizon.dashboards.syspanel import dashboard
class Services(horizon.Panel):
name = "Services"
slug = 'services'
dashboard.Syspanel.register(Services)
| {
"content_hash": "ac10391c1dad58fd1e754ac4503a4efc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 18.2,
"alnum_prop": 0.7637362637362637,
"repo_name": "citrix-openstack/horizon",
"id": "7a17f8de8a2a69fc150beeadc02163c16360d989",
"size": "991",
"... |
from django.shortcuts import render
from django.http import Http404
from .models import Recipe
def index(request):
latest_recipe_list = Recipe.objects.order_by('-date_published')[:5]
context = {
'latest_recipe_list': latest_recipe_list
}
return render(request, 'recipes/index.html', context)
... | {
"content_hash": "af37711ff1cc2284145aa6aafba45b5b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 29.88,
"alnum_prop": 0.7054886211512718,
"repo_name": "thjwhite/personal_website",
"id": "fa897fd40a3968bb97ff881ae7007aa5588bb92a",
"size": "747",
... |
"""
#;+
#; NAME:
#; io (used to be readwrite)
#; Version 1.0
#;
#; PURPOSE:
#; Module for read/write of Spectra
#; 07-Sep-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, division, unicode_literals
# ... | {
"content_hash": "dd16b5d4a9a7dab85e519d607eeb6207",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 117,
"avg_line_length": 31.942028985507246,
"alnum_prop": 0.5331215970961888,
"repo_name": "astronomeara/xastropy-old",
"id": "184a1c94e35a225f05615bbbf7d9d93177e6505e",
"... |
"""Adds guards against function calls with side effects.
Only standalone calls are guarded.
WARNING: This mechanism is incomplete. Particularly, it only guards the
arguments passed to functions, and does not account for indirectly modified
state.
Example:
y = tf.layers.dense(x) # Creates TF variable 'foo'
... | {
"content_hash": "bb744dd44867e4fa633dc55e02846076",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 80,
"avg_line_length": 36.42603550295858,
"alnum_prop": 0.6453866146848602,
"repo_name": "alshedivat/tensorflow",
"id": "910c470f9786c1d5a293becbbdfbd9544549b293",
"size":... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'IntranetProfile', fields ['user']
db.delete_unique(u'intranet_intranetprofile', ['user_id'])
... | {
"content_hash": "3012b5c431553a3dba2b1f54b529a055",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 246,
"avg_line_length": 75.28191489361703,
"alnum_prop": 0.5630608351586236,
"repo_name": "fatihzkaratana/intranet",
"id": "4d6a4518e886a0b162334e04ad05d3e61a557237",
"siz... |
import subprocess
from datetime import datetime, timedelta
from i3pystatus import IntervalModule
from i3pystatus.core.desktop import DesktopNotification
STOPPED = 0
RUNNING = 1
BREAK = 2
class Pomodoro(IntervalModule):
"""
This plugin shows Pomodoro timer.
Left click starts/restarts timer.
Right c... | {
"content_hash": "db91abc287857e7d645e29f7c00546cf",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 89,
"avg_line_length": 32.56363636363636,
"alnum_prop": 0.5555555555555556,
"repo_name": "richese/i3pystatus",
"id": "6ea0692a3199e815c70eed4fa11fab06ddaf86b6",
"size": "3... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myrig.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "2185df963899fa1e4e5ffa4e5b224dff",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7079646017699115,
"repo_name": "nathan-osman/myrig-website",
"id": "5ca6f39eabd35e7ac457061e09463f8d676ba585",
"siz... |
import array
from collections import defaultdict
import glob
import operator
import os
import time
import sys
import pprint
from io import BytesIO
from gi.repository import Gtk
import cairo
import essedit5
class IdTreeIter(Gtk.TreeIter):
def __init__(self):
Gtk.TreeIter.__init__(self)
self.lists... | {
"content_hash": "44daef944ad2ea07940e952e96494ea8",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 96,
"avg_line_length": 34.013333333333335,
"alnum_prop": 0.5903567228537828,
"repo_name": "bjowi/essedit",
"id": "f8ddbda2d13897c56b34bb33946e0597cf12f66d",
"size": "5121"... |
"""Volume interface (v2 extension)."""
import six
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from cinderclient import base
SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('id', 'status', 'size', 'availability_zone', 'name',
'bootable', 'c... | {
"content_hash": "82491bd18c226205761e5e32bbd3322e",
"timestamp": "",
"source": "github",
"line_count": 510,
"max_line_length": 79,
"avg_line_length": 36.9078431372549,
"alnum_prop": 0.5611220315571376,
"repo_name": "hybrid-storage-dev/cinder-client-fs-111t-hybrid-cherry",
"id": "52ba263cd9142a4003b0... |
from __future__ import annotations
import sys
import pytest
from airflow import models
from airflow.cli import cli_parser
from airflow.executors import celery_executor, celery_kubernetes_executor
from tests.test_utils.config import conf_vars
# Create custom executors here because conftest is imported first
custom_e... | {
"content_hash": "f1444ea711df541af23b7ab9ede61ea5",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 96,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.7598463016330451,
"repo_name": "apache/airflow",
"id": "0a0e2ec5cb99ad2090edd1e83dd15b13a4b6602f",
"size": "1828"... |
from datetime import datetime
from dateutil.tz import tzutc
import dateutil.parser
import re
import json
from mtools.util.pattern import json2pattern
class DateTimeEncoder(json.JSONEncoder):
""" custom datetime encoder for json output. """
def default(self, obj):
if isinstance(obj, datetime):
... | {
"content_hash": "138f283f8f6941b0716dbecd9885a5a7",
"timestamp": "",
"source": "github",
"line_count": 820,
"max_line_length": 188,
"avg_line_length": 35.11707317073171,
"alnum_prop": 0.5525767467703848,
"repo_name": "aerrami/mtools",
"id": "ba74788402044fd41d6d2d258ecf25ed31419241",
"size": "2879... |
from oslo.config import cfg
from nova.compute import api as compute_api
from nova.compute import manager as compute_manager
import nova.context
from nova import db
from nova import exception
from nova.network import api as network_api
from nova.network import manager as network_manager
from nova.network import model a... | {
"content_hash": "fa59c85f4fb80a830a33880635f379d0",
"timestamp": "",
"source": "github",
"line_count": 486,
"max_line_length": 79,
"avg_line_length": 34.51440329218107,
"alnum_prop": 0.5596756885656373,
"repo_name": "imsplitbit/nova",
"id": "ebf78a82dde58a0c36729483844ca7940586e8d0",
"size": "1741... |
from __future__ import print_function
import os
import boto
from sos.sosreport import SoSReport
s3 = boto.connect_s3()
def get_bucket():
return s3.create_bucket(os.environ['S3S_BUCKET'])
def get_key():
return boto.s3.key.Key(get_bucket())
if __name__ == '__main__':
# Grab an S3 key before running sosr... | {
"content_hash": "66702ddb66e5b144ce2aa3e79f8d225a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 53,
"avg_line_length": 21.9375,
"alnum_prop": 0.6695156695156695,
"repo_name": "shawnsi/s3s",
"id": "af6b0248681e6630d50248c8f214a8fe52c47ccb",
"size": "725",
"binary": f... |
"""
Cells RPC Communication Driver
"""
import urllib
import urlparse
from oslo.config import cfg
from nova.cells import driver
from nova.openstack.common import rpc
from nova.openstack.common.rpc import dispatcher as rpc_dispatcher
from nova.openstack.common.rpc import proxy as rpc_proxy
cell_rpc_driver_opts = [
... | {
"content_hash": "05e7df752476319dd4b5729e933e549a",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 79,
"avg_line_length": 36.70065789473684,
"alnum_prop": 0.631173254459084,
"repo_name": "shootstar/novatest",
"id": "274611ad41298eb90c4b853a3da61037a847ccd2",
"size": "11... |
import sys
import signal
try:
import StringIO as io
except ImportError:
import io as io
sys.displayhook = lambda x: None
def intHandler(signum, frame): # Set the signal handler
print ("Paragraph interrupted")
raise KeyboardInterrupt()
signal.signal(signal.SIGINT, intHandler)
def help():
print... | {
"content_hash": "21d6853ed052f8c3e9a709cf0d98b857",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 33.41573033707865,
"alnum_prop": 0.6106254203093476,
"repo_name": "nikste/incubator-zeppelin",
"id": "ee199f4710c669ec99db1ddf504c9639c8b3ff90",
"siz... |
__author__ = 'BisharaKorkor'
import numpy as np
from math import exp, pow, sqrt, pi, fmod
def movingaverage(a, w):
""" An array b of length len(a)-w is returned where b_n = (a_n + a_n-1 + ... + a_n-w)/w """
return [np.mean(a[i:i+w]) for i in range(len(a)-w)]
def gaussiankernel(sigma, width):
"""Generates... | {
"content_hash": "82fe727125b7f647dc3fdb40025568f6",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 111,
"avg_line_length": 31.28235294117647,
"alnum_prop": 0.6126363294471606,
"repo_name": "BishKor/pyboon",
"id": "ae48e50cc24b11bfc5c9253f284783bf37628ce2",
"size": "2659"... |
from random import randint
from ..quest import Quest
from ..quest_segment import QuestSegment
from utils.command_set import CommandSet
GOLD_REWARD = 190
GOLD_PENALTY = 315
GOLD_REWARD_BIG = 240
GOLD_PENALTY_SMALL = 75
GOLD_PENALTY_WAIT = 150
GOLD_VARIANCE = 22
EXP_REWARD = 2
class Archer(Quest):
def __init__(s... | {
"content_hash": "77ead8dcd0eff406e468bd97bf6a8c87",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 118,
"avg_line_length": 43.21348314606742,
"alnum_prop": 0.5972438897555902,
"repo_name": "Xelaadryth/Xelabot",
"id": "0b9e95d25532c925f28f5fee8edb9dd252b68f60",
"size": "3... |
import sys
import os
import shlex
# 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('.'))
sys.p... | {
"content_hash": "bd6f061fff3f7af2559b14b7eee314ca",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 80,
"avg_line_length": 31.792717086834735,
"alnum_prop": 0.7063436123348018,
"repo_name": "cwhite1026/Py2PAC",
"id": "1ba6df07755e7fe3f394370f4e0d92cf1e42583d",
"size": "1... |
import argparse
import logging
import sys
from mwm.decode_id import decode_id
from mwm.dump_mwm import dump_mwm
from mwm.find_feature import find_and_print_features
from mwm.ft2osm import ft2osm
from mwm.mwm_feature_compare import compare_mwm
logger = logging.getLogger("mwm")
logger.setLevel(logging.ERROR)
class Mw... | {
"content_hash": "0812cee9f0ae6aa0e105e9c80428d89a",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 85,
"avg_line_length": 34.1865671641791,
"alnum_prop": 0.5728006985374372,
"repo_name": "mapsme/omim",
"id": "81f4e79846daae2d87ccfa8bd4f8811a56cbdd6a",
"size": "4581",
... |
from ..pdf_infos import PDFInfos
from ..pdf_renderer import renderAllPages
from ..decomposer import decompose_pages
pdfFilename = "../testtalks/FATE_Motivation.pdf"
sizePX = (1024, 768)
infos = PDFInfos.create(pdfFilename)
pages = list(renderAllPages(pdfFilename, sizePX = sizePX,
pageCoun... | {
"content_hash": "5c9cd4a101a50708a4a5be1352068fc5",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 78,
"avg_line_length": 29.728571428571428,
"alnum_prop": 0.67611725132148,
"repo_name": "hmeine/pdfdecanter",
"id": "8ee8c72111d3abed7d95cbd8836a237b692f1be8",
"size": "208... |
import rope.base.exceptions
import rope.base.pyobjects
from rope.base import libutils
from rope.base import taskhandle, evaluate
from rope.base.change import (ChangeSet, ChangeContents)
from rope.refactor import rename, occurrences, sourceutils, importutils
class IntroduceFactory(object):
def __init__(self, proj... | {
"content_hash": "dc84506e3d0a7f3c97310ad1bb603544",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 78,
"avg_line_length": 45.837037037037035,
"alnum_prop": 0.5871040723981901,
"repo_name": "ruchee/vimrc",
"id": "bbaf347e9bb9e856b3efdd190055d32cc601f3cd",
"size": "6188",... |
import sys
import numpy
import matplotlib.pyplot
def analyse (filename, outfile=None):
data = numpy.loadtxt(fname=filename, delimiter=',')
# Create a wide figure to hold the subplots
fig = matplotlib.pyplot.figure (figsize=(10.0, 3.0))
# create placeholders for plots
subplot1 = fig.add_subplo... | {
"content_hash": "9ba97c702a3d57010b926febcb5c90e8",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 121,
"avg_line_length": 26.8,
"alnum_prop": 0.6368159203980099,
"repo_name": "adwood92/sc-python-bristol",
"id": "ecfa97b7ec505ef037d1eb87f75982dfbf143a8e",
"size": "1626",... |
import pytex
import unittest
import logging
open('test.log', mode='w').close()
logging.basicConfig(filename='test.log',
level=logging.DEBUG,
format='%(asctime)s\t-%(message)s')
logging.info('Start Test Sequence\n')
class TestPyTeX(unittest.TestCase):
'''
Unittest for P... | {
"content_hash": "84796bfc798b642500ccbfcce7a29ca0",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 94,
"avg_line_length": 54.05464480874317,
"alnum_prop": 0.3831378892033967,
"repo_name": "willzfarmer/PyTeX",
"id": "65e726f2731fbd65306df41952e82604d4e10cb0",
"size": "99... |
"""
=================
Plot multiple EMD
=================
Shows how to compute multiple EMD and Sinkhorn with two differnt
ground metrics and plot their values for diffeent distributions.
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import numpy as np
import matplotlib.pylab as pl
im... | {
"content_hash": "d5aac0800a119ee10411c62ac6cd86fd",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 23.564356435643564,
"alnum_prop": 0.5521008403361345,
"repo_name": "aje/POT",
"id": "73b42c34fb3f4cd70a56d829fc317e998f5a1e15",
"size": "2404",
"b... |
from box.box import Box
class ConfigBox(Box):
"""
Modified box object to add object transforms.
Allows for build in transforms like:
cns = ConfigBox(my_bool='yes', my_int='5', my_list='5,4,3,3,2')
cns.bool('my_bool') # True
cns.int('my_int') # 5
cns.list('my_list', mod=lambda x: int(x))... | {
"content_hash": "c531955185554197496f66cf2dfd178a",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 103,
"avg_line_length": 29.325581395348838,
"alnum_prop": 0.5482421358710019,
"repo_name": "cdgriffith/Box",
"id": "0d42b3b7fc20f799d25c445b68f662a1ada98f24",
"size": "383... |
'''Tool for filtering a csv file where each row corresponds to data for a protein mutant.
There are four filter types possible -
Positions: Match entries based on residue indexes;
Mutations: Match entries based on mutations e.g. 46L.;
Substitutions: Match entries based on substitutions e.g. ALA,GLY.;
GroupSubs: Match ... | {
"content_hash": "c16a0cccd9b60b3cf5da864f053eeadd",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 108,
"avg_line_length": 37.609375,
"alnum_prop": 0.6830078936435396,
"repo_name": "dmnfarrell/peat",
"id": "31cbbbd78090418696791651b18876990ba49945",
"size": "5787",
"b... |
"""Utilities for generating and updating index.yaml."""
import os
import logging
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import datastore_admin
from google.appengine.api import yaml_errors
from google.appengine.datastore import datastore_index
import yaml
AUTO_MARKER = '\n# AU... | {
"content_hash": "79e6eb72c7987f733bacf461eda6bb29",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 99,
"avg_line_length": 31.869230769230768,
"alnum_prop": 0.6634081583393676,
"repo_name": "jamslevy/gsoc",
"id": "d69f6568dae00daee9c07b95cf74c22c03195aac",
"size": "8888"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.