text stringlengths 4 1.02M | meta dict |
|---|---|
from restclients.sws.v5.term import get_term_by_year_and_quarter
from restclients.sws.v5.term import get_current_term
from restclients.sws.v5.term import get_next_term
from restclients.sws.v5.term import get_previous_term
from restclients.sws.v5.term import get_term_before
from restclients.sws.v5.term import get_term_a... | {
"content_hash": "d45dc3851f649300d433a36a3a3c5615",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 54,
"alnum_prop": 0.8227513227513228,
"repo_name": "jeffFranklin/uw-restclients",
"id": "c098bd5174840529282e78a628cb0b64bc5a7bd7",
"size": "378",
"... |
class Country:
index = {'cname':0,'population':1,'capital':2,'citypop':3,'continent':4,
'ind_date':5,'currency':6,'religion':7,'language':8}
def __init__(self, row):
self.__attr = row.split(',')
# Added to support + and -
self.__attr[Country.index['population'... | {
"content_hash": "d7fc6e368f887e5d7b110f30758ae716",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 106,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.5698131760078663,
"repo_name": "rbprogrammer/advanced_python_topics",
"id": "5297ee46acbc7259d98552f377853194f7d8b... |
import gym
from gym.envs.registration import register
import readchar
LEFT = 0
DOWN = 1
RIGHT = 2
UP = 3
arrow_keys = {
'\x1b[A':UP,
'\x1b[B':DOWN,
'\x1b[C':RIGHT,
'\x1b[D':LEFT
}
register(
id = 'FrozenLake-v3... | {
"content_hash": "b68f269eae9194a4b0d89304bdd17a1d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 95,
"avg_line_length": 25.026315789473685,
"alnum_prop": 0.4889589905362776,
"repo_name": "TeamLab/lab_study_group",
"id": "9f7b3bf34145f8691c41fff45d027123c91dd9a3",
"size... |
import re
from .completion_base import GenerateCompletionListBase
from ..anf_util import *
class WindowsCompletion(GenerateCompletionListBase):
def __init__(self, command):
super(WindowsCompletion, self).__init__(command)
self.view = command.view
def completion(self, path_in):
pattern ... | {
"content_hash": "3b8bde7dc4e593fe635c933e7eaebb0e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 121,
"avg_line_length": 41.644067796610166,
"alnum_prop": 0.5327635327635327,
"repo_name": "herove/dotfiles",
"id": "952be8e560a470ec22ebee24e7fa33e950bff16a",
"size": "245... |
import sys
sys.path.insert(0,'../')
if sys.version_info[:2] == (2,6):
import unittest2 as unittest
else:
import unittest
from rivets_test import RivetsTest
import rivets
class TestDirectiveProcessor(RivetsTest):
def directive_parser(self,fixture_name):
return rivets.processing.DirectiveProcessor(self.fixture_pa... | {
"content_hash": "ec53e695462c5343ed178f0e71a8e282",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 108,
"avg_line_length": 28.594594594594593,
"alnum_prop": 0.6805293005671077,
"repo_name": "OiNutter/rivets",
"id": "930a08ed945abb14b6e8d3b8533884264391068b",
"size": "52... |
import json
import operator
import os
import re
import sys
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from functools import wraps
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, TypeVar, cast
from unittest.mock import Mock, patch
import orjson
import respo... | {
"content_hash": "77412eeb5c38f847b2fc69b3d72dbd37",
"timestamp": "",
"source": "github",
"line_count": 2236,
"max_line_length": 153,
"avg_line_length": 54.319320214669055,
"alnum_prop": 0.6319468458232476,
"repo_name": "brainwane/zulip",
"id": "752fc09863735e71459243f7cfc985804faa2d86",
"size": "1... |
__version__ = "2.0.1"
"""
:mod:`pysal.explore.esda` --- Exploratory Spatial Data Analysis
=================================================
"""
from .moran import (Moran, Moran_BV, Moran_BV_matrix,
Moran_Local, Moran_Local_BV,
Moran_Rate, Moran_Local_Rate)
from .getisord import... | {
"content_hash": "aeea4ac0726b75d24b815fd6dd1c3bc3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 63,
"avg_line_length": 32.23076923076923,
"alnum_prop": 0.5704057279236276,
"repo_name": "lixun910/pysal",
"id": "0ba28352c58ff35be5cdb55929bf90a448f79e80",
"size": "419",
... |
import sys
import LessonData
import RosterData
import HTMLRosterParser
import RosterExtractor
import Roster
listOfRosters = []
for i in range(1,len(sys.argv)) :
# try :
roster = Roster.Roster(sys.argv[i])
# except :
# print('error in :'+sys.argv[i])
| {
"content_hash": "43cdb4c83c54162c3ef97f09fa5e4736",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 40,
"avg_line_length": 18,
"alnum_prop": 0.6888888888888889,
"repo_name": "Zilleplus/KHBOLessenroosterAPI",
"id": "bda562e4c56631fadd447898601b16d7cd18a134",
"size": "316",... |
import sys
import time
import telepot
"""
$ python2.7 skeleton.py <token>
A skeleton for your telepot programs.
"""
def handle(msg):
flavor = telepot.flavor(msg)
summary = telepot.glance(msg, flavor=flavor)
print(flavor, summary)
TOKEN = sys.argv[1] # get token from command-line
bot = telepot.Bot(TO... | {
"content_hash": "8ff49a589744e94ebd578f9595041328",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 50,
"avg_line_length": 16.53846153846154,
"alnum_prop": 0.6953488372093023,
"repo_name": "mpunkenhofer/irc-telegram-bot",
"id": "9358589d0fea6d85d60e10e1981190b51c2a37dc",
... |
"""
Flood Alerts Module - Controllers
@author: Fran Boon
@see: http://eden.sahanafoundation.org/wiki/Pakistan
"""
module = request.controller
if module not in deployment_settings.modules:
session.error = T("Module disabled!")
redirect(URL(r=request, c="default", f="index"))
# Options Menu (avail... | {
"content_hash": "6ff58f278ca5c37537dd831c52ad1612",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 149,
"avg_line_length": 32.815384615384616,
"alnum_prop": 0.5100796999531176,
"repo_name": "ptressel/sahana-eden-madpub",
"id": "6cb53625c9b51bb7eff1a6c7012f9aef9f6b55ba",
... |
from azure.cli.core import AzCommandsLoader
from azure.cli.core.profiles import ResourceType
from azure.cli.command_modules.managedservices._help import helps # pylint: disable=unused-import
class ManagedServicesCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.comm... | {
"content_hash": "cb6a29062bf2d3f5b34c4eec55442541",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 118,
"avg_line_length": 43.76,
"alnum_prop": 0.6718464351005484,
"repo_name": "yugangw-msft/azure-cli",
"id": "8d795e4a7ba5be6863ad871fb461898befcd18d6",
"size": "1440",
... |
"""Class to hold all sensor accessories."""
from __future__ import annotations
from collections.abc import Callable
import logging
from typing import NamedTuple
from pyhap.const import CATEGORY_SENSOR
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.const import (
ATT... | {
"content_hash": "7370f280355d65ea8489673173ce49d6",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 88,
"avg_line_length": 38.30944625407166,
"alnum_prop": 0.6553014199472834,
"repo_name": "rohitranjan1991/home-assistant",
"id": "46e241efab010d4f6c4b06d2e36d7f81d5fe90b5",
... |
from __future__ import print_function, division, unicode_literals
__doc__="""
(GUI) Lets you rename kerning names and pairs associated with them.
"""
import vanilla
import GlyphsApp
thisFont = Glyphs.font
# builing a more accessible kerning dictionary
# it's a dictionary of lists. newKernDic[master.id][left, right, ... | {
"content_hash": "d40d231070c4e0c7d825c68eaf1e79e4",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 156,
"avg_line_length": 40.404761904761905,
"alnum_prop": 0.7032017285405617,
"repo_name": "Tosche/Glyphs-Scripts",
"id": "b636e27a7346fc22bc42382cad3ba41dbf0ab8bb",
"size... |
__version__=''' $Id: rltempfile.py 3342 2008-12-12 15:55:34Z andy $ '''
__doc__='''Helper for the test suite - determines where to write output.
When our test suite runs as source, a script "test_foo.py" will typically
create "test_foo.pdf" alongside it. But if you are testing a package of
compiled code inside a... | {
"content_hash": "7a1b3a0dfe09ab6f2c4b68484ffee775",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 95,
"avg_line_length": 31.97142857142857,
"alnum_prop": 0.6264521894548705,
"repo_name": "commtrack/temp-aquatest",
"id": "fecf2d2eb702465e564050f49b3e1b284b6ac40b",
"size"... |
from collections import Counter
def combine(*args):
return sum((Counter(a) for a in args), Counter())
| {
"content_hash": "4c85491724fbeb6a195dc38408e14968",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 53,
"avg_line_length": 21.6,
"alnum_prop": 0.7037037037037037,
"repo_name": "the-zebulan/CodeWars",
"id": "138179002b50a2a45edaee7cc73746b7d5267e52",
"size": "108",
"binar... |
"""
Title: Convolutional autoencoder for image denoising
Author: [Santiago L. Valdarrama](https://twitter.com/svpino)
Date created: 2021/03/01
Last modified: 2021/03/01
Description: How to train a deep convolutional autoencoder for image denoising.
"""
"""
## Introduction
This example demonstrates how to implement a ... | {
"content_hash": "0ea43722501e6fb79c3882b1146c147a",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 98,
"avg_line_length": 26.69142857142857,
"alnum_prop": 0.6981374438021837,
"repo_name": "keras-team/keras-io",
"id": "3cc95a9ffa50ce20c7ad1fa1af6aeabb1bc876b0",
"size": "... |
import os
from email.utils import parseaddr
from configurations import Configuration, values
ugettext = lambda s: s
class Base(Configuration):
"""
The are correct settings that are primarily targeted at the production
system but allow (where appriate) easy overrides either via subclassing
or enviro... | {
"content_hash": "3be59ce2dc3dc5edaca06dc78a0168e1",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 110,
"avg_line_length": 30.79050736497545,
"alnum_prop": 0.5864561739222878,
"repo_name": "EuroPython/djep",
"id": "ce4e9cee8af993274a23b80f75e03b9e4908525a",
"size": "188... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BuildData',
fields=[
('id', models.AutoField(verbose_name='ID', seriali... | {
"content_hash": "0592dffa5e16f2588ccd4b79bd0e4024",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 114,
"avg_line_length": 34.407407407407405,
"alnum_prop": 0.5629709364908504,
"repo_name": "vegitron/aws-mess-around",
"id": "4272827281e08ed88d6936a0b316328d99416502",
"si... |
import os
from BeautifulSoup import BeautifulSoup
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
import re, string
from nltk.stem.porter import *
from nltk.stem import *
from nltk.stem import WordNetLemmatizer
wnl = WordNetLemmatizer()
def save(data, filename, dir=None):
try:
... | {
"content_hash": "e9b2d7f131bf2c8a0517c4e06434d43f",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 122,
"avg_line_length": 32.03,
"alnum_prop": 0.5897596003746488,
"repo_name": "hanhaohh/cvhelper",
"id": "42ce881d92d4869aa863156ec7d52837c0a8194f",
"size": "3203",
"bin... |
"""
Core: Hardtree module definition
"""
PROPERTIES = {
'title': 'Administration',
'details': 'Core Administration',
'url': '/admin/',
'system': True,
'type': 'user',
}
URL_PATTERNS = [
'^/admin/',
]
f... | {
"content_hash": "7ec492736c3306bed0da5d0bfc15bd3a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 47,
"avg_line_length": 20.736842105263158,
"alnum_prop": 0.4467005076142132,
"repo_name": "rogeriofalcone/treeio",
"id": "d1dc225bf90196227612cf0ad3eea4a80ac4b4fa",
"size":... |
from django.http import HttpResponseRedirect
class SpecialAuthenticationMiddleware(object):
def process_request(self, request):
ip = request.META["REMOTE_ADDR"]
if ip.startswith("192.168.") or ip == "127.0.0.1":
# Do not request authentication if IP is in LAN, or localhost
... | {
"content_hash": "fd25c25ad8d8834d3bc1458385bd3da8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 87,
"avg_line_length": 40.63157894736842,
"alnum_prop": 0.6437823834196891,
"repo_name": "ojarva/home-info-display",
"id": "b242dcaeafc3983de8ad45f482058806c518f62b",
"size... |
from db2charts.analysis.base import AnalysisBase
from db2charts.models import *
import json
class AnalysisCreate(AnalysisBase):
record_count_col_name = 'recordCount'
record_count_translated_name = '记录数'
def __init__(self):
super(AnalysisCreate, self).__init__()
def get_available_tables(self,... | {
"content_hash": "c2dea7313ceb16a23f8d3df0aa4ede86",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 100,
"avg_line_length": 36.8780487804878,
"alnum_prop": 0.5231481481481481,
"repo_name": "Alfredx/django-db2charts",
"id": "dcf96f1472691c6d4f57b5af5fe373c0cd74e3b3",
"size... |
from .controller import AdminController
from .config import AdminConfig, CrudRestControllerConfig | {
"content_hash": "f71d4e39bd1d1f741f4af5cb654bd3e1",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 57,
"avg_line_length": 48.5,
"alnum_prop": 0.8865979381443299,
"repo_name": "TurboGears/tgext.admin",
"id": "1c66556ce77715e97ee8c6f070d820a8e7d4df92",
"size": "97",
"bina... |
from test.integration.base import DBTIntegrationTest, use_profile
class TestConcurrency(DBTIntegrationTest):
@property
def schema(self):
return "concurrency_021"
@property
def models(self):
return "models"
@use_profile('postgres')
def test__postgres__concurrency(self):
... | {
"content_hash": "896d8a55c19caf828b7df605a6ad038b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 69,
"avg_line_length": 32.205128205128204,
"alnum_prop": 0.6496815286624203,
"repo_name": "analyst-collective/dbt",
"id": "1a1dab724af7fc8240a43ebf1946c70137985e89",
"size"... |
"""Tests Nighthawk's basic functionality."""
import json
import logging
import math
import os
import pytest
import subprocess
import sys
import time
from threading import Thread
from test.integration.common import IpVersion
from test.integration.integration_test_fixtures import (
http_test_server_fixture, https_t... | {
"content_hash": "4d8b411cf1fad2074b6079450cd3025c",
"timestamp": "",
"source": "github",
"line_count": 990,
"max_line_length": 128,
"avg_line_length": 50.73232323232323,
"alnum_prop": 0.7082926829268292,
"repo_name": "envoyproxy/nighthawk",
"id": "d061bb502cd75193f3ffd4c55001646ff4bad665",
"size":... |
'''
Created on Jul 9, 2013
@author: Chunwei Yan @ pkusz
@mail: [email protected]
'''
from __future__ import division
from random_forest_model import *
| {
"content_hash": "9c66d3098ed8a936217effe14a766ee8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 33,
"avg_line_length": 16,
"alnum_prop": 0.70625,
"repo_name": "Superjom/sematic",
"id": "35e81e27e380e9bbd70cf10cea0e113a526711a9",
"size": "184",
"binary": false,
"co... |
from tg import tmpl_context as c
from mock import patch
from tg import config
from allura.lib import helpers as h
from allura.tests import decorators as td
from allura import model as M
from alluratest.controller import TestRestApiBase
from forgetracker import model as TM
class TestTrackerApiBase(TestRestApiBase):... | {
"content_hash": "8b8d0a23cd45765548d1b11d337bb0ea",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 111,
"avg_line_length": 40.72075471698113,
"alnum_prop": 0.5793716986377537,
"repo_name": "apache/allura",
"id": "85cfc77eb36568f5009d7aac58af29d593550a03",
"size": "11661... |
import cv2
import glob
import math
import os
import sys
import tempfile
import numpy as np
from PIL import Image
from scipy import ndimage
from cnn import get_num, get_name
BUF = 5
def gap_left(hist, x, th, K=10):
"""
Checks if this x-coordinate marks the start of a new word/block.
:param hist: distribu... | {
"content_hash": "08dc20f838a5bd2c99946ba19492f766",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 116,
"avg_line_length": 34.84477611940299,
"alnum_prop": 0.6108112738798938,
"repo_name": "benjaminvialle/Markus",
"id": "5441296dbc61902d46a4c45b18408046ba73168b",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wmdadict', '0004_auto_20170817_0819'),
]
operations = [
migrations.AlterModelOptions(
name='dictionaryfield',
options={'orde... | {
"content_hash": "e3fae8edb6627b30cf361eb48a168626",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 201,
"avg_line_length": 30.59090909090909,
"alnum_prop": 0.5601783060921248,
"repo_name": "antmont/wmda-stuff",
"id": "36c76967a6ea72a0e0f479485f64231d5118335e",
"size": "7... |
from __future__ import unicode_literals
import csv
import itertools
import re
from mptt.forms import TreeNodeMultipleChoiceField
from django import forms
from django.conf import settings
from django.core.validators import URLValidator
from django.urls import reverse_lazy
COLOR_CHOICES = (
('aa1409', 'Dark red')... | {
"content_hash": "b52f8ced980eec546317fb8612f15098",
"timestamp": "",
"source": "github",
"line_count": 525,
"max_line_length": 129,
"avg_line_length": 36.68952380952381,
"alnum_prop": 0.602481569930433,
"repo_name": "snazy2000/netbox",
"id": "0fa402d52823f1d8537647ab3f696e3f4437107c",
"size": "192... |
"""
QC OTA API
Test Result dictionary
----
tests:
name
status
subject
suite
description
exec_date
exec_time
bug
steps:
name
status
description
expected
actual
"""
# pylint: disable=I0011, no-member
from datetime import datetime
import fnmat... | {
"content_hash": "1d5a39afb0f48b02428f3f62198744e3",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 79,
"avg_line_length": 27.42970822281167,
"alnum_prop": 0.5973310124746156,
"repo_name": "douville/qcri",
"id": "9547c915eafc99e73ee7c8c0b3e6dd2e19ff8214",
"size": "10341"... |
"""
Usage: analyse.py <dir_name> [<sffx>]
Arguments
dir_name : name of the directory from which to read in parameters and write data files
suff : optional suffix to add to the data file name
Options
-h : displays this help file
"""
import os
import yaml
from sys import argv
from csv imp... | {
"content_hash": "60ef36254e438bc0765e78a63ece73a6",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 533,
"avg_line_length": 42.02512562814071,
"alnum_prop": 0.6643548965682171,
"repo_name": "geraintpalmer/SimulatingAQingNetwork",
"id": "6726dcd060ad4095c42fdf176b2c3a43b574... |
import json
from wtforms import ValidationError
from userver.object.application import Application
from . import api, root
from flask import request, Response
from userver.object.group import Group
from binascii import hexlify
from utils.errors import KeyDuplicateError, PatchError
from .decorators import group_belong_... | {
"content_hash": "80a7ed3e6f7a239bc80d9210c04ac3cb",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 170,
"avg_line_length": 45.5625,
"alnum_prop": 0.5901234567901235,
"repo_name": "soybean217/lora-python",
"id": "858d9c712b50be292785ee9d63260dc6687fbf7c",
"size": "3645",
... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard import api
class CreateAlarm(tables.LinkAction):
name = "create"
verbose_name = _("Create Alarm")
iconfont = "iconfont icon-... | {
"content_hash": "2515eaaf920ee16550918b3c15a22097",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 31.44736842105263,
"alnum_prop": 0.6502092050209205,
"repo_name": "MKTCloud/MKTCloud",
"id": "5d65067a15e2d7c32578f6f83b3d729cadcfaa1f",
"size": "119... |
"""Re-segment raw read and re-label the data"""
########################################################################
# File: event_detection.py
# executable: event_detection.py
#
# Author: Andrew Bailey
# History: 10/6/17 Created
########################################################################
import sys
... | {
"content_hash": "7766eb61cbf08fcae479a63aed734068",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 195,
"avg_line_length": 47.743362831858406,
"alnum_prop": 0.6018535681186283,
"repo_name": "UCSC-nanopore-cgl/nanopore-RNN",
"id": "27e988fa056f0809d4866855ae52c3c5ddbfe104"... |
import logging
import os
import paramiko
import signal
import socket
import sys
import time
import urllib.parse
import urllib.request
PROBE_TIME_OUT_SECONDS = 300
SSH_USERNAME = "tds"
TCP_PORT = 15621
class CaptainException(Exception):
pass
def setup_logger():
logger = logging.getLogger("TDSLogger")
lo... | {
"content_hash": "83e996a27df58367b6ee114b0146ee25",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 128,
"avg_line_length": 35.825278810408925,
"alnum_prop": 0.5716509287122549,
"repo_name": "TheDutchSelection/captain",
"id": "7af03c0cc73eff84f84aaee056a75ade94bf6088",
"... |
"""
Django settings for mechanical_checklist project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
... | {
"content_hash": "3633fe64dc049db2d6c0f5e683cf29df",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 71,
"avg_line_length": 26.229357798165136,
"alnum_prop": 0.6918502973067506,
"repo_name": "matthewjweaver/mechanical-checklist",
"id": "76ff93da000e87721416ceac83388ec92a25b... |
import os
from lxml import etree
from django.test import TestCase
from corehq.apps.app_manager.models import Application
from corehq.apps.app_manager.tests.util import SuiteMixin
from corehq.apps.app_manager.translations import escape_output_value
import commcare_translations
class AppManagerTranslationsTest(TestC... | {
"content_hash": "20bd6e932d872b6c6ec62734b21776a4",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 142,
"avg_line_length": 46.88636363636363,
"alnum_prop": 0.619001454192923,
"repo_name": "qedsoftware/commcare-hq",
"id": "10301a0ffbb6e75b04bf601dfe4d82c7afad87b3",
"size"... |
from datetime import datetime
# Third-party libraries
from flask.ext.login import UserMixin, AnonymousUserMixin
# Other modules
from lemur import db, login_manager
# Association tables for Many-To-Many relationships between various tables
association_table_class_user = db.Table('association_class_user',
... | {
"content_hash": "952a3a6bbc38644a21b0ae8c41eb83cc",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 80,
"avg_line_length": 42.813559322033896,
"alnum_prop": 0.5519398258115598,
"repo_name": "reed-college/lemur",
"id": "f4fb0a67b6c71575593d525091730c14e39c0392",
"size": "... |
import socket
import sys
from colors import bcolors
ADDR = ''
PORT = 10000
BUFF_SIZE = 4096
device_id = None
server_address = (ADDR, PORT)
# Create a UDP socket
client_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def send_command(sock, message):
sock.sendto(message.encode(), server_address)
# Re... | {
"content_hash": "2901edd28c92559468476ff55d66fbcd",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 79,
"avg_line_length": 27.493333333333332,
"alnum_prop": 0.553831231813773,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "ecbf765278e8503989db01fad5b10c6bc22... |
from collections import defaultdict
import itertools
import time
class FailuresHistory(object):
""" Stores the history of recent build failures.
The failures are identified by their unique ID
(e.g. failed test, memory suppression hash, etc)
This class is similar to LRU but it also stores counts.
... | {
"content_hash": "372350bda34d9228e2e80e21e814f995",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 80,
"avg_line_length": 37.659574468085104,
"alnum_prop": 0.6621468926553672,
"repo_name": "eunchong/build",
"id": "60fea569e84ce07150f63d938cd164243330a798",
"size": "3707"... |
from app.model.post.service import PostService
from app.util.handler_util import BasicHandler
class IframeHandler(BasicHandler):
def get(self, url):
page_params = {"url": url}
return self.page("iframe.html", **page_params)
class IndexHandler(BasicHandler):
def get(self):
total_page =... | {
"content_hash": "908016d55a3488af149b10d446c129ec",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 54,
"avg_line_length": 23.736842105263158,
"alnum_prop": 0.6529933481152993,
"repo_name": "Jackeriss/Typora-Blog",
"id": "ffc947d4a35a0f7312429f129b49dd3cc38d12d6",
"size":... |
import unittest
import os
import coverage
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from project import app, db, models
app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
... | {
"content_hash": "348ebf0bc1eec4a01de590b1fb8094a3",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 61,
"avg_line_length": 23.454545454545453,
"alnum_prop": 0.687015503875969,
"repo_name": "Kirza/sv-blog",
"id": "4b02aee4bb7a981063e97edbef66eec83061bdba",
"size": "1032",
... |
"""Test that all GOATOOLS package dirs are in the setup.py file"""
# pylint: disable=wrong-import-position
from os import walk
from os.path import join
from os.path import abspath
import sys
sys.argv = [abspath(__file__), '--help']
from setup import NAME # goatools
from setup import PACKAGES # modules in goatool... | {
"content_hash": "65d0c34270e7b38873255712d3b6bcba",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 33.095238095238095,
"alnum_prop": 0.6215827338129496,
"repo_name": "tanghaibao/goatools",
"id": "1930a0429ef090475bac6acdc218dd59b7a730d9",
"size": "... |
from pygaps.iast.pgiast import iast_point
from pygaps.iast.pgiast import iast_point_fraction
from pygaps.iast.pgiast import iast_binary_svp
from pygaps.iast.pgiast import iast_binary_vle
from pygaps.iast.pgiast import reverse_iast
| {
"content_hash": "d56d7f70431b3b03b65a003b034bd904",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 50,
"avg_line_length": 46.2,
"alnum_prop": 0.8354978354978355,
"repo_name": "pauliacomi/pyGAPS",
"id": "bbeeaa3bca87798aa69fec071fc383b189982857",
"size": "300",
"binary":... |
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import subprocess
import tempfile
from flexmock import flexmock
import pytest
import json
import tarfile
import re
from atomic_rea... | {
"content_hash": "86a85da4810b9c186a77c83625933296",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 99,
"avg_line_length": 37.51898734177215,
"alnum_prop": 0.627642825011246,
"repo_name": "DBuildService/atomic-reactor",
"id": "fbe09d9e39992e71b86e08ccefc8f8a16941db37",
"... |
import ninjag
import os
from read_all import read_all
def test():
f_inputs = [
"input/in3.yaml",
]
f_answer = "output/build.ninja"
f_solution = "solution/sol3.ninja"
cmd = " ".join(["ninjag", *f_inputs])
os.system(cmd)
os.remove(f_answer)
os.rename('build.ninja', f_answer)
... | {
"content_hash": "33793f737c149c6298c7ff9e368a9c20",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 41,
"avg_line_length": 23.22222222222222,
"alnum_prop": 0.6076555023923444,
"repo_name": "yuhangwang/ninjag-python",
"id": "7f0386234dcf966d09de973047e1f3bd52b3e91b",
"size... |
"""Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo
class M... | {
"content_hash": "3118e5601d31a2e4d63629a4ff7a4657",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 22.85185185185185,
"alnum_prop": 0.6320907617504052,
"repo_name": "hchunhui/pop",
"id": "70e36c1fda433afcfd7f5ca08dad043c78759a40",
"size": "617",
... |
from numpy import *
from numpy.linalg import pinv
from numpy.linalg import svd
from numpy.random import permutation
from numpy.random import random_sample
def _onehot_encode(y):
C = unique(y)
N = len(y)
Y = zeros((N, len(C)))
Y[arange(N), y] = 1.0
return Y
def _train_test_split(X, T, test_size=0... | {
"content_hash": "ce9264e2f497674438886b877d042d7f",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 104,
"avg_line_length": 38.56613756613756,
"alnum_prop": 0.5929482782274661,
"repo_name": "ttsuchi/neural-network-demo",
"id": "c665c72d31b5a70da0e324b27310e67d1aa13196",
... |
"""
Stack-In-A-WSGI: StackInAWsgiAdmin
"""
import json
import logging
import re
from stackinabox.services.service import StackInABoxService
from stackinawsgi.exceptions import InvalidSessionId
from stackinawsgi.session.service import (
global_sessions,
session_regex
)
logger = logging.getLogger(__name__)
... | {
"content_hash": "a4d57bcba27f0e626997ced6eb506403",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 77,
"avg_line_length": 29.91131498470948,
"alnum_prop": 0.5471833145895103,
"repo_name": "TestInABox/stackInAWSGI",
"id": "5933dd5df4a23ff4f18dc316fb98d653598f5cbe",
"size... |
"""
sentry.scripts.data_faker
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from sentry import VERSION, app, capture
from sentry.interfaces import Http
import os.path
import random
import sys
from optparse import Opti... | {
"content_hash": "c86aaa6f5bfc24f0750fbe8e99e09fff",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 125,
"avg_line_length": 33.37179487179487,
"alnum_prop": 0.5566653860929697,
"repo_name": "dcramer/sentry-old",
"id": "6cb876fadf144770606377c877bcf4a00e447417",
"size": "2... |
from iptest.assert_util import *
add_clr_assemblies("loadorder_1a")
# namespace NamespaceOrType {
# public class C {
# public static string Flag = typeof(C).FullName;
# }
# }
import NamespaceOrType
add_clr_assemblies("loadorder_1c")
# public class NamespaceOrType<T> {
# public static strin... | {
"content_hash": "b68530c25ccd6b0dcaadde000af7a158",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 22.4,
"alnum_prop": 0.7321428571428571,
"repo_name": "IronLanguages/ironpython3",
"id": "47c7f0c90a691398428b9c1a8fdda18b9fe8d8e4",
"size": "767",
... |
def cost(matrix1, matrix2):
return matrix1[0]*matrix1[1]*matrix2[1]
def single_to_double(elements):
return [(elements[i], elements[i+1]) for i in range(len(elements)-1)]
def minimum_cost(i, j, matrix_array, cache=None):
if not cache:
cache={}
if not (i,j) in cache:
if i==j:
... | {
"content_hash": "4d78fff19a73f72157db9008cabc435b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 187,
"avg_line_length": 37.97560975609756,
"alnum_prop": 0.5433526011560693,
"repo_name": "Bolt64/my_code",
"id": "08089bc5cb636cea926d7a07563478d2daa84ec8",
"size": "1581"... |
"""
sentry.conf.urls
~~~~~~~~~~~~~~~~
These are additional urls used by the Sentry-provided web server
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
from sentry.web.urls import *
from sentry.web.frontend import generic
from django.c... | {
"content_hash": "19c2a8d7b3ff4f93dc7a61daab80a04d",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 73,
"avg_line_length": 26.29787234042553,
"alnum_prop": 0.6901294498381877,
"repo_name": "chayapan/django-sentry",
"id": "0042b8638758ca58989f578a8b10ea58d4a8979b",
"size":... |
import mock
import pytest
from hpe_test_utils import ImageStreamerBaseTest
from oneview_module_loader import GoldenImageModule
FAKE_MSG_ERROR = 'Fake message error'
@pytest.mark.resource(TestGoldenImageModule='golden_images')
class TestGoldenImageModule(ImageStreamerBaseTest):
"""
ImageStreamerBaseTest has ... | {
"content_hash": "c7bcbf6136ac3b9644c04c7954b0bc1f",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 142,
"avg_line_length": 35.39033457249071,
"alnum_prop": 0.6269957983193277,
"repo_name": "HewlettPackard/oneview-ansible",
"id": "098dd6b9d19dadefe0fac5783fd51eaf6fc56ba6",... |
from feedz.processors.content_filter import ContentFilterProcessor
| {
"content_hash": "a92cf56c7d809cc6b30eb3c443a7d33d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 66,
"avg_line_length": 67,
"alnum_prop": 0.8955223880597015,
"repo_name": "indexofire/gork",
"id": "d9f85b63adbb3083071e4eba3a673c4a93f8de7c",
"size": "91",
"binary": fals... |
""" Test the signal module. """
import os.path, time, signal
import srllib.process as _process
from srllib import util
from _common import *
class TestError(_process.PickleableException):
pass
def _childfunc_writes(outstr, errstr):
for i in range(10):
sys.stdout.write("%s\n" % outstr)
sys.std... | {
"content_hash": "3296fd722d2938f635eea1c174740bcb",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 81,
"avg_line_length": 35.10457516339869,
"alnum_prop": 0.5758704151927015,
"repo_name": "aknuds1/srl-python-lib",
"id": "1d1fe4d3f6cab88bdbae0060c6d2ebe2d346735b",
"size"... |
__author__ = 'Administrator'
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def merge_list(head1, head2):
fakehead = ListNode(0)
lastnode = fakehead
while head1 != None and head2 != None:
if head1.val <= head2.val:
lastnode.next = head1
... | {
"content_hash": "9fce84428d248ad1a08eb0a26ef67c49",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 54,
"avg_line_length": 24.41304347826087,
"alnum_prop": 0.5983971504897596,
"repo_name": "deepbluech/leetcode",
"id": "0afef05c2ec4b4e45a28cdedc4f82702da995ef3",
"size": "1... |
import os
import logging
import traceback
import requests
import zipfile
from tempfile import NamedTemporaryFile
from django.conf import settings
from django.core.files.storage import get_storage_class, FileSystemStorage
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.mail import mail... | {
"content_hash": "b6534098356f313d19bc471190055fa8",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 116,
"avg_line_length": 31.908695652173915,
"alnum_prop": 0.622428123722578,
"repo_name": "kobotoolbox/kobocat",
"id": "ccdf964482cf58f8b529c94f7d8994bdb4256b1c",
"size": ... |
"""
Copyright Theophile Rotoudjimaye <[email protected]>
All Rights Reserved
"""
from django.db import models
from django.utils.translation import ugettext as _
import datetime
def datetime2millis(timestamp):
delta = timestamp - datetime.datetime(1970, 1, 1)
return (delta.days * 24 * 60 * 60 + delta... | {
"content_hash": "fd6a4c5c95586e30273ddb0bce3bbddd",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 105,
"avg_line_length": 39.07865168539326,
"alnum_prop": 0.7239792984473835,
"repo_name": "rotoudjimaye/django-jy",
"id": "02e9b5b32f5a31d943c33d8c92af694dbcb1e1ea",
"size"... |
"""
nmeta tc_identity.py Tests
Uses pytest, install with:
sudo apt-get install python-pytest
To run test, type in:
py.test -vs
Note that packets + metadata are imported from local packets_* modules
TBD: everything
"""
#*** Handle tests being in different directory branch to app code:
import sys
sys.path.... | {
"content_hash": "5c5b7068d098010edfba192d5e7ba146",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 115,
"avg_line_length": 43.04248366013072,
"alnum_prop": 0.706704122693797,
"repo_name": "mattjhayes/nmeta",
"id": "be1c0943b2ce6c0dd1e848428c9da63b26d9d6fe",
"size": "131... |
from __future__ import unicode_literals
from django.db import migrations, models
import creditor.models
def generate_tids(apps, schema_editor):
Transaction = apps.get_model('creditor', 'Transaction')
for t in Transaction.objects.all().iterator():
t.unique_id = creditor.models.generate_transaction_id()... | {
"content_hash": "a5150a2b91197e2f1ff4afba5a1f6c5b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 101,
"avg_line_length": 28.185185185185187,
"alnum_prop": 0.6294349540078844,
"repo_name": "ojousima/asylum",
"id": "2a96072b64922d6889c674c9569899ca528d7160",
"size": "785... |
"""Daemon launched at startup to handle skill activities.
In this repo, you will not find an entry called mycroft-skills in the bin
directory. The executable gets added to the bin directory when installed
(see setup.py)
"""
import time
from threading import Event
import mycroft.lock
from msm.exceptions import MsmExc... | {
"content_hash": "0e6a5b88590fc11a74232458f2d53e99",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 35.156488549618324,
"alnum_prop": 0.6486809249810009,
"repo_name": "Dark5ide/mycroft-core",
"id": "30a1d6d8d8794dfc067b50b6aa2c081bbdfd50f3",
"size"... |
import serial
import time
import rospy
import math
import thread
import tty
import sys
import termios
from std_msgs.msg import String
from geometry_msgs.msg import Twist
from tms_msg_rc.msg import arduino_serial
#global_cmd
global_cmd = Twist()
#callback_function
def callback(cmd):
global global_cmd
global_c... | {
"content_hash": "045435a75f5b704efe3b85e0f64cd6c8",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 82,
"avg_line_length": 23.674418604651162,
"alnum_prop": 0.5962671905697446,
"repo_name": "irvs/ros_tms",
"id": "11a041087f66612df0463a108c28d50e99499f4e",
"size": "2090",
... |
import os
import sys
kernels = {
'triad' : 'triad',
}
def main (directory, source):
if not 'TRACER_HOME' in os.environ:
raise Exception('Set TRACER_HOME directory as an environment variable')
os.chdir(directory)
obj = source + '.llvm'
opt_obj = source + '-opt.llvm'
executable = source + '-instrumented... | {
"content_hash": "fa4f6616cebf52e898973847e3170671",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 33.91428571428571,
"alnum_prop": 0.6141533277169334,
"repo_name": "amritamaz/LLVM-Tracer",
"id": "8f32a586cf147f39f67d7d8f0b58de38c7777a72",
"size": ... |
"""Mutators for evolutionary algorithms."""
import random
from typing import List, Optional, Tuple
import pyglove.core as pg
from pyglove.ext.evolution import base
# We disable implicit str concat as it is commonly used class schema docstr.
# pylint: disable=implicit-str-concat
def where_fn_spec():
"""Returns V... | {
"content_hash": "51f7fcc5a86b93ddd59d1c35e3b6a9c0",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 80,
"avg_line_length": 42.07798165137615,
"alnum_prop": 0.6608525019077728,
"repo_name": "google/pyglove",
"id": "e56e7540edbe48ae67c58d55777578cf3da3c156",
"size": "9757"... |
"""
Django settings for trello_reporter project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
impo... | {
"content_hash": "03df76d4791a9a0fe6c8d205d6065f8e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 76,
"avg_line_length": 27.925925925925927,
"alnum_prop": 0.6489832007073386,
"repo_name": "TomasTomecek/trello-reporter",
"id": "9d0cb086d579eac4b2277840e18e23498e508dc5",
... |
__author__ = 'linlin'
import os
import logging
import re
import pdb
logger = logging.getLogger(__name__)
################################################################
root_dir = '/home/linlin/time/0903_classify_false_start/1003_raw_features/'
separator = '\t\t'
######################################################... | {
"content_hash": "ddd861026545d30d3084a508e3ab9d6a",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 110,
"avg_line_length": 36.545994065281896,
"alnum_prop": 0.5289866839883078,
"repo_name": "linkinwong/word2vec",
"id": "ea9edd85e262d178a397351fa2d622cb40df4778",
"size":... |
"""Test a FCN on an imdb (image database)."""
from fcn.config import cfg, get_output_dir
import argparse
from utils.timer import Timer
import numpy as np
import cv2
import cPickle
from utils.blob import im_list_to_blob
from utils.backprojection import backproject
import os
import math
import tensorflow as tf
def _get... | {
"content_hash": "e314fd7923e686eae45aff12cb3fbe85",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 98,
"avg_line_length": 30.269736842105264,
"alnum_prop": 0.6350793305803086,
"repo_name": "yuxng/Deep_ISM",
"id": "923dd321a02c3a5613d47352683f87cb94cc0935",
"size": "4838... |
from selenium.common.exceptions import WebDriverException
from libs.angular.angularCustomJavascript import *
import selenium.webdriver.support.ui as ui
import time
class AngularCommands:
def __init__(self, webdriver, jsinjector):
self.version = 0.1
self.driver = webdriver
self.jsinjector = jsinjector
#self.re... | {
"content_hash": "aff3d8f1b457491fab56565ec7a0121b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 103,
"avg_line_length": 32.45161290322581,
"alnum_prop": 0.7311133200795229,
"repo_name": "bugbound/webnuke",
"id": "87cf3bf89983a1eaa841ebf8d58eda02752154c0",
"size": "201... |
from django.core.cache import cache
from django.db import models
from django.utils.translation import ugettext_lazy as _
from core.models import BaseModel
from package.models import Project
from grid.models import Grid
ITEM_TYPE_CHOICES = (
('package', 'Package'),
('grid', 'Grid'),
)
class SearchV2(BaseMode... | {
"content_hash": "b5cc9b7965dd5d5081e1fbab84ba3320",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 96,
"avg_line_length": 35.24390243902439,
"alnum_prop": 0.62560553633218,
"repo_name": "noisy/steemprojects.com",
"id": "d2c29e2398b8e470abdc5e55c0d74473a4a4c5dc",
"size": ... |
import unittest
from stackato import restclient
class MockRestClient(restclient.RestClient):
class requests(object):
@classmethod
def session(cls, headers, verify):
cls.init = [headers, verify]
return cls
headers = {}
@classmethod
def request(cls, ... | {
"content_hash": "48a6d91f7c3eb7a8f957823cad93ba31",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.5936170212765958,
"repo_name": "noderabbit-team/PyStackato",
"id": "cb3239ff7b58aa34852641883c0e6123ede9394e",
"si... |
'''
Created on 2016年1月4日
@author: Darren
'''
'''
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If no such two words exist, return 0.
Example 1:
Given ["abcw", ... | {
"content_hash": "8fa681e68ab28a4a1add506243ff67bc",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 242,
"avg_line_length": 27.58823529411765,
"alnum_prop": 0.5373134328358209,
"repo_name": "darrencheng0817/AlgorithmLearning",
"id": "a5a8734e08b2005de1ca9479a1e4be0aef72b6c8... |
'''Binary search'''
from __future__ import division
from __future__ import print_function
def recursive_binary_search(sorted_sequence, key, start=0, end=None):
'''Returns the index of `key` in the `sorted_sequence`, or None if `key` is
not in `sorted_sequence`.'''
end = end or len(sorted_sequence)
i... | {
"content_hash": "e88cc54645f662b794708de5cefc6ce6",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 28.807692307692307,
"alnum_prop": 0.6021361815754339,
"repo_name": "gg/algorithms",
"id": "8fb25101ba3f10600cc1f89043550f880e728641",
"size": "2630",... |
from unittest import TestCase, mock
from unittest.mock import patch, MagicMock
from core.httpoperation import HttpOperation
from core.replicator import Replicator
from tests.core.replicatortest import ReplicatorTest
def mock_request_get(url, params=None, headers=None, verify=False):
pass
def mock_request_post(... | {
"content_hash": "f3e2f29c3ca5c871332d26ff73bad4d7",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 120,
"avg_line_length": 44.820809248554916,
"alnum_prop": 0.5757028630384318,
"repo_name": "Teebytes/TnT-Fuzzer",
"id": "2e1234c7024755d019892d8d2deb905650ff751a",
"size":... |
import time
from oslo_log import log as logging
from murano.api import v1
from murano.common import wsgi
from murano.db.services import stats
LOG = logging.getLogger(__name__)
class RequestStatisticsCollection(object):
request_count = 0
error_count = 0
average_time = 0.0
requests_per_tenant = {}
... | {
"content_hash": "05d8c39be845c73cba2abee4354541c7",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 75,
"avg_line_length": 30.956043956043956,
"alnum_prop": 0.5733049343272986,
"repo_name": "openstack/murano",
"id": "f16472267f60ec6ad50afe0c356256f070aefe90",
"size": "343... |
import jsonrpc
import sys
import urllib
username = urllib.quote_plus ("ultimateonlinecash")
password = urllib.quote_plus ("password")
port = 8336
url = "http://%s:%s@localhost:%d/" % (username, password, port)
class AuxpowStats:
"""
Keep track of the interesting statistics of the auxpows
found in the blockchain... | {
"content_hash": "bf783e920e3182887882b9e1bd32d6ed",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 74,
"avg_line_length": 26.595744680851062,
"alnum_prop": 0.604,
"repo_name": "cryptoprojects/ultimateonlinecash",
"id": "623d7669403b708f02a2a65570005369cabc4a85",
"size": ... |
"""
Dummy client runner
This module implements a stand-alone launcher for stress-testing
an Evennia game. It will launch any number of fake clients. These
clients will log into the server and start doing random operations.
Customizing and weighing these operations differently depends on
which type of game is tested. T... | {
"content_hash": "2dc106cb48fdb0d61ad9a18481b45a59",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 95,
"avg_line_length": 31.018433179723502,
"alnum_prop": 0.6374238597533799,
"repo_name": "jamesbeebop/evennia",
"id": "3b13bb49f64f0dae73cb3991903fd8d0f21645e1",
"size": ... |
import wx
import armid
import ARM
from RoleCostDialog import RoleCostDialog
class RoleCostListCtrl(wx.ListCtrl):
def __init__(self,parent,winId,boxSize=wx.DefaultSize):
wx.ListCtrl.__init__(self,parent,winId,size=boxSize,style=wx.LC_REPORT)
self.InsertColumn(0,'Role')
self.SetColumnWidth(0,150)
self.... | {
"content_hash": "9ba6c207d94885a0577404a9bdccf0de",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 87,
"avg_line_length": 33.14705882352941,
"alnum_prop": 0.7054125998225377,
"repo_name": "RobinQuetin/CAIRIS-web",
"id": "50b908a037cff156107f632a5ee3407b936e6fcd",
"size":... |
import logging
import argparse
import sys
import csv
import datetime
from collections import defaultdict
from functools import partial, reduce
from itertools import groupby
parser = argparse.ArgumentParser('aggr')
parser.add_argument('-p', '--pattern', required=True)
parser.add_argument('-i', '--infile')
parser.add_a... | {
"content_hash": "6e5a8e22418d219d8e439facbc0570cf",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 96,
"avg_line_length": 27.2109375,
"alnum_prop": 0.6124031007751938,
"repo_name": "Horb/aggr",
"id": "0bede642931b46166ea75980f0d64235c8a9f5dd",
"size": "3502",
"binary"... |
"""Development settings and globals."""
from .base import *
# DEBUG CONFIGURATION
DEBUG = True
INTERNAL_IPS = ('127.0.0.1',)
ALLOWED_HOSTS = ['*']
# EMAIL CONFIGURATION
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# CACHE CONFIGURATION
CACHES = {
'default': {
'BACKEND': 'django.core.... | {
"content_hash": "59914455f314715d0c57531bb02e6da3",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 19.652173913043477,
"alnum_prop": 0.6814159292035398,
"repo_name": "tom-henderson/bookmarks",
"id": "7ca0ab3481c30e5dddd660e780ad24c80543eb82",
"size... |
from __future__ import unicode_literals
from copy import copy
from decimal import Decimal
import os
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql
from django.db import router
from django.conf import setting... | {
"content_hash": "abc0682227013cbca678856feef478f2",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 105,
"avg_line_length": 43.40909090909091,
"alnum_prop": 0.6330191972076789,
"repo_name": "denisenkom/django",
"id": "632cb98aebde640013adb28b8c05759b6954b637",
"size": "1... |
from __future__ import division, print_function, absolute_import, unicode_literals
# from qtpy.QtCore import *
from qtpy.QtGui import *
# from qtpy.QtWidgets import *
CategoryItemType = QStandardItem.UserType + 1
PropertyItemType = CategoryItemType + 1
ADD_ICON = QIcon()
UP_ICON = QIcon()
DOWN_ICON = QIcon()
DELETE_I... | {
"content_hash": "eb601db768a63f07d1004f1477f05fa4",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 82,
"avg_line_length": 26.852941176470587,
"alnum_prop": 0.6845564074479737,
"repo_name": "pashango2/sphinx-explorer",
"id": "7f7613a6421656252771d305ee62738f8f4448d5",
"si... |
"""Methods to read data in the graph."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.input_pipeline.python.ops import input_pipeline_ops
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ... | {
"content_hash": "1bc308ee1c7ae169a1c79b3bc16eb3e1",
"timestamp": "",
"source": "github",
"line_count": 773,
"max_line_length": 82,
"avg_line_length": 40.746442432082794,
"alnum_prop": 0.6378702733593675,
"repo_name": "elingg/tensorflow",
"id": "7ab6aafdf39e754d09ca81ad75c884cc4603774a",
"size": "3... |
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.21
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class ProductVideoListResponse(object):
"""
NOTE: This class is auto gen... | {
"content_hash": "7169945930242b1dfed51d8672b25ed8",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 77,
"avg_line_length": 26.074626865671643,
"alnum_prop": 0.5323411562678878,
"repo_name": "kinow-io/kinow-python-sdk",
"id": "e47fdb1e749f136c0b53cb2875b12c7a26e8488c",
"s... |
from __future__ import absolute_import, division, print_function
from fnmatch import fnmatch
from functools import wraps, partial
from glob import glob
from math import ceil
from operator import getitem
import os
import re
from threading import Lock
import uuid
import pandas as pd
import numpy as np
from toolz import... | {
"content_hash": "f2e5139faf716b1a29678aa1daa909df",
"timestamp": "",
"source": "github",
"line_count": 809,
"max_line_length": 168,
"avg_line_length": 33.982694684796044,
"alnum_prop": 0.5793321693583589,
"repo_name": "pombredanne/dask",
"id": "42819bbb3f41ece0d1799110af9cb99d40dcaccd",
"size": "2... |
import hazelcast
from hazelcast.core import HazelcastJsonValue
from hazelcast.predicate import less_or_equal
from hazelcast.projection import single_attribute, multi_attribute
client = hazelcast.HazelcastClient()
people = client.get_map("people").blocking()
people.put_all(
{
1: HazelcastJsonValue({"name... | {
"content_hash": "c58157ee4823865ef8df41da7a1040a4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 83,
"avg_line_length": 31.862068965517242,
"alnum_prop": 0.6883116883116883,
"repo_name": "hazelcast/hazelcast-python-client",
"id": "d2254425b950d259c6139888288e0bc7d18b4d70... |
from __future__ import unicode_literals
import base64
from django.conf import settings
from django.db import models
from django.db import transaction
from django.db.models import Q
import logging
import us
import uuid
from polling.models import CANDIDATES_ADVOCATED
STATES = [(state.name, state.name) for state in us.... | {
"content_hash": "8544d7e5f9cb382f3f3a1577a2d6a2d6",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 101,
"avg_line_length": 34.77914110429448,
"alnum_prop": 0.6295642970541542,
"repo_name": "sbuss/voteswap",
"id": "50c0a4e9f5d532b2e175b783f7a3945e1771f9cd",
"size": "5669... |
import os
import sys
import json
import time
import datetime
import string
import re
import math
import commands
import logging
import logging.handlers
import threading
import threadpool
# configure logs
NOW_TIME = datetime.datetime.now()
STR_NOW = NOW_TIME.strftime("%Y-%m-%d_%H:%M:%S")
commands.getstatusoutput('mkdir... | {
"content_hash": "06e8bbda177882f08a0acc1c36e15f35",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 144,
"avg_line_length": 39.49832775919732,
"alnum_prop": 0.6668924640135478,
"repo_name": "heroanxiaobo/Cloud-Tools",
"id": "328b1ad830ce74bf1fbf4a7a531eb17f60e18402",
"si... |
import copy
from functools import wraps
import json
import sys
import django
from django.contrib.admin.helpers import AdminForm
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin.models import LogEntry, CHANGE
from django.contrib.admi... | {
"content_hash": "a81caf3dcc0fd8d4dcebe2ca30fa1395",
"timestamp": "",
"source": "github",
"line_count": 1657,
"max_line_length": 179,
"avg_line_length": 44.85817742908871,
"alnum_prop": 0.5897484192116238,
"repo_name": "vxsx/django-cms",
"id": "b18c0f5336f53a78aac2e98d46e9a3231307d94b",
"size": "74... |
__author__ = ['markshao']
provider_name = "lxc"
privider_summary = "linux container"
| {
"content_hash": "8249fd174cd5fc3cef7e259ea872f71f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 36,
"avg_line_length": 21.5,
"alnum_prop": 0.6744186046511628,
"repo_name": "markshao/pagrant",
"id": "0afed9bd42e4e9b0b87e528424b07ab2c0034527",
"size": "118",
"binary": ... |
"""
==================
Visualize surfaces
==================
Here is a simple tutorial that shows how to visualize surfaces using dipy_. It
also shows how to load/save, get/set and update ``vtkPolyData`` and show
surfaces.
``vtkPolyData`` is a structure used by VTK to represent surfaces and other data
structures. Her... | {
"content_hash": "b2c4a47a32421084a3777852d1df8a49",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 24.95,
"alnum_prop": 0.564128256513026,
"repo_name": "nilgoyyou/dipy",
"id": "c0bfbaf004fd88205ed4895d5e8d448573465740",
"size": "2994",
"binary":... |
from django.contrib.sitemaps import Sitemap
from .models import Post
class PostSitemap(Sitemap):
changefreq = 'weekly'
priority = 0.9
def items(self):
return Post.published.all()
def lastmod(self, obj):
return obj.publish
| {
"content_hash": "35a6c3f06d523f20452163656e438c68",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 43,
"avg_line_length": 19.416666666666668,
"alnum_prop": 0.7467811158798283,
"repo_name": "SlouchyBeanie/blog",
"id": "65b41e8ad0c4ee8814fc220fa99872c13fe0758d",
"size": "2... |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
import cStringIO as StringIO
import struct
import header
class piemos_health(object):
__slots__ = ["header", "auton", "enabled", "robot_connection", "xbox_controller", "game_time"]
def __init__(self):
sel... | {
"content_hash": "54ec3b27cc53d960f8f8d106d66d36f9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 132,
"avg_line_length": 36.55384615384615,
"alnum_prop": 0.6460437710437711,
"repo_name": "pioneers/topgear",
"id": "1fdf67ea6308372c87a2253dbe5ffd9535ea1762",
"size": "237... |
"""
type lookahead: some operations need to be done knowing the resulting type
"""
# Somewhat easy: the type checker knows that l1 has type [str] from the start
l1 = [None]
l1[0] = "hello"
print l1
# Hard: the list literal correctly has type [None], but [None] * 1 needs to return
# an object of type [str], a case of ... | {
"content_hash": "b046e53e093168ff3a30699f6541028e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 82,
"avg_line_length": 28.5,
"alnum_prop": 0.6942355889724311,
"repo_name": "kmod/icbd",
"id": "7ea88dbb747f5c1398d0a0e2296d5061d3aae674",
"size": "399",
"binary": false,... |
import re
with open ("file.txt", "r") as myfile:
data=myfile.read().replace('moreaddress(', '')
data = data.replace ('"Bangalore");', '')
data = data.replace ('"', '')
data = data.replace (' ', '')
data = data.replace(',\n\n','\n')
data = re.sub(r',Pin-\d*', "", data)
print data
'''Write ou... | {
"content_hash": "2e5fcc99536d8a1485d66e492accd0f6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 50,
"avg_line_length": 28.384615384615383,
"alnum_prop": 0.5501355013550135,
"repo_name": "sudikrt/costproML",
"id": "15c0443fa3d62baefb6c35efaf10ec9469334fe7",
"size": "36... |
from random import sample
from discoutils.thesaurus_loader import Thesaurus
class DummyThesaurus(Thesaurus):
"""
A thesaurus-like object which return "b/N" as the only neighbour of every possible entry
"""
name = 'Constant'
def __init__(self):
pass
def get_nearest_neighbours(self, fe... | {
"content_hash": "7c74000f2cfecb7dbcb6be847fb10353",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 108,
"avg_line_length": 26,
"alnum_prop": 0.6258741258741258,
"repo_name": "mbatchkarov/dc_evaluation",
"id": "446aa1c4eab4be19b015cdfffd5ec1ee3ac8f12b",
"size": "1144",
... |
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from flask_restful import Api
from .api.gfcard import GiftCard
api = Api(main)
api.add_resource(GiftCard, '/giftcard/request')
from apscheduler.schedulers.background import BackgroundScheduler
from .jobs.giftCardSchedule imp... | {
"content_hash": "964c097cfa5be111a35e93bf62c98e11",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 26.105263157894736,
"alnum_prop": 0.7983870967741935,
"repo_name": "simonqiang/gftest",
"id": "90fcc0ce09da7fcf0724d26f0283968ac640f2d9",
"size": "49... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HMM2_if_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HMM2_if_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
super... | {
"content_hash": "853651767d2b3a16a94b3766a580762b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 96,
"avg_line_length": 24.973684210526315,
"alnum_prop": 0.6933614330874605,
"repo_name": "levilucio/SyVOLT",
"id": "32e3bdca849d00ae4c0ec71e5f2ea94adaf0a45d",
"size": "949... |
import re
import numpy as np
from sklearn.preprocessing import normalize
from sklearn.feature_extraction.text import HashingVectorizer
def preprocess_string(text):
res = re.sub("[!.;?^*()_{}|]","", text) # remove special characters (we keep characters such as "$" and ",-" )
res = re.sub("\d+", " ^number^ ", re... | {
"content_hash": "16cb8003ab30323dc9184eb5752a77b0",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 143,
"avg_line_length": 40.84313725490196,
"alnum_prop": 0.628420547287566,
"repo_name": "gogartom/TextMaps",
"id": "b49a3e821a62480610f0fdd181135b1725b3de28",
"size": "208... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.