text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function
from ommongo.py3compat import *
from nose.tools import *
from ommongo.session import Session
from ommongo.document import *
from ommongo.fields import *
from test.util import known_failure
# Document Types used in some tests
class TestDoc(Document):
int1 = IntField()
def ... | {
"content_hash": "eacadca113006b21de27ac74a41feb20",
"timestamp": "",
"source": "github",
"line_count": 527,
"max_line_length": 77,
"avg_line_length": 25.466793168880454,
"alnum_prop": 0.5977199910587885,
"repo_name": "bapakode/OmMongo",
"id": "4d257db1f79c01fbc2c1a65012eaa364619195f9",
"size": "13... |
"""
Report Table Widget
This creates a composite widget designed to display tabular data.
"""
import Tkinter as tk
import tkFont
import ttk
# ZIH - temp
style = ttk.Style()
#style.configure( '.', relief = 'flat', borderwidth = 0 )
#style.layout( 'Treeview', [ ( 'Treeview.treearea', { 'sticky' : 'nswe' } ) ] )
#=... | {
"content_hash": "1fe810f4d4fd297f5a3ab5f8c632d4eb",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 79,
"avg_line_length": 30.827118644067795,
"alnum_prop": 0.48361557070595995,
"repo_name": "zhester/hzpy",
"id": "c1b09142d58469fdea63953d9f7dec5e6e9e538e",
"size": "9118"... |
"""
A utility script that purges st2 executions older than certain
timestamp.
*** RISK RISK RISK. You will lose data. Run at your own risk. ***
"""
from __future__ import absolute_import
from datetime import datetime
import six
import pytz
from oslo_config import cfg
from st2common import config
from st2common imp... | {
"content_hash": "cc51ac27cbfc129a4f42ec494535d4e0",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 85,
"avg_line_length": 29.21951219512195,
"alnum_prop": 0.6456594323873122,
"repo_name": "StackStorm/st2",
"id": "27225d661c96dc838a8422966e7244a1e4c72f8a",
"size": "3025",... |
from neutron.api.v2 import attributes as attr
from neutron.db import allowedaddresspairs_db as addr_pair_db
from neutron.db import db_base_plugin_v2
from neutron.db import portsecurity_db
from neutron.extensions import allowedaddresspairs as addr_pair
from neutron.extensions import portsecurity as psec
from neutron imp... | {
"content_hash": "f26847068c68ca699b20aae779fa1028",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 79,
"avg_line_length": 49.46254071661238,
"alnum_prop": 0.5193282844912743,
"repo_name": "CingHu/neutron-ustack",
"id": "c5e599a057075f11b7e265b794a1df18bc7cc483",
"size":... |
"""PollSubmissions API Tests for Version 1.0.
This is a testing template for the generated PollSubmissionsAPI Class.
"""
import unittest
import requests
import secrets
from pycanvas.apis.poll_submissions import PollSubmissionsAPI
from pycanvas.apis.poll_submissions import Pollsubmission
class TestPollSubm... | {
"content_hash": "9ac166b8534584ee98d663e607fc9ac1",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 126,
"avg_line_length": 38.43333333333333,
"alnum_prop": 0.7085862966175195,
"repo_name": "PGower/PyCanvas",
"id": "03842a9b470943463d1cea893a56ce11ab49ee7d",
"size": "1153... |
import os
from ingenico.connect.sdk.factory import Factory
from ingenico.connect.sdk.domain.sessions.session_request import SessionRequest
class CreateSessionExample(object):
def example(self):
with self.__get_client() as client:
tokens = []
tokens.append("126166b16ed04b3ab85fb06... | {
"content_hash": "e2e4cf8d0554fc5a5664d01afdd6e787",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 100,
"avg_line_length": 44.48275862068966,
"alnum_prop": 0.6263565891472869,
"repo_name": "Ingenico-ePayments/connect-sdk-python3",
"id": "ca6b66cc2c223a3e7c9da910c57eb4f97f1... |
"""The tests for the image_processing component."""
from unittest.mock import patch, PropertyMock
from homeassistant.core import callback
from homeassistant.const import ATTR_ENTITY_PICTURE
from homeassistant.setup import setup_component
from homeassistant.exceptions import HomeAssistantError
import homeassistant.comp... | {
"content_hash": "2c127eba1add201e6e4f9e74bd8b44e3",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 78,
"avg_line_length": 35.11036789297659,
"alnum_prop": 0.5969708515907792,
"repo_name": "nugget/home-assistant",
"id": "7a31b2ffadfc4a858834ff197edefe9288fc5f21",
"size":... |
import datetime
import logging
import requests
from .exceptions import RequestsError, InputError
logging.basicConfig()
class Connection(object):
BASE_URL = 'http://192.168.9.1'
def __init__(self):
self._session = requests.Session()
self._set_headers()
def get(self, params):
log... | {
"content_hash": "90e2fde28c767b910219d26129a7296b",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 36.51968503937008,
"alnum_prop": 0.5937904269081501,
"repo_name": "alzeih/python-vodem-vodafone-K4607-Z",
"id": "1d64d231ac0b7e5c0d52dac8852a57be72408... |
from django.conf.urls import url
urlpatterns = [
url(r'^$', 'schedules.views.index', name='index'),
url(r'^home$', 'schedules.views.home', name='home'),
url(r'^login$', 'schedules.views.log_in', name='login'),
url(r'^logout$', "schedules.views.log_out", name="logout"),
url(r'^query-users$', 'sched... | {
"content_hash": "250e45abca3c4a3c8c67b40d8e2544b1",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 98,
"avg_line_length": 50.94117647058823,
"alnum_prop": 0.6466512702078522,
"repo_name": "Shelo/Schedules",
"id": "6468fe4aa0af8a24a8abd258e5b56561e1cbc1b4",
"size": "866",... |
from logging import Formatter
from logging.handlers import RotatingFileHandler
from celery.utils.log import logging
def sketchy_logger(app):
'''Logger configuration for Sketchy'''
file_handler = RotatingFileHandler(
app.config.get('SKETCHY_LOG_FILE'),
maxBytes=10000000,
backupCount=100... | {
"content_hash": "804c1702ebb54f2d4caaea57ee3ea3e7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 81,
"avg_line_length": 37.06666666666667,
"alnum_prop": 0.6654676258992805,
"repo_name": "Netflix/sketchy",
"id": "0913de0b5345eb789694e2d3e90765e8b53c1b68",
"size": "1173"... |
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from designate import exceptions
from designate.tests import fixtures
from designate.tests import TestCase
from designate.worker import processing
CONF = cfg.CONF
class TestProcessingExecutor(TestCase):
def se... | {
"content_hash": "3462d9a8b12be3c2d49fb6aff06da2ca",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 63,
"avg_line_length": 26.128205128205128,
"alnum_prop": 0.6211972522080471,
"repo_name": "openstack/designate",
"id": "5229b1573e574aec33ccde3a4af79116e6322e6e",
"size": "... |
import pysal
from pysal.cg.standalone import get_shared_segments
import numpy as np
from collections import defaultdict
from itertools import combinations
import multiprocessing as mp
# delta to get buckets right
DELTA = 0.000001
QUEEN = 1
ROOK = 2
# constants for bucket sizes
BUCK_SM = 8
BUCK_LG = 80
SHP_SMALL = ... | {
"content_hash": "e1e844e462df5ce44b6f7069a338c52a",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 172,
"avg_line_length": 32.21533923303835,
"alnum_prop": 0.48539511033788113,
"repo_name": "pysal/pPysal",
"id": "2042221847fffd917b28256be180ec9966fde594",
"size": "10921... |
from trac.core import Component, implements
from trac.web import ITemplateStreamFilter
from trac.ticket import ITicketManipulator, ITicketChangeListener
from trac.ticket.model import Ticket, TicketSystem, Type
from genshi.filters import Transformer
from genshi.builder import tag
import re
NUMBERS_RE = re.compile(r'\d... | {
"content_hash": "b9932f21da37384dc2bd1a9ec23f77d6",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 137,
"avg_line_length": 39.15438596491228,
"alnum_prop": 0.5512142665113361,
"repo_name": "CaulyKan/TracTicketRelationPlugin",
"id": "7b0f6e10e5839dd3645e2dfe5ca9a7c0716e62a... |
import os.path
import sys
from functools import wraps
from django.conf import settings as django_settings
from django.core.management.utils import get_random_secret_key
from fabric.api import (cd, env, prefix, prompt, put, quiet, require, run,
settings, sudo, task)
from fabric.colors import gre... | {
"content_hash": "04d13833a9f0ff5e916c76800ff9f9cb",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 78,
"avg_line_length": 30.67168674698795,
"alnum_prop": 0.6069920455661396,
"repo_name": "kingsdigitallab/mpol-django",
"id": "e7fe7752c1450887047c143310298d50829d41d4",
"... |
import os
import subprocess
from typing import Optional, Type
import irctest
from irctest.basecontrollers import BaseServicesController, DirectoryBasedController
import irctest.cases
import irctest.runner
TEMPLATE_CONFIG = """
loadmodule "modules/protocol/{protocol}";
loadmodule "modules/backend/opensex";
loadmodule ... | {
"content_hash": "a122f0b17c0b20c237031903ba34dee1",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 123,
"avg_line_length": 29.495412844036696,
"alnum_prop": 0.6202177293934681,
"repo_name": "ProgVal/irctest",
"id": "6877c9f8a93d6eda35600a527f4bd6ecc3c31b4c",
"size": "32... |
"""
Given a sorted linked list, delete all nodes that have duplicate numbers,
leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2->3, return 2->3.
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
#... | {
"content_hash": "34424c2d69afc577d9038bf17e544f6b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 28.694444444444443,
"alnum_prop": 0.5353339787028074,
"repo_name": "ufjfeng/leetcode-jf-soln",
"id": "49e923e7706d7868cf867bd47be668e60cb671da",
"siz... |
from truck import Truck
from utils.setting import configuration
def test():
car = Truck('GMC', configuration)
car.display()
print car.power
if __name__ == '__main__':test() | {
"content_hash": "4254a60581b11fdc289469b146a4d0d5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 39,
"avg_line_length": 21.11111111111111,
"alnum_prop": 0.6473684210526316,
"repo_name": "vollov/py-lab",
"id": "2cd1bc74b919582231794a2e20312b92ac53e434",
"size": "190",
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "f46ce7442c6e4b8e96a34f2ab371f3de",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 173,
"avg_line_length": 31.933333333333334,
"alnum_prop": 0.7113778705636743,
"repo_name": "alexryndin/ambari",
"id": "076e4511987d47b320d09fa8409afec4bfdcf680",
"size": "1... |
from .client import AdServiceClient
__all__ = ("AdServiceClient",)
| {
"content_hash": "17bbd59588f0dac7b65f36dc3c4c6127",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 35,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7205882352941176,
"repo_name": "googleads/google-ads-python",
"id": "7880d3db959175ea35c3b48ec931fe1d022bc7ec",
"s... |
"""
This program is demonstration for face and object detection using haar-like features.
The program finds faces in a camera image or video stream and displays a red box around them.
Original C implementation by: ?
Python implementation by: Roman Stanchak, James Bowman
Updated: Copyright (c) 2016, Tal Regev.
"""
im... | {
"content_hash": "59da6cf52c0ba52d656b72331b4ba475",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 185,
"avg_line_length": 38.46280991735537,
"alnum_prop": 0.6602922217447357,
"repo_name": "ros-perception/vision_opencv",
"id": "ee0e30f0f8719211d91ca18284b8e7987c710661",
... |
import parlai.core.build_data as build_data
from parlai.core.build_data import DownloadableFile
import os
RESOURCES = [
DownloadableFile(
url='1kVr-YsUVFisceiIklvpWEe0kHNSIFtNh',
file_name='entailment_trees_emnlp2021_data_v3.zip',
hashcode='fe05a02f181bb3d27fa2f8bafda824f7a988af9df59f848d6... | {
"content_hash": "c5608b59668532732005ff390cb55482",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 30.38888888888889,
"alnum_prop": 0.6590493601462523,
"repo_name": "facebookresearch/ParlAI",
"id": "92252c0d1e682207f3cb46fe0976a63cf59891a3",
"size"... |
import filecmp
import os
from typing import Any, Dict, List, Mapping, Optional
from unittest.mock import MagicMock, patch
import orjson
from django.core import mail
from django.test import override_settings
from zulip_bots.custom_exceptions import ConfigValidationError
from zerver.lib.actions import (
do_change_s... | {
"content_hash": "cb0db5fa867258622b575169c530320d",
"timestamp": "",
"source": "github",
"line_count": 1668,
"max_line_length": 133,
"avg_line_length": 39.6378896882494,
"alnum_prop": 0.5931242059410733,
"repo_name": "eeshangarg/zulip",
"id": "837a33bb13ef8ce734300019eeb22ae548f83476",
"size": "66... |
import os
import sys
import matplotlib
matplotlib.use('Qt5Agg')
from PyQt5.QtWidgets import QApplication
from bssrdf_estimate.interface import MainWindow
if __name__ == '__main__':
# Create directory for intermediate results
try:
os.mkdir('result')
print('[INFO] result directory is created!')... | {
"content_hash": "4f0c3b891226580231f79c7de67ef4c6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 24.363636363636363,
"alnum_prop": 0.6772388059701493,
"repo_name": "tatsy/bssrdf-estimate",
"id": "7f02d55b598e76342b30d86705fe6a69bdb68d02",
"size":... |
import re
from nova import exception
from nova.i18n import _
# Define the minimum and maximum version of the API across all of the
# REST API. The format of the version is:
# X.Y where:
#
# - X will only be changed if a significant backwards incompatible API
# change is made which affects the API as whole. That is, s... | {
"content_hash": "c6741f826656a1b7b603f533885f60c8",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 79,
"avg_line_length": 37.331288343558285,
"alnum_prop": 0.6440427280197206,
"repo_name": "nikesh-mahalka/nova",
"id": "450b2717fd8659c9dc1de3175387655a0abfcb46",
"size": ... |
import pbr.version
version_info = pbr.version.VersionInfo('ironic_lib')
| {
"content_hash": "e6f8dcf9ef83107ccb36adfeda0a7b1d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 52,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.7808219178082192,
"repo_name": "NaohiroTamura/ironic-lib",
"id": "cd45253b1a29ea281267655b3688a3cf38af0f21",
"size... |
from distutils.core import setup
setup(
name='python-escpos',
version='1.0.9',
url='https://github.com/mosquito/python-escpos',
download_url='https://github.com/mosquito/python-escpos/archive/master.zip',
description='Python library to manipulate ESC/POS Printers',
long_description=open('README... | {
"content_hash": "fa1af07f96f8ea21b7e6ee9f3ccaf19d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 28.347826086956523,
"alnum_prop": 0.6119631901840491,
"repo_name": "1upon0/rfid-auth-system",
"id": "e5ee86010948c8f226bfcab89461782f296d20a7",
"size... |
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from talkstarter.models import *
class EventAdmin(ModelAdmin):
list_display = ['title', 'date', 'operator', 'minimum_backers', 'backing_percentage', 'is_backed',]
admin.site.register(Operator)
admin.site.register(Event, EventAdmin)
admin.si... | {
"content_hash": "9faef5ff8bc05f9e90c28d339f3d0622",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 100,
"avg_line_length": 33.90909090909091,
"alnum_prop": 0.7882037533512064,
"repo_name": "appsburg/talkstarter",
"id": "2fe28136308046b804cf6b80845ea89e6c936c4c",
"size": ... |
"""Python front-end supports for functions.
NOTE: functions are currently experimental and subject to change!
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import hashlib
from tensorflow.core.framework import attr_value_pb2
from t... | {
"content_hash": "57e2cb6e85ec3c5c0c72791ecebbffcc",
"timestamp": "",
"source": "github",
"line_count": 1007,
"max_line_length": 80,
"avg_line_length": 34.25124131082423,
"alnum_prop": 0.6480821083760981,
"repo_name": "adamtiger/tensorflow",
"id": "727242383e33e3449b1bbc1cc9a84c48155ea1bd",
"size":... |
from django.db import models
POSITIONS = (
('G', 'Goalkeeper'),
('D', 'Defender'),
('M', 'Midfielder'),
('F', 'Forward'),
('S', 'Sub'),
)
class BaseModel(models.Model):
''' Simple abstract base model '''
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeFiel... | {
"content_hash": "b658907525c052d71a762f11b42aa33d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 53,
"avg_line_length": 19.894736842105264,
"alnum_prop": 0.58994708994709,
"repo_name": "f4nt/mls-api",
"id": "be1ee535c658317d0f97dd6b955499b640499a91",
"size": "378",
"... |
import ConfigParser
import logging
import tornado.web
import httplib
import json
from tornado.escape import json_encode
from MongoManager import MongoManager
import FormatConverterUtil
logger = logging.getLogger('log.application')
class SearchController(tornado.web.RequestHandler):
config = ConfigParser.Confi... | {
"content_hash": "b5ea92caefc7bf1d5f8a5c37915c9b6a",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 164,
"avg_line_length": 45.01204819277108,
"alnum_prop": 0.6587259100642399,
"repo_name": "SubhasisDutta/CAMEO-JRC-Database",
"id": "72fac8f3a3de858896ee345b9d222dca90cd5cdc"... |
from . import api
class StudentEvents():
# StudentEvents.StudentEvents
def student_events(self, titleOnly=False, auth=True):
params = {'TitleOnly': titleOnly}
return api.call('StudentEvents', params, auth)
# StudentEvents.StudentEvents_Categories
def student_events_categories(self, inc... | {
"content_hash": "d4b255777a934248515686aed7a1b765",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 143,
"avg_line_length": 52.78125,
"alnum_prop": 0.7217288336293665,
"repo_name": "karen/ivle-bot",
"id": "a20bf48fcfbae6ba84cad96392d9a645aceb41aa",
"size": "1689",
"bina... |
'''
Created on Jul 15, 2021
@author: 658723
'''
from dateutil import parser
from datetime import datetime
from datetime import timedelta
from ....core.BaseAgent3 import BaseAgent
import json
class SpinnakerAgent(BaseAgent):
@BaseAgent.timed
def process(self):
baseUrl = self.config.get("baseUrl",... | {
"content_hash": "619f95328df49d5c3863c2f069ec0b0b",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 133,
"avg_line_length": 45.015151515151516,
"alnum_prop": 0.6199932682598451,
"repo_name": "CognizantOneDevOps/Insights",
"id": "755d33b0e526e6ec02325d4c386976b925a6813a",
... |
import cairocffi
from . import base
from os import statvfs
import time
__all__ = [
'CPUGraph',
'MemoryGraph',
'SwapGraph',
'NetGraph',
'HDDGraph',
'HDDBusyGraph',
]
class _Graph(base._Widget):
fixed_upper_bound = False
defaults = [
("graph_color", "18BAEB", "Graph color"),
... | {
"content_hash": "03455e1c9af803d0ff13b8f09d17dd38",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 82,
"avg_line_length": 31.439086294416242,
"alnum_prop": 0.5487204327117139,
"repo_name": "aniruddhkanojia/qtile",
"id": "5ab252c05dca6a5775c767645f4910c1e6016a07",
"size"... |
from flask import Flask
app = Flask(__name__)
app.config.from_object('config')
| {
"content_hash": "ad4ec99e58467e89e0c5c625d529032c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 32,
"avg_line_length": 20,
"alnum_prop": 0.7125,
"repo_name": "Akagi201/learning-python",
"id": "f3d0dca854e3089a28fc109ebbb3657711bc0c37",
"size": "80",
"binary": false,
... |
from abc import abstractmethod
class Algo(object):
"""Training algorithm interface."""
@abstractmethod
def train(self, dataset, LR, M):
raise NotImplementedError
def supervised(algo, dataset,
learningRate, momentum,
epoches, E=0.001):
"""Supervised training on th... | {
"content_hash": "b3a814994ac2fd031659c2ce82da196d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 28.4,
"alnum_prop": 0.625,
"repo_name": "khachik/ghugh",
"id": "27f3f13be921ef10d5f63acf142bc029674a54d4",
"size": "568",
"binary": false,
"copie... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
host:
description:
- Specifies the DNS host name or address for connecting to the remote
device over the specified transport. The value of host is used as
the destination address f... | {
"content_hash": "36b4b7dad9daccfac695b7c3f363bb3c",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 79,
"avg_line_length": 38.44927536231884,
"alnum_prop": 0.6950621937429325,
"repo_name": "abtreece/ansible",
"id": "dd9944b99595a2f7817a1fe632c2c42541571ffa",
"size": "3395... |
import os
import sys
import time
import httplib
import hmac
import json
import hashlib
import urllib
import re
import socket
host = 'api.pusherapp.com'
port = 80
app_id = None
key = None
secret = None
channel_name_re = re.compile('^[-a-zA-Z0-9_=@,.;]+$')
app_id_re = re.compile('^[0-9]+$')
def url2o... | {
"content_hash": "d9d1c6d430b39897f177d5f9789b910d",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 137,
"avg_line_length": 38.2807881773399,
"alnum_prop": 0.6233431990734783,
"repo_name": "cloud9209/chatting",
"id": "f43a4813abdaf80bd1e1a345756364d98d322064",
"size": "7... |
"""Extensions to Jax/Flax core functions for Mixture of Experts training."""
from typing import Sequence
import jax.numpy as jnp
from flaxformer.types import Array
def scatter_nd(indices: Array, updates: Array, shape: Sequence[int]) -> Array:
"""JAX implementation of tf.scatter_nd.
See https://www.tensorflow.... | {
"content_hash": "58417ad1299e27d423c0c13497c56709",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 35.25714285714286,
"alnum_prop": 0.7163695299837926,
"repo_name": "google/flaxformer",
"id": "6040b5ed51dc733a0174fcc282adf904a3b233ea",
"size": "181... |
import time, datetime, os
from collections import OrderedDict
import csv, json, re, sys
import requests
import random
import operator
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.finance import quotes_historical_yahoo_ochl
from matplotlib.dates import HourLocator, MinuteLocator, SecondLocator, Da... | {
"content_hash": "be9f413074fb1c23723743626b62ea39",
"timestamp": "",
"source": "github",
"line_count": 542,
"max_line_length": 111,
"avg_line_length": 33.5,
"alnum_prop": 0.5453544087679683,
"repo_name": "liu12295/stock",
"id": "6e6dfcc962f1a489b0168e34ecdc6599e004f8b8",
"size": "19297",
"binary... |
__all__ = ['imread', 'imsave']
from ...util.dtype import convert
try:
import imread as _imread
except ImportError:
raise ImportError("Imread could not be found"
"Please refer to http://pypi.python.org/pypi/imread/ "
"for further instructions.")
def imread(fname, dt... | {
"content_hash": "56a06d39fbd7ee6701a83e1ab7d60304",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 22.46511627906977,
"alnum_prop": 0.5807453416149069,
"repo_name": "michaelpacer/scikit-image",
"id": "9311f18f03368eed3b0ca8b3a109741de8b833ca",
"siz... |
"""Tree-based minimization algorithms."""
import copy
import inspect
import numbers
import numpy as np
from collections import Iterable
from sklearn.base import clone
from sklearn.base import is_regressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.utils import check_random_state
from .acqui... | {
"content_hash": "e7457e7e6152172fbd3bd8276bb91edf",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 94,
"avg_line_length": 40.01559020044544,
"alnum_prop": 0.6081705348694829,
"repo_name": "glouppe/scikit-optimize",
"id": "a7f8963f435a984b51f7ddbbec075ebf436e1656",
"size... |
from suplemon.suplemon_module import Module
class LStrip(Module):
def run(self, app, editor, args):
# TODO: move cursors in sync with line contents
line_nums = editor.get_lines_with_cursors()
for n in line_nums:
line = editor.lines[n]
line.data = line.data.lstrip()
... | {
"content_hash": "569ad981d0844b16d052e8142ff75943",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 25.133333333333333,
"alnum_prop": 0.6021220159151194,
"repo_name": "trylle/suplemon",
"id": "fa3dadaa913046dcbd5ef652c44af9d7af672674",
"size": "400"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MarketPostComment'
db.create_table('market_marketpostcomment', (
('id', self.gf('django.db.model... | {
"content_hash": "38a469e7415d4d33194561bcc9913332",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 181,
"avg_line_length": 69.0725806451613,
"alnum_prop": 0.5522475189725627,
"repo_name": "codepython/CollectorCity-Market-Place",
"id": "7f910aefef63f1bc1b31b400ae5565338d0a... |
import urlparse,urllib2,urllib,re
import os
from core import scrapertools
from core import logger
from core import config
def test_video_exists( page_url ):
return True,""
def get_video_url( page_url , premium = False , user="" , password="", video_password="" ):
logger.info("[nowdownload.py] get_video_url (... | {
"content_hash": "fe1d90761dc70b548296aa023d43c0c9",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 234,
"avg_line_length": 44.758620689655174,
"alnum_prop": 0.6548536209553159,
"repo_name": "jose36/plugin.video.Jmdl2",
"id": "4e84c2a8ceca670d263a87fd513d827cf519c7e8",
"s... |
""" Module to test exercise3.py """
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__ = "MIT License"
import mock
from exercise3 import diagnose_car
# test passed!!
def test_accepted_inputs(capsys):
with mock.patch("__builtin__.raw_input", side_effect=["Y", ... | {
"content_hash": "6716edec80b9ee10ec7513c79af005a7",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 84,
"avg_line_length": 34.5625,
"alnum_prop": 0.5786618444846293,
"repo_name": "eden-r/inf1340_2015_asst1",
"id": "a9952a2f6ab30e9279ce9a032331ed37a7f2c9cc",
"size": "1682"... |
"""
Django settings for engine project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | {
"content_hash": "380992fc7efe3eeb7a148391d870679d",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 97,
"avg_line_length": 26.022222222222222,
"alnum_prop": 0.6783376031881583,
"repo_name": "brandoshmando/devour",
"id": "42675268ae10d1348f0f9fb2747eaa4688d61a6f",
"size":... |
import codecs
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of r... | {
"content_hash": "4764fe6bc7676ff15a38e28c6ff48c8f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 89,
"avg_line_length": 35.67883211678832,
"alnum_prop": 0.5552373158756138,
"repo_name": "renzon/gaeforms",
"id": "ea215663022d44fae2b039ccb5a93c28dbf30f7f",
"size": "4888... |
from ztag.annotation import *
class VerisIndustriesAnnotation(Annotation):
protocol = protocols.MODBUS
subprotocol = protocols.MODBUS.DEVICE_ID
port = None
def process(self, obj, meta):
vendor = obj["mei_response"]["objects"]["vendor"].lower()
if "veris" in vendor:
meta.g... | {
"content_hash": "21d947bab55af944fb9ffe6f384044fc",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 26.266666666666666,
"alnum_prop": 0.6598984771573604,
"repo_name": "zmap/ztag",
"id": "fcacdbb6a3905a6302c2e60f4db8e80dfe292772",
"size": "394",
"b... |
from __future__ import absolute_import
import pytest
from .utils import decode_psd
@pytest.mark.parametrize('filename', ['masks.psd', 'masks2.psd'])
def test_file_with_masks_is_parsed(filename):
psd = decode_psd(filename)
for channels in psd.layer_and_mask_data.layers.channel_image_data:
assert len(ch... | {
"content_hash": "4d113295e60482aeca32b04567a40214",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 70,
"avg_line_length": 33.3,
"alnum_prop": 0.7207207207207207,
"repo_name": "EvgenKo423/psd-tools",
"id": "11560a1254f332dbdd4d691558d98505cfba48e5",
"size": "357",
"bina... |
"""Support for command line covers."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
import voluptuous as vol
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity
from homeassistant.const import (
CONF_COMMAND_CLOSE,
CONF_COMMAND_OPEN,
CONF_COM... | {
"content_hash": "0934496f30d1f1b2e9d3b19c7dde9bf6",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 87,
"avg_line_length": 32.260355029585796,
"alnum_prop": 0.6254585473220836,
"repo_name": "nkgilley/home-assistant",
"id": "8298201228f45d3e5533361838ed5b44a43bd245",
"siz... |
import aiohttp.web
import aiohttp.web_request
class HealthController:
@staticmethod
async def handle_health_check(request: aiohttp.web_request.Request) -> aiohttp.web.Response:
return aiohttp.web.Response(text='TriggearIsOk', reason=f'Host {request.host} asked')
| {
"content_hash": "e6bc89b3b4a6f73cb521710347d3ba23",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 96,
"avg_line_length": 35.125,
"alnum_prop": 0.7580071174377224,
"repo_name": "futuresimple/triggear",
"id": "e29fb7635e86d0fa03416c5505022f64c548580c",
"size": "281",
"bi... |
"""virt 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-based... | {
"content_hash": "b0de0836766a25ebc66747f144f2f25c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 40.035714285714285,
"alnum_prop": 0.687778768956289,
"repo_name": "erikkn/vmx-hosting",
"id": "e199f18e5372070e30974dc479fe97cb1ed17055",
"size": "11... |
def cargarListas(nombrearchivo,lista):
try:
archivo = open(nombrearchivo, "rt")
while True:
linea = archivo.readline()
if not linea:
break
linea = linea[:-1]
listaNombre, Articulos = linea.split("=")
if Articulos.st... | {
"content_hash": "3e54d467df7a393b4fc2b025b00e6754",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 68,
"avg_line_length": 26.923076923076923,
"alnum_prop": 0.5571428571428572,
"repo_name": "jlermauip/uip-prog3",
"id": "34a0a409ab4899b80abab1abb576c3080199a882",
"size": "... |
from abc import ABCMeta, abstractmethod
from sft.Actions import Actions
class ActionHistory(object):
__metaclass__ = ABCMeta
ACTION_WIDTH = len(Actions.all)
@abstractmethod
def get_size(self):
pass
@abstractmethod
def get_history(self, all_actions):
pass
@abstractmethod
def new_action(self, action):
... | {
"content_hash": "109b79d83d5096d54429b5e73ecbbf4b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 39,
"avg_line_length": 15.04,
"alnum_prop": 0.7367021276595744,
"repo_name": "kevinkepp/look-at-this",
"id": "c227163a11d67131842e95cc47e82de07b31e69e",
"size": "376",
"b... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def render(context, obj, args):
"""
Try to render an attribute from an object. It will first look for a function called 'render_<attr_name>' on the
view, If this doesnt exist it will look for an attribute w... | {
"content_hash": "7a1eebb2a597f971ff3bc8dcdc335d90",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 125,
"avg_line_length": 36.80327868852459,
"alnum_prop": 0.6610244988864142,
"repo_name": "wildfish/django-directory",
"id": "f7a1544ffc4bd5f5b9090b6ee00028b29906b77e",
"si... |
from __future__ import unicode_literals
from django.apps import AppConfig
class AuthentificationConfig(AppConfig):
name = 'authentification'
| {
"content_hash": "60f799f97945d37c11533d5541987f49",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 40,
"avg_line_length": 21.142857142857142,
"alnum_prop": 0.7837837837837838,
"repo_name": "rachidoulasri/django_projectwebpage",
"id": "b3a8f5069a03b8635ffb7f9cc3cdf597bd40840... |
"""
Script to fetch DBpedia data
"""
import sys, time
from urllib.request import urlopen
from urllib.parse import unquote
import json
def main():
for line in sys.stdin.readlines():
line = line.strip()
norm = unquote(line)
url = line.replace('/resource/', '/data/') + '.json'
time.sl... | {
"content_hash": "73357ddf6dca68a1c6cf13abeeac8268",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 106,
"avg_line_length": 30.6,
"alnum_prop": 0.4891067538126362,
"repo_name": "ViralTexts/vt-passim",
"id": "8c69c145e96a1b753d54c424c6c2636b9d3204c9",
"size": "940",
"bin... |
import numpy as np
#PARAMS DE TEST
def sommePonderee(utilite_marginale, poids):
"""Evaluation par somme ponderee"""
u = np.array(utilite_marginale)
p = np.array(poids)
print(" U ----", u, '-----P', p)
return np.dot(u, p)
| {
"content_hash": "4a9d8c2cb31406676a47f3e2780b6d05",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 25.3,
"alnum_prop": 0.5889328063241107,
"repo_name": "SimoRihani/ProjetLS",
"id": "342d52e04806ee7f6f8742657a5c1decec799744",
"size": "253",
"binar... |
"""
We need three stack migrations for 0.8.0 - there is an issue with fixing data and migrating
schema at the same time
"""
from __future__ import unicode_literals
from django.db import migrations
def blank_to_null(model_name, field_name):
def func(apps, schema_editor):
model_cls = apps.get_model('stac... | {
"content_hash": "3796250516ff0fc195f9a375d814ded7",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 123,
"avg_line_length": 28.536231884057973,
"alnum_prop": 0.6373793803961402,
"repo_name": "clarkperkins/stackdio",
"id": "8d4a4284d76ed0ebb2d2817881ad854aa323dc15",
"size"... |
"""
This actually does a write in Wikidata
"""
from wikidataintegrator import wdi_login, wdi_core, wdi_helpers
from scheduled_bots.geneprotein import HelperBot
from scheduled_bots.geneprotein.ProteinBot import main, Protein, PROPS
from pymongo import MongoClient
from scheduled_bots.local import WDUSER, WDPASS
def _te... | {
"content_hash": "1881f0b8a6365fb2d48d554e25e1d2c2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 97,
"avg_line_length": 30.38157894736842,
"alnum_prop": 0.6916414032048506,
"repo_name": "SuLab/scheduled-bots",
"id": "8d1d2680eff2e6cec5a6c7ae18b314653d923ad9",
"size": "... |
from os.path import realpath, normpath, exists
from multiprocessing import Process
import cv2
import imutils
import numpy as np
from detect_picture_utils import Broadcaster, Listener, log
class EmotionRecognizer(Process, Broadcaster, Listener):
def __init__(self):
Process.__init__(self)
Broadcas... | {
"content_hash": "5789416dd6d507a2b313ca1b1fe91b56",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 128,
"avg_line_length": 36.49438202247191,
"alnum_prop": 0.5504926108374384,
"repo_name": "CyberLabs-BR/face_detect",
"id": "607a18fac6138ee022dd343b4a8de133452c40c2",
"siz... |
""" Actors execute tasks from the database and upload the results. """
from __future__ import print_function
import simcity
from .util import Timer
from couchdb.http import ResourceConflict
try:
from Queue import Empty as QueueEmpty
except ImportError:
from queue import Empty as QueueEmpty
from multiprocessin... | {
"content_hash": "84330d680bab04567f43ab5702d6ea57",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 32.89820359281437,
"alnum_prop": 0.5575172915908263,
"repo_name": "indodutch/sim-city-client",
"id": "88bc21d9db0ec9202e86316bdb865ac034041651",
"si... |
"""
=============================================================
Online Latent Dirichlet Allocation with variational inference
=============================================================
This implementation is modified from Matthew D. Hoffman's onlineldavb code
Link: http://www.cs.princeton.edu/~mdhoffma/code/onli... | {
"content_hash": "17e917621f3a97dbcefea42e47ad9a2b",
"timestamp": "",
"source": "github",
"line_count": 712,
"max_line_length": 83,
"avg_line_length": 37.58005617977528,
"alnum_prop": 0.5702433008184774,
"repo_name": "imaculate/scikit-learn",
"id": "d7adedbeedb13e3c8bcdbce822711ecc559cd27b",
"size"... |
import os
import sys
import signal
from multiprocessing import util, process
__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close', 'ForkingPickler']
#
# Check that the current thread is spawning a child process
#
def assert_spawning(self):
if not Popen.thread_is_spawning():
raise RuntimeE... | {
"content_hash": "1fa1b89d2e95107ffdabc5c7810ea1ec",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 86,
"avg_line_length": 30.572340425531916,
"alnum_prop": 0.5408866309416104,
"repo_name": "MalloyPower/parsing-python",
"id": "5e04725a1e20c09b166b28c2ba17006e637b88ae",
"... |
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='brokenaxes',
version='0.5.0',
d... | {
"content_hash": "3c00a2bddc5237a526c655089e7ceb2d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 31.901639344262296,
"alnum_prop": 0.6500513874614594,
"repo_name": "bendichter/brokenaxes",
"id": "a98b46a3270bb6755cc41ae3d9cb41190e88f3d6",
"size":... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('event_mapper', '0029_auto_20150618_1416'),
]
operations = [
migrations.CreateModel(
name='Pro... | {
"content_hash": "4eb4fbb17d56aeb999dda5b5ce4b0aea",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 125,
"avg_line_length": 34.256410256410255,
"alnum_prop": 0.5643712574850299,
"repo_name": "timlinux/watchkeeper",
"id": "ba66f62830eb85407923b84d29c21bae6e787b3d",
"size":... |
from __future__ import absolute_import
# Generated by Django 1.9 on 2016-01-17 00:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sites', '0005_auto_20150823_2041'),
]
operations = [
migrations.RemoveF... | {
"content_hash": "71aaa19fe5d6e8557b30772cfedd0b7d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 45,
"avg_line_length": 21,
"alnum_prop": 0.6115288220551378,
"repo_name": "AlmostBetterNetwork/podmaster-host",
"id": "633690e89b168c1313f109c376fed034ea6aa4ee",
"size": "4... |
import io
import util
import typedbytes2
| {
"content_hash": "ca808a2cbab6883046d818c8cf9cbb19",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 18,
"avg_line_length": 10.5,
"alnum_prop": 0.8333333333333334,
"repo_name": "arbenson/mrtsqr",
"id": "2d42304d7e533a871ee2d5634a8697a360f2fe0a",
"size": "924",
"binary": f... |
# -*- coding: utf-8 -*-
from dronekit import connect, VehicleMode, LocationGlobal, LocationGlobalRelative
from pymavlink import mavutil
from Find_serial_ports import serial_ports
from Use_Sensors import engage_target
import logging
import time
import math
import serial
sensor_port = serial_ports()
ser = s... | {
"content_hash": "561b798dce4a1c6e856598b109fadc17",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 115,
"avg_line_length": 32.05780346820809,
"alnum_prop": 0.6601153984853949,
"repo_name": "sassystacks/DASS",
"id": "1bacb09d3a9ce3fe4a0f517867638dc1d2476db1",
"size": "55... |
''' Parameter settings for SFselect training.
Models of the scaled SFS for classifying neutral evolution from selective sweeps.
'''
####################################################################################
#################################### General #######################################
#############... | {
"content_hash": "62e87aca0421e1f1f60490237ad68862",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 89,
"avg_line_length": 37.28915662650602,
"alnum_prop": 0.4849757673667205,
"repo_name": "rronen/SFselect",
"id": "d2d2e1436a62df73438e070dfbb94c9887396306",
"size": "3096"... |
"""Tests for nn module."""
import collections
from functools import partial
import itertools
from absl.testing import absltest
from absl.testing import parameterized
import scipy.stats
from jax import core
from jax._src import test_util as jtu
from jax.test_util import check_grads
from jax import nn
from jax import... | {
"content_hash": "599236cfcd23ed75d5f21319d3e757ba",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 103,
"avg_line_length": 34.48196721311476,
"alnum_prop": 0.640106494247409,
"repo_name": "google/jax",
"id": "1d65eaa39e2c9f724f242d14d218dd704f1f64f7",
"size": "11099",
... |
import unittest
from urllib import unquote
import cStringIO as StringIO
from logging.handlers import SysLogHandler
import mock
from test.unit import FakeLogger
from swift.common.utils import get_logger
from swift.common.middleware import proxy_logging
from swift.common.swob import Request
class FakeApp(object):
... | {
"content_hash": "e143ca7f2aa976735ffb0ab2631c704d",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 79,
"avg_line_length": 43.103078982597054,
"alnum_prop": 0.5485744456177403,
"repo_name": "xiaoguoai/ec-dev-swift",
"id": "7e0744a4be779dde73b9a20c691019e19f3daf6b",
"size... |
"""
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
# Author: Edouard Duchesnay
# Gael Varoquaux
# Virgile Fritsch
# Alexandre Gramfort
# Lars Buitinck
# Licence: BSD
from collections import defaultdict... | {
"content_hash": "e7cc476ed5ad472ff2ef38c6bd477038",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 89,
"avg_line_length": 38.05324074074074,
"alnum_prop": 0.6005231461767747,
"repo_name": "treycausey/scikit-learn",
"id": "8c6483c8ac14d59a58f207b2d4469902c1e0b973",
"size... |
from functools import total_ordering
import itertools
import re
all_modules = []
@total_ordering
class Module(object):
"""
A module is the basic abstraction in our test runner script. Each module consists of a set
of source files, a set of test commands, and a set of dependencies on other modules. We use... | {
"content_hash": "84c7f819785cab38abec0b86c86347ce",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 100,
"avg_line_length": 24.368705035971225,
"alnum_prop": 0.5964277806480183,
"repo_name": "eyalfa/spark",
"id": "2aa355504bf290f847ebdab6f255e7c2840e5f9a",
"size": "14334... |
'''
Created on Jul 23, 2012
Copyright © 2013
The Board of Trustees of The Leland Stanford Junior University.
All Rights Reserved
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.ap... | {
"content_hash": "0615aca11760831ae0d059f0587ef664",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 96,
"avg_line_length": 29.89090909090909,
"alnum_prop": 0.6721411192214112,
"repo_name": "daStrauss/subsurface",
"id": "c34a366505f1443126b84278dc875ab515ba858f",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/weapon/shared_rifle_berserker.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "d489f3d79d76711a94ef210ed8b6f301",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 77,
"avg_line_length": 23.53846153846154,
"alnum_prop": 0.696078431372549,
"repo_name": "anhstudios/swganh",
"id": "5a707da674bd8b9985630804690b81668695b794",
"size": "451"... |
"""This hybrid library/listener can be used to verify messages that
have been logged and keywords have been called.
This works by listening for log messages and keywords via the
listener interface, and saving them in a cache. Keywords are
provided for doing assertions on called keywords and for resetti... | {
"content_hash": "117cf8d228eafe41ea8fab1c9c4e71a1",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 85,
"avg_line_length": 36.795698924731184,
"alnum_prop": 0.6075394506136762,
"repo_name": "SalesforceFoundation/CumulusCI",
"id": "0894da4ceb3e8392506632d6a400342f57252d0a",
... |
from statsd.connection import Connection
from statsd.client import Client
from statsd.timer import Timer
from statsd.gauge import Gauge
from statsd.average import Average
from statsd.raw import Raw
from statsd.counter import Counter, increment, decrement
__all__ = [
'Client',
'Connection',
'Timer',
'Co... | {
"content_hash": "17152e4e127a246c3da83b6a977b117e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 26.178571428571427,
"alnum_prop": 0.6725784447476125,
"repo_name": "LiquidGalaxy/lg-root-fs",
"id": "1f31a92e199a8d8767592cfd8070c0e4f63048fb",
"size... |
import sys, re, operator, string
#
# The event management substrate
#
class EventManager:
def __init__(self):
self._subscriptions = {}
def subscribe(self, event_type, handler):
if event_type in self._subscriptions:
self._subscriptions[event_type].append(handler)
else:
... | {
"content_hash": "995d76e0b14fb19dfbee2fc2c34ca199",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 95,
"avg_line_length": 32.18446601941748,
"alnum_prop": 0.6024132730015083,
"repo_name": "kranthikumar/exercises-in-programming-style",
"id": "4ada5470d04ee320e3c88fcfa4e0f3... |
print("Running animation_simulation.py")
from setup import *
from Person import *
import matplotlib.animation as animation
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
# plot configuration
fig = plt.figure()
ax = fig.add_subplot(111, autoscale_on = False, xlim = (-1,1), ylim = (-1,1))
ax.set_xtick... | {
"content_hash": "b9d3ab2b83b3a1d97916df3decbeff26",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 80,
"avg_line_length": 35.956989247311824,
"alnum_prop": 0.6644736842105263,
"repo_name": "kraemerd17/flu-propagation-models",
"id": "d162588fe580859c162166c783c5e4307fb70b78... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# clicking on Welcome link.
driver = webdriver.Firefox()
driver.get("http://www.practiceselenium.com/")
driver.find_element_by_link_text("Check Out").click()
assert "Check Out" in driver.title
driver.close() | {
"content_hash": "0df335e72859588f4197cff6ed286ca4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 53,
"avg_line_length": 35.75,
"alnum_prop": 0.7832167832167832,
"repo_name": "bishnucit/Python-Preludes",
"id": "bf730adb1852f12cf3a15058247ad75810b90121",
"size": "286",
... |
from __future__ import absolute_import
from haystack import indexes
from .models import Event
from talks.events.models import EVENT_IN_PREPARATION, EVENT_PUBLISHED
class EventIndex(indexes.SearchIndex, indexes.Indexable):
# text: multiple fields use to do full-text search
text = indexes.MultiValueField(docum... | {
"content_hash": "ac6b3324fba42290d9796a4496941da8",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 101,
"avg_line_length": 38.443396226415096,
"alnum_prop": 0.6522699386503068,
"repo_name": "ox-it/talks.ox",
"id": "c227bb20033d2d96883088454a827f4e53a6df87",
"size": "407... |
import urllib
from oslo.config import cfg
from designate import exceptions
from designate.openstack.common import log as logging
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class BaseView(object):
"""
The Views are responsible for coverting to/from the "internal" and
"external" representations o... | {
"content_hash": "e97e5de2d042ebee45e13a6734651939",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 32.838509316770185,
"alnum_prop": 0.559674673728012,
"repo_name": "melodous/designate",
"id": "653645263986a47efb777924db708e6cea8c832b",
"size": "5... |
import boto3
import json
import logging
import os
import sys
import urllib.request
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
from urllib.error import HTTPError, URLError
from botocore.exceptions import ClientError
from datetime import datetime
class KubecostReportsExporter:
... | {
"content_hash": "8cba82037091c4887386777778b9182d",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 120,
"avg_line_length": 35.64848484848485,
"alnum_prop": 0.5637538252295138,
"repo_name": "deliveryhero/helm-charts",
"id": "b90929f4ea11273620012b6a19ef79c8b58686ae",
"si... |
""" Outline nodes.
We use them for re-formulations and for inlining of code. They are expressions
that get their value from return statements in their code body. They do not
own anything by themselves. It's just a way of having try/finally for the
expressions.
"""
from .NodeBases import ChildrenHavingMixin, Express... | {
"content_hash": "db5a006d96721192770bfa0a2c757a76",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 85,
"avg_line_length": 30.725806451612904,
"alnum_prop": 0.6146981627296588,
"repo_name": "wfxiang08/Nuitka",
"id": "c15e6d36e3a15f62cd7f53c08d110fd3dbd05b1e",
"size": "45... |
import os
import re
import os.path
import argparse
import paths
import numpy as np
from PIL import Image, ImageFont, ImageOps, ImageEnhance
from PIL.ImageDraw import Draw
contrast_ratio = 3
def resize(img,hMax):
(wIm,hIm) = img.size
ratio = hMax/float(hIm)
(wNewIm,hNewIm) = (int(wIm*ratio),hMax)
newIm... | {
"content_hash": "3f4f8bb1dc1223079b19359363bf2f5b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 65,
"avg_line_length": 28.43548387096774,
"alnum_prop": 0.659103800340329,
"repo_name": "mvpossum/deep-learning",
"id": "3c5345dbdb2629b8c625fe49bf3a7e2c0f733128",
"size": ... |
import unittest as ut
import pypsignifit.psignidata as pd
import swignifit.swignifit_raw as sft
import numpy as np
import sys
def approximatedly_equal ( x, y, eps=1e-4 ):
e = abs ( x-y ) > eps
if not e==0:
sys.stderr.write ( "%g != %g\n" % (x,y) )
return e
class TestPsiInference ( ut.TestCase ):... | {
"content_hash": "3c43f11812ca06416f603250b66a287c",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 179,
"avg_line_length": 49.1968085106383,
"alnum_prop": 0.5966050383825279,
"repo_name": "esc/Psignifit-3.x",
"id": "6e2893a951a885b66365248411ffa987dbc2803b",
"size": "92... |
"""Auto-generated file, do not edit by hand. CI metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_CI = PhoneMetadata(id='CI', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[14]\\d{2,3}', possible_length=(3, 4)),... | {
"content_hash": "0c32e6881ee2b640ef66e1e8586f2b98",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 126,
"avg_line_length": 85.18181818181819,
"alnum_prop": 0.7246531483457844,
"repo_name": "daviddrysdale/python-phonenumbers",
"id": "996c27b2ad384d7158e895b32964c8f90f833aad... |
import os
import shutil
from plenum.cli.constants import NO_ENV
from plenum.common.util import createDirIfNotExists
from sovrin_client.client.wallet.wallet import Wallet
def testRestoreWalletFromMinimalGoLive(aliceCLI):
fileName = "wallet_from_minimal_go_live"
curPath = os.path.dirname(os.path.realpath(__fil... | {
"content_hash": "8239d5cb9efe04aeb720779a61de0802",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 41.5,
"alnum_prop": 0.7938420348058902,
"repo_name": "keenondrums/sovrin-node",
"id": "203c3486f2f2cd5069aa1a8dbf5221b6c96de440",
"size": "747",
"b... |
from __future__ import with_statement
from mparts.manager import Task
from mparts.host import HostInfo, SourceFileProvider, STDERR
from mparts.util import Progress
from support import ResultsProvider, SetCPUs, IXGBE, FileSystem, \
ExplicitSystemMonitor
import postgres
import os, time, signal, re, math
__all__ = ... | {
"content_hash": "26ebdea17be81f337fc7bfc97f46dabc",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 79,
"avg_line_length": 36.37948717948718,
"alnum_prop": 0.5661122074992951,
"repo_name": "KMU-embedded/mosbench-ext",
"id": "90e7a6b78d95c211df1e59528cc7d614baacc90c",
"si... |
from zope.interface import Interface, Attribute
class IPlugin(Interface):
"""Base interface for all plugins and all plugin interfaces. Classes that do
not implement ``IPlugin`` can not be used as plugin objects.
"""
name = Attribute("Unique plugin object name")
class IStorable(IPlugin):
"""Inte... | {
"content_hash": "6041c11827e42dd4eacf10ee0c12406e",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 25.2972972972973,
"alnum_prop": 0.6629273504273504,
"repo_name": "gflerm/python-irc-bot",
"id": "bd3080c80ce91bf87636ebedccddb450bce9ad68",
"size": "... |
"""
<Program Name>
test_secondary.py
<Purpose>
Unit testing for uptane/clients/secondary.py
Much of this is modified from test_primary.py.
<Copyright>
See LICENSE for licensing information.
"""
from __future__ import unicode_literals
import uptane # Import before TUF modules; may change tuf.conf values.
imp... | {
"content_hash": "e5aa3016399f500692c5412a39a98bbc",
"timestamp": "",
"source": "github",
"line_count": 757,
"max_line_length": 153,
"avg_line_length": 39.00792602377807,
"alnum_prop": 0.6887466558298622,
"repo_name": "uptane/uptane",
"id": "cdd92bde5686b5921426505304de2df750a74c14",
"size": "29529... |
from waterbutler import settings
config = settings.child('GITHUB_PROVIDER_CONFIG')
BASE_URL = config.get('BASE_URL', 'https://api.github.com/')
VIEW_URL = config.get('VIEW_URL', 'https://github.com/')
MOVE_MESSAGE = config.get('MOVE_MESSAGE', 'Moved on behalf of WaterButler')
COPY_MESSAGE = config.get('COPY_MESSAGE... | {
"content_hash": "3d41a2ace6dd0fecddc362285330862f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 102,
"avg_line_length": 51.26190476190476,
"alnum_prop": 0.7473293079424059,
"repo_name": "felliott/waterbutler",
"id": "54e088c2102254de3f2cd5ec4f8c3f0561ab885e",
"size": ... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from .models import Unidade
from django.urls import reverse
# Create your views here.
def index(request):
unidades = Unidade.objects.all()
return render(request, "list_unidade.html", {"unidades": ... | {
"content_hash": "5a39d8714fcfa9819df7c7c31e3c3b90",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 89,
"avg_line_length": 35.31818181818182,
"alnum_prop": 0.7271557271557272,
"repo_name": "Bleno/sisgestor-django",
"id": "7646087e03a010025d2a8ea07559d09d4461d080",
"size":... |
from django.conf.urls import url
from EncryptDecrypt import views
urlpatterns = [
url(r'^$', views.viewlogin, name='index'),
url(r'^Register/', views.viewRegister, name='register'),
url(r'^RegisterAct/', views.register, name='registeract'),
url(r'^LoginAct/', views.login, name='loginact'),... | {
"content_hash": "99c90cf950f861b3d87d18fa5322d337",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 66,
"avg_line_length": 33.52173913043478,
"alnum_prop": 0.582360570687419,
"repo_name": "Midhus/musicalcrypto",
"id": "081ce32bbae439d13a614b3dfc6a0a71677462f5",
"size": "7... |
class Throwing:
def __init__(self, exceptionFactory):
self.exceptionFactory = exceptionFactory
| {
"content_hash": "0853b60d3a282b903c6d38d7d208ded8",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 48,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.7102803738317757,
"repo_name": "haarcuba/testix",
"id": "4f48dfd65ba9194e391ebdaab0ce93a633e80994",
"size": "107",... |
from __future__ import print_function
try:
# Python 3
import tkinter as tk
except ImportError:
# Python 2
import Tkinter as tk
from PLOD import plotHandler as ph
from matplotlib import pyplot as plt
import subprocess
import numpy as np
class Control:
def __init__( self, master ):
self.mast... | {
"content_hash": "40bbc48b69812e6062cc5d9f772b950b",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 126,
"avg_line_length": 33.075949367088604,
"alnum_prop": 0.5718841688990943,
"repo_name": "davidkleiven/PLOD",
"id": "43f400be619d542bce108f831ede7fe2d1af8cb5",
"size": "... |
"""
categories: Modules,random
description: ``getrandbits`` method can only return a maximum of 32 bits at a time.
cause: PRNG's internal state is only 32bits so it can only return a maximum of 32 bits of data at a time.
workaround: If you need a number that has more than 32 bits then utilize the random module from mic... | {
"content_hash": "2d4af049b3dacd72a913ed30040298c1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 112,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.75,
"repo_name": "bvernoux/micropython",
"id": "523e3a329d4e4255f5fff188ab545525a6ba92ae",
"size": "404",
"bin... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"content_hash": "55987b93a561b2a8a2deeb9216b60206",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 128,
"avg_line_length": 37.049180327868854,
"alnum_prop": 0.7165929203539823,
"repo_name": "pbchou/trafficserver",
"id": "13b41028049e70f423630785d35ba36b777bea08",
"size"... |
from searchlight.elasticsearch.plugins import base
from searchlight.elasticsearch.plugins.glance \
import metadefs_notification_handler
from searchlight.elasticsearch.plugins.glance \
import serialize_glance_metadef_ns
class MetadefIndex(base.IndexBase):
def __init__(self):
super(MetadefIndex, sel... | {
"content_hash": "9f4e1bf21d8260d2cc5a21ebe2c324b9",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 74,
"avg_line_length": 35.1875,
"alnum_prop": 0.4187882376159463,
"repo_name": "lakshmisampath/searchlight",
"id": "054da54b914b493a53e4bb2d37ddd7f154fab6e8",
"size": "570... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.