text stringlengths 4 1.02M | meta dict |
|---|---|
from ansible.module_utils.ansible_release import __version__ as ANSIBLE_VERSION
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_configuration import AzureConfiguration
from msrest.service_client import ServiceClient
from msrest.pipeline import ClientRawResponse
from ... | {
"content_hash": "cb900853541ca7221b1525cd965cffae",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 134,
"avg_line_length": 38.043010752688176,
"alnum_prop": 0.6396269078575466,
"repo_name": "thaim/ansible",
"id": "4fd7eaa3b454d8d81e61e61e9febe4ebce7f58a8",
"size": "3696"... |
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
impo... | {
"content_hash": "511a8ad52997251658812ff0dfd0c30a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 119,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.7121364092276831,
"repo_name": "mindbody/API-Examples",
"id": "5d41f1acbc622414c0a24183b468fbc52ffc84d1",
"size"... |
import sys
from pysnmp.entity.rfc3413 import config
from pysnmp.proto import rfc1905, errind
from pysnmp.proto.api import v2c
from pysnmp.proto.proxy import rfc2576
from pysnmp import error, nextid, debug
from pysnmp.proto.error import StatusInformation
from pyasn1.type import univ
getNextHandle = nextid.Integer(0x7ff... | {
"content_hash": "03e4d9b9f4a6322b04c19b7ce1f19e55",
"timestamp": "",
"source": "github",
"line_count": 608,
"max_line_length": 179,
"avg_line_length": 37.004934210526315,
"alnum_prop": 0.5091781856971421,
"repo_name": "imron/scalyr-agent-2",
"id": "362dc368307ff50bbeab7958a19666fbedc4cfc7",
"size"... |
from django.conf import settings
def is_alpaca_enabled():
return getattr(settings, 'ALPACA_ENABLED', True)
def get_alpaca_project_path_fragment():
return getattr(settings, 'ALPACA_PROJECT_PATH_FRAGMENT', '')
def get_alpaca_environment():
try:
return settings.ALPACA_ENVIRONMENT
except Value... | {
"content_hash": "f6fe7947c270cbaf040812d738280ca9",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 24.774193548387096,
"alnum_prop": 0.7109375,
"repo_name": "msiedlarek/alpaca-django",
"id": "ed2d15ac86c46f958c7858bd40853c39a35b05d0",
"size": "768"... |
from __future__ import division
from django.conf import settings
from django.db import models
class Ingredient(models.Model):
name = models.CharField(max_length=250)
unit = models.CharField(max_length=20)
class Meta:
unique_together = ("name", "unit")
def __str__(self):
return f"{self... | {
"content_hash": "727c3fb5a44d9e574fcb5de242db242c",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 116,
"avg_line_length": 31.30188679245283,
"alnum_prop": 0.6481816355234077,
"repo_name": "Code4SA/medicine-price-registry",
"id": "fe5b6a1d4f22481b9c3ad4b684aa345c68f1ab91"... |
import sys
# Initialize a bunch of variables.
x, y, x_lo, x_hi, y_lo, y_hi = None, None, None, None, None, None
current_count = 0 # Counts the number of observations in current bin.
# Input comes from STDIN.
for line in sys.stdin:
# Remove leading and trailing whitespace
line = line.strip()
# Parse the input we go... | {
"content_hash": "34cd06c58ba4a9bec49ec9e2b51b4b01",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 30.894736842105264,
"alnum_prop": 0.6405451448040886,
"repo_name": "longphin/Bayesian---STA250",
"id": "65b6e211d99804214e91fce3b5516058b498b9ba",
"s... |
import smtplib
class CL_Email:
def __init__(self, email_obj):
self.data = email_obj
self.sender = self.data['sender']
self.recipient = self.data['recipients']
self.server_pwd = self.data['server_pwd']
self.message = ''
def write(self, craigslist_listings):
self.... | {
"content_hash": "e8e389ecdea2d034e02166b3a7a71689",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 103,
"avg_line_length": 43.64,
"alnum_prop": 0.5206232813932172,
"repo_name": "evanhenri/Craiglist-Post-Notification-Bot",
"id": "4509c8603b49b01d0a1acf840be39043249f3417",
... |
from collections import deque
import itertools
import operator
import net_utils
import tobii_api
import cv2
import cv2.aruco as aruco
import config
import logging
import numpy
def nothing(x):
pass
class VideoProcessing():
''' Detect Fiducial and check if gaze position falls within ROI '''
def __init__(se... | {
"content_hash": "9af475958e2bbb1c74c3ddc3d653e3e7",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 185,
"avg_line_length": 42.07586206896552,
"alnum_prop": 0.565972791345681,
"repo_name": "robot-army/gazecontrol",
"id": "e68ed253b47214abcef632b9e94bc11752c06f3b",
"size"... |
import mock
from os_brick import encryptors
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
from nova import block_device
from nova import context
from nova import exception
from nova import objects
from nova.objects import fields
from nova import test
from nova.tests.unit... | {
"content_hash": "10a809cb9cb49a2015908d1c3b9d363e",
"timestamp": "",
"source": "github",
"line_count": 1573,
"max_line_length": 79,
"avg_line_length": 44.75842339478703,
"alnum_prop": 0.560585185711242,
"repo_name": "mikalstill/nova",
"id": "d4085bc71d84eb314d4688a8c9eac2bda736ce37",
"size": "7100... |
class Country():
def __init__(self, name, gold, silver, bronze):
self.name = name
self.gold, self.silver, self.bronze = gold, silver, bronze
def __str__(self):
return "%s %d %d %d" % (self.name, self.gold, self.silver, self.bronze)
def __lt__(self, other):
if self.gold == ... | {
"content_hash": "d7678d287d035491c41b0e08c5e1aa44",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 33.54054054054054,
"alnum_prop": 0.5165189363416599,
"repo_name": "chandps/Topcoder",
"id": "79e62bc7e74bce9c8928862dd070f6e15eb54810",
"size": "1241... |
import unittest
import IECore
class DisplayDriverServerTest( unittest.TestCase ) :
def testPortNumber( self ) :
s1 = IECore.DisplayDriverServer( 1559 )
self.assertEqual( s1.portNumber(), 1559 )
self.assertRaises( RuntimeError, IECore.DisplayDriverServer, 1559 )
s2 = IECore.DisplayDriverServer( 0 )
self... | {
"content_hash": "66033abca1df4187e72360b409ea2afb",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 26.535714285714285,
"alnum_prop": 0.7187079407806191,
"repo_name": "hradec/cortex",
"id": "eb4f0ec15cac7aaa3ecb45d9938e6d21d13d98f5",
"size": "2527",... |
from ckanext.geoview import plugin
def test_plugin():
"""This is here just as a sanity test
"""
p = plugin.OLGeoView()
assert p | {
"content_hash": "112adc44c85da96f8d53e7eb1f2a01e1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 41,
"avg_line_length": 20.571428571428573,
"alnum_prop": 0.6458333333333334,
"repo_name": "kalxas/ckanext-geoview",
"id": "f04f001446c7e76dfff81b6bdb9a2a313ba218d3",
"size":... |
"""Generic entry point script."""
import sys
from tensorflow.python.platform import flags
def run():
f = flags.FLAGS
f._parse_flags()
main = sys.modules['__main__'].main
sys.exit(main(sys.argv))
| {
"content_hash": "e8679c139b73ee786ac4c32f32da17ad",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 19.454545454545453,
"alnum_prop": 0.6495327102803738,
"repo_name": "liyu1990/tensorflow",
"id": "5917d00ce3f70c6d955203d18dd578fa1ae50887",
"size": "... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "9f21e3330c4fc7d38a3601836d98fe39",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 80,
"avg_line_length": 31.520325203252032,
"alnum_prop": 0.6987361361877741,
"repo_name": "KenKundert/inform",
"id": "51be33570329a74af41791a2ff0861c4738947d8",
"size": "8... |
"""
Description:
Requirements: pySerial, wxPython Phoenix
glossary and of other descriptions:
DMM - digital multimeter
PSU - power supply
SBC - single board computer
INS - general instrument commands
GEN - general sequence instructions
"""
import wx
import theme
import base
# from wx.lib.agw import spinctrl
cl... | {
"content_hash": "a85e7bdde72bcb46308868b28cc47441",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 96,
"avg_line_length": 38.449122807017545,
"alnum_prop": 0.5519255338565432,
"repo_name": "swprojects/Serial-Sequence-Creator",
"id": "6908cffde56a21b72280902a83a4be36dee43b... |
"""Famas URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | {
"content_hash": "33bf1beb4fdd0b7df72a331bbf099f6e",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 89,
"avg_line_length": 37.93333333333333,
"alnum_prop": 0.7065026362038664,
"repo_name": "Pepedou/Famas",
"id": "203b2f1938fdc8e903575283e0912057b85b6b2f",
"size": "1138",
... |
import os
import re
import sys
import traceback
from robot.errors import RobotError
from .platform import JYTHON, RERAISED_EXCEPTIONS
from .unic import unic
EXCLUDE_ROBOT_TRACES = not os.getenv('ROBOT_INTERNAL_TRACES')
if JYTHON:
from java.io import StringWriter, PrintWriter
from java.lang import Throwable,... | {
"content_hash": "c41eb00a679553e6e4bd6b34a7bc7259",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 78,
"avg_line_length": 33.84293193717277,
"alnum_prop": 0.6202042079207921,
"repo_name": "joongh/robotframework",
"id": "f4af61154ceaf9b26b7f9536872824d81a3061c6",
"size":... |
from .census import get_census_profile
from .geography import get_geography, get_locations, get_locations_from_coords, LocationNotFound
__all__ = ['get_census_profile', 'get_elections_profile', 'get_geography',
'get_locations', 'get_locations_from_coords']
| {
"content_hash": "6ccda575071d70c99b954ff155217bd0",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 96,
"avg_line_length": 53.8,
"alnum_prop": 0.7323420074349443,
"repo_name": "callmealien/wazimap_zambia",
"id": "a6008e680000a7cfec6dedd2a30fbeb0980771b9",
"size": "269",
... |
"""
Test for LRUCache without a TTL value.
"""
import pytest
import barrelmagazine
_key = 'test_key'
@pytest.fixture
def cache():
return barrelmagazine.LRUCache()
def test_invalid_get_value_no_value(cache):
with pytest.raises(KeyError):
cache[_key]
def test_valid_get_value(cache):
with pyt... | {
"content_hash": "397b63b458ed1ee976a4c1a68611c548",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 46,
"avg_line_length": 19.46969696969697,
"alnum_prop": 0.6140077821011674,
"repo_name": "cngo-github/barrel-magazine",
"id": "1b48a65f96f066acd20e97cbb92207b43e885c8c",
"s... |
from Bio.PopGen.GenePop import FileParser
import Bio.PopGen.FDist
# Quite a few utility functions could be done (like remove pop,
# add locus, etc...). The recommended strategy is convert back
# and forth from/to GenePop and use GenePop Utils
def convert_genepop_to_fdist(gp_rec, report_pops=None):
"""Converts a ... | {
"content_hash": "9e3b6e16d1bc94e04c05141be8b1b14c",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 82,
"avg_line_length": 32.383495145631066,
"alnum_prop": 0.5588367561085295,
"repo_name": "poojavade/Genomics_Docker",
"id": "da19ee8aae4f650e0214dabb03f35cec7e7ef1b1",
"s... |
import pypcd
import numpy as np
def write_pcd_with_normals(points, normals, output_pcd_filepath):
with open(output_pcd_filepath, 'w') as new_pcd_file:
new_pcd_file.write(
"# .PCD v0.7 - Point Cloud Data file format\n"
"VERSION 0.7\n"
"FIELDS x y z normal_x normal_y nor... | {
"content_hash": "250832bbeeb1a384f6ce58152357f7ed",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 123,
"avg_line_length": 27.663366336633665,
"alnum_prop": 0.6252684323550465,
"repo_name": "CRLab/curvox",
"id": "9667631acd471ab94962abb30bd21eb691e4f610",
"size": "2794"... |
"""Graph mode cluster tests for the experimental `replicate` transformation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import sessi... | {
"content_hash": "be908c717845083f739820e23f63cf72",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 80,
"avg_line_length": 40.1865671641791,
"alnum_prop": 0.664066852367688,
"repo_name": "DavidNorman/tensorflow",
"id": "41acbc804e78b3d759717f05a9d5f60fd1cf5a35",
"size": ... |
import errno
import logging
import os
from airflow import configuration as conf
from airflow.utils.helpers import parse_template_string
from datetime import datetime
class FileProcessorHandler(logging.Handler):
"""
FileProcessorHandler is a python log handler that handles
dag processor logs. It creates a... | {
"content_hash": "25e7ee7d9586c2ab08c07844f149c799",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 82,
"avg_line_length": 36.36220472440945,
"alnum_prop": 0.5961455175400606,
"repo_name": "fenglu-g/incubator-airflow",
"id": "8b0bc978e1aa3297bbe013dc32009fca44098814",
"s... |
"""Core control stuff for Coverage."""
import atexit, os, random, socket, sys
from coverage.annotate import AnnotateReporter
from coverage.backward import string_class
from coverage.codeunit import code_unit_factory, CodeUnit
from coverage.collector import Collector
from coverage.config import CoverageConfig
from cov... | {
"content_hash": "5e19faf38d79008ed43dc0e5fc5ff67a",
"timestamp": "",
"source": "github",
"line_count": 673,
"max_line_length": 84,
"avg_line_length": 38.454680534918275,
"alnum_prop": 0.5993044822256569,
"repo_name": "akiokio/centralfitestoque",
"id": "1d403b56a094f710116eeaa4a751a950d7a1cd78",
"s... |
from CIM14.IEC61970.LoadModel.EnergyArea import EnergyArea
class SubLoadArea(EnergyArea):
"""The class is the second level in a hierarchical structure for grouping of loads for the purpose of load flow load scaling.
"""
def __init__(self, LoadGroups=None, LoadArea=None, *args, **kw_args):
"""Initi... | {
"content_hash": "765745eaa833ea69b95566022d20a981",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 129,
"avg_line_length": 30.696969696969695,
"alnum_prop": 0.6164856860809477,
"repo_name": "rwl/PyCIM",
"id": "83e4a4a4301fffe95f96490d1b35fc1ab6909f20",
"size": "3126",
... |
'''
Credential creation and verification utilities.
'''
import os
import logging
import xmlrpclib
import sys
import datetime
import dateutil
import handler.geni.v3.extensions.sfa.trust.credential as cred
import handler.geni.v3.extensions.sfa.trust.gid as gid
import handler.geni.v3.extensions.sfa.trust.rights as right... | {
"content_hash": "e1b85b91ffbc169de0e909eb61c6a963",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 250,
"avg_line_length": 45.564935064935064,
"alnum_prop": 0.6308963944705714,
"repo_name": "ict-felix/stack",
"id": "f1b6411c3d6c5d173eb856da1a46373d94f08316",
"size": "15... |
from warnings import catch_warnings
with catch_warnings(record=True):
import json
import sys
version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid": "62a87bf4a2af02a8d3bc271ad26e5994292b8e6a",
"version": "0.25.3"
}
''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)... | {
"content_hash": "a88925fb2590eb0b95567bd5b7377109",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 18.88235294117647,
"alnum_prop": 0.7040498442367601,
"repo_name": "kushalbhola/MyStuff",
"id": "842357466ad043abc2961b2d0e4560c78b2a4a6f",
"size": "5... |
'''
Roles in this namespace are meant to provide `MongoDB <http://www.mongodb.org/>`_ database management utilities for Debian distributions.
'''
from cStringIO import StringIO
from configobj import ConfigObj
from provy.core import Role
from provy.more.debian.package.aptitude import AptitudeRole
class MongoDBRole(... | {
"content_hash": "aef548a53d68d14f29b2e9b4b0a975b4",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 174,
"avg_line_length": 35.61271676300578,
"alnum_prop": 0.6099659146242493,
"repo_name": "python-provy/provy",
"id": "127a3babaef372b7ff39fe1a82be2960d2d73dfe",
"size": "... |
import pygame
import Resources, InputState, Vector2, Factory
BG_COLOR = Resources.BLACK
# Classe que armazena a Surface principal do jogo onde tudo sera desenhado
class ScreenManager:
def __init__(self):
#pygame.font.init()
#pygame.mixer.init()
# quantidade de frames por segundo maxima
... | {
"content_hash": "440804fd29945f73f7eea48c4eeb1f78",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 146,
"avg_line_length": 43.96621621621622,
"alnum_prop": 0.6300906715844475,
"repo_name": "iPatso/PyGameProjs",
"id": "c803791ef4e0bfd9993ac6c326fe8f8cafe4771a",
"size": "... |
from ._hcache import Cached
from ._hcache import cached
| {
"content_hash": "410d606e939363586651588295d29859",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.7857142857142857,
"repo_name": "PMBio/limix",
"id": "98cdc3661c4fea8396ea3f878dfbae6e4ba648fa",
"size": "56",
"binary": false,
... |
from city.bus_stop import BusStop
from city.double_stop import DoubleStop
from city.point import Point
from city.tram_stop import TramStop
from transport.bus import Bus
from transport.taxi import Taxi
from transport.tram import Tram
import networkx as nx
from city.edge import Edge
from random import randint
class Env... | {
"content_hash": "03ce2c5ddfa0f38538e8d76e4b41dc9d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 233,
"avg_line_length": 41.083333333333336,
"alnum_prop": 0.5235294117647059,
"repo_name": "PrzemekBurczyk/TransportSimulation",
"id": "b42bde7e2dd5fb9354cc43f2ad61c5858275b... |
from robot.output.xmllogger import XmlLogger
from robot.result.visitor import ResultVisitor
# TODO: Unify XmlLogger and ResultVisitor APIs.
# Perhaps XmlLogger could be ResultVisitor.
class OutputWriter(XmlLogger, ResultVisitor):
def __init__(self, output):
XmlLogger.__init__(self, output, generator='R... | {
"content_hash": "0927d2041e1afcadd5bdccb148841e62",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 73,
"avg_line_length": 29.692307692307693,
"alnum_prop": 0.6778929188255614,
"repo_name": "qitaos/robotframework-mabot",
"id": "21ad4b70c5b30ae1697244fd31f727b1ceef3d4f",
"... |
"""RPC proxy, allows both client/server to connect and match connection.
In normal RPC, client directly connect to server's IP address.
Sometimes this cannot be done when server do not have a static address.
RPCProxy allows both client and server connect to the proxy server,
the proxy server will forward the message b... | {
"content_hash": "ed8d49d574850e83333fe9e075be1d3b",
"timestamp": "",
"source": "github",
"line_count": 693,
"max_line_length": 98,
"avg_line_length": 33.086580086580085,
"alnum_prop": 0.5528370186227048,
"repo_name": "dmlc/tvm",
"id": "c3b0056eb591c83b53016d90b34a899a20bd0359",
"size": "23714",
... |
import numpy as np
import time, math
import matplotlib.pyplot as plt
import pylab
from scipy.interpolate import splprep, splev
import Op, Interface
from GCore import Label
import ISCV
plt.switch_backend('Qt4Agg')
class Track2D(Op.Op):
def __init__(self, name='/Track 2D', locations='', x2dThreshold=0.012, frameRang... | {
"content_hash": "8c682bee4a7bedff28af98964af2e9ec",
"timestamp": "",
"source": "github",
"line_count": 1780,
"max_line_length": 152,
"avg_line_length": 41.02191011235955,
"alnum_prop": 0.6704145496377655,
"repo_name": "davidsoncolin/IMS",
"id": "479864eca198b3a370fecb41ff9d820bb4ff33eb",
"size": "... |
"""
Support for Modbus Register sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.modbus/
"""
import logging
import struct
import voluptuous as vol
import homeassistant.components.modbus as modbus
from homeassistant.const import (
CONF... | {
"content_hash": "64bb837ed1ae3bdebd31bbc87d34424b",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 77,
"avg_line_length": 34.20454545454545,
"alnum_prop": 0.595514950166113,
"repo_name": "ewandor/home-assistant",
"id": "c4014fbd1dd038f05e4783055364c3de27ed66ef",
"size":... |
from django.urls import reverse
from django.contrib.auth.models import User
from rest_framework.test import APITestCase
from mock import patch, call
from .. import models
from sample_app.models import TestRealm, TestAgent
class RealmListViewTestCase(APITestCase):
def setUp(self):
self.user = User.objects... | {
"content_hash": "6a891bd59ef3e0f5bba55515c330b0d1",
"timestamp": "",
"source": "github",
"line_count": 1133,
"max_line_length": 83,
"avg_line_length": 38.11297440423654,
"alnum_prop": 0.5466166458246492,
"repo_name": "jbradberry/django-turn-generation",
"id": "994969c3dc9985034bc82d43f2c752718028597... |
import datetime
import json
import humanize
import os
import urllib
from operator import itemgetter
from django.http import HttpResponse, HttpResponseNotFound
from django.conf.urls import url
class FileChooser(object):
def __init__(self, id, basedir, callback = None):
self.pattern = r'^filechooser/'+id+'... | {
"content_hash": "205cbd03b63ff2072716844abe06e2ef",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 116,
"avg_line_length": 32.98888888888889,
"alnum_prop": 0.5678679690131357,
"repo_name": "martinvw/django-filechooser",
"id": "fbcafca661982bb3cad075abbd9c9778affab144",
"... |
import swapper
from pytz import utc
from datetime import datetime
from django.db.models import Q
from django.urls import reverse
from accelerator.models import (
CoreProfile,
UserRole)
from accelerator.utils import UserAlert
from accelerator_abstract.models import (
ACTIVE_PANEL_STATUS,
CAPTURE_AVAILA... | {
"content_hash": "47aec025fbfb1029a3eab5b2e1c66acc",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 78,
"avg_line_length": 37.36434108527132,
"alnum_prop": 0.6367219917012448,
"repo_name": "masschallenge/django-accelerator",
"id": "b9a7333ceb228410b01ec5a2db37a368e5f78d17"... |
"""TensorFlow-related utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.eager import context
from tensorflow.python.framework import composite_tensor
from tensorflow.python.framework import ops
from tensorflow.p... | {
"content_hash": "c89f710c883008020ffdc74fe8cf2112",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 80,
"avg_line_length": 30.68075117370892,
"alnum_prop": 0.6912777352716144,
"repo_name": "ppwwyyxx/tensorflow",
"id": "cec7497851f98cfa929de4411558677bc42c7043",
"size": "... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from airy.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._lock ... | {
"content_hash": "a07f4595bca966b8454e6d962a4b0d5e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 33.3235294117647,
"alnum_prop": 0.5728155339805825,
"repo_name": "letolab/airy",
"id": "90edebbbfb23b577e3a4ab7f2e4d4f6c65e05e22",
"size": "1133",
... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['MovingAverage'] , ['NoCycle'] , ['LSTM'] ); | {
"content_hash": "0ee78474fa4b006860fc87839c887d7f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 91,
"avg_line_length": 41,
"alnum_prop": 0.725609756097561,
"repo_name": "antoinecarme/pyaf",
"id": "556bb359d003f420021e1cadd4def7181e8d6b68",
"size": "164",
"binary": fa... |
import kasparGUI.Model as Model
models = [
{'class': Model.CustomAction, },
{'class': Model.CustomTrigger, },
{'class': Model.User, },
]
blueprints = []
| {
"content_hash": "6c2d0608801ec368c697af17fb439857",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 43,
"avg_line_length": 22.555555555555557,
"alnum_prop": 0.5024630541871922,
"repo_name": "scheunemann/KASPAR",
"id": "ee85ea9cbcb9d5f13df782441c103e730d579eb5",
"size": "20... |
from ggrc import db
from ggrc.access_control.roleable import Roleable
from ggrc.fulltext.mixin import Indexed
from .mixins import BusinessObject, Timeboxed, CustomAttributable
from .object_owner import Ownable
from .object_person import Personable
from .relationship import Relatable
from .track_object_state import HasO... | {
"content_hash": "cc7f7e71b03e23f095da3414ec442023",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 34.22222222222222,
"alnum_prop": 0.7483766233766234,
"repo_name": "AleksNeStu/ggrc-core",
"id": "e634f36912d7df905ddd488f495edb72edaea37f",
"size": "... |
from __future__ import absolute_import
import bootstrap
import unittest
from nark import *
class TimeTests(unittest.TestCase):
def test_convert_to_timestamp_and_back(self):
a = Assert()
now = DateTime.now()
timestamp = DateTime.as_timestamp(now)
datetime = Timestamp.as_datetime(timestamp)
a.true... | {
"content_hash": "25046a315128599d2ce80ecb1011019f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 24.764705882352942,
"alnum_prop": 0.6959619952494062,
"repo_name": "shadowmint/python-nark",
"id": "db9be6135241df047c1309bd213823783f8dce93",
"size"... |
from suplemon.suplemon_module import Module
class Upper(Module):
def run(self, app, editor, args):
line_nums = []
for cursor in editor.cursors:
if cursor.y not in line_nums:
line_nums.append(cursor.y)
data = editor.lines[cursor.y].get_data().upper()
... | {
"content_hash": "a9198d6b3426f2d2ac28d9c04abd32da",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 26.5625,
"alnum_prop": 0.5647058823529412,
"repo_name": "severin31/suplemon",
"id": "d6679ab5fa42adeb12b0d1688aacc3fc7cc4c838",
"size": "448",
"bin... |
import argparse
import cgi
import json
import logging
import os
import subprocess
import sys
import tempfile
import time
_SRC_DIR = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'catapult', 'devil'))
from devil.android import devi... | {
"content_hash": "aa9a304a38833c17fffcea4539c50f36",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 80,
"avg_line_length": 32.64741641337386,
"alnum_prop": 0.6600875151289451,
"repo_name": "junhuac/MQUIC",
"id": "fd1ba4ef9eb89194044918ff27e843a9121039ae",
"size": "10923"... |
import unittest
import numpy as np
import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.fluid.layers as layers
class TranspilerTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.trainer_id = 0
self.trainers = 2
self.pservers = 2
self.pserve... | {
"content_hash": "a6954b34fd34a16db2ee73a7d05fa822",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 76,
"avg_line_length": 29.93220338983051,
"alnum_prop": 0.5855039637599094,
"repo_name": "Canpio/Paddle",
"id": "d84c5d9c41c705cf6d14cc0b5a8c692b0d646337",
"size": "2379",
... |
"""Parallel workflow execution via PBS/Torque
"""
import os
import sys
from .base import (GraphPluginBase, logger)
from ...interfaces.base import CommandLine
class PBSGraphPlugin(GraphPluginBase):
"""Execute using PBS/Torque
The plugin_args input to run can be used to control the SGE execution.
Curren... | {
"content_hash": "b4a80d5e528eaa39c144a4beff34c4c8",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 39.42424242424242,
"alnum_prop": 0.5172943889315911,
"repo_name": "christianbrodbeck/nipype",
"id": "c177973d9170196c7bf7c0c06a41d76743c8bbe8",
"size... |
from ..DynamicDiffusionModel import DynamicDiffusionModel
import numpy as np
import networkx as nx
import future.utils
__author__ = "Giulio Rossetti"
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"
class DynSIRModel(DynamicDiffusionModel):
"""
Model Parameters to be specified via Mode... | {
"content_hash": "185b325e2d71f3a8f530dddd37740f42",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 97,
"avg_line_length": 36.419117647058826,
"alnum_prop": 0.4910155461336564,
"repo_name": "GiulioRossetti/ndlib",
"id": "1861af556f91f41a9ad85bcdb378b303d1dd00e0",
"size":... |
"""
sentry.management.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand
from optparse imp... | {
"content_hash": "7ab4620d9fff1116fcedb54f1e733ff4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 107,
"avg_line_length": 34.05714285714286,
"alnum_prop": 0.6426174496644296,
"repo_name": "llonchj/sentry",
"id": "c98a615536f9b0e1a43bcbe496af5ec7e5e006d8",
"size": "1192"... |
import argparse
import json
from pipeline.backend.pipeline import PipeLine
from pipeline.component import DataTransform
from pipeline.component import Evaluation
from pipeline.component import HomoLR
from pipeline.component import Reader
from pipeline.interface import Data
from pipeline.interface import Model
from pip... | {
"content_hash": "c237befb6379c1681d80b8bc0ba8ea2d",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 101,
"avg_line_length": 32.716981132075475,
"alnum_prop": 0.6242791234140715,
"repo_name": "FederatedAI/FATE",
"id": "dbb419f41a381d2ad383237e3575f9ceff94afc8",
"size": "4... |
from flask_philo.serializers import BaseSerializer, uuid_schema
from tests.test_app.models import User
class GetUserSerializer(BaseSerializer):
"""
Used to serialize get resopnses
"""
_schema = {
'type': 'object',
'properties': {
'id': {'type': 'number'},
'email... | {
"content_hash": "f2ae40ea1ea9a3a74164fad2f1a8f617",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 68,
"avg_line_length": 28.050632911392405,
"alnum_prop": 0.4824007220216607,
"repo_name": "maigfrga/flaskutils",
"id": "7a1d224fc8fb2604437c45784a01676a48109a67",
"size": "... |
"""CSV single-pass output plugin."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import zipfile
from future.builtins import str
from grr_response_core.lib import utils
from grr_response_core.lib.rdfvalues import structs as rdf_structs
from ... | {
"content_hash": "2def107461a31397dad82c5627484fcc",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 80,
"avg_line_length": 33.27777777777778,
"alnum_prop": 0.6844741235392321,
"repo_name": "demonchild2112/travis-test",
"id": "785ebc31d7116c141ecf81c3dd24f065b57090a2",
"s... |
import unittest
from katas.kyu_7.string_chunks import string_chunk
class StringChunkTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(string_chunk('codewars', 2),
['co', 'de', 'wa', 'rs'])
def test_equal_2(self):
self.assertEqual(string_chunk('thi... | {
"content_hash": "8ed257927404c506eca5eab348496570",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 69,
"avg_line_length": 30.346153846153847,
"alnum_prop": 0.5640050697084917,
"repo_name": "the-zebulan/CodeWars",
"id": "e1a0e4e926dbfae24f2b79670a8f0a504744a2d2",
"size": ... |
"""
A collection of language information for use in FeatureExtraction.
"""
from .language import get, register, Language
from . import english
| {
"content_hash": "544aeca543bbb5e6c3da56220b4435e0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 66,
"avg_line_length": 20.714285714285715,
"alnum_prop": 0.7655172413793103,
"repo_name": "wikimedia/Wiki-Class",
"id": "b249c935ac3e65548f29e1fdc0aa14e2a1185ca8",
"size": "... |
import logging
import cgtk_log
log = cgtk_log.cgtk_log(level=logging.INFO)
def load_sheves():
pass
if __name__ == "__main__":
load_sheves()
| {
"content_hash": "71dfef9229ce08f586621e8170a5d0a5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 43,
"avg_line_length": 12.75,
"alnum_prop": 0.6274509803921569,
"repo_name": "cineuse/CNCGToolKit",
"id": "cb1be36f669f7388c81f68b4f4635e6f44970824",
"size": "197",
"bina... |
import ShareYourSystem as SYS
#define
MyTeamDict=SYS.Teamer.TeamDict([('a',1),('b',2)])
#print
print('MyTeamDict is ')
SYS._print(MyTeamDict)
#get
print(MyTeamDict.getValue(0))
print(MyTeamDict.getValue(1))
| {
"content_hash": "a65056b28299acfddfb49e8cca7b378e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 49,
"avg_line_length": 15.142857142857142,
"alnum_prop": 0.7264150943396226,
"repo_name": "Ledoux/ShareYourSystem",
"id": "ca7bb9c82c711cdd41357342755cc83abc20ab2d",
"size"... |
import sys, os
sys.path.insert(0, os.path.abspath('../src'))
from vcstools.__version__ import version
# 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 absol... | {
"content_hash": "5d281e68b3e1c798387443542eeb90c2",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 84,
"avg_line_length": 32.88834951456311,
"alnum_prop": 0.7076014760147602,
"repo_name": "k-okada/vcstools",
"id": "3c4f45d8c69ed01fa45f293561ed89bb4cd671c6",
"size": "719... |
import sys, argparse
import urllib2, cookielib
class cookie_settings(object):
def __init__(self, url, port=None, ssl=None, verbosity=True):
self.url = url
self.server = url.split('/')[0]
self.path = '/'+'/'.join(url.split('/')[1:])
self.port = port or (443 if ssl else 80)
se... | {
"content_hash": "b0473bed71129900068df0141e1e05c0",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 111,
"avg_line_length": 36.3421052631579,
"alnum_prop": 0.5191889934829833,
"repo_name": "amckenna/fruit_picker",
"id": "65a1e0767d5e022309dbe3a5b73eedfb0cc0ae67",
"size": ... |
from window import Window
from mapwindow import MapWindow
from map import Map
from draw import draw
from plot import plot
from gif import GIF
| {
"content_hash": "c6a6f7fbedae0db6b19a169fd1608731",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 31,
"avg_line_length": 18,
"alnum_prop": 0.8194444444444444,
"repo_name": "geoscript/geoscript-py",
"id": "5a9a17b55683117356f90b80fd419bc93b1f9883",
"size": "144",
"binar... |
"""
A real simple app for using webapp2 with auth and session.
It just covers the basics. Creating a user, login, logout
and a decorator for protecting certain handlers.
Routes are setup in routes.py and added in main.py
"""
# standard library imports
import logging
import json
# related third party ... | {
"content_hash": "486fd053cb4f365ee094684f124b4ea6",
"timestamp": "",
"source": "github",
"line_count": 1699,
"max_line_length": 128,
"avg_line_length": 42.45732783990583,
"alnum_prop": 0.5267207319609066,
"repo_name": "eugenewong/AirShare",
"id": "e27f978bbdc7b3fb2ea5d72fa656baa9006fe8e7",
"size":... |
import numpy as np
from sft.agent.model.KerasMlpModel import KerasMlpModel
class KerasMlpModelNew(KerasMlpModel):
def __init__(self, logger, layers, loss, optimizer):
super(KerasMlpModelNew, self).__init__(logger, layers, loss, optimizer)
def predict_qs(self, state):
# assume one channel and one sample
X = ... | {
"content_hash": "a7cba266172d8909531d0d9212ef416b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 74,
"avg_line_length": 32.285714285714285,
"alnum_prop": 0.6283185840707964,
"repo_name": "kevinkepp/look-at-this",
"id": "df3d9ab7d1c7949cd0fceff2573af40ec86bafc6",
"size"... |
import nussl
import matplotlib.pyplot as plt
import time
start_time = time.time()
audio_path = nussl.efz_utils.download_audio_file(
'historyrepeating_7olLrex.wav')
audio_signal = nussl.AudioSignal(audio_path)
separator = nussl.separation.primitive.Repet(
audio_signal, mask_type='binary')
estimates = separator... | {
"content_hash": "fa147c7baa0550d2b546ca94610adf61",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 68,
"avg_line_length": 28.633333333333333,
"alnum_prop": 0.7217694994179278,
"repo_name": "interactiveaudiolab/nussl",
"id": "0a9438a7defa7ff8117f659a7d521c0a26ac8696",
"si... |
""" Define the class _KNNModel_, used to represent a k-nearest neighbhors model
"""
from rdkit.DataStructs.TopNContainer import TopNContainer
class KNNModel(object):
""" This is a base class used by KNNClassificationModel
and KNNRegressionModel to represent a k-nearest neighbor predictor. In general
one of thi... | {
"content_hash": "a19778333634545d2fc9a1e69b287b07",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 94,
"avg_line_length": 29.054054054054053,
"alnum_prop": 0.6818604651162791,
"repo_name": "rvianello/rdkit",
"id": "0200abe951fde04454f3c352520af798d0b2cb5a",
"size": "2233... |
"""Support for the Netatmo binary sensors."""
import logging
import pyatmo
from homeassistant.components.binary_sensor import BinarySensorDevice
from .camera import CameraData
from .const import AUTH, DOMAIN, MANUFACTURER
_LOGGER = logging.getLogger(__name__)
# These are the available sensors mapped to binary_sens... | {
"content_hash": "f10a442410522ffba0d543b94e967bba",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 87,
"avg_line_length": 37.40886699507389,
"alnum_prop": 0.5360811166710561,
"repo_name": "postlund/home-assistant",
"id": "5f419bda2c25164e3af0e351981c7257e09687a7",
"size... |
"""
This is an integration test for the BigQuery-luigi binding.
This test requires credentials that can access GCS & access to a bucket below.
Follow the directions in the gcloud tools to set up local credentials.
"""
import json
import os
import luigi
from luigi.contrib import bigquery
from contrib import gcs_test... | {
"content_hash": "5cc1536d2df083bf637303828312354b",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 92,
"avg_line_length": 32.89320388349515,
"alnum_prop": 0.6304604486422668,
"repo_name": "rizzatti/luigi",
"id": "61c2ccbf0869b21458c76754d280c61309f1ec08",
"size": "3988"... |
"""Guardian Search web application
A small, simple web application which allows a user to search for
articles on the Guardian's website (http://www.guardian.co.uk) using
simple queries.
The aim of this project is primarily to learn about the Guardian's
Open Platform Content API (http://www.guardian.co.uk/open-platfor... | {
"content_hash": "a6f2e95ad0ce70e802eab759b383134f",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 34.35820895522388,
"alnum_prop": 0.6092528236316247,
"repo_name": "alnesbit/guasearch",
"id": "249b37fa7177891b52e5d87b1eb2b6f454721f78",
"size": "4... |
import sys
import urllib2
import math
def getSongLink(name, song):
searchLink = "http://www.allmusic.com/search/songs/"
#Seperate the words to make a correct link
words = song.rsplit(" ")
allWords = name.rsplit(" ")
link = "http://allmusic.com" #This will hold the link to the actual album
... | {
"content_hash": "2fe0e72a874e58b7005ad6e928e52f9f",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 109,
"avg_line_length": 37.36521739130435,
"alnum_prop": 0.5038398882941587,
"repo_name": "aacoppa/Song-Downloader",
"id": "4971b1c32c24dc9e8a8b193413e1204e0dbce063",
"siz... |
import sys
from devp2p.service import BaseService
from ethereum.db import BaseDB
from ethereum.slogging import get_logger
from ephemdb_service import EphemDB
log = get_logger('db')
dbs = {}
dbs['EphemDB'] = EphemDB
try:
from leveldb_service import LevelDBService
except ImportError:
pass
else:
dbs['Level... | {
"content_hash": "36a967223809b2f94f1ef125ad889106",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 88,
"avg_line_length": 21.791208791208792,
"alnum_prop": 0.6333837619768028,
"repo_name": "gsalgado/pyethapp",
"id": "ed1c672570c4153d233b77caeee24633b927a7e0",
"size": "20... |
from cs import CloudStackApiException
from cosmic.base import *
from cosmic.common import *
from cosmic.cosmicLog import CosmicLog
from cosmic.cosmicTestCase import cosmicTestCase
class TestSSVMs(cosmicTestCase):
def setUp(self):
self.logger = CosmicLog(CosmicLog.LOGGER_TEST).get_logger()
self.te... | {
"content_hash": "c859780818bbaf61f7ddcc81bc918d51",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 127,
"avg_line_length": 33.7008547008547,
"alnum_prop": 0.5492433849015133,
"repo_name": "MissionCriticalCloud/cosmic",
"id": "fd92fd59be45fb24b003fda1bb461081785b46ad",
"... |
"""Utilities for working with multiple processes, including both forking
the server into multiple processes and managing subprocesses.
"""
from __future__ import absolute_import, division, print_function
import errno
import os
import signal
import subprocess
import sys
import time
from binascii import hexlify
from ... | {
"content_hash": "76cc91f5a9a0eabfd182a0299e56b4be",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 82,
"avg_line_length": 34.41907514450867,
"alnum_prop": 0.6198673272315056,
"repo_name": "Lancher/tornado",
"id": "122fd7e14b47bf478ee8a93570f76c16c6e9f370",
"size": "1248... |
""" Atop log data analyzer.
Usage:
{cmd} metrics [-c <cmd>] [-p <path>] [-e <time>] [-r <hours>]
{cmd} (csv|json|table) [-c <cmd>] [-p <path>] [-e <time>] [-r <hours>] [<metric>...]
{cmd} (diagram|gnuplot) [-c <cmd>] [-p <path>] [-e <time>] [-r <hours>] [-x <lines>] [-y <lines>] [<metric>...]
Options:
diag... | {
"content_hash": "e85d67886efc18ca78eb3d65100abb12",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 119,
"avg_line_length": 36.25668449197861,
"alnum_prop": 0.5011061946902655,
"repo_name": "efenka/aplot",
"id": "58f5e01aed0ee6c190684c9d7b6a49f9753b8846",
"size": "13600"... |
import os
from os.path import abspath, join, dirname
from sys import path
from envs.keys_and_passwords import *
PROJECT_ROOT = abspath(join(dirname(__file__), "../"))
APPS_DIR = abspath(join(dirname(__file__), "../", "apps"))
path.insert(0, PROJECT_ROOT)
path.insert(0, APPS_DIR)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
... | {
"content_hash": "20a1e83e7972d3e9bdd9d058daf36d45",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 84,
"avg_line_length": 28.4875,
"alnum_prop": 0.6845107503290917,
"repo_name": "hobson/totalgood",
"id": "521091f8d21576a154b79ff8bd95b348fb137455",
"size": "6837",
"bin... |
import dataclasses
import json # type: ignore
import re
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
import warnings
from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming
from google.api_core import exceptions as core_exceptions
from google.api_core import retr... | {
"content_hash": "ca1d953471b217f400893d8457d6f03f",
"timestamp": "",
"source": "github",
"line_count": 856,
"max_line_length": 112,
"avg_line_length": 40.41238317757009,
"alnum_prop": 0.5918538432630879,
"repo_name": "googleapis/python-compute",
"id": "6c6305e5eecbe3717fb65a409249fc8a1a590388",
"s... |
"""Day 6: Universal Orbit Map"""
import math
from collections import defaultdict, deque
from copy import deepcopy
from typing import DefaultDict, Iterator, List, NamedTuple, Tuple
import aoc
DAY = 6
OrbitGraph = DefaultDict[str, List[str]]
def parse_input(input_text: str) -> OrbitGraph:
orbits: OrbitGraph = de... | {
"content_hash": "fd26c523ab8cc2cc3475ed88d342076d",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 81,
"avg_line_length": 29.06122448979592,
"alnum_prop": 0.6357677902621723,
"repo_name": "robjwells/adventofcode-solutions",
"id": "575c7323607ca37bb1ad3bcf43f942e74774eaa8"... |
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import Sequence, Func, Wait
from menu import Menu
import os
import json
from pathlib import Path
class Load(Menu):
def __init__(self):
super().__init__()
self.parentNode = aspect2d.attachNewNode('Load')
self.backButton... | {
"content_hash": "ecb0df751ac9b9d680086409697121cd",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 116,
"avg_line_length": 50.921052631578945,
"alnum_prop": 0.5488372093023256,
"repo_name": "Aklaran/trickingGame",
"id": "81c1d1c8bf83352bd5acad59d45635be5fff0b70",
"size":... |
from haystack import indexes
from oscar.core.loading import get_class, get_model
# Load default strategy (without a user/request)
is_solr_supported = get_class('search.features', 'is_solr_supported')
Selector = get_class('partner.strategy', 'Selector')
strategy = Selector().strategy()
class ProductIndex(indexes.Mod... | {
"content_hash": "fbdce984f7e8e06c43244de1651117f6",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 79,
"avg_line_length": 35.608695652173914,
"alnum_prop": 0.663003663003663,
"repo_name": "angelsantosa/ad-manage",
"id": "1a01d728b158139d58ed6f19e5f1c9450af57e05",
"size"... |
from asposebarcode import Settings
from com.aspose.barcode import BarCodeBuilder
from com.aspose.barcode import Symbology
from com.aspose.barcode import AustraliaPostFormatControlCode
class ManageDimension:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithBarcode/AdvanceBarcodeFeatures/ManageD... | {
"content_hash": "5e9985847891c4de2fcc94c856e18ce4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 97,
"avg_line_length": 29.18,
"alnum_prop": 0.6572995202193284,
"repo_name": "asposebarcode/Aspose_BarCode_Java",
"id": "283fef6697c90b941fd85e6299bf8acd233c0896",
"size": ... |
import os
db = os.getenv('DB', "mongodb")
mongodb_uri = os.getenv('MONGODB_URI', "mongodb://username:password@host:port/db")
salt = os.getenv('salt', "")
rethink_db_host = os.getenv('RETHINK_DB_HOST', "localhost")
rethink_db_port = os.getenv('RETHINK_DB_PORT', "28015")
metadata_key = "st::"
reserved_words = ['sor... | {
"content_hash": "c4c2c0cfa57e2eeb4cf01d5ffddc0458",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 82,
"avg_line_length": 26.8125,
"alnum_prop": 0.6923076923076923,
"repo_name": "snclucas/stashy",
"id": "8a5a0fc318d3ac3a61fd7dc9a62363296fecd733",
"size": "429",
"binary... |
import sys
import os
import azure.cli.main
from azure.cli.core.telemetry import (init_telemetry, user_agrees_to_telemetry,
telemetry_flush, log_telemetry)
try:
try:
if user_agrees_to_telemetry():
init_telemetry()
except Exception: #pylint: disable=bro... | {
"content_hash": "b65c90e3861c93f934da0732e876e810",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 26.647058823529413,
"alnum_prop": 0.6169977924944813,
"repo_name": "BurtBiel/azure-cli",
"id": "96ab52b1481c6d6c3345af50b7c817988d3752ff",
"size": "1... |
from collections import namedtuple, OrderedDict
from ast import literal_eval
import re
from datetime import datetime
import sys
ScriptFunction = \
namedtuple('Method', ['definition', 'signature', 'body', 'sha1'])
class Scripts(object):
def __init__(self):
self.namespaces = { 'default': {} }
def a... | {
"content_hash": "1c9889187df2fbc14edf1da4cc66c2b5",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 35.28155339805825,
"alnum_prop": 0.49036873968079253,
"repo_name": "Ostico/pyorient",
"id": "bcd6f69231ae6ae786350e3525e8cdbca55e999b",
"size": "363... |
import numpy as np
from copy import copy
import pandas as pd
class constant:
def __init__(self, val):
self.val = val
def rvs(self, size=1):
if size == 1:
return copy(self.val)
return np.asarray([copy(self.val) for _ in range(size)])
def invert_value_mapping(value_mapping... | {
"content_hash": "3930c0e86473690ff1b378095cade0ad",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 69,
"avg_line_length": 23.204545454545453,
"alnum_prop": 0.6258570029382958,
"repo_name": "DLunin/pygraphmodels",
"id": "1b5a1ae9d98fd9fbc1770ed230a182efb4708226",
"size": ... |
from Geometry import ListGeoms
import Tools.web as web
import logging
log = logging.getLogger(__name__)
class IRC(ListGeoms):
def __init__(self,other=None):
#IRC specific lines
self.direction = 1
self.both = False
ListGeoms.__init__(self,other)
def __nonzero__(self):
... | {
"content_hash": "6a2328820c0f21dced59018249bbeb0d",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 141,
"avg_line_length": 29.15686274509804,
"alnum_prop": 0.5225285810356423,
"repo_name": "mtthwflst/terse",
"id": "87b87428b79ca4cdd057beb91565a15a698438e4",
"size": "297... |
import math
VERBOSE = False # enables various prints during the algorithm execution. Used for debugging purpose or for the purpose of simulating the algorithm by hand and checking the various steps against those made by this program.
LITERALS_COST_FUNCTION = 0 # TODO explain (refer to Reti Logice book for explaination... | {
"content_hash": "4e9c75e9166031fd90d34e01479eaa24",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 221,
"avg_line_length": 41.126315789473686,
"alnum_prop": 0.5379233853766744,
"repo_name": "massivezh/qmc",
"id": "b3b6d8f23f8423b9d48ad9728ba0138dee37a29e",
"size": "2441... |
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
from oslo_config import cfg
from cloudbaseinit.tests import testutils
from cloudbaseinit.utils import network
CONF = cfg.CONF
class NetworkUtilsTest(unittest.TestCase):
@mock.patch('sys.platform', new='win32')
@mock... | {
"content_hash": "d1834d7382b090e1d602f0a05a53c665",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 38.28169014084507,
"alnum_prop": 0.6103752759381899,
"repo_name": "cmin764/cloudbase-init",
"id": "f10aaabe0922bc2f237432d3f24201fedb17746b",
"size":... |
import re
import sys
import requests
def searchDatabase(startDate, endDate, searchText, stateArray):
# Database imposed year range
STARTYEAR = 1789
ENDYEAR = 1922
# check if all arguments are present
if len(sys.argv) >= 5:
if startDate >= STARTYEAR and endDate <= ENDYEAR:
pri... | {
"content_hash": "a474cc6201144b36c7014a4bc6ea4579",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 123,
"avg_line_length": 41.36363636363637,
"alnum_prop": 0.46373626373626375,
"repo_name": "azharhussain96/newspaperDatabaseSearch",
"id": "d326ca696868b9c14db746a6d377367c3d... |
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 'OrganizationMember.counter'
db.add_column(
'sentry_organizationmember'... | {
"content_hash": "8d99317833e053c65cdb0bdd87772364",
"timestamp": "",
"source": "github",
"line_count": 1492,
"max_line_length": 101,
"avg_line_length": 36.34517426273459,
"alnum_prop": 0.3923137920224243,
"repo_name": "jean/sentry",
"id": "3ffc1b7b91a8e8e967b466deea2846552e55c15a",
"size": "54251"... |
import os
import os.path
import sys
import tempfile
import subprocess
import logging
# This and check_output are shims to support features of Python 2.7
# on Python 2.6.
#
# This code was borrowed from PyPy 2.7.
# bitbucket.org/pypy/pypy/src/9d88b4875d6e/lib-python/2.7/subprocess.py
#
# This can be removed when t... | {
"content_hash": "d38b7adf31bca122a28b1f0922c1175f",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 36.773809523809526,
"alnum_prop": 0.5768857235351247,
"repo_name": "cloudn/cf-php-build-pack",
"id": "2a992486e9bdd6a621868831912905b6a15ccb78",
"si... |
import os
import tempfile
import unittest
import time
import math
import re
import platform
import uuid
import pwd
import signal
from functools import partial
from multiprocessing import Process, Event
from ast import literal_eval
import psutil
from thrift.protocol import TBinaryProtocol
from plow.rndaemon imp... | {
"content_hash": "3c08bbcef1a7d03ec3c1bb4f0ef99e1b",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 111,
"avg_line_length": 29.789934354485776,
"alnum_prop": 0.575657411488174,
"repo_name": "chadmv/plow",
"id": "77c9413373123ef96bc6f829449c71d5e9487bb5",
"size": "13637",... |
#
## Licensed to the .NET Foundation under one or more agreements.
## The .NET Foundation licenses this file to you under the MIT license.
## See the LICENSE file in the project root for more information.
#
#
#USAGE:
#Add Events: modify <root>src/vm/ClrEtwAll.man
#Look at the Code in <root>/src/scripts/genLttngProvid... | {
"content_hash": "3a9cefae24ef101c15f860aa34c1e75d",
"timestamp": "",
"source": "github",
"line_count": 818,
"max_line_length": 127,
"avg_line_length": 34.84841075794621,
"alnum_prop": 0.5873851119062653,
"repo_name": "JosephTremoulet/coreclr",
"id": "123ce81be4f35630921ed336f07c3f6e1689170c",
"siz... |
import flyer
import pyuv
import signal
import socket
class PyuvAdaptor(object):
"""pyuv event loop adaptor."""
def __init__(self, listener):
self._listener = listener
self._is_connected = False
self._is_writable = False
self._loop = pyuv.Loop.default_loop()
return
... | {
"content_hash": "6f253d8b351dbc476fdf62b9b04f7b31",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 70,
"avg_line_length": 23.39160839160839,
"alnum_prop": 0.5910313901345291,
"repo_name": "FIXFlyer/pyflyer",
"id": "cda8650d2cc952b68fb77dbf6825eb85ee551eeb",
"size": "334... |
import nltk
import os.path
from nltk.corpus import stopwords
from nltk.collocations import *
from urllib import urlopen
unnecessary = ["http", ":", "RT", "@", "&", ";", "I", "'m", "(", ")", "lt", "...", "n't", "``", "''", "gt", "!", "[", "]", "?", "#", "--", "-", "YouTube", ".", ",","=","'s","'ll" ]
url = "http://ils.u... | {
"content_hash": "c92675873a950fde87e8cbf05452b4f5",
"timestamp": "",
"source": "github",
"line_count": 435,
"max_line_length": 180,
"avg_line_length": 45.760919540229885,
"alnum_prop": 0.7256103687330453,
"repo_name": "britth/inls890-microblog",
"id": "affba945bcf44682f0c2642fc9b366e0bb795edb",
"s... |
import logging
import datetime as dt
import numpy as np
from opyrant import (EndSession,
EndExperiment,
ComponentError,
InterfaceError,
utils)
logger = logging.getLogger(__name__)
class State(object):
""" States provide a nice in... | {
"content_hash": "c9a30813b87888585cd1ff39b2bb17d2",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 298,
"avg_line_length": 31.48138957816377,
"alnum_prop": 0.614566091274533,
"repo_name": "opyrant/opyrant",
"id": "93a01dd6ef39afa3c2fee9cfff4d0de4baa1fb95",
"size": "1268... |
import os
import sys
from setuptools import setup, find_packages
version = '0.3.3'
def get_package_manifest(filename):
packages = []
with open(filename) as package_file:
for line in package_file.readlines():
line = line.strip()
if not line:
continue
... | {
"content_hash": "045e2d93ed3aa4c4b021eb1e497a5b11",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 75,
"avg_line_length": 25.305882352941175,
"alnum_prop": 0.594607159460716,
"repo_name": "njoyce/sockjs-gevent",
"id": "865849c6bd13fd18622333b7a97d4874136554a1",
"size": "... |
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.views.generic import ListView, UpdateView
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import get_object_or_404
from django.contrib.contenttypes.models import Con... | {
"content_hash": "dab776c0fa579552ae0374b2dcd59a42",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 123,
"avg_line_length": 45.161490683229815,
"alnum_prop": 0.6182093247146198,
"repo_name": "vIiRuS/Lagerregal",
"id": "6b48fb681e1e6383979d70b5c43e5de7b983504d",
"size": "... |
#!/usr/bin/env python3
import codecs
#from pprint import pprint
key_map = {
'COUNT': 'count',
'KEY': 'key',
'PLAINTEXT': 'plain',
'CIPHERTEXT': 'cipher',
}
def c_escaped_string(s, encoding='latin'):
if isinstance(s, str):
s = s.encode(encoding)
s = s.decode('latin')
result = ''
... | {
"content_hash": "c596dc145f8899b25925ed33bc5717cb",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 96,
"avg_line_length": 30.486486486486488,
"alnum_prop": 0.5132978723404256,
"repo_name": "cmcqueen/aes-min",
"id": "763ecd1d0837498b9fca6b154b720094cfa49fc6",
"size": "33... |
import argparse
import glob
import multiprocessing
import os
import shutil
import subprocess
import sys
from parse_link_map import parse_link_map
sys.path.append(
os.path.join(
os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils'))
import comment_on_pr
# Only show diff 1KB or greater
diff... | {
"content_hash": "f425f441c05ed387eddaf7d3eb1f0a9d",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 132,
"avg_line_length": 37,
"alnum_prop": 0.5554659136748689,
"repo_name": "thinkerou/grpc",
"id": "d4d134fef3725c41692e088fd9fdd6e021148c05",
"size": "5563",
"binary": ... |
from . import opdict_data
from . import entities
import sys
opdict = {}
import os
def _lookup_entity(content):
if content.startswith('&') and content.endswith(';'):
return entities.map[content[1:-1]]
else:
return content
for line in opdict_data.data.split('\n'):
tokens = line.split()
if not tokens... | {
"content_hash": "4940749288fbbf817911a727eb309fdf",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 57,
"avg_line_length": 21.96923076923077,
"alnum_prop": 0.5980392156862745,
"repo_name": "ahjulstad/mathdom-python3",
"id": "274715ad12f32bc9b1db053d07a706d494596b90",
"siz... |
import plot
import model
import dataset
import sys
import numpy as np
import os.path as path
group_id = int(sys.argv[1])
cluster = model.load(path.realpath(sys.argv[2]))
articles = dataset.news.fetch(100000)
nodes = cluster['group'][group_id, 0:cluster['group_size'][group_id]]
print('nodes: ', nodes)
for node_id in... | {
"content_hash": "7ee8469bb366c1e9caad72b9adf9e3a2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 69,
"avg_line_length": 22.941176470588236,
"alnum_prop": 0.6974358974358974,
"repo_name": "AndreasMadsen/bachelor-code",
"id": "b1c781542043018bfd502a88bfeb338def604b4f",
"... |
from webob import Request
from fixtures import ServerFixture
class TestInput(ServerFixture):
def make_app(self):
def app(environ, start_response):
req = Request(environ)
status = "200 OK"
body =\
"""
<html>
<head><title>form page</title></hea... | {
"content_hash": "956bc93e2c65a196c356ef24230acb2c",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 74,
"avg_line_length": 36.179245283018865,
"alnum_prop": 0.4863102998696219,
"repo_name": "storborg/livetest",
"id": "9ba3312c338c3346805cf356370181baa8e84a94",
"size": "3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.