text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests of the climate entity of the balboa integration."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.components.climate.const import (
ATTR_FAN_MODE,
ATTR_HVAC_ACTION,
ATTR_HVAC_MODES,
ATTR_MAX_TEMP,
ATTR_MIN_TEMP,
ATTR_PR... | {
"content_hash": "044bf94d8db932fec6cfad2d8e8ce97c",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 88,
"avg_line_length": 30.4,
"alnum_prop": 0.6822368421052631,
"repo_name": "home-assistant/home-assistant",
"id": "94a5b612f2c242ce360b11dc12718c9ad6251f13",
"size": "760... |
import logging
import warnings
import cherrypy
from cherrypy._cptools import Tool, _getargs
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.exc import SQLAlchemyError
__all__ = ["SQLAlchemySessionTool"]
logger = logging.getLogger(__name__)
class MultiHookPointTool(Tool):
"""MultiHook... | {
"content_hash": "2407fa52591b8fabe1fd4f93f2c5e4a8",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 82,
"avg_line_length": 37.25806451612903,
"alnum_prop": 0.6070995670995671,
"repo_name": "wyuenho/blueberrypy",
"id": "4f58c0789514d8bc1dd476ac5e56e37f890e784b",
"size": "... |
# should re-write compiled functions to take a local and global dict
# as input.
from __future__ import absolute_import, print_function
import sys
import os
from . import ext_tools
from . import catalog
from . import common_info
from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRA... | {
"content_hash": "7534f4e4560c1b982f174064a686385b",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 93,
"avg_line_length": 42.87025948103793,
"alnum_prop": 0.574960424620542,
"repo_name": "juliantaylor/scipy",
"id": "54b1aaaffe199c1d1b4544c92d7ff4ae855af525",
"size": "21... |
"""
This tests VTK's use of Piston's slice operator.
"""
import sys
import vtk
from vtk.test import Testing
from PistonTestCommon import *
def widgetCallBack(obj,event):
global plane, filter
obj.GetPlane(plane)
filter.Update() #TODO: Why is this necessary?
class TestSlice(Testing.vtk... | {
"content_hash": "5dc0128744a04b287e3fa68ad1b26f86",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 67,
"avg_line_length": 28.13,
"alnum_prop": 0.6519729825808745,
"repo_name": "timkrentz/SunTracker",
"id": "2805ae24959a29c093a985e653d4c8a1200491a0",
"size": "2836",
"b... |
import os.path
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running... | {
"content_hash": "102720e3d2ad52672e1f921f62198f3e",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 88,
"avg_line_length": 31.528089887640448,
"alnum_prop": 0.7337847469707769,
"repo_name": "gtsiokos/diogenis",
"id": "6add0cbc84b7acf7ca777b8313b41127e2653295",
"size": "28... |
"""
TransportCoefficients for flow and transport in porous media
.. inheritance-diagram:: proteus.SubsurfaceTransportCoefficients
:parts: 1
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from builtins import zip
from builtins import range
from past.... | {
"content_hash": "a9df32475b607d85542af2fe2865c3e8",
"timestamp": "",
"source": "github",
"line_count": 4859,
"max_line_length": 186,
"avg_line_length": 51.840913768265075,
"alnum_prop": 0.43284701959149646,
"repo_name": "erdc/proteus",
"id": "4b39f8269da1f9d5cae9e8cba57efb7453f7ac24",
"size": "251... |
from __future__ import division
import os
import subprocess
from tempfile import TemporaryFile, NamedTemporaryFile
import wave
import sys
try:
from StringIO import StringIO
except:
from io import StringIO, BytesIO
from .utils import (
_fd_or_path_or_tempfile,
db_to_float,
ratio_to_db,
get_enc... | {
"content_hash": "0b3fc4bcd79e0b5ff39823a2bad3c007",
"timestamp": "",
"source": "github",
"line_count": 703,
"max_line_length": 120,
"avg_line_length": 31.86628733997155,
"alnum_prop": 0.5469600928488528,
"repo_name": "joshuaMarple/phase-vocoder",
"id": "18ba73860987bd821d65466f4064abc095806369",
"... |
from __future__ import absolute_import
import responses
from six.moves.urllib.parse import parse_qs
from sentry.utils import json
from sentry.models import Integration
from sentry.testutils.cases import RuleTestCase
from sentry.integrations.slack import SlackNotifyServiceAction
class SlackNotifyActionTest(RuleTest... | {
"content_hash": "3d04bbe474d51646194eb38b92e5e88a",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 128,
"avg_line_length": 31.510344827586206,
"alnum_prop": 0.5383015977237907,
"repo_name": "beeftornado/sentry",
"id": "78ac9bf7250ca5df3d30d4b2e73171b0c50f120e",
"size": ... |
from decimal import Decimal
from dateutil.parser import parse
LITERAL = {'false': False, 'true': True}
def compatible_bool(value):
"""it's used to reqparser.RequestParser
Example:
>>> from flask_restful import reqparse
>>> parser = reqparse.RequestParser()
>>> parser.ad... | {
"content_hash": "6ed7eef5a52fb4e4fd31c42d72a175ff",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 103,
"avg_line_length": 24.636363636363637,
"alnum_prop": 0.6223862238622386,
"repo_name": "by46/flask-kits",
"id": "ec019aa0b4d1713b0a11b8cb0187ba0e2d7d99b5",
"size": "813... |
def atan2_backward(grad_inputs, inputs, input_shapes, outputs, output_shapes):
"""
Args:
grad_inputs (list of :obj:`nnabla.Variable`): Propagated grads to this backward function.
inputs (list of :obj:`nnabla.Variable` and None): Input Variables of the forward function
if this backward func... | {
"content_hash": "cb1129d70112cdd221edc91466f63db1",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 97,
"avg_line_length": 50.625,
"alnum_prop": 0.6674897119341564,
"repo_name": "sony/nnabla",
"id": "0ef1e1b29a5fefd1a2c71769ee69c2bea0b57272",
"size": "1849",
"binary": f... |
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 field 'Card.price_low'
db.add_column(u'cards_card', 'price_low',
s... | {
"content_hash": "5eb89de524a193c1ea8dd097e1fde2c7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 134,
"avg_line_length": 47.66101694915254,
"alnum_prop": 0.5622332859174964,
"repo_name": "EdSalisbury/mtgstore",
"id": "04d3521d93a2caa22b76b0e142ff19686bc6789c",
"size": ... |
"""
Accessors for related objects.
When a field defines a relation between two models, each model class provides
an attribute to access related instances of the other model class (unless the
reverse accessor has been disabled with related_name='+').
Accessors are implemented as descriptors in order to customize acces... | {
"content_hash": "5711e175528f5582358a9a049ed94b8a",
"timestamp": "",
"source": "github",
"line_count": 1149,
"max_line_length": 119,
"avg_line_length": 44.15839860748477,
"alnum_prop": 0.5757617564744373,
"repo_name": "erikr/django",
"id": "9b693ed19606029d44871da71bccd70390420847",
"size": "50738... |
r"""Worker Script for generating scenes from the Semistatic-KLEVR dataset."""
# pylint: disable=logging-format-interpolation
import collections
import json
import logging
from typing import Dict, List, Optional, Tuple
import kubric as kb
import kubric.renderer.blender
import kubric.simulator.pybullet
import numpy as ... | {
"content_hash": "c72cf6fb45c34d499aa4941d2bf95ed5",
"timestamp": "",
"source": "github",
"line_count": 499,
"max_line_length": 82,
"avg_line_length": 33.86172344689379,
"alnum_prop": 0.6552642480913772,
"repo_name": "google-research/kubric",
"id": "bcf755c34489527f25a3725de63fffa160a1e978",
"size"... |
def __load():
import imp, os, sys
try:
dirname = os.path.dirname(__loader__.archive)
except NameError:
dirname = sys.prefix
path = os.path.join(dirname, 'win32file.pyd')
#print "py2exe extension module", __name__, "->", path
mod = imp.load_dynamic(__name__, path)
## mod.frozen... | {
"content_hash": "a9ad5ea4ccb2761dded7c39f9fbb67f4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 28.75,
"alnum_prop": 0.5826086956521739,
"repo_name": "IronLanguages/ironpython2",
"id": "f43c9727f6ad456119b205849d6c3de4e7e99466",
"size": "346",
... |
"""Functional tests for shape inference helper classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.framework import tensor_shape_pb2
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tes... | {
"content_hash": "941532749ed9a6c847c89bb03486130a",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 94,
"avg_line_length": 45.08849557522124,
"alnum_prop": 0.6652927706902192,
"repo_name": "ninotoshi/tensorflow",
"id": "9aa55e47e3e87c50e7c70ac5d42972dc04056d5f",
"size": ... |
from condensation import flavor as flavors
class Vm(object):
""" This class is representation of OpenStack System"""
def __init__(self, node, vm_id, flavor):
self.vm_id = vm_id
self.node = None
self.flavor = None
if flavor is None:
flavor = flavors.default
... | {
"content_hash": "3d7f65f20ed0dd603ecf5197b65586e9",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 70,
"avg_line_length": 26.3125,
"alnum_prop": 0.5581947743467933,
"repo_name": "archyufa/CloudFerry",
"id": "7acb265a0c8a9fbc7f5e1b7c88f7dcfe2855e7e3",
"size": "1417",
"b... |
import chardet
from itertools import cycle
class Morph():
def __init__(self, surface, base, pos, pos1):
self.surface = surface
self.base = base
self.pos = pos
self.pos1 = pos1
def print_all(self):
return self.surface + "\t" + self.base + ", " + self.pos + ", " + self.po... | {
"content_hash": "00ddd9d588e9d2d78af8eb2d16df21ab",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 83,
"avg_line_length": 25.94871794871795,
"alnum_prop": 0.532608695652174,
"repo_name": "yasutaka/nlp_100",
"id": "ce9d6198831f8d9593e77e4c3439de548f191794",
"size": "1013"... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_sqlfirewallrule_facts
version_added: "2.8"
short_d... | {
"content_hash": "b8129aea751ffd1cf05f2303f07be251",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 144,
"avg_line_length": 28.86764705882353,
"alnum_prop": 0.5545933095601969,
"repo_name": "SergeyCherepanov/ansible",
"id": "be79e642eab07014823bcde8d558f33dca3725c6",
"si... |
from __future__ import absolute_import
from .tracer import Tracer # noqa
| {
"content_hash": "1e420bb8ab7c45b1fe0200e17704775a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 25,
"alnum_prop": 0.7466666666666667,
"repo_name": "nornagon/xray-python-opentracing",
"id": "0ec145b06f3645322fbaea01f63bb218a69b6523",
"size": "75",... |
from swift.common import utils as swift_utils
from swift.common.middleware import acl as swift_acl
from swift.common.swob import HTTPNotFound, HTTPForbidden, HTTPUnauthorized
class KeystoneAuth(object):
"""Swift middleware to Keystone authorization system.
In Swift's proxy-server.conf add this middleware to ... | {
"content_hash": "5bd86e8c38ad9df3009dae588090de51",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 79,
"avg_line_length": 39.552542372881355,
"alnum_prop": 0.598388755570792,
"repo_name": "Triv90/SwiftUml",
"id": "8c0b8bfb3161638ede704fc16039905bad61563d",
"size": "1229... |
from pythonds.basic import Deque
def palchecker(aString):
chardeque = Deque()
for ch in aString:
chardeque.addRear(ch)
stillEqual = True
while chardeque.size() > 1 and stillEqual:
first = chardeque.removeFront()
last = chardeque.removeRear()
if first != last:
... | {
"content_hash": "46d88d8c2f567ad68776c48d6853d44a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 46,
"avg_line_length": 22.8125,
"alnum_prop": 0.6301369863013698,
"repo_name": "robin1885/algorithms-exercises-using-python",
"id": "ea8dbf8d2fc0d74219a47417052741a37c52ba70"... |
"""This code example creates new orders. To determine which orders exist, run
get_all_orders.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
sys.path.insert(0, os.pa... | {
"content_hash": "18055d289e039e552b12aeb8dde020ad",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 30.22222222222222,
"alnum_prop": 0.6933823529411764,
"repo_name": "caioserra/apiAdwords",
"id": "f4bed2b8ffb6f619715d4609c051fcaf9c150b81",
"size": "... |
class Line(object):
def __init__(self, start, end, width, layer):
self.start = start
self.end = end
self.width = width
self.layer = layer
class Rectangle(object):
def __init__(self, topleft, bottomright, layer):
self.topleft = topleft
self.bottomright = bottomri... | {
"content_hash": "a37b6d92679f34f18d0258b5234d1bb9",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 56,
"avg_line_length": 24.783783783783782,
"alnum_prop": 0.5823336968375137,
"repo_name": "storborg/pypcb",
"id": "f6a761f8abf13e2df73d2825bf7034c91bdc350d",
"size": "917",... |
try:
from setuptools import setup
except ImportError:
"""
I am still trying to make sense of this ez_setup stuff
commenting it out for now
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
"""
setup(
name='nom',
version='0.1',
url="https://github.com/JamesMcMahon/nom",
lic... | {
"content_hash": "f3b2aa9e076c0ee36e19fc5abfd6941f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 55,
"avg_line_length": 20.40740740740741,
"alnum_prop": 0.6896551724137931,
"repo_name": "JamesMcMahon/nom",
"id": "484b29982149e7ebeee6dc01386696bfe7bd0bf9",
"size": "573"... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import MagicMock
from ansible.template.vars import AnsibleJ2Vars
class TestVars(unittest.TestCase):
def setUp(self):
self.mock_templar = MagicMock(name='mock_t... | {
"content_hash": "aa9887b9cb0c8a0a3df24035f82e5744",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 84,
"avg_line_length": 33.73015873015873,
"alnum_prop": 0.6103529411764705,
"repo_name": "thaim/ansible",
"id": "74e6783925b8aecf55a559cb78b687e81e2b423a",
"size": "2870",
... |
import os.path as op
from mne.datasets import testing
from mne.preprocessing._fine_cal import (read_fine_calibration,
write_fine_calibration)
from mne.utils import _TempDir, object_hash, run_tests_if_main
# Define fine calibration filepaths
data_path = testing.data_path(downlo... | {
"content_hash": "495f6c6a5676fa5d8e0c4df9e30d49dc",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 36.24242424242424,
"alnum_prop": 0.6722408026755853,
"repo_name": "adykstra/mne-python",
"id": "2f3bbaf67edcad594cc91bb90c411835ef88b053",
"size": "1... |
from __future__ import print_function, division
import pandas as pd
from datetime import timedelta
from nilmtk.tests.testingtools import data_dir
from os.path import join
import itertools
from collections import OrderedDict
import numpy as np
from nilmtk.consts import JOULES_PER_KWH
from nilmtk.measurement import measu... | {
"content_hash": "9147e3097794706f790a53f2b1419fe5",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 81,
"avg_line_length": 31.098425196850393,
"alnum_prop": 0.5834915812128117,
"repo_name": "josemao/nilmtk",
"id": "7c2de876cff68d8c21303a6288984ff69fd93d44",
"size": "7899... |
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
from cloudbaseinit.plugins.common import base
from cloudbaseinit.plugins.common import trim
from cloudbaseinit.tests import testutils
class TrimPluginPluginTests(unittest.TestCase):
def setUp(self):
self._trim_plu... | {
"content_hash": "2cc59d5cd194287b6f34bee8d00d16e6",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 30,
"alnum_prop": 0.6871794871794872,
"repo_name": "ader1990/cloudbase-init",
"id": "488ea9f10f29523aab768e01484218a190fa9cee",
"size": "1786",
"bi... |
import os
import sys
import time
import datetime
import json
import jsonpath_rw
from datetime import datetime
def validate_input(helper, definition):
"""Implement your own validation logic to validate the input stanza configurations"""
# This example accesses the modular input variable
# server = definitio... | {
"content_hash": "f6c5b5109819f7f5ae852ed82954ec01",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 156,
"avg_line_length": 31.695121951219512,
"alnum_prop": 0.550596383224317,
"repo_name": "domeger/SplunkTAforPuppetEnterprise",
"id": "645f5833e91a352d0d286c6f804e7d87942453... |
__title__ = "spacy"
__version__ = "3.2.1"
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__projects__ = "https://github.com/explosion/projects"
__projects_branch__ = "v3"
| {
"content_hash": "db16a58666265356ae86d0d45621898f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 104,
"avg_line_length": 51.666666666666664,
"alnum_prop": 0.7096774193548387,
"repo_name": "honnibal/spaCy",
"id": "c253d5052757e4dba5b9e138013ccc21eb47f082",
"size": "321",... |
import json
import logging
from base64 import b64decode
from datetime import datetime
from urlparse import parse_qs, urlparse
from redash.query_runner import *
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
try:
from oauth2client.service_account import ServiceAccountCredentials
fro... | {
"content_hash": "daab76d6f4167ecadd7df105af2bac0d",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 102,
"avg_line_length": 34.46448087431694,
"alnum_prop": 0.5438401775804661,
"repo_name": "moritz9/redash",
"id": "cd14724b664a86ffeafcf61b52f1925e9028763e",
"size": "6332... |
from django.contrib import admin
from models import *
from django.db.models import get_model
from reversion.admin import VersionAdmin
from seamoss.forms import PageForm
try:
tinymce = models.get_app('tinymce')
except ImproperlyConfigured:
tinymce = False
class PageAdmin(VersionAdmin):
ordering = ('title',... | {
"content_hash": "8df248b07e66f847626c5c03b867c4dd",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 69,
"avg_line_length": 32.369565217391305,
"alnum_prop": 0.6736064472800537,
"repo_name": "gregnewman/django-seamoss",
"id": "c497ebb0f9d8123e0807e405d5eee4570e7c0e73",
"si... |
import unittest2
from neutron import context
class TestBase(unittest2.TestCase):
'''Class to decide which unit test class to inherit from uniformly.'''
def setUp(self):
super(TestBase, self).setUp()
self.context = context.Context('fake', 'fake', is_admin=False)
class FakeContext(obj... | {
"content_hash": "0348b4bbe34f8c8a59243f3bffa9cc13",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 26.695652173913043,
"alnum_prop": 0.5700325732899023,
"repo_name": "jkoelker/quark",
"id": "d944cf2e165fa48e50e9458dcde97c93e5f4876a",
"size": "1204"... |
import commands
import math
class MemInfo:
def __init__(self, options):
pass
def report(self):
output = commands.getoutput("vm_stat")
splitted = output.split("\n")
pageSize = int(splitted[0].split()[7])
free = int(splitted[1].split()[2][:-1])
active = int(spli... | {
"content_hash": "ba3554a75793d80c37fe95a6b9f745b8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 57,
"avg_line_length": 29.65625,
"alnum_prop": 0.5226554267650158,
"repo_name": "diego351/monster",
"id": "f3a2be847c3a75f6fcb7151d6bf87348ee9405a6",
"size": "968",
"bina... |
import pyreally
import logging
import time
import pprint
import random
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
try:
pp = pprint.PrettyPrinter(depth=6)
really = pyreally.Really()
really.login_anonymous()
res1 = really.create(pyreally.R("/users"), {"firstN... | {
"content_hash": "9d8efa702dce8d6e7a6c24bb6e6e0e86",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 147,
"avg_line_length": 40.924731182795696,
"alnum_prop": 0.5641093011035208,
"repo_name": "reallylabs/pyreally",
"id": "e2460ecb8d75efb5310a95f2a9e43757144cba4f",
"size": ... |
import unittest
import runner
class TestRunnerMethods(unittest.TestCase):
def test_count_syllables(self):
syllables = runner.countSyllables('hello')
self.assertEqual(syllables, 2)
def test_is_haiku(self):
trueHaiku = runner.isHaiku("I am a haiku trust me this is a haiku, I'm dead serious")
falseH... | {
"content_hash": "37f1211286a87a62c8ad76e02c27d9fb",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 89,
"avg_line_length": 31.785714285714285,
"alnum_prop": 0.7131086142322097,
"repo_name": "hollabaq86/haikuna-matata",
"id": "28b9ce3677dc27d46bf0234d36065fca34f1926d",
"si... |
import os
import yaml
from .storage import Storage
class LocalStorage(Storage):
def __init__(self, path):
if path is None:
path = '~/.spinbot/cache'
self.path = os.path.expanduser(path)
super().__init__()
def store(self, key, val):
with open(self.path, 'w+') as f:
... | {
"content_hash": "45fb07fb1a1d5e30d3ef845f59d40fa5",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 44,
"avg_line_length": 26.862068965517242,
"alnum_prop": 0.4890885750962773,
"repo_name": "ewiseblatt/spinnaker",
"id": "eb43c9ded7190c1c17946d13e1a18ff3f3265f9b",
"size": ... |
import copy
import itertools
import re
from abc import ABC, abstractmethod
from typing import Iterable, Type
from morelia.exceptions import MissingStepError
from morelia.i18n import TRANSLATIONS
PLACEHOLDER_RE = re.compile(r"\<(\w+)\>")
class Visitor(ABC): # pragma: nocover
@abstractmethod
def visit_featur... | {
"content_hash": "6fd1c059fa8404623bb2b54fadebcf11",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 88,
"avg_line_length": 28.92124105011933,
"alnum_prop": 0.5921769268856247,
"repo_name": "kidosoft/Morelia",
"id": "3c8b4e33c7f729530cec657d5090e4829a534b3f",
"size": "121... |
DOWNLOAD_PATH = '/tmp/backgrounds/'
CUSTOM_FOLDER = 'nasa-apod-backgrounds'
RESOLUTION_TYPE = 'stretch'
RESOLUTION_X = 1024
RESOLUTION_Y = 768
NASA_APOD_SITE = 'http://apod.nasa.gov/apod/'
IMAGE_SCROLL = True
IMAGE_DURATION = 1200
SEED_IMAGES = 10
SHOW_DEBUG = False
import glib
import subprocess
import commands
import... | {
"content_hash": "b723a7ae2887fd33dbf4a6ba2668dd3d",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 117,
"avg_line_length": 34.375,
"alnum_prop": 0.6243232323232323,
"repo_name": "mikuyves/nasa-apod-desktop",
"id": "dc609af7a4af710aa48295d9a61d47fe54dd3baf",
"size": "155... |
import os
import sys
import json
import time
import threading
from requests_futures.sessions import FuturesSession
extensions = ["php", "txt", "pdf", "zip", "tgz", "asp", "inc", "tpl"]
session = FuturesSession(max_workers=100)
randomseed = "1enjfn3i"
dumb_code = 404
dumb_length = 0
url_cache = {}
current_dir = ""
loc... | {
"content_hash": "48c157668dbaf69b3fd3099016eabd05",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 69,
"avg_line_length": 28.02857142857143,
"alnum_prop": 0.6223241590214067,
"repo_name": "zulla/pixel",
"id": "907e4a2aabbe54062fc943b8b1e7fd204b2c5e98",
"size": "2125",
... |
import argparse
import json
import os
import shutil
import sys
import tempfile
import traceback
import merge_api
MISSING_SHARDS_MSG = r"""Missing results from the following shard(s): %s
This can happen in following cases:
* Test failed to start (missing *.dll/*.so dependency for example)
* Test crashed or hung
... | {
"content_hash": "cecb14a9bd5829994c25ba3dbb69c3a4",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 80,
"avg_line_length": 33.37185929648241,
"alnum_prop": 0.6494503839783166,
"repo_name": "endlessm/chromium-browser",
"id": "99adf7bc7e961bebbc1b889c0fa81212d1d535bd",
"si... |
from typing import Callable, NamedTuple, Tuple
import jax
import jax.numpy as jnp
from blackjax.types import PyTree
class SMCInfo(NamedTuple):
"""Additional information on the tempered SMC step.
weights: jnp.ndarray
The weights after the MCMC pass.
proposals: PyTree
The particles that w... | {
"content_hash": "7de7b093734230d8e903c1f6a398e3f9",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 103,
"avg_line_length": 31.836879432624112,
"alnum_prop": 0.6331031410113611,
"repo_name": "blackjax-devs/blackjax",
"id": "22509de4efeab0799471e45d6160880a9618f8fd",
"siz... |
"""Benchmark for KPL implementation of vocabulary columns + indicator from lists with dense inputs."""
from tensorflow.python import keras
from tensorflow.python.compat import v2_compat
from tensorflow.python.eager.def_function import function as tf_function
from tensorflow.python.feature_column import feature_column_... | {
"content_hash": "404465a8ec92f458d45e653963f7d136",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 102,
"avg_line_length": 36.225352112676056,
"alnum_prop": 0.7270606531881804,
"repo_name": "petewarden/tensorflow",
"id": "2c7f2f68f6bc45e30642888ebec451e33269bf84",
"size"... |
import os
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score
try:
import torch
except ImportError:
torch = None
### Evaluator for node property prediction
class Evaluator:
def __init__(self, name):
self.name = name
meta_info = pd.read_csv(os.path.join(os.pat... | {
"content_hash": "18d0c1915fdf7a5017909b0fa6e0327a",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 137,
"avg_line_length": 39.340782122905026,
"alnum_prop": 0.5785288270377733,
"repo_name": "snap-stanford/ogb",
"id": "d5c88ff535430f2751d8688fee5f47cdb40d1f1c",
"size": "... |
import io
import unittest
from unittest.mock import patch
from kattis import k_modulararithmetic
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Run ... | {
"content_hash": "a5cf992e0fffae76721944f72f7a4cbf",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 31.8,
"alnum_prop": 0.5010482180293501,
"repo_name": "ivanlyon/exercises",
"id": "8e3208995df570e944fa84baaf8fcec6ce2bf9cd",
"size": "1431",
"binar... |
from unittest import TestCase
from django.template import Context, Template
from ddcz.html import (
encode_valid_html,
unsafe_encode_valid_creation_html,
unsafe_encode_any_creation_html,
)
class TestInsecureHtmlRender(TestCase):
def assert_output(self, entity_string, expected):
output = unsa... | {
"content_hash": "79ca9862bbe3334995ca5a1b17b61c04",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 466,
"avg_line_length": 42.49090909090909,
"alnum_prop": 0.6280131222364855,
"repo_name": "dracidoupe/graveyard",
"id": "8972ce066700c2f68f9caf987d9bbb15d63bcc5b",
"size":... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0056_repopulate_series_head'),
]
operations = [
migrations.RemoveField(
model_name='message',
name='is_series_head',
... | {
"content_hash": "382af4c3cf4ce5de42881e69598628fa",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 47,
"avg_line_length": 19.352941176470587,
"alnum_prop": 0.5896656534954408,
"repo_name": "patchew-project/patchew",
"id": "c0dc4760e127585edc3b9c4cccd1776e499c53be",
"size... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/reactor/shared_base_reactor_subcomponent_mk2.iff"
result.attribute_template_id = 8
result.stfName("space_crafting_n","base_reactor_subcomponent_mk2")
#### BEGIN MODIFICATIONS ####
#### END MO... | {
"content_hash": "abb1e6d7ef7f5fc2148b762b350f8691",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 98,
"avg_line_length": 27.23076923076923,
"alnum_prop": 0.7231638418079096,
"repo_name": "obi-two/Rebelion",
"id": "a8f1a0396849f87fbc8e3e9f558332612a3027f1",
"size": "499"... |
from __future__ import print_function
import errno
import os
import tempfile
import fixtures
import six
from essential import processutils
from essential import test
class UtilsTest(test.BaseTestCase):
# NOTE(jkoelker) Moar tests from nova need to be ported. But they
# need to be mock'd out.... | {
"content_hash": "1fd79c8a0598540ed4467ba7f4f90b27",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 79,
"avg_line_length": 35.40823970037453,
"alnum_prop": 0.5645229532473027,
"repo_name": "zhangxiaolins/python_base",
"id": "fadc4f22970da28eb551f25156719e502d67378d",
"si... |
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import group_types as schema
from tempest.lib.common import rest_client
from tempest.lib.services.volume import base_client
class GroupTypesClient(base_client.BaseClient):
"""... | {
"content_hash": "d49e96bbce641b12f04c5b485c9808aa",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 108,
"avg_line_length": 43.381294964028775,
"alnum_prop": 0.6490878938640132,
"repo_name": "cisco-openstack/tempest",
"id": "e0bf5e2ae6cf14fea3fbbb5767ac760abdf381dc",
"si... |
from docker import Client
from docker.utils import kwargs_from_env
from subprocess import call
cli = Client(**kwargs_from_env(assert_hostname=False))
def scale(container, cpu_usage, scale_dict):
scale_num = scale_dict[container]
if (cpu_usage > 30):
print("Will scale [%s] to %d instances." % (container, sc... | {
"content_hash": "f3b80f5dc0b9e85f4f64cc8c15749612",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 122,
"avg_line_length": 43.61702127659574,
"alnum_prop": 0.6478048780487805,
"repo_name": "mwellner/voting",
"id": "ff41235d2665125b5123587800a222b4a1f3a8e7",
"size": "2050... |
from django.db import models
from django.template import Context, Template
from django.test import SimpleTestCase, TestCase, override_settings
from django.test.utils import isolate_apps
from .models import (
AbstractBase1, AbstractBase2, AbstractBase3, Child1, Child2, Child3,
Child4, Child5, Child6, Child7, Re... | {
"content_hash": "7ed52183a95ab8e887b9facd72537514",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 107,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.6428834808259587,
"repo_name": "adamchainz/django",
"id": "c18cd8adda13a49d91a95baf2e1cdbcf98aed442",
"size": "... |
import os
import sys
import codecs
from collections import defaultdict
import unittest
from models import *
class Dump(object):
def __init__(self, downloaded_dir=None):
self.downloaded_dir = downloaded_dir
self.iso_languages_3 = {}
self.iso_languages_2 = {}
self.iso_languages_1 = {}... | {
"content_hash": "fbf392e2b800bb383483124ae25e93dd",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 297,
"avg_line_length": 37.34,
"alnum_prop": 0.535083020889127,
"repo_name": "DenisKuzin/geonames-dump",
"id": "375876ca70ec4b74e2f383487582e281cf1ec348",
"size": "14990",... |
"""
Tweepy streaming API StreamListener message recognizers.
These recognize various types of incoming data based on predefined rules.
TODO: Probably don't need classes. Consider refactoring.
"""
import json
import tweepy
class MessageRecognizer(object):
def __init__(self, handler_method):
... | {
"content_hash": "0d7af084ccb6778aa7e5e6d93bd128e1",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 29.58823529411765,
"alnum_prop": 0.6984758117958914,
"repo_name": "inactivist/twitter-streamer",
"id": "8e4742a3fa27af1bc6d705df7ad1a45051372ea1",
"s... |
from node import *
class Bst:
def __init__(self, key_cmp = None):
self.cnt = 0
self.head = Node()
self.head.l = self.head.r = self.head.p = self.head
self.head.data = -1
def node_cmp(x, y):
if not isinstance(x, Node) or not isinstance(y, Node):
ra... | {
"content_hash": "d3474fa5fc300304ae38d54a6ffb00ef",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 119,
"avg_line_length": 29.104761904761904,
"alnum_prop": 0.5166884816753927,
"repo_name": "wfyaibaib/py-algorithms",
"id": "72426050aa3daceede1877867d8c5c636ca30554",
"si... |
__author__ = 'lachlan'
from Flask_App import db
# Create mapping from db objects to named objects for simplicity
Model = db.Model
Column = db.Column
Enum = db.Enum
String = db.String
Integer = db.Integer
DateTime = db.DateTime
Boolean = db.Boolean
Table = db.Table
ForeignKey = db.ForeignKey
Index = db.Index
Metadata ... | {
"content_hash": "3df068d0745a3a5a8783e420cbb16c46",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 64,
"avg_line_length": 24.658536585365855,
"alnum_prop": 0.6973293768545994,
"repo_name": "QuicklyRainbow/FieldGuideAU",
"id": "4eaf78ecf5c8d76aa502fce93209563e7d17a782",
"... |
"""Language model hyper-parameters."""
# Import ModelParams to ensure that they are added to the global registry.
# pylint: disable=unused-import
import lingvo.jax.tasks.lm.params.bert
import lingvo.jax.tasks.lm.params.lm_cloud
# pylint: enable=unused-import
| {
"content_hash": "bd0ac864a72e52034fa24993d1b3c975",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 74,
"avg_line_length": 32.625,
"alnum_prop": 0.7816091954022989,
"repo_name": "tensorflow/lingvo",
"id": "6520e9e68bca0445829e0c1e3035a52778631f3b",
"size": "950",
"binary... |
"""TABLE BERT utility functions."""
import dataclasses
import functools
from typing import Any, Optional
from tapas.models.bert import modeling
from tapas.utils import attention_utils
from tapas.utils import tableformer_utils
import tensorflow.compat.v1 as tf
from tensorflow.compat.v1 import estimator as tf_estimator
... | {
"content_hash": "831ddd082c763919733b4c01b510d28f",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 92,
"avg_line_length": 38.61290322580645,
"alnum_prop": 0.7197994987468672,
"repo_name": "google-research/tapas",
"id": "91e0cf6e5e886d4daf0753afe6a95753d8a51259",
"size":... |
import os
from setuptools import setup
def read(fname):
"""Utility function to read the README file.
Used for long_description. It's nice, because now (1) we have a top level
README file and (2) it's easier to type in the README file than to put a raw
string in below."""
return open(os.path.join(... | {
"content_hash": "f3719c3f41adf1c8ec549ca83de32a9a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 31.941176470588236,
"alnum_prop": 0.6353591160220995,
"repo_name": "rossant/ipycache",
"id": "f957e13c26031e0f9a3a6f60c0a869fd310b6dd5",
"size": "108... |
read_file = open("text.txt", "r")
# Use a second file handler to open the file for writing
write_file = open("text.txt", "w")
# Write to the file
write_file.write("Not closing files is VERY BAD.")
write_file.close()
# Try to read from the file
print read_file.read()
read_file.close() | {
"content_hash": "72eb8ba1bf707080c59c652236a7d9fc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 22.153846153846153,
"alnum_prop": 0.6979166666666666,
"repo_name": "haozai309/hello_python",
"id": "ae4327ae1cdd3d291a453f04ead9739bc241c2b3",
"size"... |
from __future__ import print_function
import unittest2
from lldbsuite.test.decorators import *
from lldbsuite.test.concurrent_base import ConcurrentEventsBase
from lldbsuite.test.lldbtest import TestBase
@skipIfWindows
class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.comp... | {
"content_hash": "8707f0d528e3a85631d075bc704d2c63",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 81,
"avg_line_length": 33.78260869565217,
"alnum_prop": 0.7477477477477478,
"repo_name": "apple/swift-lldb",
"id": "bf92488babc0218b8fb5c8dd201e80767fba13c4",
"size": "777"... |
"""
Connectivity
~~~~~~~~~~~~
Use the connectivity filter to remove noisy isosurfaces.
This example is very similar to `this VTK example <https://lorensen.github.io/VTKExamples/site/Python/VisualizationAlgorithms/PineRootConnectivity/>`__
"""
# sphinx_gallery_thumbnail_number = 2
import pyvista as pv
from pyvista imp... | {
"content_hash": "3e37095e3bebfa8fcc481d752d8e5945",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 151,
"avg_line_length": 32.38095238095238,
"alnum_prop": 0.6404411764705882,
"repo_name": "akaszynski/vtkInterface",
"id": "210e8ea0bb00400ccded4733c069e1a4e5526025",
"size... |
import logging
import os
try:
import telescope.telescope.utils as telescope_utils
except ImportError:
raise Exception(('Could not find Telescope library. '
'Please verify all submodules are checked out.'))
import site_metadata
import telescope_data_parser
def _ensure_dir_exists(dir_path):
"... | {
"content_hash": "658a0a4a020365a3cfcea201c6f30b32",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 78,
"avg_line_length": 37.75,
"alnum_prop": 0.6416990180406485,
"repo_name": "mtlynch/mlab-observatory",
"id": "c73cd2458900e945238c772a5237686990de6ca6",
"size": "9386",
... |
from flask import Flask, request, make_response
from gevent import monkey; monkey.patch_socket()
from gevent.wsgi import WSGIServer
import redis
import json
r = redis.StrictRedis()
app = Flask(__name__)
app.config.from_object('settings')
r = redis.StrictRedis(host=app.config.get('PUBSUB_HOST', '127.0.0.1'),
... | {
"content_hash": "b22d37f9cefc3dbd6e54104f0cfda0f3",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 75,
"avg_line_length": 27.29032258064516,
"alnum_prop": 0.6353427895981087,
"repo_name": "zhemao/lerner",
"id": "18640054256be982cb41b44e372f6deb8d47ea2b",
"size": "1715",
... |
from minibus import MiniBusTwistedClient
import sys
sys.DONT_WRITE_BYTECODE = True
class ServiceClient(MiniBusTwistedClient):
def __init__(self):
MiniBusTwistedClient.__init__(self, name="ServiceClient")
self.echoback = self.service_client("echoback", { }, { }, self.echoback_reply, self.echoback_er... | {
"content_hash": "ceb141869a9f9770104d31644cef8b6a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 107,
"avg_line_length": 28.5,
"alnum_prop": 0.6383265856950068,
"repo_name": "allohakdan/minibus",
"id": "af95fb3761649fb1cc6f00571aa854747c8cbcc4",
"size": "763",
"binar... |
MAX_STATS_AGE = 60
"""
#
# dump1090-stats-to-statsd.py
#
# Requires the statsd python package, there are a bazillion ways to install it. I use:
# sudo apt-get install python-pip
# sudo pip install statsd
#
# Reads dump1090's JSON stats file (usually located at /run/dump1090-mutability/stats.json)
# and sends the... | {
"content_hash": "6852995420d272cb7cfd0efafe446d96",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 120,
"avg_line_length": 38.2695652173913,
"alnum_prop": 0.6757555101113384,
"repo_name": "dsilvers/dump1090-statsd",
"id": "5541224e4a9617802c03ec5cc68af6ac4fb16781",
"siz... |
import sys
#from distutils.core import setup, Extension
from setuptools import setup,Extension
version = sys.version_info
module1 = None;
other_sources = [
"depends/libmilk/def.cpp",
"depends/libmilk/dict.cpp",
"depends/libmilk/log.cpp",
"depends/libmilk/thread.cpp",
"depends/libmilk/netio.cpp",
"depends/libmil... | {
"content_hash": "12d63a8716fd4beeeaf91328eba5d503",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 170,
"avg_line_length": 33.17333333333333,
"alnum_prop": 0.6981511254019293,
"repo_name": "lyramilk/cavedb",
"id": "73b3d625d555a16325013e1f28d93ed6856fe8db",
"size": "2488... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['rodi_robot'],
package_dir={'': 'src'}
)
setup(**setup_args)
| {
"content_hash": "290220a688e591842507c329a0961627",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.6681034482758621,
"repo_name": "rodibot/rodi_robot",
"id": "d90da04ecb4ff0269019b7cdcaccc2525b9b7d3b",
"size": "255... |
from django.conf.urls import patterns, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('pyforum.views',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
... | {
"content_hash": "8512fe2c3c991675cb47f29ef6633227",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 44.529411764705884,
"alnum_prop": 0.6010568031704095,
"repo_name": "pombredanne/PyForum",
"id": "3c19bb835788d4a6dcb1de414f546e3023a9f08a",
"size": "... |
import socket
class Rprint:
name = 'user'
host = '127.0.0.1'
port = 10000
ver = '0.0.8'
dbg = False
def config(name='user', host='localhost', port=10000):
Rprint.name = name
Rprint.host = host
Rprint.port = port
print(Rprint.name, Rprint.host, Rprint.port)
def send(message):
... | {
"content_hash": "f4f9884dc80a071bcf00f19594848105",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 63,
"avg_line_length": 19.78205128205128,
"alnum_prop": 0.594296824368114,
"repo_name": "cletrix/rprint",
"id": "f3a87c2ad8e3ff25208584cc12a457b4d999f846",
"size": "1543",
... |
import botocore.session
from botocore.handlers import SERVICE_NAME_ALIASES
def test_can_use_service_alias():
session = botocore.session.get_session()
for (alias, name) in SERVICE_NAME_ALIASES.items():
yield _instantiates_the_same_client, session, name, alias
def _instantiates_the_same_client(session... | {
"content_hash": "be3836cfe78cc0815674405a4c9db9ba",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 74,
"avg_line_length": 40.04761904761905,
"alnum_prop": 0.7074910820451843,
"repo_name": "pplu/botocore",
"id": "d82cfbcf6aa432dff592574a4cce437a9d421f32",
"size": "1402",
... |
"""
px_generate_uorb_topic_headers.py
Generates c/cpp header files for uorb topics from .msg (ROS syntax)
message files
"""
from __future__ import print_function
import os
import shutil
import filecmp
import argparse
try:
import genmsg.template_tools
except ImportError as e:
print("python import error:... | {
"content_hash": "44710d3fbd48e97f8b1b07e2a6be4089",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 79,
"avg_line_length": 36.3125,
"alnum_prop": 0.5037292025243832,
"repo_name": "Yndal/ArduPilot-SensorPlatform",
"id": "c7ed72d582871e5e845d378a13a1f3f53d8d0905",
"size": ... |
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | {
"content_hash": "0597214b07d21ff73c1a49f384a7697a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 36.08888888888889,
"alnum_prop": 0.6859605911330049,
"repo_name": "superstack/nova",
"id": "a648efb160d2c8d77fad607d03fecc3c03340046",
"size": "1669"... |
"""Sum of Digits
Given a positive integer, find the sum of its constituent digits.
"""
import sys
def main():
with open(sys.argv[1]) as f:
lines = (l.strip() for l in f)
nums = (map(int, l) for l in lines)
sums = (sum(digits) for digits in nums)
for sum_digits in sums:
... | {
"content_hash": "054bdc2c299e1231fc033e362c21d14f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 19.94736842105263,
"alnum_prop": 0.5620052770448549,
"repo_name": "foxdan/codeeval",
"id": "124c2f5f26a482602b911c4ddc9bb666849a9185",
"size": "401",... |
from .feed_summary import *
| {
"content_hash": "59ad6e9ae8d870fc6d5d6d9f20a2bd0b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.75,
"repo_name": "jarrodmillman/stat133-fall2014",
"id": "93db3bed80a887720df701e98a371b4498cd1104",
"size": "28",
"binary": fal... |
"""
Bitstamp API client.
<https://www.bitstamp.net/api/>
The client uses `tornado.httpclient` and can be used
either synchronous or asynchronous fashion.
-----
Based on:
kmadac/bitstamp-python-client
Copyright (c) 2013 Kamil Madac
<https://github.com/kmadac/bitstamp-python-client/blob/master/LICENSE.tx... | {
"content_hash": "259682f240eb00f15bd0aab4eb3de3a8",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 78,
"avg_line_length": 28.596774193548388,
"alnum_prop": 0.5429860607525582,
"repo_name": "jakubroztocil/cointrol",
"id": "156574606ef1405203e7a138eb9bf802e62c3fc4",
"size... |
"""DB2 storage backend
"""
from __future__ import division
import pymongo
from ceilometer.alarm.storage import pymongo_base
from ceilometer.openstack.common import log
from ceilometer import storage
from ceilometer.storage.mongo import utils as pymongo_utils
LOG = log.getLogger(__name__)
class Connection(pymongo_... | {
"content_hash": "bd5dd9e9e8e376519306e15e64afee70",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 78,
"avg_line_length": 38.93103448275862,
"alnum_prop": 0.6647475642161205,
"repo_name": "luogangyi/Ceilometer-oVirt",
"id": "9ca37f203cdbde8029666852ecd1846d423e2215",
"si... |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineRespon... | {
"content_hash": "372afc37caa9ed109ca462f566516343",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 202,
"avg_line_length": 42.25919439579685,
"alnum_prop": 0.6535018648984666,
"repo_name": "Azure/azure-sdk-for-python",
"id": "435c3b4a010e7e9c37f34d14dee73724fcb5e1d1",
"... |
import pip
pip.main(['install', 'requests'])
pip.main(['install', 'pandas'])
pip.main(['install', 'numpy'])
pip.main(['install', 'json'])
pip.main(['install', 'datetime'])
pip.main(['install', 'sklearn']) | {
"content_hash": "2c43f878b5a5883da2c304bc3e51ce1c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 33,
"avg_line_length": 29.142857142857142,
"alnum_prop": 0.6421568627450981,
"repo_name": "andurilhuang/Movie_Income_Prediction",
"id": "c097f92b1c33b4959de46c3539df8f7dcc1e39... |
from ark.scheduler import Scheduler
from ark.cli import *
from ark.server_control import ServerControl
from ark.event_handler import EventHandler
class Task_CheckForUpdates(Scheduler):
@staticmethod
def run():
if ServerControl.new_version() is True:
EventHandler.triggerEvent(EventHandler.E_... | {
"content_hash": "70a75f84ade020977e33323fc2976df4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 34.166666666666664,
"alnum_prop": 0.7219512195121951,
"repo_name": "f4ble/pyarc",
"id": "8a28e6aa3ed196745635761eab85e22ee0eb2bc6",
"size": "410",
... |
import json
f = open("test.json", "r")
f_out=open("analized.json", "w")
myData = json.load(f)
'''
#Parsing para valores concretos de un atributo
for line in myData:
if line["context"]["org_id"]!="":
#print json.dumps(line, sort_keys=True,indent=4, separators=(',', ': '))
json.dump(line,f_out)
#Parsi... | {
"content_hash": "ba27328232d29fb885112ba4b2751920",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 75,
"avg_line_length": 21.875,
"alnum_prop": 0.6447619047619048,
"repo_name": "Farmijo/TFG-Dashboard",
"id": "61e67c9a062238cc016bea5566af3483869d04e9",
"size": "1050",
"... |
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core... | {
"content_hash": "442d0c2ea1847f6983b35a9b245091e8",
"timestamp": "",
"source": "github",
"line_count": 966,
"max_line_length": 181,
"avg_line_length": 46.5175983436853,
"alnum_prop": 0.6356150970268827,
"repo_name": "Azure/azure-sdk-for-python",
"id": "216b39ec33f54ba8580aa85c9431b9945cac3908",
"s... |
"""Adadelta for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.keras import backend_config
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.training import trainin... | {
"content_hash": "fdd0fab30f805fefa63e214dd69aa1fa",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 39.29370629370629,
"alnum_prop": 0.6611496707599217,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "1ceb93328246f44525a17098fa5e8fc3eaf98611",
"... |
from collections import namedtuple
import itertools
import functools
import operator
import ctypes
import numpy as np
from numba import _helperlib
from numba.core import config
Extent = namedtuple("Extent", ["begin", "end"])
attempt_nocopy_reshape = ctypes.CFUNCTYPE(
ctypes.c_int,
ctypes.c_long, # nd
... | {
"content_hash": "9634927644f590a825da3bc3bb1bef76",
"timestamp": "",
"source": "github",
"line_count": 483,
"max_line_length": 145,
"avg_line_length": 31.51345755693582,
"alnum_prop": 0.5418829249063793,
"repo_name": "stonebig/numba",
"id": "6239e93756219f27d76018ab3f3c5d88fc67e0b9",
"size": "1522... |
"""Test Home Assistant template helper methods."""
from datetime import datetime, timedelta
import logging
import math
import random
from unittest.mock import patch
from freezegun import freeze_time
import pytest
import voluptuous as vol
from homeassistant.components import group
from homeassistant.config import asyn... | {
"content_hash": "783204d6f03e1938c69e6b9418eee6c2",
"timestamp": "",
"source": "github",
"line_count": 3476,
"max_line_length": 191,
"avg_line_length": 31.204257767548906,
"alnum_prop": 0.5807073184223628,
"repo_name": "jawilson/home-assistant",
"id": "4a97b99d05d46d2494f6608d24283fc1522b2f1d",
"s... |
from Classes import Status
from runner import run
from test_data import tc1, cpp_source_code_add_two_numbers, c_source_code_add_two_numbers_compile_error
def test_c_add_two_numbers_code():
out = run(cpp_source_code_add_two_numbers, "cpp", ["g++", "-o", "program"], ["./program"], [tc1])
assert 1 == len(out)
... | {
"content_hash": "a9d7e5f3da0df65eebf78512c4eb9c35",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 103,
"avg_line_length": 35.45454545454545,
"alnum_prop": 0.6641025641025641,
"repo_name": "jbuddha/OpenRank",
"id": "21115a4ed5ff4727cf7a4a10ba55703a8ba653e0",
"size": "390... |
from PyQt4 import QtGui, QtCore
from Views import ui_dialog_splitcolumn as dsplitcolumn
from poplerGUI import ui_logic_preview as tprev
from poplerGUI import class_modelviewpandas as view
from poplerGUI.logiclayer import class_helpers as hlp
from poplerGUI import class_inputhandler as ini
class SplitColumnDialog(QtGu... | {
"content_hash": "d224af2486d9c00d09e845e8d44054ec",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 66,
"avg_line_length": 36.629629629629626,
"alnum_prop": 0.6164475901584092,
"repo_name": "bibsian/database-development",
"id": "541aa67dab055812783e036ecb82800b7a480806",
... |
"""Python part of the warnings subsystem."""
import sys
__all__ = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
def showwarning(message, category, filename, lineno, file=None, line=None):
"""Hook to write a wa... | {
"content_hash": "f915d1a7c865e690a6345e8288a6198b",
"timestamp": "",
"source": "github",
"line_count": 554,
"max_line_length": 86,
"avg_line_length": 35.63357400722022,
"alnum_prop": 0.6008307583202472,
"repo_name": "Microsoft/PTVS",
"id": "81f98647786d2c7b37eb51b04aa0fcd51c44e400",
"size": "19741... |
import os
import json
import boto
import urllib2
from boto.s3.key import Key
import boto3
import click
import logging
from copy import copy
from collections import OrderedDict
from datetime import date, timedelta
from elasticsearch import Elasticsearch, RequestError, RequestsHttpConnection
from requests_aws4auth import... | {
"content_hash": "082517dc0aaf7ae5f9a05b05df8ab7c7",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 113,
"avg_line_length": 31.734567901234566,
"alnum_prop": 0.589768527523828,
"repo_name": "sat-utils/landsat8-metadata",
"id": "55c1d4a841e9f878b2cbf40b92bd8bd6e5d0ef61",
... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name=None):
return render_template('main.html', name=name)
if __name__ == '__main__':
app.run()
| {
"content_hash": "31a79b277b3a416029a3fefc2fec1d30",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 50,
"avg_line_length": 16.923076923076923,
"alnum_prop": 0.6090909090909091,
"repo_name": "mkhuthir/learnPython",
"id": "089328fc0638cec476d994177eaf6c4561919c7f",
"size": ... |
import sys
import requests
import logging
import ssl
import json
import pkg_resources
from requests.adapters import HTTPAdapter
try:
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
from urllib3.poolmanager import PoolManager
from qds_sdk.retry import retry
from qds_sdk.exceptio... | {
"content_hash": "462632e013e4ef866e524c7b54743148",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 122,
"avg_line_length": 35.18300653594771,
"alnum_prop": 0.582203232398291,
"repo_name": "tanishgupta1/qds-sdk-py",
"id": "bd0848c71d8f169217eda2683a268171875471a2",
"size... |
from __future__ import with_statement
from cms.test_utils.compat import skipIf
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.util.context_managers import TemporaryDirectory
from sphinx.application import Sphinx
import cms
import os
import socket
from cms.utils.compat.string_io import StringIO
R... | {
"content_hash": "010a46ade15da355ce796775c6d5989f",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 67,
"avg_line_length": 26.829787234042552,
"alnum_prop": 0.578112609040444,
"repo_name": "SurfasJones/icecream-info",
"id": "b59c093da00465df420f47fe9d95222bd6202193",
"siz... |
class DominoesPool():
def __init__(self):
#self.known_bricks_in_pool = []
#self.possible_bricks_in_pool = []
#self.number_of_bricks_in_pool = 0
pass | {
"content_hash": "80f28ed4547c1956edf7bbecd9cab92c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6144578313253012,
"repo_name": "theysconator/DominoesAI",
"id": "eea8f098399dc2aa3880183e1ce9a2b70aa8bb9d",
"size"... |
from enaml.widgets.raw_widget import ProxyRawWidget
from .qt_control import QtControl
class QtRawWidget(QtControl, ProxyRawWidget):
""" A Qt implementation of an Enaml ProxyRawWidget.
"""
def create_widget(self):
""" Create the underlying widget for the control.
"""
self.widget ... | {
"content_hash": "12bc754c8bda80addd9eb5115781a56c",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 29.52173913043478,
"alnum_prop": 0.508100147275405,
"repo_name": "ContinuumIO/ashiba",
"id": "a1dc104cd6953d2c08caa32b2cad44d6e23c0a23",
"size": "102... |
from setuptools import setup, find_packages
setup(
name = "liboozie",
version = "3.6.0",
url = 'http://github.com/cloudera/hue',
description = "Oozie Libraries",
packages = find_packages('src'),
package_dir = {'': 'src' },
install_requires = ['setuptools', 'desktop'],
# ... | {
"content_hash": "53991b279f023fbc89c625312020c9ca",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 35.142857142857146,
"alnum_prop": 0.6138211382113821,
"repo_name": "vitan/hue",
"id": "3c04d2a67b20438d8c9a0a250554fc7304ec9a45",
"size": "1262",
"... |
"""
This API can be used to interact with and modify Motorola S-Record files.
.. moduleauthor:: Yves-Noel Weweler <y.weweler@gmail.com>
"""
__author__ = 'Yves-Noel Weweler <y.weweler@gmail.com>'
__status__ = 'Development'
__version__ = '0.0.1'
__all__ = ('SRECError', 'SRecordParsingError', 'NotSRecFileError')
class... | {
"content_hash": "82463e35dc81a663045e26be7143281b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 73,
"avg_line_length": 20.875,
"alnum_prop": 0.6541916167664671,
"repo_name": "yweweler/pysrec",
"id": "b3bb3d717225caf804453038f5d5578fc48c23a0",
"size": "668",
"binary"... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import pytest
import numpy as np
# RiBuild Modules
from delphin_6_automation.delphin_setup import weather_modeling
from ... | {
"content_hash": "142bc70af0261b62ca4178144116ad6c",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 120,
"avg_line_length": 40.25,
"alnum_prop": 0.6211180124223602,
"repo_name": "thp44/delphin_6_automation",
"id": "cdc0ebf72373852bab673813f035f387c5e96632",
"size": "1932"... |
"""
Test the RR Lyrae helper functions.
"""
from __future__ import absolute_import, unicode_literals, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import astropy.units as u
import numpy as np
import pytest
from ..core import *
from ..rrl... | {
"content_hash": "923f6d5dcbecea85ae3568d0cd39bb3a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 82,
"avg_line_length": 20,
"alnum_prop": 0.6596774193548387,
"repo_name": "abonaca/gary",
"id": "a9c9527edaef60bdfa2ae02e2db16bf0d8bb2651",
"size": "636",
"binary": false... |
from gftools import fonts_public_pb2
import enum
import re
class Udhr():
def __init__(self, key, iso639_3, iso15924, bcp47, direction, ohchr, stage, loc, name):
self.key = key
self.iso639_3 = iso639_3
self.iso15924 = iso15924
self.bcp47 = bcp47
self.direction = direction
self.ohchr = ohchr
... | {
"content_hash": "d656fcd9c9b8e7e6f678ed3d401c7c08",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 98,
"avg_line_length": 35.9125,
"alnum_prop": 0.6139923424991298,
"repo_name": "googlefonts/gftools",
"id": "991e47396cb1c3d1e512bc8418a79fbe48d4297c",
"size": "8619",
"... |
try:
from collections import OrderedDict # NOQA
except ImportError: # Python < 2.7
from ordereddict import OrderedDict # NOQA
# Import simplejson if we have it (Python 2.6), and use json from the
# standard library otherwise.
#
# Note: Python 2.6 does have a JSON library, but it lacks `object_pairs_hook`
#... | {
"content_hash": "3009c22661439d6bb374d6459b713bfb",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 77,
"avg_line_length": 30.235294117647058,
"alnum_prop": 0.7101167315175098,
"repo_name": "ansible/tower-cli",
"id": "9e922e429bd689190580fd828c6525764ab943c0",
"size": "12... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.