text stringlengths 4 1.02M | meta dict |
|---|---|
"""This example gets all packages in progress.
"""
# Import appropriate modules from the client library.
from googleads import ad_manager
def main(client):
# Initialize appropriate service.
pkg_service = client.GetService('PackageService', version='v201805')
# Create a statement to select packages.
statement... | {
"content_hash": "d470593fb53e371fc8e1a1ff8d60bef1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 35.25,
"alnum_prop": 0.6713947990543735,
"repo_name": "Aloomaio/googleads-python-lib",
"id": "1093281b91ce95fe081be729a6e704a1fd59a2b6",
"size": "189... |
import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from engine.models import WebPage
from engine.crawler import get_page
from engine.forms import WebPageForm
from engine.tasks import crawler_v2
import hashlib
def simple_crawl(page):
# Crawl URL
#pa... | {
"content_hash": "033ed78cc3fc4364b71a0adf03dc317c",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 84,
"avg_line_length": 26.319444444444443,
"alnum_prop": 0.5641160949868074,
"repo_name": "tanguy-s/ucl-search-engine",
"id": "af8f64c700619c541c2a4342f1ad41dfe3766f9f",
"s... |
from __future__ import unicode_literals
import argparse
import logging
import re
from streamlink.compat import parse_qsl, is_py2
from streamlink.plugin import Plugin, PluginError, PluginArguments, PluginArgument
from streamlink.plugin.api import validate, useragents
from streamlink.plugin.api.utils import itertags, p... | {
"content_hash": "885079da50956d325482715dbc138b9b",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 112,
"avg_line_length": 34.24119241192412,
"alnum_prop": 0.5193510091017016,
"repo_name": "back-to/streamlink",
"id": "b1081c13cae8df702ea6aaa44ae86f9be686529e",
"size": "... |
from __future__ import print_function
import argparse
import datetime
import difflib
import glob
import os
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument(
"filenames",
help="list of files to check, all files if unspecified",
nargs='*')
rootdir = os.path.dirname(__file__) + "/... | {
"content_hash": "92781ee88daaa9ab8aaaa3e4bcfb25ed",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 124,
"avg_line_length": 34.559471365638764,
"alnum_prop": 0.6108349267049076,
"repo_name": "kubernetes/autoscaler",
"id": "467bf3dd8868954d2709fb74deeac33d6f79497a",
"size... |
"""Generates JavaScript source files from a mojom.Module."""
from generate import mojom
from generate import mojom_pack
from generate import mojom_generator
from generate.template_expander import UseJinja
_kind_to_javascript_default_value = {
mojom.BOOL: "false",
mojom.INT8: "0",
mojom.UINT8: "0",
mo... | {
"content_hash": "9d2286dcd8141e2498f52d6aba22b1ec",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 78,
"avg_line_length": 31.189300411522634,
"alnum_prop": 0.6796411136033778,
"repo_name": "ChromiumWebApps/chromium",
"id": "252e4ce831b8a1578feb686523a0a9ae2b2404bd",
"si... |
from wagtailschemaorg._version import version_bits
# -- General configuration ------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
source_suffix = '.rst'
master_doc = 'index'
project = 'Wagtail Schema.org JSON-LD tags'
c... | {
"content_hash": "8944068a9a18f351455858ba0a7abb9b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 28.205479452054796,
"alnum_prop": 0.5881495871782418,
"repo_name": "takeflight/wagtail-schema.org",
"id": "b2f0a4fca893ab2ba1b3137f96b2607a19a7a558",
... |
'''Reader for Neurolucida .ASC files, v3, reversed engineered from looking at output from
Neuroludica
'''
import logging
import warnings
from io import open
import numpy as np
from neurom._compat import StringType
from neurom.core.dataformat import COLS, POINT_TYPE
from .datawrapper import DataWrapper
WANTED_SECTI... | {
"content_hash": "497478d2a41f3c551fb54895cc6913c4",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 90,
"avg_line_length": 33.62753036437247,
"alnum_prop": 0.5833132675174573,
"repo_name": "mgeplf/NeuroM",
"id": "cfd182d813532d4e352308d617dc549997e38fc5",
"size": "10000"... |
"""
Export a sensor object to a JSON file, adding ' API TEST' to the name of the sensor before exporting the JSON file and deleting any pre-existing sensor with the same (new) name, then create a new sensor object from the exported JSON file
"""
# import the basic python packages we need
import os
import sys
import tem... | {
"content_hash": "46ad06f8c2444341a16d9016e2097425",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 237,
"avg_line_length": 37.93333333333333,
"alnum_prop": 0.7026681578526921,
"repo_name": "tanium/pytan",
"id": "c4810e9704749607e4d61bc32dd3e64588dceed5",
"size": "6281",... |
import sys
from glumpy import gl
from glumpy.log import log
from glumpy.app import configuration
from glumpy.app.window import window
# Backend name
__name__ = "FreeGLUT"
# Backend version (if available)
__version__ = ""
# Backend availability
__availability__ = False
# Whether the framework has been initialized
_... | {
"content_hash": "5d1022076bebac8226641421b9c4788e",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 97,
"avg_line_length": 34.187012987012984,
"alnum_prop": 0.5064579851086461,
"repo_name": "duyuan11/glumpy",
"id": "d16fea680e5805b88a1b9ef2a62b6b2a68d98ac9",
"size": "134... |
from __future__ import division, print_function
import numpy as np
from astropy import units as u
from astropy import constants
c = 299792458 * u.meter / u.second
wavelength = np.arange(400, 5000) * u.nanometer
rv = 500000 * u.meter / u.second
def doppler_factor_shift(wave, velocity):
"""Doppler shift using d... | {
"content_hash": "1f01116ff2b8783a6395066be33ef5e8",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 53,
"avg_line_length": 22.818181818181817,
"alnum_prop": 0.6772908366533864,
"repo_name": "jason-neal/equanimous-octo-tribble",
"id": "78d5e29a2330b7d595eff56aebdb22af2d1db70... |
"""
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | {
"content_hash": "ec76fa45acd59324797a1935f1f07331",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 80,
"avg_line_length": 35.36261682242991,
"alnum_prop": 0.6414715365505577,
"repo_name": "beckastar/django",
"id": "25ec81d87a0eb5217a9f67151f3ad9f581ff5e74",
"size": "189... |
from mcmodels import Rocket, Arrow
from mcpi.minecraft import Minecraft
from time import sleep
mc = Minecraft.create()
pos = mc.player.getTilePos()
pos2 = pos.clone()
pos2.y + 10
print("create rocket")
r = Rocket(mc, pos)
sleep(5)
print("create rocket")
a = Arrow(mc, pos2)
sleep(5)
print("clear arrow")
a.clear()... | {
"content_hash": "e526f25e351cd20e7dcd65d03c89b6d5",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 36,
"avg_line_length": 12.620689655172415,
"alnum_prop": 0.6994535519125683,
"repo_name": "martinohanlon/SpaceCRAFT",
"id": "7270a35e0f1e59ce62fdec783b845c157309b0e5",
"siz... |
try:
import subprocess
except ImportError, e:
pass
class GetInterfaceList(object):
def __init__(self):
# Initiating an empty tuple to hold available wireless interfaces
self.interfaces = ()
# Calls 'iwconfig' command in system and pipes the output as stdout.
proc = subprocess.Popen(['/sbin/iwconfig'],... | {
"content_hash": "c259083610c4804783847b2d37baf92f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 133,
"avg_line_length": 33.04761904761905,
"alnum_prop": 0.6892411143131604,
"repo_name": "sajjanbh/WLAN-Monitoring",
"id": "5e9abf7c41d3efe94d5af0fd45a073b5cf5974c9",
"siz... |
import os
import unittest
from ample import constants
from ample.util import rio
class TestContacts(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.thisd = os.path.abspath(os.path.dirname(__file__))
cls.ample_share = constants.SHARE_DIR
cls.testfiles_dir = os.path.join(cls.am... | {
"content_hash": "c5263fe3feea8d42a58a6a8fee8ae50e",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 70,
"avg_line_length": 40.3921568627451,
"alnum_prop": 0.6716019417475728,
"repo_name": "rigdenlab/ample",
"id": "ed0910e6fd8159694f423031b5e0c7cf8647266f",
"size": "4120"... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/player/shared_player_house_corellia_large_style_02.iff"
result.attribute_template_id = -1
result.stfName("building_name","housing_corellia_large_style_2")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATI... | {
"content_hash": "bfdf8ea0fdbed12df70a00d058738287",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 91,
"avg_line_length": 26.615384615384617,
"alnum_prop": 0.7138728323699421,
"repo_name": "obi-two/Rebelion",
"id": "1c9ec403150804bf726693dea04d3924da7ea212",
"size": "491... |
"""Test Home Assistant pressure utility functions."""
import pytest
from homeassistant.const import (
PRESSURE_CBAR,
PRESSURE_HPA,
PRESSURE_INHG,
PRESSURE_KPA,
PRESSURE_MBAR,
PRESSURE_MMHG,
PRESSURE_PA,
PRESSURE_PSI,
)
from homeassistant.exceptions import HomeAssistantError
import homea... | {
"content_hash": "095652dadef217d0bd2bdd1c0fa7d7be",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 88,
"avg_line_length": 34.567567567567565,
"alnum_prop": 0.6792415949960907,
"repo_name": "w1ll1am23/home-assistant",
"id": "f87b89df3f76932f658425e63db3cb11a773c239",
"si... |
"""Utilities related to SSH connection management."""
import os
import string
from eventlet import pools
from oslo_config import cfg
import paramiko
from cinder import exception
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)
ssh_opts = [
cfg.... | {
"content_hash": "6fb0f46778cbdc108788d7a01a05a09b",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 79,
"avg_line_length": 40.96875,
"alnum_prop": 0.5600305110602594,
"repo_name": "Accelerite/cinder",
"id": "5ce4b1cf232cf5a69cdef4cad6b53ea62f2f7188",
"size": "7356",
"b... |
import json
import logging
import datetime
import random
from flask import url_for, current_app
from flask.ext.security import current_user
from flask.ext.admin.babel import lazy_gettext
from quokka.core.db import db
from quokka import admin
from quokka.core.admin.models import ModelAdmin
from quokka.modules.accounts.m... | {
"content_hash": "0e84e5327c0d1a66ce69e9bcbb049b36",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 79,
"avg_line_length": 31.91194968553459,
"alnum_prop": 0.5782420181316515,
"repo_name": "eltonsantos/quokka",
"id": "0761ee87129a6e74cb84ff096ad5a5fd4deb403f",
"size": "1... |
"""
Module containing filter functions that allow code to be highlighted
from within Jinja templates.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
# pygments must not be imported at the module level
# because errors should be raised at runtime if it's actual... | {
"content_hash": "ae6b056146cf49df6fb75d02698c3903",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 86,
"avg_line_length": 34.213235294117645,
"alnum_prop": 0.632495164410058,
"repo_name": "ArcherSys/ArcherSys",
"id": "e7abd0dbee442760b04df67087d83e85b8bfdd79",
"size": "... |
import random
import unittest
from pymongo import MongoClient
from service.UserService import UserService, DuplicateUserException
class test_user_service(unittest.TestCase):
def setUp(self):
self.dbClient = MongoClient()
self.db = self.dbClient.test_foodbeazt_database
self.db.user_collecti... | {
"content_hash": "41f9df9b6d2235fe0c5bc8c8e2d65a22",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 89,
"avg_line_length": 31.16417910447761,
"alnum_prop": 0.5953065134099617,
"repo_name": "cackharot/fbeazt",
"id": "ffde9a0add8df7c6d13ed1a0c26009072b77c93d",
"size": "2088... |
from sqlalchemy.testing import eq_, assert_raises, \
assert_raises_message, is_
from sqlalchemy.ext import declarative as decl
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, String, ForeignKey, select, func
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy.o... | {
"content_hash": "35b3b58d7731dcc08ccad46fdd005be5",
"timestamp": "",
"source": "github",
"line_count": 1731,
"max_line_length": 79,
"avg_line_length": 30.291161178509533,
"alnum_prop": 0.5270625929740245,
"repo_name": "bdupharm/sqlalchemy",
"id": "1f9fa1dfaf0c2b43067363c2ff4ba771c7af821b",
"size":... |
"""Tests for the Connector Webex Teams class."""
import asyncio
import unittest
import asynctest
import asynctest.mock as amock
from opsdroid.core import OpsDroid
from opsdroid.connector.webexteams import ConnectorWebexTeams
from opsdroid.events import Message
from opsdroid.cli.start import configure_lang
class Tes... | {
"content_hash": "f03a4f28af30f582775d91e23957119e",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 85,
"avg_line_length": 40.5,
"alnum_prop": 0.6663655525444143,
"repo_name": "FabioRosado/opsdroid",
"id": "73b5c18c87c64a5915a2b97c81727b3d20ce769a",
"size": "6642",
"bi... |
from __future__ import division, print_function, absolute_import
from os.path import join
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
from numpy.distutils.misc_util import get_info as get_misc_info
from numpy.distutils.s... | {
"content_hash": "4f4eb7a7aeb6f18ba5dafd298f9ba133",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 39.370370370370374,
"alnum_prop": 0.533082470994042,
"repo_name": "larsmans/scipy",
"id": "00c4e0f79d380ab6783b5e9f560b8a81dc7d6be4",
"size": "3212",... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
setup(
name='negative-cycles',
# Versions should com... | {
"content_hash": "420a15874278b64f5efd0e3b85fe0243",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 29.928571428571427,
"alnum_prop": 0.6634844868735084,
"repo_name": "mnpatil17/negative_cycles",
"id": "a6f38eae58e6a77f75a7d523e8c54bab5543efd2",
"si... |
from __future__ import unicode_literals
from sqlalchemy import func
from indico.modules.rb.models.rooms import Room
from indico.modules.rb.operations.rooms import get_managed_room_ids
from indico.modules.rb.settings import RoomEmailMode, rb_user_settings
from indico.modules.users import ExtraUserPreferences
from indi... | {
"content_hash": "32707b14767264fd3b703484e08edec9",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 114,
"avg_line_length": 49.88461538461539,
"alnum_prop": 0.5239013107170393,
"repo_name": "OmeGak/indico",
"id": "1b2bfc07c1116d669b28d662f3279f894da80145",
"size": "2808",... |
number = raw_input('Enter a number to find a square : ')
try :
# In order to accept floating numbers, we are converting the varibale to float.
actualNumber = float(number)**2
print 'Square of the number is', actualNumber
except :
print 'Instead of typing number you entered -', number
| {
"content_hash": "918a9b124b0d06ccf18316d84083bf66",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 83,
"avg_line_length": 42.714285714285715,
"alnum_prop": 0.7123745819397993,
"repo_name": "rahulbohra/Python-Basic",
"id": "b8ead120867c65f46e8fffd0c0e0223affb72253",
"size"... |
import html.parser
import re
import urllib.error
import urllib.parse
import urllib.request
from time import time
import dateutil.parser
import socks
from sockshandler import SocksiPyHandler
USER_AGENT = yui.config_val('url', 'httpUserAgent', default='Yui')
PROXY_HOST = yui.config_val('url', 'socksProxyHost')
PROXY_PO... | {
"content_hash": "63d8f7763e750def65dab6492fbc9773",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 103,
"avg_line_length": 29.5,
"alnum_prop": 0.5568463149876214,
"repo_name": "Rouji/Yui",
"id": "88eeffe692aa11535eed88344a13d15cd925cf90",
"size": "5267",
"binary": fal... |
"""Implementation of the TinyQuery service."""
import collections
import compiler
import context
import evaluator
import tq_types
class TinyQueryError(Exception):
# TODO: Use BigQuery-specific error codes here.
pass
class TinyQuery(object):
def __init__(self):
self.tables_by_name = {}
s... | {
"content_hash": "5db7499289e10b699cec5ebad7377e8e",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 79,
"avg_line_length": 39.071174377224196,
"alnum_prop": 0.5665361144002186,
"repo_name": "burnhamup/tinyquery",
"id": "7f545f85ba7c83094d5d933e90e5bf55053097e8",
"size": ... |
"""
Contains concepts related to requests, tracing them and the work they generate.
"""
import collections
import simpy
from .base import NamedObject
TraceItem = collections.namedtuple('TraceItem', 'when who direction')
def trace_request(instance_method):
"""
Decorates an instance method to trace a request ... | {
"content_hash": "6b7141edbfe44f6058336396e4636352",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 88,
"avg_line_length": 34.61643835616438,
"alnum_prop": 0.6189157103284527,
"repo_name": "cristiklein/tailtamer",
"id": "568f50a0741403d2892618c2f3fbba9617a99344",
"size":... |
from __future__ import division
import htpc, cherrypy, logging, xmlrpclib, base64
from cherrypy.lib.auth2 import require, member_of
from htpc.helpers import serve_template, fix_basepath, striphttp
class RTorrent(object):
def __init__(self):
self.logger = logging.getLogger('modules.rtorrent')
htpc.... | {
"content_hash": "8ac01562592d890b4ca9bdc75d2a789b",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 150,
"avg_line_length": 41.764367816091955,
"alnum_prop": 0.564744736479978,
"repo_name": "Hellowlol/HTPC-Manager",
"id": "5c124e80e55cfaa4cab174333c4a7c3415452ea3",
"size... |
from flask.ext.login import current_user
from flask.ext.restless import *
from models import (Warrior, Queue)
from app import db, bcrypt
from wqueue import schedule_queue
# Create the REST API
def check_auth(instance_id=None, **kw):
if not current_user.is_authenticated():
raise ProcessingException(message=... | {
"content_hash": "cdaabb5988d5d759ee10181d918284fe",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 81,
"avg_line_length": 31.43243243243243,
"alnum_prop": 0.5663513900831184,
"repo_name": "mahrz/kernkrieg",
"id": "a57c8c1a977deae96634386b31cb8ed0ab3543d9",
"size": "3489... |
"""The tests for the Async Media player helper functions."""
import pytest
import homeassistant.components.media_player as mp
from homeassistant.const import (
STATE_IDLE,
STATE_OFF,
STATE_ON,
STATE_PAUSED,
STATE_PLAYING,
)
class ExtendedMediaPlayer(mp.MediaPlayerEntity):
"""Media player test... | {
"content_hash": "3b1d11d9c7d421249e2d609e75e85abb",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 66,
"avg_line_length": 28.44736842105263,
"alnum_prop": 0.6103607770582794,
"repo_name": "toddeye/home-assistant",
"id": "53c80bfc8deb1cd531b8bfcd1b5e874b92743a77",
"size"... |
"""Solvers for linear equations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from tensorflow.contrib.solvers.python.ops import util
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes... | {
"content_hash": "11a8f9248ffa2d0eb3cc4e4e6cbed68b",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 80,
"avg_line_length": 42.43589743589744,
"alnum_prop": 0.6418932527693857,
"repo_name": "dendisuhubdy/tensorflow",
"id": "9305c6a11c4ec898c82553773e8e7277a54ab82e",
"size... |
from sqlalchemy import Column, ForeignKey, UniqueConstraint
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import backref, relationship
from sqlalchemy.types import Boolean, Integer, String
from pycroft.model.base import IntegerIdModel
class Site(IntegerIdModel):
name = Column(String(), nul... | {
"content_hash": "0fbad10efd65f538a6f8579bfbbbb195",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 111,
"avg_line_length": 35.839285714285715,
"alnum_prop": 0.6626806178375685,
"repo_name": "lukasjuhrich/pycroft",
"id": "d62ceae807cdedfeac46d21ae8fc91765e0457da",
"size":... |
#!/usr/bin/env python
''' unit test suite for SQL parsing features of rdbhdb.'''
import unittest
import time
import sys, os
import accounts
import asyncio
sys.path.insert(0, '..\lib')
from rdbhdb import rdbhdb
def asyncio_meth_ruc(f):
def asy(self, *args):
loop = asyncio.get_event_loop()
loop.r... | {
"content_hash": "37ea979ec28dd1a535b72d36d2a1905a",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 106,
"avg_line_length": 31.540816326530614,
"alnum_prop": 0.5469103849886768,
"repo_name": "rdbhost/Rdbhdb",
"id": "57b0d926d24fc589a49f328b3e71178e5edfa304",
"size": "618... |
import os
from numpy import array, concatenate
import scipy
from scipy import ndimage
import numpy as np
def convNd_sparse(src, kernel, centroids):
"""ND convolution at sparse sampling centroids.
For input of K N-dimensional centroids which are locations
within N-dimensional src image, K scalars ar... | {
"content_hash": "4d96ff5f066d1304d65914993146d7d7",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 140,
"avg_line_length": 33.46551724137931,
"alnum_prop": 0.5633693972179289,
"repo_name": "informatics-isi-edu/synspy",
"id": "1f9c26a3764bd0f79b5037ce82334afeb5147940",
"... |
from flask import Blueprint, render_template, session, redirect, url_for, request, abort, flash
from flask import current_app
from itsdangerous import URLSafeSerializer, BadSignature
from flask.ext.login import current_user, login_user, logout_user
from flask.ext.mail import Message
from app.helpers import login_requir... | {
"content_hash": "99f5dcdccdf365f4aaad64e58c1cfb17",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 267,
"avg_line_length": 36.74264705882353,
"alnum_prop": 0.6577946768060836,
"repo_name": "teamgivn/givnapp",
"id": "88f8783b5355478d39c031e6aa6fcb01ac54bb6c",
"size": "49... |
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('daiquiri_query', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
name='queryjob',
m... | {
"content_hash": "b9a10b9c952b3baa052365adf1c2f031",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 21.5,
"alnum_prop": 0.5837209302325581,
"repo_name": "aipescience/django-daiquiri",
"id": "330e143001745d4a54b94c3f32baf7f413c5de06",
"size": "502",
... |
from traitlets import directional_link, HasTraits, TraitError, observe, validate, Int, Instance
from .tree import Tree
from .traittypes import TreeType
class HasTree(HasTraits):
tree = Instance(klass=Tree, allow_none=True)
src = TreeType(allow_none=True)
def __init__(self, src=None):
self._link =... | {
"content_hash": "baaa995935e3a608be3a74968c5a8d92",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 95,
"avg_line_length": 30.976190476190474,
"alnum_prop": 0.5703305149884704,
"repo_name": "yarden-livnat/regulus",
"id": "65b971fbec7cb02b6bc2a6ed4626ab750cbf1c22",
"size":... |
"""
:synopsis: Define the basic script class that will generate the script code.
"""
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
from importlib import import_module
from .url import get_url, check_valid_url
class AbstractScript(object):
"""Abstract representation ... | {
"content_hash": "53c46af8aebc1efe2671dc784a29cb4c",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 121,
"avg_line_length": 34.96666666666667,
"alnum_prop": 0.5974397385264878,
"repo_name": "dhruvagarwal/http-request-translator",
"id": "3fdd30667bfa000462e8d54550b3f1a3ce2c... |
from unimodel.model import ModelRegistry
import datetime
class Serializer(object):
def __init__(
self,
validate_before_write=True,
model_registry=None):
self.validate_before_write = validate_before_write
self.model_registry = model_registry or ModelRegistry()
... | {
"content_hash": "5ef927e500ec3cdcea12e772ed03188e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 66,
"avg_line_length": 26.51219512195122,
"alnum_prop": 0.6421343146274149,
"repo_name": "neumark/unimodel",
"id": "ec05f00acd87defee938399b7c7439d9ed5913d5",
"size": "1087... |
"SikuliLogo.png"
"btnnightly.png"
"netblogo.png"
"nightly.png"
"quickstart.png"
"raimanlogo.png"
"sxpower.png"
"netbicons.png"
"firefox.png" | {
"content_hash": "3d0319a976bfaff9e3da6afd0a077a50",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 16,
"avg_line_length": 15.555555555555555,
"alnum_prop": 0.75,
"repo_name": "henriqueguchi/SikuliServer",
"id": "cfe0b7ef12802e199932ef9111c4592a58d6aa2a",
"size": "140",
... |
"""
Utilities for generating random numbers, random sequences, and
random selections.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import random
import sys
import networkx a... | {
"content_hash": "a30443b3c1bea89db6fbad21286a79d8",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 79,
"avg_line_length": 28.56888888888889,
"alnum_prop": 0.6316116988176727,
"repo_name": "destijl/forensicartifacts",
"id": "229479105143b94f443c7ad689bedda1c1ec27e1",
"si... |
import os
import grp
import pwd
import stat
import sys
from angel.locks import get_lock_filename
from angel.util.pidfile import *
def is_lock_available(config, lockname):
if None == who_has_lock(config, lockname):
return True
return False
def who_has_lock(config, lockname):
''' Return the pi... | {
"content_hash": "dd2dfe432dc107c9ff350182a45ae11b",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 211,
"avg_line_length": 47.74731182795699,
"alnum_prop": 0.6152460308523815,
"repo_name": "chillinc/angel",
"id": "27ddbb523c45eda671d1d7453ee95a658bc7804e",
"size": "8881... |
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import test
class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
@test.idempotent_id('0ecf465c-0dc4-4532-ab53-91ffeb74d12d')
def test_project_create_with_description(self):
# Create project with a descript... | {
"content_hash": "f1c1d0bccda84dc68ccd19dd931a7fa6",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 78,
"avg_line_length": 44.19512195121951,
"alnum_prop": 0.6226545253863135,
"repo_name": "nuagenetworks/tempest",
"id": "607bebe3e654a9a7bda05fb75cd7d608f9bbdd67",
"size":... |
"""Test the Soundtouch component."""
from unittest.mock import call, patch
from libsoundtouch.device import (
Config,
Preset,
SoundTouchDevice as STD,
Status,
Volume,
ZoneSlave,
ZoneStatus,
)
import pytest
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
... | {
"content_hash": "f74d11cfc7c70e7154cb69078f68d566",
"timestamp": "",
"source": "github",
"line_count": 1062,
"max_line_length": 88,
"avg_line_length": 30.130885122410547,
"alnum_prop": 0.6421763180099378,
"repo_name": "toddeye/home-assistant",
"id": "797b5b440d166e5d687131690969dbc380862d89",
"siz... |
"""
DMLC submission script, local machine version
"""
import argparse
import sys
import os
import subprocess
from threading import Thread
import tracker
import signal
import logging
keepalive = """
nrep=0
rc=254
while [ $rc -eq 254 ];
do
export DMLC_NUM_ATTEMPT=$nrep
%s
rc=$?;
nrep=$((nrep+1));
done
"... | {
"content_hash": "b7207a9491bdaabbc3eebcc10132c101",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 88,
"avg_line_length": 30.595959595959595,
"alnum_prop": 0.5123803235391218,
"repo_name": "xcgoner/ps-lite-new",
"id": "c9cef4dbd813fe051ffc407e239e0d7b58c883ac",
"size": "... |
import os, re, sys, subprocess, plistlib
import eclim
from util import caret_position
def call_eclim(project, file, line, offset, applied_correction=None):
eclim.update_java_src(project, file)
correct_cmd = "$ECLIM -command java_correct \
-p %s \
-f %s \
-l %i ... | {
"content_hash": "d8752fdd77f5cebcd6cdb26c162b84d7",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 32.971830985915496,
"alnum_prop": 0.6048697137975224,
"repo_name": "JulianEberius/Eclim.tmbundle",
"id": "9393cce0d9a13556cddceae89980ae4e934cf510",
... |
"""
Unit tests for PySpark; additional tests are implemented as doctests in
individual modules.
"""
import os
import shutil
import sys
from tempfile import NamedTemporaryFile
import time
import unittest
from pyspark.context import SparkContext
from pyspark.files import SparkFiles
from pyspark.java_gateway import SPARK... | {
"content_hash": "8ca692a1d9cf5257c408244118be7768",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 79,
"avg_line_length": 35.676829268292686,
"alnum_prop": 0.6602290206802256,
"repo_name": "vax11780/spark",
"id": "dfd841b10a0dfa31b0c32c08adf690a9e7405538",
"size": "6636... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('part', '0035_auto_20200406_0045'),
]
operations = [
migr... | {
"content_hash": "46e23c5f9dde1579a02c1a7bb5d20745",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 152,
"avg_line_length": 30.157894736842106,
"alnum_prop": 0.6596858638743456,
"repo_name": "inventree/InvenTree",
"id": "d59bc7ffb21dac8a16b2a439eb0ae7344fb42c10",
"size": ... |
"""A very simple MNIST classifier.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import data
from tensorflow.examples.tutorials.mnist import input_data
import t... | {
"content_hash": "55f8cb00e28bca3ace611137234392af",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 85,
"avg_line_length": 31.25581395348837,
"alnum_prop": 0.7247023809523809,
"repo_name": "dhalleine/tensorflow",
"id": "6621d7bb3972f62d3ece240e42824f5f37568a6b",
"size": "... |
import argparse
from datetime import datetime
from dateutil import tz
import logging
import logging.handlers
import requests
import sys
from xml.etree import ElementTree
logger = logging.getLogger(__name__)
# Python 2.6 does not support total_seconds()
def timedelta_total_seconds(timedelta):
return (
tim... | {
"content_hash": "af7ddb5b96981adf44decddca784ea08",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 120,
"avg_line_length": 35.32102272727273,
"alnum_prop": 0.6379795704978686,
"repo_name": "markperdue/havocbot",
"id": "0e8a975b58817ee1870e1d7951099ab4d905a966",
"size": ... |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | {
"content_hash": "83946f13681123c7281be92da0396f72",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 96,
"avg_line_length": 34.34146341463415,
"alnum_prop": 0.6725852272727273,
"repo_name": "airbnb/streamalert",
"id": "0ab99202352c667c5fd1225efb1ad14100df9997",
"size": "14... |
from django.conf.urls.defaults import *
from tastypie.api import Api
from validation.api.resources import NoteResource, UserResource, AnnotatedNoteResource
api = Api(api_name='v1')
api.register(NoteResource(), canonical=True)
api.register(UserResource(), canonical=True)
api.register(AnnotatedNoteResource(), canonical=... | {
"content_hash": "1474d1c3042889f185c0aa6f442a52e5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 86,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.7741116751269036,
"repo_name": "rbraley/django-tastypie",
"id": "8a54422a786af8f61d200505fcd1638bc518a17e",
"size... |
"""
This is the Ultra-faint Galaxy Likelihood (UGaLi) software package.
"""
__author__ = "Keith Bechtol & Alex Drlica-Wagner"
__email__ = "bechtol@kicp.uchicago.edu, kadrlica@fnal.gov"
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
# ADW: Is this a good idea?
#import ugali... | {
"content_hash": "823b007b561724b219d360e12bfb34a1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 31.789473684210527,
"alnum_prop": 0.75,
"repo_name": "DarkEnergySurvey/ugali",
"id": "070fe3a9a79fd978c01f714a54f7d131bd1a9087",
"size": "604",
"bi... |
from msrest.serialization import Model
class GeoFilter(Model):
"""Rules defining user's geo access within a CDN endpoint.
:param relative_path: Relative path applicable to geo filter. (e.g.
'/mypictures', '/mypicture/kitty.jpg', and etc.)
:type relative_path: str
:param action: Action of the geo... | {
"content_hash": "01d8cb427242e55553d4988fbe47d2cb",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 36.09090909090909,
"alnum_prop": 0.6238455079764903,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "17c73205995f27112cdf73ffc1a77d012c1a4f92",
... |
from provglish import transform, prov
from provglish.lexicalisation import urn_from_uri as lex
from provglish.lexicalisation import plural_p
from provglish.prov import PROV
from provglish.nl.tools import SETTINGS, realise_sentence
import rdflib
from rdflib.plugins import sparql
from rdflib import RDF
import urllib2
... | {
"content_hash": "26649a5a68b047aae7e8aa2e21f00163",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 95,
"avg_line_length": 34.98461538461538,
"alnum_prop": 0.5765171503957783,
"repo_name": "mnestis/provglish",
"id": "bc42a73f9f0d275a2433226bf7b2405013ef9310",
"size": "227... |
"""
Загрузка конфига.
"""
from openre.agent.decorators import action
from openre.agent.domain.decorators import state
from openre.domain import create_domain_factory
from openre.domain.packets import TransmitterVector, TransmitterMetadata, \
ReceiverVector, ReceiverMetadata, SpikesVector, SpikesMetadata
from o... | {
"content_hash": "3151e5928a102c7221bd75164446a9e3",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 79,
"avg_line_length": 35.96907216494845,
"alnum_prop": 0.5750453807203593,
"repo_name": "openre/openre",
"id": "9662fbc99195a28ad80e051f364673249be41973",
"size": "11011"... |
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations
from analytics.lib.counts import do_delete_count_stat
def delete_messages_sent_to_stream_stat(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEdi... | {
"content_hash": "3c757b682cd4b6292f832ea1abcf0853",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 31.68421052631579,
"alnum_prop": 0.739202657807309,
"repo_name": "samatdav/zulip",
"id": "7d3da10e76aae1f279009c0a1dcc0ab6d25c37b4",
"size": "626",
... |
import sys
import propertyWidget as pw
import listPropertyWidget as lpw
import actionWidget as aw
import labelWidget as lw
import commonWidget as common
class Container (common.Widget):
def __init__(self, generated, element, parentName, languageSetName, isRoot = 0) :
common.Widget.__init__(self, generated... | {
"content_hash": "ffa6f1dea8720e78a2cb1265514cdb83",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 140,
"avg_line_length": 41.58620689655172,
"alnum_prop": 0.6252072968490879,
"repo_name": "ADVANTECH-Corp/node-alljoyn",
"id": "f20d2cd5e758caa42d89cc293f5b4c3b3604c378",
"... |
from data_migrator.emitters.base import BaseEmitter
from data_migrator.models.fields import HiddenField
from data_migrator.utils import sql_escape, default_logger
log = default_logger()
class MySQLEmitter(BaseEmitter):
'''MySQL emitter to output MySQL specific insert statements
Attributes:
base_temp... | {
"content_hash": "64b582974dcce2f670b96397fdd2bd51",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 96,
"avg_line_length": 39.03225806451613,
"alnum_prop": 0.5566115702479338,
"repo_name": "schubergphilis/data-migrator",
"id": "514c5049a749a31df531b292d7feed5f428f2051",
"... |
import logging
from fabric.api import env, task, require, prompt
from neckbeard.actions.utils import _get_gen_target
from neckbeard.environment_manager import Deployment
logger = logging.getLogger('actions.override')
@task
def override():
"""
Manually fix the generational config for the given generation.
... | {
"content_hash": "6923dedf043bde3fdba5bd116ae46f7a",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 78,
"avg_line_length": 34.37903225806452,
"alnum_prop": 0.5446868402533427,
"repo_name": "winhamwr/neckbeard",
"id": "9f6048a0cc13d7bd270f41d6a66ebf4e125a288e",
"size": "4... |
import threading
from utils import list_contains
class TagCache:
def __init__(self):
self.data = []
self.threadLock = threading.Lock()
def append(self, tag):
self.threadLock.acquire()
self.data.append(tag)
self.threadLock.release()
def remove(self, tag):
s... | {
"content_hash": "afd4c4e5997ce2c34b3490efc7f8ee6c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 65,
"avg_line_length": 22.7,
"alnum_prop": 0.5704845814977973,
"repo_name": "fablab-ka/labtags",
"id": "5c99ff6d1cf5d9be2d0f9b39eb82b751eb460d68",
"size": "908",
"binary"... |
from __future__ import unicode_literals
from indico.core.db.sqlalchemy import PyIntEnum, db
from indico.modules.events.models.persons import PersonLinkBase
from indico.util.locators import locator_property
from indico.util.string import format_repr, return_ascii
from indico.util.struct.enum import IndicoEnum
class A... | {
"content_hash": "2c9dd6f4a429bc6eab55317d455a0ee0",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 117,
"avg_line_length": 30.544554455445546,
"alnum_prop": 0.6638573743922204,
"repo_name": "mic4ael/indico",
"id": "a544c97b31e94d7bc76e10f4ea06414fd459c788",
"size": "329... |
from testix import *
import pytest
import line_monitor
@pytest.fixture
def override_imports(patch_module):
patch_module(line_monitor, 'subprocess')
patch_module(line_monitor, 'pty')
patch_module(line_monitor, 'open')
def launch_scenario(s):
s.pty.openpty() >> ('write_to_fd', 'read_from_fd')
s.open... | {
"content_hash": "d51af3f0e516bb6722018df35516a437",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 87,
"avg_line_length": 33.19444444444444,
"alnum_prop": 0.6376569037656904,
"repo_name": "haarcuba/testix",
"id": "e885adedf0f6dce557cce2cd3b67ed6b1110ffcd",
"size": "1195"... |
"""Mechanisms for ION services and service management infrastructure"""
__author__ = 'Adam R. Smith, Michael Meisinger'
from zope.interface import implementedBy
from mi.core.exceptions import BadRequest, ServerError
from mi.core.log import log
from mi.core.containers import named_any, itersubclasses
from mi.core.co... | {
"content_hash": "86fadfa952c312570b47e37f921ac5c2",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 141,
"avg_line_length": 34.96666666666667,
"alnum_prop": 0.5811595458878586,
"repo_name": "rmanoni/mi-instrument",
"id": "196cdef29c82155bd5611650a03a198d887bb23c",
"size"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.mixedreality import MixedRealityClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-mixedreality
# USAGE
python update_object_anchors_account.py
Before run the sample, please set the values of the client ID, ten... | {
"content_hash": "f8827b21bf1266f345f5a7398999617e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 150,
"avg_line_length": 34.86842105263158,
"alnum_prop": 0.6988679245283019,
"repo_name": "Azure/azure-sdk-for-python",
"id": "99fe799d25480c3993a4819cba13faca1a985ff2",
"s... |
import datetime
from django.core import exceptions
from django.utils import translation
from django.utils.timezone import activate
from django.conf import settings
from django import http
from lino.core import constants
from .utils import AnonymousUser
from lino.utils import get_client_ip_address
from lino.core impo... | {
"content_hash": "4fcbc2ab4decfd5141236759d0b714fa",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 112,
"avg_line_length": 39.774468085106385,
"alnum_prop": 0.6231946078955815,
"repo_name": "lino-framework/lino",
"id": "ce45f4e5555908e5aa91b4311a56d7f5dc21eede",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ja_social', '0008_userprofile_profile_pic'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='profile... | {
"content_hash": "1784a3d9963742e31cf0609a4eb52043",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 76,
"avg_line_length": 23.38888888888889,
"alnum_prop": 0.6128266033254157,
"repo_name": "Bryconc/JA-Social",
"id": "bb7f7d226bfc174cfddbc4ab09b2c37b50da0e88",
"size": "494... |
"""Class for probabilistic distance QSR
:Author: Christian Dondrup <cdondrup@lincoln.ac.uk>
:Organization: University of Lincoln
"""
from __future__ import print_function, division
import numpy as np
from qsr_arg_relations_distance import QSR_Arg_Relations_Distance
from random import uniform
class QSR_Arg_Prob_Rela... | {
"content_hash": "6ee3908af68ebce0989c707d2b5a0942",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 97,
"avg_line_length": 41.25806451612903,
"alnum_prop": 0.6411258795934324,
"repo_name": "yianni/rtd-dbg",
"id": "c444cf8c823d0201a55724b5946f8de009d2e310",
"size": "1303",... |
"""A set of utility functions."""
class cached_property:
""" A property that is only computed once per instance and then replaces
itself with an ordinary attribute. Deleting the attribute resets the
property.
"""
def __init__(self, function):
self.__doc__ = getattr(function, '__doc__')
... | {
"content_hash": "f5c49f8538ff0831d03a6b6b0b85a807",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 76,
"avg_line_length": 31,
"alnum_prop": 0.6053130929791272,
"repo_name": "AlanCristhian/symbolic_old",
"id": "6ffb2d00c05904d8914fe110024d60578401fd5a",
"size": "527",
"... |
import re
charset_re = re.compile('CHARACTER_SET[ ]+(?P<charset>.*)')
header_item_or_end_re = re.compile('(((?P<key>[^ ]+)(?P<space>[ ]*:[ ]*)(?P<value>.*))|(?P<end_comment>[*]/))')
header_item_re = re.compile('(?P<key>[^ ]+)(?P<space>[ ]*:[ ]*)(?P<value>.*)')
string_entry_re = re.compile('(?P<start>rls_string[ ]+)(?P... | {
"content_hash": "4dad2ab0ff10377777fa51f2a1c5347c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 111,
"avg_line_length": 31.78723404255319,
"alnum_prop": 0.5823293172690763,
"repo_name": "dbbhattacharya/kitsune",
"id": "df06a0c4f64357ed7b06e016d6bc3440f725c8e6",
"size"... |
# Copyright 2012-2015 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | {
"content_hash": "3503bb489b6f3d389e0b7756900e50d6",
"timestamp": "",
"source": "github",
"line_count": 1129,
"max_line_length": 152,
"avg_line_length": 34.425155004428696,
"alnum_prop": 0.5853445170586117,
"repo_name": "jeandet/meson",
"id": "1b9cb42b8d61c859756c7d93b56c1cac016ca6ed",
"size": "388... |
from threading import Thread
from flask import current_app, render_template
from flask.ext.mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = ... | {
"content_hash": "6c23af01ac1ecfced7e9741d94fc81b9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 33.95,
"alnum_prop": 0.6671575846833578,
"repo_name": "codeforamerica/westsac-farm-stand",
"id": "05d06450f99b5aaab9e1ee5b22de31d42007cca5",
"size": ... |
import gzip
import os
from collections import defaultdict
from unittest.mock import patch
from parameterized import parameterized
from torchtext.datasets.conll2000chunking import CoNLL2000Chunking
from ..common.case_utils import TempDirMixin, zip_equal, get_random_unicode
from ..common.torchtext_test_case import Torc... | {
"content_hash": "d06b81ef575e121085a9d31dca9b1eef",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 103,
"avg_line_length": 39.29113924050633,
"alnum_prop": 0.6398195876288659,
"repo_name": "pytorch/text",
"id": "5f6e85180fd0e744a8473dae0a66c722629ff517",
"size": "3104",
... |
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import Comparator, hybrid_method, hybrid_property
from sqlalchemy.orm import joinedload, noload
from indico.core.db.sqlalchemy import PyIntEnum, db
from indico.core.db.sqlalchemy.util.models... | {
"content_hash": "3c9766b42ac79e3d9ae083927ad60457",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 120,
"avg_line_length": 39.20553935860058,
"alnum_prop": 0.5921918572225321,
"repo_name": "pferreir/indico",
"id": "980196abadab0c67e67c690afc4329165769daca",
"size": "271... |
import json
import pymongo
import sys
def connect_to_db_collection(db_name, collection_name):
'''
Return collection of a given database name and collection name
'''
connection = pymongo.Connection('localhost', 27017)
db = connection[db_name]
collection = db[collection_name]
return col... | {
"content_hash": "6a78c534e55fb8712b94afa531b469f8",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 85,
"avg_line_length": 35.76923076923077,
"alnum_prop": 0.6021505376344086,
"repo_name": "McGillX/edx_data_research",
"id": "7305b973e15fdf95ba48b635df39f8b4eb7dae73",
"siz... |
from config_manager.baseconfig import BaseConfig
class ClusterController(BaseConfig):
def __init__(self,
hostname,
name=None,
description=None,
read_file_path=None,
write_file_path=None,
property_type=None,
... | {
"content_hash": "fb2a62e8e2a5c065b277a2930e347b9e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 82,
"avg_line_length": 46.82142857142857,
"alnum_prop": 0.43783371472158655,
"repo_name": "tbeckham/DeploymentManager",
"id": "a1bee2024e3af6da242bf492dcc9a75a8b61b6c3",
"s... |
import pygame
"""
Splits the text in such a way that none of the line rendered by the pygame.font.Font object will exceed expected width.
:returns: a generator that yields string for each line whose rendered surface's length won't exceed expected width
"""
def truncate_to_width(text, font, max_width):
done = 0
w... | {
"content_hash": "5134d0c7105bc88998c3389b502d0af2",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 119,
"avg_line_length": 21.547619047619047,
"alnum_prop": 0.6883977900552486,
"repo_name": "r0jsik/rinde",
"id": "8bdc1ab026ad4985c26e7e76eeaa4f920208c7c3",
"size": "1810",... |
import contextlib
import time
import mock
from oslo.config import cfg
import testtools
from neutron.agent.linux import ovs_lib
from neutron.extensions import securitygroup as ext_sg
from neutron.plugins.oneconvergence.agent import nvsd_neutron_agent
from neutron.tests import base
DAEMON_LOOP_COUNT = 5
class TestOn... | {
"content_hash": "0b5f182093679d243d5467dd2985ce9b",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 41.67701863354037,
"alnum_prop": 0.5912071535022355,
"repo_name": "onecloud/neutron",
"id": "f04d2fecb11bc14a1b30d27f16779aa3c9dc33e4",
"size": "739... |
from __future__ import print_function
# from cloudmesh_job.cm_jobdb import JobDB
from cmd3.console import Console
from cmd3.shell import command
import hostlist
from pprint import pprint
from cloudmesh_base.util import banner
from cloudmesh_job.cm_jobdb import JobDB
from cloudmesh_pbs.DbPBS import DbPBS
from cloudmesh... | {
"content_hash": "3754267d7821b9e2bfc858cb8551a2e8",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 116,
"avg_line_length": 31.288389513108616,
"alnum_prop": 0.466004309312904,
"repo_name": "rajpushkar83/pbs",
"id": "847e2013a60105f720a15a25e23d9201648e55ce",
"size": "16... |
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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.a... | {
"content_hash": "211561fa96a91db090d9b35d5874d3a4",
"timestamp": "",
"source": "github",
"line_count": 648,
"max_line_length": 363,
"avg_line_length": 34.45216049382716,
"alnum_prop": 0.6343113101903696,
"repo_name": "ftl-toolbox/lib_openshift",
"id": "c865f33adfd8a6dbb8ddae923f50a3e7e1f9e633",
"s... |
from setuptools import setup
setup(
name='CONCUSS',
version='1.0',
description='Combatting Network Complexity Using Structural Sparsity',
author='Michael P. O\'Brien, Clayton G. Hobbs, Kevin Jasnik, Felix Reidl, '
'Nishant G. Rodrigues, and Blair D. Sullivan',
author_email='blair_sulliva... | {
"content_hash": "75fd54fce95c6c4119ef04599ed1e273",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 32.77777777777778,
"alnum_prop": 0.535593220338983,
"repo_name": "nish10z/CONCUSS",
"id": "29785875f7c0ff848c1c7555f182c725f22fcb2e",
"size": "885",
... |
"""Test script for the imageop module. This has the side
effect of partially testing the imgfile module as well.
Roger E. Masse
"""
from test.test_support import verbose, unlink, import_module, run_unittest
imageop = import_module('imageop', deprecated=True)
import uu, os, unittest
SIZES = (1, 2... | {
"content_hash": "5029c2330c96312d8946a10264d13558",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 84,
"avg_line_length": 33.642857142857146,
"alnum_prop": 0.6075017692852088,
"repo_name": "MattDevo/edk2",
"id": "666a93c2adb2a25eace7787f757191d1933875a7",
"size": "7089"... |
import socket
class UDPDebugger(object):
def __init__(self, ip_address, port):
self.ip_address = ip_address
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Internet + UDP
def Log(self, message):
self.sock.sendto(message, (self.ip_address, self.port))
| {
"content_hash": "b320de750f09bd8138fef0d3f7a94e82",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 79,
"avg_line_length": 29.6,
"alnum_prop": 0.706081081081081,
"repo_name": "robertjacobs/rpf_python_test",
"id": "50651e7c646dff6c3baed841312fa6e29dba777f",
"size": "319",
... |
from allauth.socialaccount.providers import registry
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse
from .provider import AsanaProvider
class AsanaTests(create_oauth2_tests(registry.by_id(AsanaProvider.id))):
def get_mocked_response(self):
return Mock... | {
"content_hash": "14c3f3a915960a4315ad8f5ca880ec17",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 35.6875,
"alnum_prop": 0.6760070052539404,
"repo_name": "pennersr/django-allauth",
"id": "c33655658db852a03021754bb5873b25f068636f",
"size": "571",
... |
from argparse import ArgumentParser
import torch
import torch.nn.functional as F
from torch import nn
from torch.optim import SGD
from torch.utils.data import DataLoader
from torchvision.datasets import FashionMNIST
from torchvision.transforms import Compose, Normalize, ToTensor
from tqdm import tqdm
from ignite.engi... | {
"content_hash": "263769070713b5440152d39b7e79362b",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 149,
"avg_line_length": 39.88034188034188,
"alnum_prop": 0.6648092584654951,
"repo_name": "suresh/notebooks",
"id": "54de0eefacb9ad22b653a631171f4a734fe8e35e",
"size": "46... |
"""Contains the definition for Inflated 3D Inception V1 (I3D).
The network architecture is proposed by:
Joao Carreira and Andrew Zisserman,
Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset.
https://arxiv.org/abs/1705.07750
"""
from __future__ import absolute_import
from __future__ import divi... | {
"content_hash": "286e8963f1b002bce177c9f0e1a036ed",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 80,
"avg_line_length": 34.52121212121212,
"alnum_prop": 0.6574789325842697,
"repo_name": "googleinterns/wss",
"id": "c4782d4199007746444a97b024f1e481c052c154",
"size": "63... |
import uuid
import http.client
from oslo_serialization import jsonutils
from keystone.common.policies import grant as gp
from keystone.common import provider_api
import keystone.conf
from keystone.tests.common import auth as common_auth
from keystone.tests import unit
from keystone.tests.unit import base_classes
from... | {
"content_hash": "83b8f00147fb56b8a77c107260393412",
"timestamp": "",
"source": "github",
"line_count": 2265,
"max_line_length": 119,
"avg_line_length": 35.4644591611479,
"alnum_prop": 0.5496159448255257,
"repo_name": "openstack/keystone",
"id": "bb74b090142059ac2d9e8ecf31ae065a5c730b43",
"size": "... |
import jinja2
import jinja2.nodes
from jinja2.ext import Extension
from .templatetags.wagtailcore_tags import pageurl, richtext, slugurl, wagtail_version
class WagtailCoreExtension(Extension):
tags = {'include_block'}
def __init__(self, environment):
super().__init__(environment)
self.envir... | {
"content_hash": "d11637c12febe5468ba1d48b5787231c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 117,
"avg_line_length": 31.216666666666665,
"alnum_prop": 0.6241324079017618,
"repo_name": "timorieber/wagtail",
"id": "e5f6c499450f0e03f4f65cba338ee66430f37b98",
"size": "... |
"""Universal Vision Transformer with Adaptive Computation Time."""
from typing import Any, Optional
import flax.linen as nn
from flax.training import common_utils
import jax
import jax.numpy as jnp
import ml_collections
import numpy as np
from scenic.model_lib.base_models import base_model
from scenic.model_lib.base_... | {
"content_hash": "0c7cced0290d7d4fba812275437026bb",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 102,
"avg_line_length": 36.01146788990825,
"alnum_prop": 0.6514871664225209,
"repo_name": "google-research/scenic",
"id": "f5fe86f532f8415638ecb6218c798e7f934328a2",
"size... |
"""Tests for xla_sharding.Sharding class and associated module functions."""
from absl.testing import absltest
import numpy as np
from google.protobuf.message import DecodeError
from tensorflow.compiler.xla import xla_data_pb2
from tensorflow.python.compiler.xla.experimental import xla_sharding
from tensorflow.python... | {
"content_hash": "d66b5f991ff59ef40954f90840f50f99",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 80,
"avg_line_length": 40.98089171974522,
"alnum_prop": 0.704849238420889,
"repo_name": "yongtang/tensorflow",
"id": "2f0281e99b21de16a9548666e78faa7ab1f22d9e",
"size": "7... |
from __future__ import with_statement
import sys
import logging
from os import path, sep, remove
from subprocess import Popen, PIPE # the default jython included in android sdk does not support check_output
from engine.Tester import Tester
from engine.TestServer import TestServer
from engine.AppTestEngine import AppTe... | {
"content_hash": "80ebef7738569a4dae529cf6d670e3ae",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 135,
"avg_line_length": 40.39148936170213,
"alnum_prop": 0.6267383059418458,
"repo_name": "xinquanking/test4u",
"id": "16d963c6e89af21a1ab096520fcfaed02b41e682",
"size": "... |
import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | {
"content_hash": "c907d59c82b40c081644111742efea59",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 78,
"avg_line_length": 38.47511312217195,
"alnum_prop": 0.6369516641185464,
"repo_name": "kaichogami/scikit-learn",
"id": "ce67c0eccc9d89c9bbbb10abe568f5eaa2b8e759",
"size... |
"""
KFServing
Python SDK for KFServing # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class V1Time(object):
"""NOTE: This class is auto generated by the swagger code generator prog... | {
"content_hash": "01352225875569b5519e97b7e701ac4a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 80,
"avg_line_length": 27.28235294117647,
"alnum_prop": 0.5222078482104355,
"repo_name": "kubeflow/kfserving-lts",
"id": "cf0646700c2b3920aa2b827547691defaec0f5bf",
"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.append(os.path.abspath('../'))
# -- General configuratio... | {
"content_hash": "de5d5eff1f80629f87c0aab2c512b23a",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 80,
"avg_line_length": 32.78688524590164,
"alnum_prop": 0.7108333333333333,
"repo_name": "myles-archive/asgard-blog",
"id": "bee533e2a1429a4f82b231dcc0509103325e7add",
"si... |
import numpy as np
def percent_round_int(percent, x):
return np.round(percent * x).astype(int)
| {
"content_hash": "d8259666725c6cc7396352cdc8201a1d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 20.2,
"alnum_prop": 0.7029702970297029,
"repo_name": "ntasfi/PyGame-Learning-Environment",
"id": "cf7f43aa25b5a67ac35b0b60fcb760e5d507b335",
"size": "... |
"""Extra commands for setup.py.
In addition to providing a few extra command classes in `l10n_cmdclass`,
we also modify the standard `distutils.command.build` and
`setuptools.command.install_lib` classes so that the relevant l10n commands
for compiling catalogs are issued upon install.
"""
from __future__ import with... | {
"content_hash": "edc6af443602f3232c715544ecb604ea",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 79,
"avg_line_length": 41.026365348399246,
"alnum_prop": 0.5121413816846454,
"repo_name": "jun66j5/trac-ja",
"id": "ddb586e48520a1bedb86ec992716b82d973e0227",
"size": "222... |
import re
from gitdb.util import hex_to_bin
from .objects.blob import Blob
from .objects.util import mode_str_to_int
from git.compat import (
defenc,
PY3
)
__all__ = ('Diffable', 'DiffIndex', 'Diff')
class Diffable(object):
"""Common interface for all object that can be diffed against another object... | {
"content_hash": "489d4e67fa0e923e8b88b5676a31a27c",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 107,
"avg_line_length": 36.55128205128205,
"alnum_prop": 0.5351104875482287,
"repo_name": "bwrsandman/GitPython",
"id": "dc53f3f7113abab8196b12745d03d06265fc5941",
"size":... |
import sys, os
foo_dir = os.path.dirname(os.path.join(os.getcwd(), __file__))
sys.path.append(os.path.normpath(os.path.join(foo_dir, '../DataGathering', '..')))
sys.path.append(os.path.normpath(os.path.join(foo_dir, '../Classification', '..')))
sys.path.append(os.path.normpath(os.path.join(foo_dir, '../TextCleaning', '... | {
"content_hash": "c5add6cc45a1fbf98068e70be7cf1831",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 93,
"avg_line_length": 26.8375,
"alnum_prop": 0.6297158826269212,
"repo_name": "steinnp/Big-Data-Final",
"id": "60e88a82cb8cb28171fdbcd4e7adc1a270766bfa",
"size": "2148",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.