text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from unittest.mock import Mock
from airflow.models import TaskInstance
from airflow.ti_deps.deps.dag_ti_slots_available_dep import DagTISlotsAvailableDep
class TestDagTISlotsAvailableDep(unittest.TestCase):
def test_concurrency_reached(self):
"""
Test max_active_tasks reached shou... | {
"content_hash": "71e05c94fff1dbbecc974300ca71a4aa",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 83,
"avg_line_length": 34.407407407407405,
"alnum_prop": 0.682454251883746,
"repo_name": "apache/incubator-airflow",
"id": "9ae6a1daafa9bcc9d93f88afc35cdc6ab7abef7e",
"size... |
from PySide import QtCore, QtGui
class Ui_About(object):
def setupUi(self, About):
About.setObjectName("About")
About.setWindowModality(QtCore.Qt.ApplicationModal)
About.resize(480, 560)
About.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
Abo... | {
"content_hash": "681aceccd487fc254ef14ef209ac646e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 166,
"avg_line_length": 59.333333333333336,
"alnum_prop": 0.713664371148967,
"repo_name": "noembryo/KoHighlights",
"id": "aa167941b4cff5bd1b92630b58755326d370b949",
"size":... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from . import config
__version__ = config.VERSION
# Module API
from .cli import cli
from .stream import Stream
from .loader import Loader
from .parser import Parser
fro... | {
"content_hash": "41a5673e11f6a59ff6f75eab93bae19a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 42,
"avg_line_length": 25.79310344827586,
"alnum_prop": 0.8114973262032086,
"repo_name": "okfn/tabulator-py",
"id": "b3eb112917ac0b95570f450ffaae559a5a2281ab",
"size": "772... |
from django.conf import settings
from django.contrib import admin
#from django.utils.safestring import mark_safe
#from django.utils.translation import ugettext_lazy as _
from cablegate.cable.models import Cable, CableMetadata
class CableMetadataInline(admin.StackedInline):
model = CableMetadata
class CableAdmin... | {
"content_hash": "7be08bd5dc2e2ae6b89d6e77bb59e45b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 70,
"avg_line_length": 30.608695652173914,
"alnum_prop": 0.7599431818181818,
"repo_name": "h3/django-cablegate",
"id": "774202cd06d5d828ea0e735eb39db7ee16fc6bfd",
"size": "... |
import time
import datetime
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from list import ListView
from detail import DetailView
class DateView(ListView):
"""
Abstract base class for date-based views.
"""
def __init__(self, **kwarg... | {
"content_hash": "bd65e225ce7200197b0c1ec8ce64b3ce",
"timestamp": "",
"source": "github",
"line_count": 546,
"max_line_length": 97,
"avg_line_length": 35.010989010989015,
"alnum_prop": 0.5929587779870266,
"repo_name": "livni/old-OK",
"id": "2ab00ec53de25aa82a1368792b3bd822e47ae4ae",
"size": "19116"... |
"""Gradient checker for any ops, graphs.
The gradient checker verifies numerically that an op/graph properly
computes the gradients
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import numpy as np
from tensorflow.py... | {
"content_hash": "7ab5d609c80db12206b9d37213400093",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 80,
"avg_line_length": 37.733333333333334,
"alnum_prop": 0.6727291623363126,
"repo_name": "MemeticParadigm/TensorFlow",
"id": "1adf22d512588d56787550cc607014e99c766ce0",
"... |
"""
Created on Thu Dec 29 20:19:25 2016
@author: simon
"""# This is the implement of Fig 4
"""Anchor vectors in LeNet-5 for the MNIST dataset change during training:"""
###########
# Note: this part is drawing paraments from LeNet-5.
import numpy as np
from sklearn import preprocessing
from matplotlib import pyplot ... | {
"content_hash": "0999718bde5d09a56921a6c7b9fecaa9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 95,
"avg_line_length": 30.773333333333333,
"alnum_prop": 0.6304159445407279,
"repo_name": "XinDongol/RECOS",
"id": "4b256f5c7178d64ffbcb8f55fbb6632977f78441",
"size": "2355... |
import socket
UDP_IP = "10.27.15.13" #ip of phone, use ifconfog in terminal
UDP_PORT = 1337
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
def move(x,y):
data = str(x)+","+str(y)
try:
soc... | {
"content_hash": "b4766ffb997a4984e6f9169fbb15e97d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 22.352941176470587,
"alnum_prop": 0.5947368421052631,
"repo_name": "helloworldC2/VirtualRobot",
"id": "b84a1c0ed6c8c3c5fe7156d92a78635d01ff4d98",
"si... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Page'
db.create_table(u'main_page', (
('id', self.gf('uuidfield.fields.UUIDField')(unique=True, max_leng... | {
"content_hash": "f90f43c2fd9222a6662e36b7817cab43",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 187,
"avg_line_length": 81.09685863874346,
"alnum_prop": 0.5894961102682462,
"repo_name": "reverie/jotleaf.com",
"id": "e69052fbdff6b67c20671e53b3de4612b1dca6ae",
"size": ... |
import Gaffer
import GafferImage
import GafferUI
import imath
Gaffer.Metadata.registerNode(
GafferImage.CopyViews,
"description",
"""
Copies views from the secondary input images onto the primary input image.
Only works with multi-view images.
""",
plugs = {
"views" : [
"description",
"""
The na... | {
"content_hash": "9193088fcebc82a2ac8677959f867cc4",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 14.516129032258064,
"alnum_prop": 0.6866666666666666,
"repo_name": "andrewkaufman/gaffer",
"id": "743bc467391872743a4c120876c947b4c15d3009",
"size": ... |
'''
Interactive Brokers的gateway接入,已经替换为vn.ib封装。
注意事项:
1. ib api只能获取和操作当前连接后下的单,并且每次重启程序后,之前下的单子收不到
2. ib api的成交也只会推送当前连接后的成交
3. ib api的持仓和账户更新可以订阅成主推模式,因此qryAccount和qryPosition就用不到了
4. 目前只支持股票和期货交易,ib api里期权合约的确定是基于Contract对象的多个字段,比较复杂暂时没做
5. 海外市场的交易规则和国内有很多细节上的不同,所以一些字段类型的映射可能不合理,如果发现问题欢迎指出
'''
import os
import json... | {
"content_hash": "5c0494a1567da04d9b64979741b3f6f3",
"timestamp": "",
"source": "github",
"line_count": 734,
"max_line_length": 166,
"avg_line_length": 35.775204359673026,
"alnum_prop": 0.4749990479454663,
"repo_name": "ujfjhz/vnpy",
"id": "a5edf45a75a8605cf5eef5bd6f812fdb40bb12dc",
"size": "28036"... |
import pytest
from pytest_bdd import (
scenarios,
then,
when,
)
from . import browsersteps
pytestmark = [
pytest.mark.bdd,
pytest.mark.usefixtures('workbook', 'admin_user'),
]
scenarios(
'title.feature',
'generics.feature',
'create_gene_disease.feature',
'curation_central.feature',... | {
"content_hash": "909e19833b8e81d7de8052d2a94b8b7e",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 84,
"avg_line_length": 26.794871794871796,
"alnum_prop": 0.6947368421052632,
"repo_name": "philiptzou/clincoded",
"id": "ce83e14c1de34f273675bfc93a8cd32fed77d39c",
"size": ... |
import os
from wsgiref.simple_server import make_server
from webob import exc
from webob.dec import wsgify
import logging
from yubiauth.core.rest import application as core_rest
from yubiauth.client.rest import application as client_rest
from yubiauth.client.web import application as client_web
from yubiauth.util.stat... | {
"content_hash": "282e62145ab96779b26e8676a07bd26f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 30.56,
"alnum_prop": 0.6393979057591623,
"repo_name": "Yubico/yubiauth-dpkg",
"id": "cf96569d37c7ecbff5ee5796c415d3547444efff",
"size": "2904",
"bi... |
import mock
from oslo_context import context as o_context
from oslo_context import fixture as o_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from nova import context
from nova import exception
from nova import objects
from nova import test
from nova.tests import fixtures as nova_fixtures
class Contex... | {
"content_hash": "15771dbf282777b333123f1ec3f777a2",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 79,
"avg_line_length": 46.12978723404255,
"alnum_prop": 0.5577233522439002,
"repo_name": "gooddata/openstack-nova",
"id": "ac40f9a7cf66997e9e4364cef781d7659200a669",
"size... |
from __future__ import print_function
import unittest
import urllib2
import urllib
import json
import os
class Blah(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp(self):
#self.send_request('/dump', {"yes": True})
self.send_request('/drop', {... | {
"content_hash": "197ac64fc3654c88f66ce4d2a6a9afc5",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 96,
"avg_line_length": 23.40223463687151,
"alnum_prop": 0.6653139174027214,
"repo_name": "qweqq/dwmb",
"id": "23bab4a81e95070158269bfdf8c3a23c7edca843",
"size": "4189",
... |
import os
import sys
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import tempfile
import time
import logging
from tmdb_api import tmdb
from mutagen.mp4 import MP4, MP4Cover
fr... | {
"content_hash": "02596fcae40d0da09f5b8e1b236ce8f5",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 198,
"avg_line_length": 36.77522935779817,
"alnum_prop": 0.5359860296869153,
"repo_name": "Filechaser/sickbeard_mp4_automator",
"id": "77461c1343ef88d13cafcf3d31c7103b521b23... |
__all__ = ['volume_blueprint']
import os
import sys
import json
import uuid
import random
from datetime import datetime, timedelta
# dateutil
from dateutil.parser import parse as dtparse
# flask
from flask import (
Flask, request, session, g,
redirect, url_for, abort,
render_template, flash, jsonify,
... | {
"content_hash": "26434a6b338a891f232fc634b78275c6",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 79,
"avg_line_length": 26.511627906976745,
"alnum_prop": 0.606516290726817,
"repo_name": "mtasic85/dockyard",
"id": "e9cc0fd13c90adbc03c015c8e94578a59581192b",
"size": "80... |
import argparse
import os
import ssh_facade.logging
import ssh_facade.utils
__all__ = ['parameters']
@ssh_facade.utils.memoize
def parameters():
parser = argparse.ArgumentParser(description='SSH-Facade')
parser.add_argument(
'-i', '--identity', required=False,
help='Path to identity file.')... | {
"content_hash": "d687705ba0dcc77f49ce1680c9a56473",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 83,
"avg_line_length": 23.85,
"alnum_prop": 0.660377358490566,
"repo_name": "rremizov/ssh-facade",
"id": "4085f3eb46443f70f69b0a23f59935abcbc0fa40",
"size": "954",
"binar... |
"""empty message
Revision ID: 406b874c9e9f
Revises: 09893098abbe
Create Date: 2017-09-14 23:53:38.438189
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '406b874c9e9f'
down_revision = '09893098abbe'
branch_labels = None
depends_on = None
def upgrade():
# ... | {
"content_hash": "f96a35c1de219e1e7c431ffdef89599b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 24.035714285714285,
"alnum_prop": 0.6894502228826151,
"repo_name": "ahoarfrost/metaseek",
"id": "97bce6ae17dd33f8560763c2cff7c60e52bfd623",
"size": "... |
"""Identity v2 Service Catalog action implementations"""
import logging
from cliff import columns as cliff_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from openstackclient.i18n import _
LOG = logging.getLogger(__name__)
class EndpointsColumn(cliff_columns.... | {
"content_hash": "b92f576fd5f71fe121eebb18d12ac27c",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 74,
"avg_line_length": 31.12087912087912,
"alnum_prop": 0.5526129943502824,
"repo_name": "openstack/python-openstackclient",
"id": "05d0e9aebc55f746b14f34efa4ab6256f6b9a24b",... |
"""
Contains integration tests for the `api` app.
"""
from datetime import datetime
from pytz import utc
import pytest
from django.contrib.auth.models import User
from utils.test_helpers import solr_test_profiles as tp
# FIXTURES AND TEST DATA
# ---------------------------------------------------------------------
... | {
"content_hash": "fc7cb28113bfcb1f9203b19e88ab4508",
"timestamp": "",
"source": "github",
"line_count": 2327,
"max_line_length": 88,
"avg_line_length": 49.38332617103567,
"alnum_prop": 0.5044859243788887,
"repo_name": "unt-libraries/catalog-api",
"id": "28d4973b045d2e0a0ca3f5968d80f8cc68225b60",
"s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb
import pwndbg.decorators
import pwndbg.events
import pwndbg.gdbutils
import pwndbg.memoize
from pwndbg.color import disable_colors
from pwndbg.color import me... | {
"content_hash": "a0906047a89581f899b9df411ccd1753",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 115,
"avg_line_length": 28.205882352941178,
"alnum_prop": 0.6856100104275287,
"repo_name": "0xddaa/pwndbg",
"id": "7645310abe1968b1e29b6f113b31192b2c84b4de",
"size": "1964"... |
'''
This example shows how to define a custom function.
The function must return two values, the timestamp in microseconds
and the signal value. The function documentation is used to define
a label or name for the signal.
'''
import numpy
def myFunction(msg):
'''velocity magnitude'''
return msg.utime, numpy... | {
"content_hash": "22579e7f0497e6795c4933e192cff6b5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 67,
"avg_line_length": 24.1875,
"alnum_prop": 0.751937984496124,
"repo_name": "openhumanoids/signal-scope",
"id": "614122b6390fcb22c741634a61297f12b03aeb1f",
"size": "387",... |
from .base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': project_path('src', 'apnea', 'db.sqlite3'),
}
}
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
COMPRESS_ENABLED = True
TEMPLATE_LOADERS = (
... | {
"content_hash": "88d6c172f51cc9e1c0e8f02cbb6d70d7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 65,
"avg_line_length": 22.625,
"alnum_prop": 0.6837016574585635,
"repo_name": "GotlingSystem/apnea",
"id": "953424cc6f2a710c5f0060736171e36738e5e337",
"size": "724",
"bin... |
import socket
import subprocess
import sys
import time
from airflow import configuration, LoggingMixin
NEED_KRB181_WORKAROUND = None
log = LoggingMixin().log
def renew_from_kt():
# The config is specified in seconds. But we ask for that same amount in
# minutes to give ourselves a large renewal buffer.
... | {
"content_hash": "c14d5ecefa3849c0b9874a727c8a901c",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 93,
"avg_line_length": 38.958333333333336,
"alnum_prop": 0.6005347593582888,
"repo_name": "yati-sagade/incubator-airflow",
"id": "55566a0c16344d2e4b6f35a3f509b38ecf4bbe25",
... |
from ansible.runner.return_data import ReturnData
class ActionModule(object):
def __init__(self, runner):
self.runner = runner
def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs):
''' transfer the given module name, plus the async module, then run it '''
... | {
"content_hash": "87df532f439bdb3d011e96de9ee078cf",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 143,
"avg_line_length": 38.74193548387097,
"alnum_prop": 0.6286427976686095,
"repo_name": "marcusramberg/dotfiles",
"id": "dc53d6fa6cb49095340e9c760241e9cdbb29532a",
"size"... |
from unittest import mock
import unittest
from pydoof.search_api.search import query, suggest
from pydoof.search_api.search import QueryNames, SearchFilterExecution
class TestSearch(unittest.TestCase):
@mock.patch('pydoof.search_api.search.SearchAPIClient')
def test_minimum_requirements_query(self, APIClie... | {
"content_hash": "9ba3c00f70296b22e0f5af7339b462ae",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 111,
"avg_line_length": 39,
"alnum_prop": 0.4960552268244576,
"repo_name": "doofinder/pydoof",
"id": "7d70333c5fb08b990f293f2f2cc25e7bffee3601",
"size": "3042",
"binary":... |
import datasource, datepicker, dropdownlist, grid
import themeroller
# TS does currently not expose our imports, so we redeclare, explicitly:
# for clients to be able to call e.g. pykendo.DataSource(...)
class Grid(grid.Grid) : pass
class DataSource(datasource.DataSource) : pass
class DatePi... | {
"content_hash": "1d78d11aa1cb9d2e76d663b2c203a24b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 72,
"avg_line_length": 29.13888888888889,
"alnum_prop": 0.6625357483317446,
"repo_name": "axiros/misc_transcrypt",
"id": "62792f0a29a3bea55112ba3f5de74cfd39dd45a0",
"size":... |
import argparse
import rauth
import pandas as pd
import ast
import csv
import json
import pprint
import sys
import urllib
import urllib2
import time
import oauth2
import collections
from itertools import izip
def flatten(d, parent_key='', sep='_'):
items = []
for k, v in d.items():
new_key = parent_key... | {
"content_hash": "04b5b3bab9b893bafedb559a2aa87349",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 202,
"avg_line_length": 37.30275229357798,
"alnum_prop": 0.6625676340383669,
"repo_name": "vjadon/Front-End-workspace",
"id": "14c579c3e571b9962ce6cdbb609839a4c76a92d9",
"... |
"""UWUM (Unified WeGovNow User Management) provider for django-allauth."""
from os import path
from setuptools import setup, find_packages
name = 'django-allauth-uwum'
version = __import__('allauth_uwum').__version__
repository = path.join('https://github.com/ExCiteS', name)
setup(
name=name,
version=versio... | {
"content_hash": "4da9a11c2bd848a17f9206596faa0707",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 74,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.6410496719775071,
"repo_name": "ExCiteS/django-allauth-uwum",
"id": "140ad3b3368a7ce01f8d655369f310dba8e0ecfa",
"... |
import httplib,urllib
import random
import time
import datetime
from threading import Thread
def get_url():
switch_dict={
0:'hadoop',
1:'spark',
2:'apple',
3:'hello',
4:'mapreduce',
5:'java',
6:'python',
7:'PHP',
8:'Perl',
9:'Bash'
}
i = int((random.random() * 100) % 10)
url = 'http://localhost... | {
"content_hash": "f43735db5f459f1a2ea98ecb83c4249a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 57,
"avg_line_length": 18.96153846153846,
"alnum_prop": 0.6561866125760649,
"repo_name": "tianqichongzhen/ProgramPrac",
"id": "d1ddd03f4a17274d93886f9ffe80f8b81b3c6474",
"s... |
import string
def ignore_punctuation_spaces_case(text):
return "".join(i.lower() for i in text if i in string.ascii_letters)
def reverse(text):
return text[::-1]
def is_palindrome(text):
text = ignore_punctuation_spaces_case(text)
return text == reverse(text)
something = raw_input("Enter text: ")
if... | {
"content_hash": "e73edd495ec6e87edf150304c51efcea",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 25.11764705882353,
"alnum_prop": 0.6908665105386417,
"repo_name": "pezy/python_test",
"id": "84c8a7106e3d249e3a71642c577663490a600ce5",
"size": "551"... |
from stromx import runtime
import unittest
class ExceptionsTest(unittest.TestCase):
def setUp(self):
stream = runtime.Stream()
counter = stream.addOperator(runtime.Counter())
dump = stream.addOperator(runtime.Dump())
stream.initializeOperator(counter)
stream.initializeOperator(dump)
... | {
"content_hash": "4d238910247dbdad3873a713b1eba8a6",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 63,
"avg_line_length": 24.924242424242426,
"alnum_prop": 0.5148936170212766,
"repo_name": "uboot/stromx",
"id": "6695991ab2895f00e47606cf5d2676fda0694c2e",
"size": "1670",
... |
from weboob.core.modules import ModuleLoadError
from weboob.exceptions import BrowserIncorrectPassword
from connector import Connector
import sys
def EnsurePrint(wat):
try:
print wat
return wat
except:
wat = unicode(wat).encode('utf-8')
print wat
class BaseBankHandler(object)... | {
"content_hash": "52d7be08d0bff96fc4bb9dc798cf2915",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 27.813186813186814,
"alnum_prop": 0.6108257605689451,
"repo_name": "frankrousseau/kresus",
"id": "42f658a5c9991887549051ae898f99d39d8ef93e",
"size": ... |
"""
===============================================================================
Original code copyright (C) 2009-2022 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in co... | {
"content_hash": "f44306269624b21d1c55fbe2032638b5",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 79,
"avg_line_length": 28.985294117647058,
"alnum_prop": 0.5819381024860477,
"repo_name": "RudolfCardinal/pythonlib",
"id": "7e8a7752148e2d1ccdecfcab2a0c6816371d2d02",
"siz... |
from pants.base.exceptions import TaskError
from pants.base.build_environment import get_scm
from pants.task.task import Task
from pants.base.workunit import WorkUnit, WorkUnitLabel
from pants.util.contextutil import temporary_dir
import os
import stat
import subprocess
import logging
import pystache
from kubernetes... | {
"content_hash": "0d1ccd0b2188c2bd8db0080d8a4d8fcd",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 123,
"avg_line_length": 33.64772727272727,
"alnum_prop": 0.7041540020263425,
"repo_name": "toddgardner/pants-plugins",
"id": "d8ebd7604c67f378bd4173f9f805ef3b977d13c9",
"si... |
from hwt.hdl.constants import DIRECTION
from hwt.interfaces.std import Signal, VectSignal
from hwt.math import log2ceil
from hwt.synthesizer.interface import Interface
from hwt.synthesizer.param import Param
class LocalLink(Interface):
"""
Stream with "byte enable" and "start/end of frame/packet"
.. hwt-... | {
"content_hash": "6071f2e8e6f67d2499d280d3acf24453",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 61,
"avg_line_length": 28.5,
"alnum_prop": 0.6464237516869096,
"repo_name": "Nic30/hwtLib",
"id": "4dc01c2b2cb5975a67b710c5aee2ccdffd4e39c7",
"size": "741",
"binary": fal... |
'''Test the taq.processing module'''
import pytest
from pytest import mark
@mark.xfail
def test_split_chunks():
raise NotImplementedError
if __name__ == '__main__':
pytest.main("test_processing.py")
| {
"content_hash": "09b6a3accbd5d6015f0c67e4b414d12f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 37,
"avg_line_length": 17.583333333333332,
"alnum_prop": 0.6872037914691943,
"repo_name": "dlab-projects/python-taq",
"id": "84f1d2ee5b0c274358953104255bec1493961dcc",
"siz... |
from django import template
register = template.Library()
@register.inclusion_tag("curator/widget_block_head.html")
def widget_tag_head(widget, fullscreen=0):
#widget_data, time_intervals = widget.data_list()
return {
'widget': widget,
'model_name': widget.get_model_display(),
... | {
"content_hash": "4aa37819dd26bac8ead9e8772e866e1e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 57,
"avg_line_length": 26.863636363636363,
"alnum_prop": 0.6142131979695431,
"repo_name": "spulec/django-curator",
"id": "290f1ed841715a4ae261459f99d4d2e62acc6b1c",
"size":... |
from django.shortcuts import render
from django.http import HttpResponse
from symptom_tracker.models import SymptomEntry, Symptom
def index(request):
symptoms = SymptomEntry.objects.all()
data = {}
data['symptoms'] = symptoms
return render(request, 'index.html', data)
def add_symptom_entry(request)... | {
"content_hash": "85f720ef59d0a6e22b62b1bd04cf4b5a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 71,
"avg_line_length": 23.790697674418606,
"alnum_prop": 0.6881720430107527,
"repo_name": "sbelskie/symplicity",
"id": "9792383abe26de72c2d9412e23c420621b4dda8a",
"size": "... |
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtWidgets import QApplication
from sakia.models.generic_tree import GenericTreeModel
from sakia.data.processors import ContactsProcessor
from duniterpy.documents.crc_pubkey import CRCPubkey
class NavigationModel(QObject):
"""
The model of Navigation comp... | {
"content_hash": "230e368ebd2197ebfa7398da7ac18491",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 104,
"avg_line_length": 37.10612244897959,
"alnum_prop": 0.5318446815531844,
"repo_name": "ucoin-io/cutecoin",
"id": "d77cfcd046355b6007fddfca0737811c8ee24ae8",
"size": "9... |
"""
WSGI config for Cookie Cutter Demo project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | {
"content_hash": "3343c514f4a6740e0405aa04333e289f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 47.72222222222222,
"alnum_prop": 0.7904540162980209,
"repo_name": "geoanalytic/gpstracker",
"id": "c31dda999fb070c6cfeda2822937cc600924ac8f",
"size":... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "3873cc2dd7d89c4dbb99644d0853c47c",
"timestamp": "",
"source": "github",
"line_count": 834,
"max_line_length": 411,
"avg_line_length": 40.31175059952039,
"alnum_prop": 0.5825698988697204,
"repo_name": "napalm-automation/napalm-yang",
"id": "a926f1e506f66f4803a0a2f3a841571f9a73f1b0",
... |
"""
test solver using examples
"""
import json
import solver
import unittest
def get_status(source):
""" run program and get status
"""
with open(source, 'r') as ofile:
source = ofile.read()
res = solver.solve(source)
json_res = json.loads(res)
return json_res["result"]
de... | {
"content_hash": "55ad31a5ba3d6c2f1b39899cdd27a5cd",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 86,
"avg_line_length": 44.63636363636363,
"alnum_prop": 0.7072301425661914,
"repo_name": "uwdb/Cosette",
"id": "065ca49b549a41f33608911a95e5797c93e7c8fa",
"size": "1964",
... |
import urlparse
from urlparse import urlsplit
from coherence.extern.et import parse_xml as et_parse_xml
from coherence import SERVER_ID
from twisted.web import server, http, static
from twisted.web import client, error
from twisted.web import proxy, resource, server
from twisted.internet import reactor,protocol,def... | {
"content_hash": "fc815043b49786d2b36f33519f00f547",
"timestamp": "",
"source": "github",
"line_count": 916,
"max_line_length": 104,
"avg_line_length": 33.2467248908297,
"alnum_prop": 0.570302751691075,
"repo_name": "palfrey/coherence",
"id": "7df68746ed00f8b9692fa7d6b0b40e6f166b2fa6",
"size": "306... |
from .ast import *
class NodeFactory(object):
"""
Encapsulates abstract syntax tree node creation.
"""
def is_valid_left_hand_side(self, expression):
return isinstance(expression, Node) and expression.is_valid_left_hand_side()
#
# Statements
#
def create_block(self, statement... | {
"content_hash": "adf38b79f11f02b22db45562d1971472",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 85,
"avg_line_length": 30.90449438202247,
"alnum_prop": 0.6953281221596074,
"repo_name": "jeffkistler/BigRig",
"id": "cbfb91344146274d3b024f3007e36f5051effef4",
"size": "5... |
"""This module is deprecated. Please use `airflow.providers.http.operators.http`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.http.operators.http import SimpleHttpOperator # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.http.operators.http`.",
De... | {
"content_hash": "281bcba2ff05e4a4973c57e063ea73f9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 85,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.7625698324022346,
"repo_name": "airbnb/airflow",
"id": "34e938144f009937a408a3038aec2445330e89e4",
"size": "1145"... |
import json
import os
import sys
from pyjavaproperties import Properties
def main():
if len(sys.argv) == 1:
sys.exit('Usage: {0} <file.properties>'.format(sys.argv[0]))
if not os.path.exists(sys.argv[1]):
sys.exit('Error: {0} does not exist !'.format(sys.argv[1]))
p = Properties()
p... | {
"content_hash": "d63bd61bbd2afe5586cc594ec75d7af6",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 106,
"avg_line_length": 38.28431372549019,
"alnum_prop": 0.4937259923175416,
"repo_name": "mraad/spark-csv-es",
"id": "ba6942c3973a08f990ea53720dc9fb9a3b702d42",
"size": "... |
"""
Listen to realtime robot data
Vers:20140307
Input:
listen (in) [Generic Data] - True to listen to robot
datatype (in, optional) [Generic Data] - Data to listen to e.g. "actual_joints_pos", "tool_pose"
id (in) [Generic Data] - Robot ID: 1/2/3
Returns:
out [Text] - The execution information, as output a... | {
"content_hash": "c95a140a589acbaa9913e8122c84d0b6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 125,
"avg_line_length": 37.06666666666667,
"alnum_prop": 0.6357913669064749,
"repo_name": "tclim/your",
"id": "faeefddd5152d7398794ff0b08661b884bff9330",
"size": "1112",
... |
import pickle
import unittest
from geopy.location import Location
from geopy.point import Point
GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017"
GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773"
GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0)
GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR)
GRAND_CENT... | {
"content_hash": "d85d200541d7d699e3090ef84363c010",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 75,
"avg_line_length": 37.13636363636363,
"alnum_prop": 0.6264789881680947,
"repo_name": "geopy/geopy",
"id": "bd2b2c927ca5ac75e78dba2e038d16c634297145",
"size": "4902",
... |
import sys
import RPi.GPIO as io, time, os
io.setmode(io.BCM)
pin_number = 17
def RCtime (RCpin):
reading = 0
io.setup(RCpin, io.OUT)
io.output(RCpin, io.LOW)
time.sleep(0.1)
io.setup(RCpin, io.IN)
while (io.input(RCpin) == io.LOW):
reading += 1
... | {
"content_hash": "71d36a4b2319a28599ae6029121182b0",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 49,
"avg_line_length": 20.285714285714285,
"alnum_prop": 0.5610328638497653,
"repo_name": "kelvien/japri",
"id": "0397e67ad0c73c1e313203513b24f777adae6b5e",
"size": "448",
... |
from django.db import migrations, models
import django.db.models.deletion
import tests.testapp.models
import wagtail.core.blocks
import wagtail.core.fields
import wagtailmedia.blocks
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0059_apply_collection_ordering"),
("wagta... | {
"content_hash": "2f83e040a534b2b5c63bfebc4e8e87d8",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 84,
"avg_line_length": 35.55844155844156,
"alnum_prop": 0.36303871439006574,
"repo_name": "torchbox/wagtailmedia",
"id": "48999d957998c54e54808f5b142588e7659d70af",
"size":... |
import signal
import sys
import ssl
import logging
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer, SimpleSSLWebSocketServer
from optparse import OptionParser
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
class SimpleEcho(WebSocket):
def handleMessage(self):
... | {
"content_hash": "f2c6737748edc8775e6f1c58024ec30d",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 123,
"avg_line_length": 33.96590909090909,
"alnum_prop": 0.6022080963532954,
"repo_name": "CursosWeb/X-Nav-5.7.16-WebSocket-Chat",
"id": "5eebe6cddc36aa33646c66699e6a574f7e01... |
from itertools import chain
import requests
from nalaf.structures.data import Document, Part
from nalaf.utils.cache import Cacheable
from xml.etree import ElementTree as ET
class DownloadArticle(Cacheable):
"""
A utility generator that for a given iterable of PMIDs generates Document objects
created by ... | {
"content_hash": "e3ea4720186c63303fcf377644894ee6",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 110,
"avg_line_length": 39.7,
"alnum_prop": 0.5428211586901763,
"repo_name": "Rostlab/nalaf",
"id": "e312bd31c00447890b417be34f81ff3292dd3aec",
"size": "2382",
"binary": ... |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:9988")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| {
"content_hash": "39fe9ee12d6e8692577746d3a7d49c9d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 46,
"avg_line_length": 39.5,
"alnum_prop": 0.759493670886076,
"repo_name": "execoin/execoin",
"id": "3135b196a6ce4919ef457f480855b428ca316b8a",
"size": "158",
"binary": fa... |
import sys
DEBUG = False
class Logger:
def __init__(self, output=True):
self.indent = 0
self.output = output
self.lines = []
def quite(self):
self.output = False
def loud(self):
self.output = True
def write(self, text):
text = ' '*self.indent + text
... | {
"content_hash": "97b64cbe8bd64933835c4d3c6e08cc94",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 37,
"avg_line_length": 18.24,
"alnum_prop": 0.5504385964912281,
"repo_name": "jaredly/codetalker",
"id": "3ce4304864e426993e2370bb9d32ded0ad1d2965",
"size": "479",
"binar... |
"""
This module provides classes used to define a non-periodic molecule and a
periodic structure.
"""
from __future__ import annotations
import collections
import functools
import itertools
import json
import math
import os
import random
import re
import warnings
from abc import ABCMeta, abstractmethod
from fnmatch i... | {
"content_hash": "223c5d6a43983216c1fc82d908aa348c",
"timestamp": "",
"source": "github",
"line_count": 4396,
"max_line_length": 120,
"avg_line_length": 40.10122838944495,
"alnum_prop": 0.5568142496525512,
"repo_name": "gVallverdu/pymatgen",
"id": "add0ed4b268a0d79c8a1526eea87d5e53a44f772",
"size":... |
"""Module for working with regions of interest.
This module contains the :class:`jicimagelib.region.Region` class,
which can be used to represent regions of interest.
One can use the
:func:`jicimagelib.region.Region.select_from_array` class method
to select a region from a numeric array.
>>> im = np.array([
... ... | {
"content_hash": "2457e2bfae1ca33cca44bf33c5da7ed1",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 79,
"avg_line_length": 30.829545454545453,
"alnum_prop": 0.5888315517876889,
"repo_name": "JIC-CSB/jicimagelib",
"id": "a2e7b16db5bc1043bd71b8dc3fa70b3145f0b1fa",
"size": ... |
class Solution(object):
def dfs(self, node, left):
if node is None:
return 0
if node.left is None and node.right is None and left:
return node.val
ret = 0
if node.left is not None:
ret += self.dfs(node.left, True)
if node.right is not None:
ret += self.dfs(node.right, False)
return ret
def ... | {
"content_hash": "af5ec838a8977cfe110ada3e660c65ec",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 55,
"avg_line_length": 21.4,
"alnum_prop": 0.6542056074766355,
"repo_name": "xingjian-f/Leetcode-solution",
"id": "ed258c664959b0401fbaa56646cd4446e21a4a92",
"size": "599",... |
"""
Routes for pyramid_pages
"""
from sqlalchemy import or_
from pyramid.events import BeforeRender
from pyramid.location import lineage
from pyramid.httpexceptions import HTTPNotFound
from . import CONFIG_MODELS, CONFIG_DBSESSION
from .security import HOME_PAGE, PREFIX_PAGE
from .resources import (
BasePageResour... | {
"content_hash": "55b4618249aa8ab95aa9086d7318187e",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 79,
"avg_line_length": 32.28666666666667,
"alnum_prop": 0.6029320669006814,
"repo_name": "ITCase/pyramid_pages",
"id": "044c3225917badd41ca01990734702f0468df45b",
"size": ... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "qipr_approver.settings")
from django.core.management import execute_from_command_line
import django
django.setup()
from approver.signals.bridge.all_signals import disconnect_signals
if sys.argv[... | {
"content_hash": "b19cae24ca7ef1f0ded052ed991db625",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 31.29032258064516,
"alnum_prop": 0.668041237113402,
"repo_name": "DevMattM/qipr_approver",
"id": "00ee1d92c103ea982e3e199914b825f8e45de433",
"size": ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import Counter
import logging
import numpy
from six import text_type, string_types
logger = logging.getLogger()
class Vocabulary(object):
"""Class that holds a vocabulary for the dataset... | {
"content_hash": "5733438c1bd3fd11fe110d5281585d4f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 87,
"avg_line_length": 33.08496732026144,
"alnum_prop": 0.5331884630580798,
"repo_name": "tombosc/dict_based_learning",
"id": "f5a43b16537780477e679300a867035715befcab",
"... |
"""Base classes for channels."""
from __future__ import annotations
import asyncio
from enum import Enum
from functools import partialmethod, wraps
import logging
from typing import TYPE_CHECKING, Any, TypedDict
import zigpy.exceptions
import zigpy.zcl
from zigpy.zcl.foundation import (
CommandSchema,
Configu... | {
"content_hash": "0f37a118666a580bfe5f54a098a97c7f",
"timestamp": "",
"source": "github",
"line_count": 575,
"max_line_length": 88,
"avg_line_length": 33.84347826086957,
"alnum_prop": 0.5539568345323741,
"repo_name": "nkgilley/home-assistant",
"id": "ae5980cd63063ff431695e25f732784b4a1ff6bb",
"size... |
from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import Us... | {
"content_hash": "2ada3ae6f3a56b225b029fba40c4dde3",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 92,
"avg_line_length": 30.71153846153846,
"alnum_prop": 0.5892298058860364,
"repo_name": "kou/zulip",
"id": "886a1f143982825c388aa95bed11fb7caeafc5ba",
"size": "3194",
"... |
import sys
try:
str_type = basestring
str_is_unicode = False
except NameError:
str_type = str
str_is_unicode = True
try:
unichr = unichr
except NameError:
unichr = chr
if str_is_unicode:
def native_str(s, errors=None):
return s
else:
def native_str(s, errors=None):
ret... | {
"content_hash": "00dd7c249df06c98dd1824777f5e7d1a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 38,
"avg_line_length": 16.64,
"alnum_prop": 0.6225961538461539,
"repo_name": "dittos/graphqllib",
"id": "54fce3d42370c32f86292d9de4a667886714884c",
"size": "416",
"binary... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sys
import time
import random
import tempfile
import subprocess
import shutil
import argparse
# params overwrite priority:
# for default:
# default_params < {blackbox,whitebox}_default_params < args
# for sim... | {
"content_hash": "3cd17e7475dbfac815e42e662c71fa6c",
"timestamp": "",
"source": "github",
"line_count": 536,
"max_line_length": 105,
"avg_line_length": 39.27238805970149,
"alnum_prop": 0.5914964370546318,
"repo_name": "TeamSPoon/logicmoo_workspace",
"id": "630b96b041c420ec9836bfd03b2f0211e72d1acf",
... |
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('.'))
cwd = os.getcwd()
paren... | {
"content_hash": "9359c8dab0364e42b7f89612afa45888",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 80,
"avg_line_length": 31.966804979253112,
"alnum_prop": 0.7034008307372793,
"repo_name": "photocrowd/dj-stripe",
"id": "8aff80ac7235638bf1a7e66b27d5fcc704fb8276",
"size":... |
import logging
import httplib as http
import math
from itertools import islice
from flask import request
from modularodm import Q
from modularodm.exceptions import ModularOdmException, ValidationValueError
from framework import status
from framework.utils import iso8601format
from framework.mongo import StoredObject
... | {
"content_hash": "53fd9312381f40bf4d186ab323237ef0",
"timestamp": "",
"source": "github",
"line_count": 1436,
"max_line_length": 133,
"avg_line_length": 31.28899721448468,
"alnum_prop": 0.6028354588146269,
"repo_name": "billyhunt/osf.io",
"id": "3bf6f4a81035470ad7bc805fe6bd4c9d3bd08897",
"size": "4... |
from pymatgen.util.testing import PymatgenTest
import unittest
import os
import warnings
from pymatgen.analysis.solar.slme import optics, slme
class SolarTest(PymatgenTest):
_multiprocess_shared_ = True
def setUp(self):
warnings.simplefilter("ignore")
def tearDown(self):
warnings.simplef... | {
"content_hash": "cfaee72e23788fd3efbd47314a91c6ab",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 27.384615384615383,
"alnum_prop": 0.6699438202247191,
"repo_name": "mbkumar/pymatgen",
"id": "4e9b5396920af6b3a405fbff9035dc9090072ea3",
"size": "712... |
from django.contrib import messages
from django.core.exceptions import (
ObjectDoesNotExist, MultipleObjectsReturned, PermissionDenied)
from django.core.urlresolvers import reverse
from oscar.core.loading import get_model
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_... | {
"content_hash": "26a057f1d338f51e9f1d33ac5c1897c8",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 79,
"avg_line_length": 36.55727554179567,
"alnum_prop": 0.6236449864498645,
"repo_name": "MrReN/django-oscar",
"id": "06fbd529829fd92bb05aeb939e26f140e0ec3200",
"size": "1... |
from wtforms import Form, TextAreaField, StringField, BooleanField, validators
class NLUForm(Form):
text = TextAreaField('text', default='', validators=[
validators.DataRequired("Text is required field")
])
entities = BooleanField('Extract entities', default=False)
keywords = BooleanField('Ext... | {
"content_hash": "879a347c131a254e741f767488cc1fdd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 44.63636363636363,
"alnum_prop": 0.7372708757637475,
"repo_name": "TokhirUmarov/causal-relation-app",
"id": "8363f25b3ac24c9dac8c930e5f664f66b398f16a",... |
"""Python code format's checker.
By default try to follow Guido's style guide :
http://www.python.org/doc/essays/styleguide.html
Some parts of the process_token method is based from The Tab Nanny std module.
"""
import re
import tokenize
if not hasattr(tokenize, 'NL'):
raise ValueError("tokenize.NL doesn't exis... | {
"content_hash": "013c5a6a80d292d6b2b0ad8303a251ee",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 94,
"avg_line_length": 39.429429429429426,
"alnum_prop": 0.538004569687738,
"repo_name": "dbbhattacharya/kitsune",
"id": "751c88affd5961c066c2381316093f2fbed583e8",
"size"... |
import ffvideo
from PIL import ImageEnhance
import math
ORIGIN = (200, 180)
WIDTH = 300
FINAL_SIZE = (112, 80)
PADDED_CHAR_WIDTH = 16 # power of 2 to ensure sectors end at a line boundary
FRAME_DATA_BYTES = PADDED_CHAR_WIDTH * FINAL_SIZE[1]
FRAME_BYTES = 512 * int(math.ceil(FRAME_DATA_BYTES / 512.0))
PADDING_BYTES ... | {
"content_hash": "d21f1f45f236d4e775d4c4509a33244f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 27.024390243902438,
"alnum_prop": 0.6904332129963899,
"repo_name": "gasman/kisskill",
"id": "add9b6e15952deb1e9b81c8abe882dbba32f3493",
"size": "1108... |
__author__ = 'Debanjan Mahata'
import time
from twython import Twython, TwythonError
from pymongo import MongoClient
import TwitterAuthentication as t_auth
def collect_tweets(path_name):
emotion_sentiment_mapping = {"joy":"positive","sadness":"negative","anger":"negative","fear":"negative","disgust":"negative"... | {
"content_hash": "2d72d740978b816059daabff8bece538",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 129,
"avg_line_length": 28.86111111111111,
"alnum_prop": 0.6198267564966313,
"repo_name": "dxmahata/TwitterSentimentAnalysis",
"id": "2323dc194cc66f49a8844cba143a1dcc53736e33... |
import uuid
from decimal import Decimal
from typing import List
import pytest
from measurement.measures import Weight
from prices import Money
from ....app.models import App
from ....plugins.manager import get_plugins_manager
from ....plugins.webhook.plugin import WebhookPlugin
from ....shipping.interface import Ship... | {
"content_hash": "75e1c4c34a44caf840fadc350aaac00e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 85,
"avg_line_length": 31.30666666666667,
"alnum_prop": 0.6026405451448041,
"repo_name": "mociepka/saleor",
"id": "5200b1302d7f6615af1a4f18c7dcf83255adae6a",
"size": "2348"... |
"""
.. _stock_market:
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily... | {
"content_hash": "8a2c9a557f408bc6d0892d7aecb14b5e",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 79,
"avg_line_length": 31.8062015503876,
"alnum_prop": 0.6207652936875457,
"repo_name": "jmargeta/scikit-learn",
"id": "f2f44a2f85be76ab2e322580ddeaea98cd0c7651",
"size": ... |
"""
Tutorial: Creating Visuals
==========================
02. Making physical measurements
--------------------------------
In the last tutorial we created a simple Visual subclass that draws a
rectangle. In this tutorial, we will make two additions:
1. Draw a rectangular border instead of a solid rectangle
... | {
"content_hash": "1ff4d9791ae8c62df7b4bcc9b34bab2f",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 79,
"avg_line_length": 36.481651376146786,
"alnum_prop": 0.6244184584433548,
"repo_name": "Eric89GXL/vispy",
"id": "b6b83dd97452466ed461d0cf7453d3489e90dc87",
"size": "827... |
"""
Importing concepts found at:
GitHub Developer Support
https://github.com/Esri/developer-support/tree/master/python/general-python/update-webmap-json
https://developers.arcgis.com/rest/analysis/api-reference/programmatically-accessing-analysis-services.htm
https://developers.arcgis.com/rest/analysis/api-reference/cr... | {
"content_hash": "21fab9c358a66fc84702a15336788b72",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 151,
"avg_line_length": 41.9452736318408,
"alnum_prop": 0.5789348831692563,
"repo_name": "AkshayHarshe/developer-support",
"id": "46fe5edfc33fcea692d8b43f334d0cbdd4f8aab5",
... |
import logging
import re
from webkitpy.common.checkout.diff_parser import DiffParser
from webkitpy.common.system.executive import Executive
from webkitpy.common.system.filesystem import FileSystem
from webkitpy.common.checkout.scm.detection import SCMDetector
_log = logging.getLogger(__name__)
class PatchReader(ob... | {
"content_hash": "aa37b8baece5d7cc1fd4354ff6ba2ad5",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 94,
"avg_line_length": 39.51923076923077,
"alnum_prop": 0.6009732360097324,
"repo_name": "Samsung/ChromiumGStreamerBackend",
"id": "493b13cf02b97873d3db1d4dd8a37275669e96a6",... |
"""This code example runs a report that with custom fields found in the line
items of an order.
"""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
import tempfile
# Import appropriate modules from the client library.
from googleads import dfp
from googleads import errors
# Set the ID of the order to ... | {
"content_hash": "b1659baa4db102b43eb868017a72f93b",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 77,
"avg_line_length": 29.76923076923077,
"alnum_prop": 0.6640826873385013,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "250975b7809dd1cc7f429937c1d6d3d55d8a6138",... |
import pytest
from qtpy import PYQT5, PYQT6, PYSIDE2
@pytest.mark.skipif(PYQT5 or PYQT6 or PYSIDE2,
reason="Not available by default in PyQt. Not available for PySide2")
def test_qtnetworkauth():
"""Test the qtpy.QtNetworkAuth namespace"""
from qtpy import QtNetworkAuth
assert QtNetwor... | {
"content_hash": "3b7bb2ad5c7af5353561032ddd01cfb4",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 89,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.7700787401574803,
"repo_name": "davvid/qtpy",
"id": "e41a5db1ae884ea66a2e0f9bc2e92af950989dff",
"size": "635",
... |
import argparse
from typing import List
import torch.jit
from parlai.utils.io import PathManager
def test_exported_model(scripted_model_file: str, inputs: List[str]):
with PathManager.open(scripted_model_file, "rb") as f:
scripted_module = torch.jit.load(f)
print('\nGenerating given the scripted m... | {
"content_hash": "878eb3886856fbd1c3b97ac1c50b6c01",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 108,
"avg_line_length": 27.38095238095238,
"alnum_prop": 0.6147826086956522,
"repo_name": "facebookresearch/ParlAI",
"id": "8f19d1286eec1c8bfb4d96aa7616172187a791af",
"size... |
import csv, json, os, sys
# pass the filename as an argument when calling this script
if len(sys.argv) < 2:
sys.exit('Usage: csv-to-json.py /path/to/file.csv')
fileIn = sys.argv[1]
fileOnly = os.path.basename(fileIn)
try:
fileOut = sys.argv[2]
except IndexError:
fileList = [fileOnly.split('.')[0], 'json']
fileOut ... | {
"content_hash": "6e33770bc127d5002ec6fb4acc6ef750",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 22.6,
"alnum_prop": 0.6758849557522124,
"repo_name": "lenwood/csv-json",
"id": "7be0d186d5a60e6d327593233ecf9ddba4545c7c",
"size": "922",
"binary":... |
import logging
from tornado import escape
from odin.adapters.adapter import ApiAdapterResponse, \
request_types, response_types
from odin_data.odin_data_adapter import OdinDataAdapter
class MetaListenerAdapter(OdinDataAdapter):
"""An OdinControl adapter for a MetaListener"""
def __init__(self, **kwarg... | {
"content_hash": "26cdd5abae5d59930cd64350ffef724c",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 99,
"avg_line_length": 39.27894736842105,
"alnum_prop": 0.5921211309125016,
"repo_name": "odin-detector/odin-data",
"id": "449f0398b6339325af518613a7c882d4f4e84fb4",
"size... |
from django.db import migrations
import django.db.models.deletion
import mptt.fields
class Migration(migrations.Migration):
dependencies = [
('stock', '0013_auto_20190908_0916'),
]
operations = [
migrations.AlterField(
model_name='stocklocation',
name='parent',
... | {
"content_hash": "4db5e9d6ea5583c7e7df6284d062dbb7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 167,
"avg_line_length": 27.944444444444443,
"alnum_prop": 0.6520874751491054,
"repo_name": "SchrodingersGat/InvenTree",
"id": "b6f7411e10903fd690f3f04969797cf63e591709",
"s... |
import os
from azure.core.credentials import AccessToken, AzureKeyCredential
from azure.maps.geolocation import MapsGeolocationClient
from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy
from geolocation_preparer import MapsGeolocationPreparer
class TestMapsGeolocationClient(AzureRecordedTestCase):
... | {
"content_hash": "cae57bf6bda445c5f3b0e4fcfd594786",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 111,
"avg_line_length": 42.526315789473685,
"alnum_prop": 0.7524752475247525,
"repo_name": "Azure/azure-sdk-for-python",
"id": "303c940360551ecb81d8dc11012fabdf31ec9717",
"... |
import cStringIO
import logging
import os
import sys
import textwrap
import unittest
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, ROOT_DIR)
import dmprof
from dmprof import FUNCTION_ADDRESS, TYPEINFO_ADDRESS
class SymbolMappingCacheTest(unittest.TestCase):
class MockBu... | {
"content_hash": "bd2948fc459886a0cb0befc1da7ffa04",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 79,
"avg_line_length": 32.55747126436781,
"alnum_prop": 0.6241835834068844,
"repo_name": "nacl-webkit/chrome_deps",
"id": "23eaaa75c1a0fdbebeee5357a8c12387ca7e7a99",
"size... |
import os
import sys
import mock
import pytest
from praw.config import Config
from praw.exceptions import ClientException
class TestConfig(object):
@staticmethod
def _assert_config_read(environment, mock_config):
mock_instance = mock_config.return_value
Config.CONFIG = None # Force config fi... | {
"content_hash": "c2a6a506df3fc73ef389342a009c6a8f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 75,
"avg_line_length": 37.3177570093458,
"alnum_prop": 0.6020535937891309,
"repo_name": "leviroth/praw",
"id": "37b2e730d03d455b8edc61848a5940f14e88b93b",
"size": "3993",
... |
from pyramid.config import Configurator
from pyramid.authorization import ACLAuthorizationPolicy
from .models.sqltraversal import root_factory
from .security import groupfinder
def main(global_config, **settings):
config = Configurator(settings=settings,
root_factory=root_factory)
c... | {
"content_hash": "beb043cadc5f183c524269d2f96adf1c",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.6983783783783784,
"repo_name": "pauleveritt/moonshot",
"id": "e5ce16e306b73cce39c03281ac77857ae3501352",
"size": ... |
from __future__ import unicode_literals
from bs4 import BeautifulSoup
import requests
from .emoji import Emoji
EMOJI_CATEGORIES = ['people', 'nature', 'food-drink', 'activity',
'travel-places', 'objects', 'symbols', 'flags']
'''List of all valid emoji categories
'''
class Emojipedia:
@staticm... | {
"content_hash": "1acaa389141fd43e4789813f353a3120",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 33.10576923076923,
"alnum_prop": 0.5570723206505954,
"repo_name": "benjamincongdon/python-emojipedia",
"id": "5ac9f61f0db86f04d01354d831f2d33b362ba687... |
import sqlalchemy as SA
import core.db as db
from core.mail import MailQueue
from core.requesthandler import RequestHandler
import core.util
class DelayRequestServlet(RequestHandler):
def post(self):
if not self.current_user:
return self.send_error(403)
self.requestid = core.util.get... | {
"content_hash": "b49fed1a0b6a70300c58a238ffdc993b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 129,
"avg_line_length": 35.888888888888886,
"alnum_prop": 0.5193498452012384,
"repo_name": "pombredanne/pushmanager",
"id": "fc96c23145f6f3ec57eaf17841be112f594cc4d3",
"siz... |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import shutil
import tempfile
from os import path
import pytest
from docker.errors import APIError
from six import StringIO
from six import text_type
from .. import mock
from .testcases import DockerClientTestCase
from .testcase... | {
"content_hash": "b49d03bbc0368054acc277fb95d49d46",
"timestamp": "",
"source": "github",
"line_count": 1086,
"max_line_length": 103,
"avg_line_length": 40.79189686924494,
"alnum_prop": 0.6220090293453725,
"repo_name": "andrewgee/compose",
"id": "c1be6813055c978e253600ea24bba0504c0655ad",
"size": "... |
from .grid_plotly import plotly_grid
from .grid_qgrid import qgrid_grid
from .grid_psp import psp_grid
from .grid_phosphor import phosphor_grid
from .grid_ipysheet import ipysheet_grid
from .grid_lineup import lineup_grid
_BACKENDS = ['plotly', 'qgrid', 'psp', 'phosphor', 'ipysheet', 'lineup']
def _backend_to_grid_... | {
"content_hash": "f01c48db043e1957c973c22dd3f098c2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 30,
"alnum_prop": 0.6612903225806451,
"repo_name": "timkpaine/lantern",
"id": "9fd5f06377eec67c4e962eefd8875c9ca81b0326",
"size": "930",
"binary": ... |
from __future__ import unicode_literals
from django.db import models, migrations
import webapp.apps.taxbrain.models
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0090_auto_20150315_0612'),
]
operations = [
migrations.AlterField(
model_name='taxsaveinp... | {
"content_hash": "0cf192e75871544fe8c940205de7b3ab",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 119,
"avg_line_length": 41.142857142857146,
"alnum_prop": 0.6096230158730159,
"repo_name": "PeterDSteinberg/webapp-public",
"id": "59d8991ea9f7c79c4e672d1ca8a1215d8a6b1d94",
... |
import inspect
from librato_python_web.instrumentor.instrument import get_complex_wrapper
from librato_python_web.instrumentor.objproxies import ObjectWrapper
from librato_python_web.instrumentor.base_instrumentor import BaseInstrumentor
class WrappedCursor(ObjectWrapper):
""" Wraps native cursor class to permit... | {
"content_hash": "99cf341add9857bfae1d75a6fc742650",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 103,
"avg_line_length": 34.779411764705884,
"alnum_prop": 0.6536997885835095,
"repo_name": "librato/librato-python-web",
"id": "e18ad93a68e5ecd27e435a1188b317ff490d3c32",
"... |
'''
Calculate the coverage of each genome pair from the blastx results
Starting with the blastx converted to NC/NC ids, we want to calculate
the coverage at each position in every genome.
We will consider all the genomes with the most number of bases in the
phage as the top genomes
'''
import sys
from phage import... | {
"content_hash": "3e34737fb840dd90b4baa17c07cb93d3",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 106,
"avg_line_length": 23.296875,
"alnum_prop": 0.5546613011401744,
"repo_name": "linsalrob/PhageHosts",
"id": "166fae47c729a9129f2bcee0edf071baba415d19",
"size": "1491",
... |
from .error_response import ErrorResponse, ErrorResponseException
from .operation_display import OperationDisplay
from .operation import Operation
from .resource import Resource
from .tags_resource import TagsResource
from .application_insights_component import ApplicationInsightsComponent
from .web_test_geolocation im... | {
"content_hash": "dc7aca1d71d50fd4e30f3dc59f42e370",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 112,
"avg_line_length": 42.9622641509434,
"alnum_prop": 0.826526130873957,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "8318a9567e80ecb3caa9f15f9b5cf231475e7044",
... |
"""
.. code-block:: javascript
import { Modal } from 'react-native'
A Layer Group can be tagged as **Modal**. The child layers will
constitute the content of the **Modal**.
"""
from .component import Component
from .view import View
from .commons import StyleSheet
from ..props import Props, PropTypes
class Moda... | {
"content_hash": "461a1ae38870a3eac4f1d6ba8df2023a",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 76,
"avg_line_length": 39.610169491525426,
"alnum_prop": 0.6033376123234917,
"repo_name": "ibhubs/sketch-components",
"id": "8649f198cf222c838b6ffecfc564b11b4bc6347b",
"siz... |
from .constants import AGNOCOMPLETE_USER_ATTRIBUTE
class UserContextFormMixin(object):
"""
Form Mixin that passes the user context to its fields.
This property takes the name of the ``AGNOCOMPLETE_USER_ATTRIBUTE``
constant value, to avoid conflicting with any other field property.
This value wil... | {
"content_hash": "7a0d035a1b6349c8abc9b315f98ed861",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 72,
"avg_line_length": 38.55,
"alnum_prop": 0.682230869001297,
"repo_name": "novafloss/django-agnocomplete",
"id": "2a47967611efac887db799ce34adb3b743e8e474",
"size": "771"... |
import bookmark_pyparser as bpp
import os
from optparse import OptionParser
usage="""usage: %prog [options] dir_path1 dir_path2
All html files in the given directories will be assumed to be firefox
bookmark.html files.
If no directory is given then the current directory will be used"""
parser = OptionPars... | {
"content_hash": "163515fc886577afc03d7473070cf76b",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 108,
"avg_line_length": 35.484848484848484,
"alnum_prop": 0.6673783091374893,
"repo_name": "ElderDelp/elisp-collection",
"id": "18bbf5957aa3c9d785d145230f131fd910c68f52",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.