text stringlengths 4 1.02M | meta dict |
|---|---|
from direct.directnotify import DirectNotifyGlobal
from toontown.parties.DistributedPartyActivityAI import DistributedPartyActivityAI
from toontown.parties.DistributedPartyCatchActivityBase import DistributedPartyCatchActivityBase
from direct.task import Task
from direct.distributed.ClockDelta import globalClockDelta
f... | {
"content_hash": "ddbb1aeafbab4d2252596869d2a82ef8",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 146,
"avg_line_length": 42.7816091954023,
"alnum_prop": 0.6880709296077377,
"repo_name": "Spiderlover/Toontown",
"id": "f9fb4135a375ca9d61103861a181d5e7f51d8786",
"size": "... |
"""COUNTING AND GROUPING"""
def item_order(order):
"""Return orders and quantities
Example:
>>> item_order("salad salad hamburger")
'salad:2 hamburger:1 water:0'
"""
return "salad:{} hamburger:{} water:{}".format(
order.count("salad"),
order.count("hamburger"),
... | {
"content_hash": "b007d9a2a30f2465397f67d4bd001dd9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 21.736842105263158,
"alnum_prop": 0.5690072639225182,
"repo_name": "mottosso/mitx-6.00.1x",
"id": "e79338cf2ce9b1c6eb6a15962076be61f6a07ea6",
"size":... |
from datetime import timedelta
from rest_framework import status as http_status
from django.utils import timezone
from nose.tools import * # noqa (PEP8 asserts)
from framework.auth import campaigns, views as auth_views, cas
from website.util import web_url_for
from website.util.metrics import provider_source_tag
fro... | {
"content_hash": "8b3d9bb5294c004ac7c20cea61b0da05",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 104,
"avg_line_length": 40.26953125,
"alnum_prop": 0.6401202832476477,
"repo_name": "aaxelb/osf.io",
"id": "442d1d1f9314853daecf10446498e836c68ca284",
"size": "10309",
"... |
from django.db.models import Q
from django.apps import apps
from taiga.front.templatetags.functions import resolve
from .base import Sitemap
class WikiPagesSitemap(Sitemap):
def items(self):
wiki_page_model = apps.get_model("wiki", "WikiPage")
# Get wiki pages of public projects OR private proj... | {
"content_hash": "4e28198dfca653a7e0ffcabeaa084f54",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 109,
"avg_line_length": 31.76923076923077,
"alnum_prop": 0.6263115415657788,
"repo_name": "curiosityio/taiga-docker",
"id": "85e03ba041fe712eeb2700ea16ce8afde3eabd68",
"siz... |
import os
import sys
import csv
path = '/Users/nealcaidin/Documents/tmp/Tools'
# create a dictionary to hold the sum of all percentages of tool use across file
# (both by sites and by participants using a Python tuple construct)
aggregate_tools_percentages = {}
for file in os.listdir(path):
current = os.path.j... | {
"content_hash": "7f6ce965977755ce7b6886ca41734dc4",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 110,
"avg_line_length": 37.36470588235294,
"alnum_prop": 0.6001259445843828,
"repo_name": "ncaidin/sakai_sql_survey_results",
"id": "df4fdaf54787561477c3034d0419937446c279ac"... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
class TestTorrentMatch(object):
config = """
tasks:
test_multi_torrent_empty_name:
mock:
- {title: 'torrent1', file: 'torre... | {
"content_hash": "fca0f610783456494fbe1831d3df7608",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 120,
"avg_line_length": 45.00826446280992,
"alnum_prop": 0.5883217040029379,
"repo_name": "jawilson/Flexget",
"id": "e20fe4a8b13fae461fddbedd0d99ae72461114e5",
"size": "54... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the project root ... | {
"content_hash": "07db96c87c2bff382a064b29796afca7",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 80,
"avg_line_length": 32.58130081300813,
"alnum_prop": 0.7075483468496568,
"repo_name": "westurner/sphinxcontrib-rdf",
"id": "eb2a8b45bee9dd64ffec57446077e93f1ba1ae80",
"... |
import socket
import time
from enum import IntEnum
from typing import Tuple, TYPE_CHECKING
import threading
from PyQt5.QtCore import Qt, pyqtSignal, QThread
from PyQt5.QtWidgets import (QTreeWidget, QTreeWidgetItem, QMenu, QGridLayout, QComboBox,
QLineEdit, QDialog, QVBoxLayout, QHeaderVie... | {
"content_hash": "a62a0c9c3d487181ee4cef0fcfd6741a",
"timestamp": "",
"source": "github",
"line_count": 469,
"max_line_length": 146,
"avg_line_length": 40.25799573560768,
"alnum_prop": 0.6020867538795615,
"repo_name": "spesmilo/electrum",
"id": "cb2d4297cd9ea8ca64b67de2532e8e2720a40095",
"size": "2... |
"""Creates Homewizard Energy switch entities."""
from __future__ import annotations
from typing import Any
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity imp... | {
"content_hash": "0ca15bae7e43b338d3615bf63d1e31cb",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 84,
"avg_line_length": 32.96124031007752,
"alnum_prop": 0.660865475070555,
"repo_name": "GenericStudent/home-assistant",
"id": "7860370baa7a2dcace0eddbb4316a9f1a8238664",
... |
from __future__ import unicode_literals
from __future__ import absolute_import
from collections import namedtuple
import logging
import re
import os
import sys
from operator import attrgetter
import six
from docker.errors import APIError
from docker.utils import create_host_config, LogConfig
from docker.utils.ports im... | {
"content_hash": "db95c7617022fe8f704cdca7980d0b38",
"timestamp": "",
"source": "github",
"line_count": 946,
"max_line_length": 134,
"avg_line_length": 32.494714587737846,
"alnum_prop": 0.5690956408588159,
"repo_name": "bbirand/compose",
"id": "7df5618c55b27d9c50e07f49da3122e9675f10ff",
"size": "30... |
"""
Test WSGI basics and provide some helper functions for other WSGI tests.
"""
import testtools
import routes
import webob
from volt.common import wsgi
class WSGITest(testtools.TestCase):
def test_wsgi(self):
class Application(wsgi.Application):
"""Dummy application to test debug."""
... | {
"content_hash": "09cdd6fb9fde1b3d558f645dc84dca8c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 30.425531914893618,
"alnum_prop": 0.5895104895104896,
"repo_name": "vmthunder/volt",
"id": "3927f29d565279e4475858b374b225005472314c",
"size": "2200"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0063_auto_20211220_1422'),
]
operations = [
migrations.AddField(
model_name='sponsorshippackage',
name='slug',
field=models.SlugField(default... | {
"content_hash": "bfbcfbca6ffa8a130a88018d5a5f4bf3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 112,
"avg_line_length": 25.5,
"alnum_prop": 0.6102941176470589,
"repo_name": "proevo/pythondotorg",
"id": "bf14023b4cccd5f287f690af8cad69f700d45c07",
"size": "458",
"bina... |
import sys
from cx_Freeze import setup, Executable
exe = Executable(
script="MarioMakerLevelsBot.py",
initScript=None,
base='Win32GUI',
targetDir="dist",
targetName="MarioMakerLevelsBot.exe",
compress=True,
copyDependentFiles=True,
appendScriptToExe=True,
appendScriptToLibrary=Fals... | {
"content_hash": "b8537fc29da3e98073c37159565edfa1",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 30.085714285714285,
"alnum_prop": 0.5251661918328585,
"repo_name": "RLejolivet/MarioMakerLevelsBot",
"id": "9391f6b3399a7eeb565a73375f2405893501fc10",
... |
import asyncio
import discord
from datetime import datetime
from discord.ext import commands
from shutil import copyfile
import time
import json
import os
import re
from Cogs import DisplayName
from Cogs import Nullify
class Welcome:
def __init__(self, bot, settings):
self.... | {
"content_hash": "514001a7d419e1a034d00ae6c9d85ef3",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 167,
"avg_line_length": 45.098684210526315,
"alnum_prop": 0.6064186725018235,
"repo_name": "Mercurial/CorpBot.py",
"id": "832fdc8a41354e5c908ee3395825b62cc16adbf3",
"size"... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import RedirectView
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^executions/week/(?P<yyyy_mm_dd>\d{4}-\d{2}-\d{2})/$', 'batch_app... | {
"content_hash": "0e085b0e9d9a0eaa28929404637c32ff",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 138,
"avg_line_length": 73.41176470588235,
"alnum_prop": 0.5584935897435898,
"repo_name": "azam-a/batcher",
"id": "4a321edbcefd17691becfddb76aeb7864a039f3a",
"size": "1248"... |
import copy
import string
import collections
import contextlib
@contextlib.contextmanager
def as_handle(handleish, mode='r', **kwargs):
"""Open handleish as file.
Stolen from Biopython
"""
if isinstance(handleish, basestring):
with open(handleish, mode, **kwargs) as fp:
yield f... | {
"content_hash": "6c0a82643c0449d9eddad05886368e89",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 76,
"avg_line_length": 28.735714285714284,
"alnum_prop": 0.5781754909271688,
"repo_name": "churchlab/ulutil",
"id": "c9d0f0bc3f15e562663c214aad23c4b40d23cc58",
"size": "46... |
import pydcop
try:
# get 'player' service of 'amarok' aplication
playerService = pydcop.DCOPObject('amarok', 'player')
# call service methods for getting song information
info = dict(
title=playerService.title(),
artist=playerService.artist(),
album=playerService.album()
)
... | {
"content_hash": "455d83e3e65781f5ecc24d005b173b74",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 60,
"avg_line_length": 25.7,
"alnum_prop": 0.6595330739299611,
"repo_name": "ActiveState/code",
"id": "00f79d3c28face3d7fdae72bba565cd0b1a68cc8",
"size": "514",
"binary":... |
import string
from header_common import *
from module_info import *
from module_strings import *
from process_common import *
def save_strings(strings):
ofile = open(export_dir + "strings.txt","w")
ofile.write("stringsfile version 1\n")
ofile.write("%d\n"%len(strings))
for i_string in xrange(len(st... | {
"content_hash": "4836f278dd026fc7fc5c5e19a7e27f94",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 87,
"avg_line_length": 28.962962962962962,
"alnum_prop": 0.6585677749360613,
"repo_name": "nycz/useful-sisters",
"id": "0bca8645f251a705fb06f712e0c983d4ba1736b8",
"size": "... |
from classes import *
from featutil import *
from features import *
| {
"content_hash": "b5b82275747f607804ba92950ddc1b9d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 22,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7794117647058824,
"repo_name": "QuantSoftware/QuantSoftwareToolkit",
"id": "aca4b1e71d988c40e26803129ae2c4ea4e68491f... |
"""
Functions to operate on polynomials.
"""
from __future__ import division, absolute_import, print_function
__all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd',
'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d',
'polyfit', 'RankWarning']
import re
import warnings
import numpy.core.... | {
"content_hash": "24bbd00149d7a4c902a55b94a5e3c595",
"timestamp": "",
"source": "github",
"line_count": 1293,
"max_line_length": 79,
"avg_line_length": 29.60170146945089,
"alnum_prop": 0.5593207054212933,
"repo_name": "ssanderson/numpy",
"id": "50e6d8db276bcdf925045aa01619e10c0620208e",
"size": "38... |
import logging
import traceback
import ujson as json
from collections import *
from itertools import chain
from bs4 import BeautifulSoup, SoupStrainer
from openvenues.extract.util import *
logger = logging.getLogger('extract.soup')
def tag_value_and_attr(tag):
value_attr = None
value_attr = property_values... | {
"content_hash": "fea4c1060795db44414ab88e249a2bc8",
"timestamp": "",
"source": "github",
"line_count": 822,
"max_line_length": 137,
"avg_line_length": 31.81508515815085,
"alnum_prop": 0.5307815845824411,
"repo_name": "openvenues/openvenues",
"id": "b3b04d2588de923e1cfa007a7b5cbac634d26455",
"size"... |
from operator import itemgetter
import re
from django import template
from django.template.defaultfilters import stringfilter
from api.models import LocationMention, Location, Sentence
register = template.Library()
@register.filter
@stringfilter
def wrap_with_span(string, arg):
""" Wraps all instances of a stri... | {
"content_hash": "a6d7ba65545dbd91117a483cf25f6291",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 104,
"avg_line_length": 30.677419354838708,
"alnum_prop": 0.6146161934805467,
"repo_name": "LitPalimpsest/parser-api-search",
"id": "cc68f3da049eb4c6a3e0c419eb76fe47f73983e0"... |
import sys
#
# IDL Node
#
# IDL Node defines the IDLAttribute and IDLNode objects which are constructed
# by the parser as it processes the various 'productions'. The IDLAttribute
# objects are assigned to the IDLNode's property dictionary instead of being
# applied as children of The IDLNodes, so they do not exist i... | {
"content_hash": "ff812a2587211f7ba652cf448e480b75",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 78,
"avg_line_length": 24.615384615384617,
"alnum_prop": 0.6419117647058824,
"repo_name": "ric2b/Vivaldi-browser",
"id": "d7284d8994c54fb33faa2542447f8a2d4e0f4c74",
"size"... |
livejs = '''
/*
Live.js - One script closer to Designing in the Browser
Written for Handcraft.com by Martin Kool (@mrtnkl).
Version 4.
Recent change: Made stylesheet and mimetype checks case insensitive.
http://livejs.com
http://livejs.com/license (MIT)
@livejs
Include live.js#css to monitor css cha... | {
"content_hash": "0928b159076d79a316bcaf05c7a1c987",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 106,
"avg_line_length": 35.2,
"alnum_prop": 0.566247582205029,
"repo_name": "cbednarski/icecake",
"id": "d6d4e47c1ce723a9bac34913fb4790cc08de32bf",
"size": "8272",
"bina... |
import os
import ssl
from oslo.config import cfg
from murano.openstack.common.gettextutils import _
ssl_opts = [
cfg.StrOpt('ca_file',
help="CA certificate file to use to verify "
"connecting clients."),
cfg.StrOpt('cert_file',
help="Certificate file to use ... | {
"content_hash": "eef82f40ff0a2ace6b5d2cb3ee8fb25b",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 74,
"avg_line_length": 26.604938271604937,
"alnum_prop": 0.5976798143851508,
"repo_name": "sergmelikyan/murano",
"id": "57862251154c89819a6fe93af4d0d8f194787494",
"size": "... |
from medoly import kanon
from medoly import anthem
@kanon.menu("/")
class HomeHandler(anthem.Handler):
entry_thing = kanon.Melos("thing:Entry")
def get(self):
entries = self.entry_thing.list_entries()
if not entries:
self.redirect("/compose")
return
self.rende... | {
"content_hash": "9dc6a056e022881d3a03742e0ebd9de6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 49,
"avg_line_length": 23.466666666666665,
"alnum_prop": 0.6306818181818182,
"repo_name": "whiteclover/Medoly",
"id": "d67dcb6af27b3d725698fb894b25b92643c529e5",
"size": "3... |
'''
Created on Jan 17, 2016
@author: RJMurray
'''
# need: MUSSQ implementation, cluster definition, machine definition
import numpy as np
import random
class Controller():
def __init__(self, clusterSpecs):
# clusterSpecs is a list "numClusters" lists
self.numClusters = len(clusterSpecs)
s... | {
"content_hash": "b7caa2055ce696adddb567c968836c39",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 84,
"avg_line_length": 32.65555555555556,
"alnum_prop": 0.5634569581490303,
"repo_name": "rileyjmurray/REUcode",
"id": "61d6ce367ec7fab016e16f8d5d0f1ece04fd307c",
"size": "... |
"""Helper for building projects from source."""
from __future__ import unicode_literals
import datetime
import glob
import logging
import os
import platform
import re
import shutil
import subprocess
import tarfile
import zipfile
from l2tdevtools.build_helpers import interface
from l2tdevtools import dpkg_files
cla... | {
"content_hash": "a8d8029aa9858e579cd7741d8773cc8e",
"timestamp": "",
"source": "github",
"line_count": 879,
"max_line_length": 80,
"avg_line_length": 34.10238907849829,
"alnum_prop": 0.6677341873498799,
"repo_name": "rgayon/l2tdevtools",
"id": "21bbdfec6b975a7a0fd952c7baaac98eafa96506",
"size": "3... |
"""
This Bot uses the Updater class to handle the bot.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Basic Echobot example, repeats messages.
Pr... | {
"content_hash": "1a67d6ff99e0c7ee0968de72363f824e",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 117,
"avg_line_length": 32.463157894736845,
"alnum_prop": 0.6968223086900129,
"repo_name": "jmigual/projecte2",
"id": "04472a37039e15fcf5bb3b01afb0bc641db483ed",
"size": "3... |
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... | {
"content_hash": "1e2fca47b37f85c663e758e4d8e10a17",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 136,
"avg_line_length": 30.687203791469194,
"alnum_prop": 0.587027027027027,
"repo_name": "jarv/cmdchallenge-site",
"id": "eb07536d8c3cfacf3b8417117a5b45c13e9f8425",
"size... |
def cross(A, B):
"Cross product of elements in A and elements in B."
return [a+b for a in A for b in B]
digits = '123456789'
rows = 'ABCDEFGHI'
cols = digits
squares = cross(rows, cols)
unitlist = ([cross(rows, c) for c in cols] +
[cross(r, cols) for r in rows] +
[cross(rs, c... | {
"content_hash": "ab40f661c157bcbce5fccc00d64cbea5",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 88,
"avg_line_length": 37.58974358974359,
"alnum_prop": 0.5625284220100045,
"repo_name": "jialing3/corner_cases",
"id": "2e72b1b3031dfbd3edd76e7032ab734175265842",
"size":... |
'''
Created on 26 May 2013
@author: lukasz.forynski
@brief: Implementation of the multi-key dictionary.
https://github.com/formiaczek/python_data_structures
___________________________________
Copyright (c) 2013 Lukasz Forynski <[email protected]>
Permission is hereby granted, free of charge, to any perso... | {
"content_hash": "a6f2c41bd860640f939b8f3bc9253763",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 141,
"avg_line_length": 47.525597269624576,
"alnum_prop": 0.5634829443447038,
"repo_name": "JFDesigner/MTG",
"id": "489ac2b8f8a7db6284db2c54638f3a430d247a81",
"size": "278... |
import functools
import errno
import os
import resource
import signal
import time
import subprocess
import re
from swift import gettext_ as _
from swift.common.utils import search_tree, remove_file, write_file
SWIFT_DIR = '/etc/swift'
RUN_DIR = '/var/run/swift'
# auth-server has been removed from ALL_SERVERS, start ... | {
"content_hash": "e3f351e5b74ea6b71be4d09fa5ab88f8",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 79,
"avg_line_length": 33.85031847133758,
"alnum_prop": 0.5316586696772979,
"repo_name": "xiaoguoai/ec-dev-swift",
"id": "f345e28fec9abc760e3aedb1a906abee6b544b0a",
"size"... |
f = CurrentFont()
g = CurrentGlyph()
layer = Glyphs.font.selectedLayers[0] # current layer
def draw_circle(xxx_todo_changeme, diameter):
(origin_x, origin_y) = xxx_todo_changeme
pen = g.getPen()
d = diameter #diameter
r = d / 2 #radius
h = r * 0.55229 #handle size
x0, y0 = origin_x, origin_y #origin
#sinc... | {
"content_hash": "53a63adf6b8058be78e9eaf3c340c03f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 112,
"avg_line_length": 25.89189189189189,
"alnum_prop": 0.6649269311064718,
"repo_name": "filipenegrao/glyphsapp-scripts",
"id": "ab517c57b54723484324091a392b522484c553d9",
... |
from flask import (
g,
Blueprint,
render_template,
current_app,
request,
url_for,
redirect,
session,
)
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
import packtools
from .forms import XMLUploadForm
from .utils import analyze_xml
main ... | {
"content_hash": "ac2abcaf3a06bdf3f9a127c36732921c",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 88,
"avg_line_length": 28.612903225806452,
"alnum_prop": 0.6125516723036453,
"repo_name": "gustavofonseca/packtools",
"id": "36fd1e784a676057aa08a92c861321e2498c7f87",
"siz... |
from __future__ import unicode_literals
__version__ = version = '0.6.0'
import sys
from .core import httpretty, httprettified
from .errors import HTTPrettyError
from .core import URIInfo
HTTPretty = httpretty
activate = httprettified
SELF = sys.modules[__name__]
for attr in [name.decode() for name in httpretty.ME... | {
"content_hash": "d3e843710a882fd5cbb40234ca84e284",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 124,
"avg_line_length": 26.11764705882353,
"alnum_prop": 0.722972972972973,
"repo_name": "maxmind/HTTPretty",
"id": "d0e88a993331369dad2560f905890ac5b6843b34",
"size": "166... |
import hTools2.dialogs.glyphs.anchors_transfer
reload(hTools2.dialogs.glyphs.anchors_transfer)
hTools2.dialogs.glyphs.anchors_transfer.transferAnchorsDialog()
| {
"content_hash": "991b86f1f7323d047699066b4cf156f7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 63,
"avg_line_length": 40,
"alnum_prop": 0.8625,
"repo_name": "gferreira/hTools2_extension",
"id": "ebafdc746b9c7d4e183a775c06c1a52912338ab2",
"size": "191",
"binary": fal... |
"""
Code to sum characteristics of events split by either time or speed and write
out the results to a table.
Author: Rachel H White [email protected]
Created: Oct 2016
Example use:
python CalculateDomainAverages.py --Data TRMM --Version Standard \
--anstartyr 1998 --anendyr 2014 \
--tbound1 0 1 2 5 --tbound2 1 2 5 100 ... | {
"content_hash": "222df6818ca00987913a723a2b693716",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 97,
"avg_line_length": 35.97855227882037,
"alnum_prop": 0.5698211624441133,
"repo_name": "rhwhite/eventTracking",
"id": "59d7fd655f993dee8357fb3fda7c55dc22073357",
"size":... |
from django.contrib.gis.db import models
from django.conf import settings
from django.db.models import Max,Min
# Create your models here.
class DepthSounding(models.Model):
depth_ft = models.IntegerField(blank=True,null=True)
geometry = models.PointField(srid=settings.GEOMETRY_DB_SRID)
objects = models.Ge... | {
"content_hash": "685df51f25df785e2e5858462ca8caf4",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 85,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.6886792452830188,
"repo_name": "google-code-export/marinemap",
"id": "7c423456cff38b7f55d7d8528e5109774e54ff0b",
... |
import time
from copy import copy
from Adafruit_I2C import Adafruit_I2C
# ============================================================================
# LEDBackpack Class
# ============================================================================
class LEDBackpack:
i2c = None
# Registers
__HT16K33_REGISTER_... | {
"content_hash": "77df63ba73746cc5596a37613d41b13f",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 90,
"avg_line_length": 29.744897959183675,
"alnum_prop": 0.5927958833619211,
"repo_name": "CSF-JH/crossbarexamples",
"id": "fd41b453c61da7c074d5fc9818ba20f2e6b8c08a",
"size... |
import os
import sys
try:
# Python >=3.3
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
class Mock(MagicMock):
# xcbq does a dir() on objects and pull stuff out of them and tries to sort
# the result. MagicMock has a bunch of stuff that can't be sorted, so let's... | {
"content_hash": "f9cb01cb4fe90c6a67e513d4c3510994",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 86,
"avg_line_length": 30.550675675675677,
"alnum_prop": 0.6912529027977441,
"repo_name": "kynikos/qtile",
"id": "c6b5026bc2bea31a1e4bc1fb3658889f8d638b20",
"size": "9459"... |
import os
from flask import Flask
from webassets.loaders import PythonLoader as PythonAssetsLoader
from memex import assets
from memex.models import db
from memex.extensions import (
cache,
assets_env,
debug_toolbar,
login_manager
)
class ReverseProxied(object):
'''Wrap the application in this ... | {
"content_hash": "cba28de427dcf5821f01568c69c8f01e",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 75,
"avg_line_length": 27.5,
"alnum_prop": 0.6415584415584416,
"repo_name": "pymonger/facetview-memex",
"id": "63f0583b6707c05eb839a78586d3062bb5e37fe8",
"size": "2716",
... |
import fileinput
from termcolor import cprint
counter = 0
for line in fileinput.input():
if counter:
counter += 1
if line.startswith('='):
counter = 1
if counter > 5:
if line.startswith('\t'):
cprint(line.strip(), 'yellow')
else:
cprint(line.strip(),... | {
"content_hash": "69ef17f131adf59fbdb9f1cd008ffe76",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 42,
"avg_line_length": 21.58823529411765,
"alnum_prop": 0.547683923705722,
"repo_name": "tiborsimon/dotfiles",
"id": "fcd207fc242bc8e24093a82a45627177bf88ae57",
"size": "39... |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.transforms.preprocessing import H2OScaler
def test_scaler():
iris = h2o.import_file(pyunit_utils.locate("smalldata/iris/iris.csv"))
scaler = H2OScaler()
scaler.fit(iris)
iris_transformed = scaler.transform(iris... | {
"content_hash": "b6f08408e4d2541ac4796e505813e0d7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 113,
"avg_line_length": 27.82608695652174,
"alnum_prop": 0.6671875,
"repo_name": "h2oai/h2o-3",
"id": "3f62a27960639c2e920d5e9d5deade72d596973e",
"size": "640",
"binary":... |
from web import app
from flask import render_template
from flask_login import current_user
@app.route('/login')
def login():
return 'hello'
@app.route('/me')
def profile():
user = current_user
return render_template('user/profile.html', user=user)
| {
"content_hash": "95071cf2be36f9ba582160358619030e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 58,
"avg_line_length": 17.666666666666668,
"alnum_prop": 0.7018867924528301,
"repo_name": "alexraileanu/todo",
"id": "f8535a3b4b3517f132f0ec0dc9438e5d6263c406",
"size": "26... |
"""Script to pre-process classification data into tfrecords."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import csv
import os
from absl import app
from absl import flags
from absl import logging
import numpy as np
import tensorflow... | {
"content_hash": "e2cb5eb9d4dd4925ebb0a28735e96739",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 80,
"avg_line_length": 33.45146726862303,
"alnum_prop": 0.6224441595249343,
"repo_name": "tombstone/models",
"id": "9b34ffef7c7ed66a87b8386e1675e14c11b0791d",
"size": "155... |
import threading
import time
import math
from flask import jsonify
import datetime
import json
from data import speed_calc
from data import gear_calc
from data import gear_int_calc
from data import torque_calc
from data import engine_speed_calc
from data import fuel_consumed_calc
from data import odometer_calc
from da... | {
"content_hash": "0950f06f0f782673dc079285ed118623",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 80,
"avg_line_length": 32.64141414141414,
"alnum_prop": 0.6185981742224973,
"repo_name": "worldline-spain/openxc-vehicle-simulator",
"id": "7cd491e6aeee970cd7d1dffab9cbb7d8a... |
from .celery import app as celery_app
__all__ = ['celery_app']
| {
"content_hash": "fa4937c7d7e23e646a62404548abc765",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.65625,
"repo_name": "mongkok/defocus",
"id": "1a6c551dd5f9bd987f55763e0a142c3f71580f5f",
"size": "173",
"binary"... |
import uuid
from django.db import models
from games.managers import GameManger
class Game(models.Model):
objects = GameManger()
players = models.ManyToManyField('players.Player')
kingdom = models.JSONField(default=list)
trash_pile = models.JSONField(default=list)
game_hash = models.UUIDField()
... | {
"content_hash": "fe33b1e3e7d510ad3f90af4d5e9f85b4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 54,
"avg_line_length": 25.736842105263158,
"alnum_prop": 0.6912065439672802,
"repo_name": "jlward/dominion",
"id": "94a4424fed770ce7632b105b1a493ddeac6f0087",
"size": "489"... |
from rtmbot.core import Plugin
from chatterbot import ChatBot
from plugins.console import Command
# Sessions
SESS = {}
# Init ChatBots
BOTS = ['HAL 9000', 'Wall-E', 'Agent Smith']
TRAINER='chatterbot.trainers.ChatterBotCorpusTrainer'
BOT_DICT = {B: ChatBot(B, trainer=TRAINER) for B in BOTS}
# Train based on the ... | {
"content_hash": "084a74a836fe1fb1a056897170f5d9ba",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 88,
"avg_line_length": 29.647058823529413,
"alnum_prop": 0.5853174603174603,
"repo_name": "narunask/silly_chatbot",
"id": "83b47649b4ca6c3c455517a4806dc7837b48bc43",
"size"... |
import requests
from configparser import ConfigParser
_VTAPI = 'https://www.virustotal.com/vtapi/v2/'
def action(alert, fields, kwargs):
'''Perform a virus total lookup of a hash.
'''
config = ConfigParser()
config.read('/etc/err/virustotal.conf')
_VT_APIKEY = config.get('VirusTotal', 'apikey')
if _VT_APIKE... | {
"content_hash": "4e8a153befd182e4127a7a8f22eac02d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 86,
"avg_line_length": 19.155555555555555,
"alnum_prop": 0.6473317865429234,
"repo_name": "hosom/err-autoir",
"id": "941614b81d4b3257832a45723de097879bd575f4",
"size": "862... |
def license(age):
if age >= 16:
return True
else:
return False
#Makes triangle (w/ challenge)
def makes_triangle(one, two, three):
if one > two and one > three:
return two + three > one
if two > one and two > three:
return one + three > two
if three > o... | {
"content_hash": "0dbcfab27ca2df8021d61c93c2f8e3b9",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 88,
"avg_line_length": 21.822429906542055,
"alnum_prop": 0.5434689507494647,
"repo_name": "Nethermaker/school-projects",
"id": "04f05aa2bdecdfbcf9603fbd3ee08f32c79cd8a2",
... |
'''
Author: Hans Erik Heggem
Email: [email protected]
Project: Master's Thesis - Autonomous Inspection Of Wind Blades
Repository: Master's Thesis - CV (Computer Vision)
'''
import time
from Settings.Exceptions import PtGreyError
'''
@brief Pin control class.
Control a pin on the microcontroller
@par... | {
"content_hash": "6bd830ad6cc31c19d1f0a9e11954bffb",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 20.762820512820515,
"alnum_prop": 0.6637851188638468,
"repo_name": "hansehe/Wind-Blade-Inspection",
"id": "26456e23ffbf9e3aa29b4cf549e43356f7efb015",
... |
import argparse
import numpy as np
import os
from LigParGenTools import *
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog='Converter.py',
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""
SCRIPT TO CREATE CUSTOM SOLVENT BOXES FOR
OPENMM AND NAMD FR... | {
"content_hash": "b444d5d0dae6e9c2a3ac7d878fc0b006",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 33.325,
"alnum_prop": 0.6564141035258815,
"repo_name": "leelasd/LigParGenTools",
"id": "0db9c41e67c1c63f4f035baf3aa4bbb0e1b070fd",
"size": "1333",
... |
import testtools
from tempest.api.telemetry import base
from tempest import config
from tempest import test
CONF = config.CONF
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
_interface = 'json'
@classmethod
def resource_setup(cls):
if CONF.telemetry.too_slow_to_test:
... | {
"content_hash": "f74165158fae5abd954311a4235c3f67",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 77,
"avg_line_length": 32.25373134328358,
"alnum_prop": 0.6376677464136974,
"repo_name": "nikolay-fedotov/tempest",
"id": "42e2a2daa683dc4902eae8db6a9e817d6b8d8dea",
"size"... |
import os
import wx
import wx.calendar as wxcal
from fittopframe import FitTopFrame
class FitMainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, (250, 150))
self.start_date = ""
self.end_date = ""
self.setEpoc... | {
"content_hash": "13b8f4147673fd51a7ab44a99041b8e9",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 135,
"avg_line_length": 41.78632478632478,
"alnum_prop": 0.6076907343014931,
"repo_name": "karthikdevel/fit",
"id": "454ade21ba097c9511e1510e6a6cc55e1cb20119",
"size": "48... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0005_auto_20161027_1111'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "cd4a49f93c2e7e8b62351dec3751062e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 148,
"avg_line_length": 35.791666666666664,
"alnum_prop": 0.6309662398137369,
"repo_name": "katyaeka2710/python2017005",
"id": "2d603aa8c9f40bd92fa758ffc91608a50c1b5ad0",
"... |
from mako.template import Template
import uuid
from os.path import join, dirname
from collections import namedtuple
import requests
from owslib.wps import WebProcessingService
from pyramid.settings import asbool
from pyramid.events import NewRequest
from phoenix.db import mongodb
import logging
LOGGER = logging.ge... | {
"content_hash": "8f066a7aa1e9536fe530166393de406e",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 86,
"avg_line_length": 29.884955752212388,
"alnum_prop": 0.6665679597275689,
"repo_name": "bird-house/pyramid-phoenix",
"id": "9aed8a656e34c1e5e09f0dbe565b0050cf8f07b4",
"... |
import flask
from designate.openstack.common import log as logging
from designate.central import rpcapi as central_rpcapi
LOG = logging.getLogger(__name__)
central_api = central_rpcapi.CentralAPI()
blueprint = flask.Blueprint('quotas', __name__)
@blueprint.route('/quotas/<tenant_id>', methods=['GET'])
def get_quotas... | {
"content_hash": "0b1e9578a910252ca8c0f7f092688189",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 29.54054054054054,
"alnum_prop": 0.7136322049405307,
"repo_name": "richm/designate",
"id": "4860a4ca2998655bee656a95a420d27e260a94d3",
"size": "1742"... |
import gevent
import gevent.monkey
gevent.monkey.patch_all()
import os
import sys
import uuid
import logging
import coverage
import testtools
from testtools.matchers import Equals, MismatchError, Not, Contains
from testtools import content, content_type, ExpectedException
import keystoneclient.v2_0.client as keystone... | {
"content_hash": "59860eb27b05f92809cb2035c03556f3",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 102,
"avg_line_length": 40.023622047244096,
"alnum_prop": 0.6435176077119811,
"repo_name": "eonpatapon/contrail-controller",
"id": "7e66a8050a4d24fd5791382d8c9d973bedbffa87"... |
import os
VERSION = (0, 1, 1, 'alpha', 0)
def get_version():
version = '%d.%d.%d' % (VERSION[0], VERSION[1], VERSION[2])
return version
def get_logger(name='paloma'):
# - Python logging api
import logging
return logging.getLogger(name)
def report(msg='',exception=None,level='error',name='palo... | {
"content_hash": "01198a14c6cb7c81e93e98b8931e2c22",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 220,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6384493670886076,
"repo_name": "hdknr/paloma",
"id": "9f49ab614104d3b927d9648783b3fcf60b62d7c1",
"size": "1290",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0056_auto_20180614_0734'),
]
operations = [
migrations.AddField(
model_name='application',
name='published_timest... | {
"content_hash": "3480b136445cd4917d974fc8c88e5f29",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 22.555555555555557,
"alnum_prop": 0.6108374384236454,
"repo_name": "unicef/un-partner-portal",
"id": "bf17e0a2b2b85affd3e9fd77936b84f0b54292f6",
"siz... |
from modularodm import fields
from framework.mongo import (
ObjectId,
StoredObject,
utils as mongo_utils
)
from website.util import api_v2_url
@mongo_utils.unique_on(['text'])
class Subject(StoredObject):
_id = fields.StringField(primary=True, default=lambda: str(ObjectId()))
text = fields.String... | {
"content_hash": "5f2ccdde248f0d2860c5334140debf99",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.6862745098039216,
"repo_name": "emetsger/osf.io",
"id": "87ae382f06f6f69670a57c7f336845f1850cac77",
"size": "714"... |
from django.conf import settings
FIRSTCLASS_EMAIL_BACKEND = getattr(settings, 'FIRSTCLASS_EMAIL_BACKEND', 'django.core.mail.backends.smtp.EmailBackend')
FIRSTCLASS_MIDDLEWARE = getattr(settings, 'FIRSTCLASS_MIDDLEWARE', (
'firstclass.middleware.online.ViewOnlineMiddleware',
'firstclass.middleware.alternative.M... | {
"content_hash": "cdd613b2ab446c99bd4eeb064e31f739",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 119,
"avg_line_length": 50.75,
"alnum_prop": 0.8054187192118226,
"repo_name": "amccloud/django-firstclass",
"id": "78003e5bacb23700c746dc4a1db3c28b9a71491a",
"size": "406",
... |
"""
A script to create hyphenated redirects for n or m dash pages.
This script collects pages with n or m dash in their title and creates
a redirect from the corresponding hyphenated version. If the redirect
already exists, it is skipped.
Use -reversed option to create n dash redirects for hyphenated pages.
Some comm... | {
"content_hash": "e400de3bb24e92592e437736ceb43352",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 79,
"avg_line_length": 33.10344827586207,
"alnum_prop": 0.5930555555555556,
"repo_name": "hasteur/g13bot_tools_new",
"id": "70696e47d1dea964d35b435835bf3307ea0b5aa8",
"siz... |
"""pyNRC - Python ETC and Simulator for JWST NIRCam"""
# Import libraries
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from astropy.table import Table
from astropy.io import ascii
from webbpsf_ext.webbpsf_ext_core import NIRCam_ext
from .nrc_utils import *
from .detops import det_timing, mult... | {
"content_hash": "197741be33f17f2cdef0df2a69806c97",
"timestamp": "",
"source": "github",
"line_count": 3296,
"max_line_length": 134,
"avg_line_length": 40.37378640776699,
"alnum_prop": 0.5692331970662499,
"repo_name": "JarronL/pynrc",
"id": "600a5a64421f29589ecd5fd65cc5461e4275c349",
"size": "1330... |
import re
def search_equality(text):
""" Return the letter if that matches the pattern, else return None
"""
# pattern: [1 lower](3 uppers)[1 lower](3 uppers)[1 lower], e.g.: aBBDiLDMx
pattern = "[a-z][A-Z][A-Z][A-Z][a-z][A-Z][A-Z][A-Z][a-z]"
equality = re.search(pattern, text)
if equality:
... | {
"content_hash": "4e1f6d7df769557480b09bdb037d3238",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 31.413793103448278,
"alnum_prop": 0.6180021953896817,
"repo_name": "KellyChan/python-examples",
"id": "04fc5d0c00301ac25c640238e7bf17ed3a44aeb5",
"si... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding = 'utf-8') as f:
long_description = f.read()
setup(
name = 'money',
version = '0.0.1',
description = 'gestisce spese e ... | {
"content_hash": "11891b336f9bf5db41ceda523619b578",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 85,
"avg_line_length": 29.53846153846154,
"alnum_prop": 0.6276041666666666,
"repo_name": "scompo/money",
"id": "edf3f89a9671c85052fd5d16b6fdf76307130f08",
"size": "768",
... |
import unittest
from unittest import mock
from tethys_services.backends.hydroshare_playground import HydroSharePlaygroundOAuth2
class TestHydroSharePlayground(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
@mock.patch('tethys_services.backends.hydroshare_beta.HydroSha... | {
"content_hash": "87162372a08e3b5ecf115c0af1d5c4ab",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 98,
"avg_line_length": 43.55555555555556,
"alnum_prop": 0.7431972789115646,
"repo_name": "CI-WATER/tethys",
"id": "036d6d54d99e30c0254b0d513bd3e363467802cd",
"size": "1176"... |
'''Utilities'''
import pkg_resources
def example_audio_file():
"""Get the included example file"""
path = 'example_audio/amen.wav'
return pkg_resources.resource_filename(__name__, path)
def example_mono_audio_file():
"""Get the included example file"""
path = 'example_audio/amen-mono.wav'
r... | {
"content_hash": "35b028d332448ba392dcbbbd59c06cc0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 58,
"avg_line_length": 24.933333333333334,
"alnum_prop": 0.6764705882352942,
"repo_name": "algorithmic-music-exploration/amen",
"id": "c84a1a52f687914b7761fa4c1db530e21cc2864... |
"""Not-MNIST handler."""
import os
from dm_nevis.datasets_storage.handlers import extraction_utils as utils
from dm_nevis.datasets_storage.handlers import splits
from dm_nevis.datasets_storage.handlers import types
from tensorflow.io import gfile
_IGNORED_FILES_REGEX = '|'.join([
utils.DEFAULT_IGNORED_FILES_REG... | {
"content_hash": "d34a67c8d27df029287bf5a466832ac9",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 88,
"avg_line_length": 29.09090909090909,
"alnum_prop": 0.6683035714285714,
"repo_name": "deepmind/dm_nevis",
"id": "cd2730ab3c63b71359b2da3614d630f06a60de58",
"size": "283... |
import arbor
from arbor import mechanism as mech
from arbor import location as loc
import pandas, seaborn
import sys
# Load a cell morphology from an nml file.
# Example present here: morph.nml
if len(sys.argv) < 2:
print("No NeuroML file passed to the program")
sys.exit(0)
filename = sys.argv[1]
# Read the ... | {
"content_hash": "08aa32208182869f6dfbb5ccfadff420",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 126,
"avg_line_length": 35.58878504672897,
"alnum_prop": 0.7129726890756303,
"repo_name": "halfflat/arbor",
"id": "d4f573133f8f96e33c643c498c9cbd6f8b1a74f8",
"size": "3832... |
"""
Demo for DBNanoServer
"""
import requests
import json
import numpy as np
import datetime
import matplotlib.pyplot as plt
def main():
# Generate a sine and cosine wave
Fs = 800
f = 60
sample = 50
x = np.arange(sample)
y_sin = np.sin(2 * np.pi * f * x / Fs)
y_cos = np.cos(2 * np.pi *... | {
"content_hash": "707c9101152ab2b7ace10aedd6cff05d",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 104,
"avg_line_length": 26.782608695652176,
"alnum_prop": 0.6298701298701299,
"repo_name": "ksk5429/ShowerThoughtsProject",
"id": "d45ba9af32e6fcd9a98e145684d25e920714e738",
... |
from __future__ import annotations # isort:skip
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
from subprocess import run
from sys import executab... | {
"content_hash": "4a6476c706772b091e2dbb2881a069aa",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 37.25581395348837,
"alnum_prop": 0.5811485642946317,
"repo_name": "bokeh/bokeh",
"id": "4545619d046f03df82b033115f8c5075909d6529",
"size": "2122",
... |
import argparse
import json
import os
import signal
import sys
from time import sleep
import uuid
import alsa_sink
import spotifyconnect
from flask.testsuite import catch_stderr
from spotifyconnect.error import LibError
class Connect:
def __init__(self, web_arg_parser = None):
if web_arg_parser:... | {
"content_hash": "931a7dc5467f78b5725ba70b5506d3f7",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 240,
"avg_line_length": 42.47639484978541,
"alnum_prop": 0.637566939476609,
"repo_name": "chukysoria/spotify-connect-web",
"id": "e81223a902d985079f99a4418a05497e66da003f",
... |
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# --... | {
"content_hash": "f18e4258a8bdbfa3cf55b37caba05a81",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 32.27777777777778,
"alnum_prop": 0.7039586919104991,
"repo_name": "kefo/moto",
"id": "28a4b4e6bd1f0825b1c323fa28842c33aa236cbf",
"size": "9155",
"... |
import json
import click
from tabulate import tabulate
@click.command('groups', short_help='List user groups')
@click.pass_obj
def cli(obj):
"""List groups."""
client = obj['client']
if obj['output'] == 'json':
r = client.http.get('/groups')
click.echo(json.dumps(r['groups'], sort_keys=T... | {
"content_hash": "24e8cb200e5518eba628f633192ec497",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 119,
"avg_line_length": 31.88888888888889,
"alnum_prop": 0.6254355400696864,
"repo_name": "alerta/python-alerta",
"id": "61348e2955595d4a56e8804c4d20625ed6669c93",
"size": ... |
"""UI view definitions."""
import json
from datetime import timedelta
from logging import getLogger
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth import logout as auth_logout
from django.urls import reverse
from django.http import HttpResponse
from django... | {
"content_hash": "41f36edc80a78233c4244e30041f3d2a",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 119,
"avg_line_length": 38.27461139896373,
"alnum_prop": 0.6396372004873426,
"repo_name": "venicegeo/eventkit-cloud",
"id": "736c49b7067cf905a138628c6b044e7b0e359356",
"si... |
import numpy as np
def get_num_edges_meeting(neighbour_matrix, orig_vertex_id):
return np.sum(neighbour_matrix[orig_vertex_id,:,0] != -1)
def checkB1B2Reversal_opt(B1,quad_list,quad_index,vertex_index,regularPoints):
quadNumberLocal = np.where(B1[vertex_index,:,1] == quad_index)[0][0]
B1fromList = B1[v... | {
"content_hash": "871d32807202acf2c5ce96edce5584d5",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 110,
"avg_line_length": 42.490566037735846,
"alnum_prop": 0.683392539964476,
"repo_name": "BGCECSE2015/CADO",
"id": "9f9ed62b7afec838543e7762b928f7264943cf0b",
"size": "45... |
from __future__ import absolute_import
from celery.utils.serialization import pickle
from celery.tests.case import Case
class RegularException(Exception):
pass
class ArgOverrideException(Exception):
def __init__(self, message, status_code=10):
self.status_code = status_code
Exception.__ini... | {
"content_hash": "9ca8c83d870bc548d21b9fe1f5ac670a",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 76,
"avg_line_length": 30.823529411764707,
"alnum_prop": 0.6418575063613231,
"repo_name": "sunze/py_flask",
"id": "6b65bb3c55f3ea4cddd741dbd467a068bce5df55",
"size": "1572"... |
"""\
=====================================
Timing the speed of primes algorithms
=====================================
"""
from __future__ import division
import sys
from itertools import islice
# Conditionally hack the PYTHONPATH.
if __name__ == '__main__':
import os
path = os.path.dirname(__file__)
... | {
"content_hash": "b5fcda01e82f836de902cfc56aa3db6f",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 78,
"avg_line_length": 22.260663507109005,
"alnum_prop": 0.5673834362358953,
"repo_name": "uzumaxy/pyprimes",
"id": "921797e1106c1cc1de15d3673e4c12275b8512b5",
"size": "48... |
"""Common utility functions."""
import base64
import datetime
import hashlib
import json
import os
import random
import re
import string
import StringIO
import time
import unicodedata
import urllib
import urlparse
import zipfile
import yaml
import feconf # pylint: disable=relative-import
class InvalidInputExcepti... | {
"content_hash": "cd1855be9471ea598e5dca7db86900ff",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 79,
"avg_line_length": 32.79445727482679,
"alnum_prop": 0.6216197183098592,
"repo_name": "kennho/oppia",
"id": "027e7f3481d23a47de98871e85fbc97433c5d230",
"size": "14805",... |
"""
This script fixes links that contain common spelling mistakes.
This is only possible on wikis that have a template for these misspellings.
Command line options:
-always:XY instead of asking the user what to do, always perform the same
action. For example, XY can be "r0", "u" or "2". Be careful... | {
"content_hash": "a9e95ed2dd12c0dc7d2eec7068a64603",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 96,
"avg_line_length": 37.23529411764706,
"alnum_prop": 0.6146775815022261,
"repo_name": "trishnaguha/pywikibot-core",
"id": "05dc7b0f5f34ef7614f552e07243f8d3a2455917",
"s... |
import threading
import unittest
import socket
import os
import shutil
import time
import re
import tempfile
import ftplib
import random
import warnings
import sys
import errno
import asyncore
import atexit
import stat
try:
import cStringIO as StringIO
except ImportError:
import StringIO
try:
import ssl
exc... | {
"content_hash": "696f1b1acae5e158d70334630dbb005c",
"timestamp": "",
"source": "github",
"line_count": 3159,
"max_line_length": 90,
"avg_line_length": 37.74770496992719,
"alnum_prop": 0.5802339720743008,
"repo_name": "leighpauls/k2cro4",
"id": "1ec6db6cad83319c90acdc0dc670d84c51ece99b",
"size": "1... |
import unittest
from siapy import Sia
class SiaTest(unittest.TestCase):
def test_get_version(self):
sia = Sia()
self.assertEqual(sia.get_version(), '1.0.4')
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "7bfe570fb5ed704006a3192f09efc9f8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 22.6,
"alnum_prop": 0.6194690265486725,
"repo_name": "lolsteve/siapy",
"id": "4b854834c5db25f9237998269151233369ec9d54",
"size": "226",
"binary": f... |
"""Agent action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import utils
class CreateAgent(show.ShowOne):
"""Create agent command"""
log = logging.getLogger(__name__ + ".CreateAgent")
def get_parser... | {
"content_hash": "9c89462e8ab921a11644861b7a5c7033",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 65,
"avg_line_length": 28.536912751677853,
"alnum_prop": 0.5402163687676388,
"repo_name": "derekchiang/python-openstackclient",
"id": "c8fb6ccc0dd5afc9a18b8218f04c18407df5e2... |
"""UI Functions"""
import ctypes
import logging
import platform
from enum import Enum
from pathlib import Path
import qdarkstyle
from PyQt5 import QtCore, QtGui, QtWidgets
from config import configurations
from config.constants import ICON_FILE
logger = logging.getLogger(__name__)
def set_window_icon(widget: QtWid... | {
"content_hash": "d64cbc8a2f6db0db50501b1c2bdd59b9",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 89,
"avg_line_length": 27.51219512195122,
"alnum_prop": 0.6496010638297872,
"repo_name": "hueyyeng/AssetsBrowser",
"id": "8fa0c15894665b30002e1d86168a0548b79dd5ec",
"size"... |
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 field 'Competition.payment_option'
db.add_column('competition_competition', 'payment_option',
self.gf... | {
"content_hash": "d45f8c4854cf1015eec89fc6dda3c455",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 227,
"avg_line_length": 74.77380952380952,
"alnum_prop": 0.5570768985830282,
"repo_name": "michaelwisely/django-competition",
"id": "0db7df94aadfd5bae153680bc36a80ad30d459ab... |
import argparse
import logging
import math
import os
import random
from pathlib import Path
from typing import Optional
import numpy as np
import torch
import torch.utils.checkpoint
from torch.utils.data import Dataset
import jax
import jax.numpy as jnp
import optax
import PIL
import transformers
from diffusers impor... | {
"content_hash": "3dbbf6a7981c42529714895d197a9035",
"timestamp": "",
"source": "github",
"line_count": 650,
"max_line_length": 119,
"avg_line_length": 37.74153846153846,
"alnum_prop": 0.6191504973096363,
"repo_name": "huggingface/diffusers",
"id": "6406be8ad698fb2c9684c6dcbeed67dd865b323c",
"size"... |
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ... | {
"content_hash": "8f3bbb1271d26db1e472fce39005607f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 76,
"avg_line_length": 24.903225806451612,
"alnum_prop": 0.6152849740932642,
"repo_name": "Stranger6667/MaxMindAPI",
"id": "93440b3fce3fb58bd03f207f9b3dc56c46cdf018",
"size... |
import csv
import json
import re
CRS_RE = re.compile(r'[A-Z]{3}')
class Station(dict):
def __init__(self, code, name) -> None:
self['stationCode'] = code
self['stationName'] = name
def __hash__(self) -> int:
return hash((self['stationCode'], self['stationName']))
def __eq__(self... | {
"content_hash": "2d4e31fd31d4ec7cb4d61bd5932cb426",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 145,
"avg_line_length": 33.24324324324324,
"alnum_prop": 0.5585365853658537,
"repo_name": "danielthepope/trntxt",
"id": "cd7feab66ab04c789ab9a17a098021b7d7e01161",
"size": ... |
from abc import ABCMeta, abstractmethod
class IUnikernelBackend(object):
"""
Interface that must be implemented by every Unikernel Backend. It contains method stubs used by the REST API
provider and other components.
Redefinition of functions decorated with @asbstractmethod is compulsory.
"""
... | {
"content_hash": "c1bda0119d5a062d6562dd1a9ef73a62",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 112,
"avg_line_length": 21.416666666666668,
"alnum_prop": 0.5437743190661478,
"repo_name": "onyb/dune",
"id": "ece4bbff8ac330f5ba1d17797e4d8b7f641b317e",
"size": "2056",
... |
import collections
import json
import os
import stat
import warnings
import click
import six
from requests.auth import HTTPBasicAuth
from requests.exceptions import RequestException
from tower_cli import __version__, exceptions as exc
from tower_cli.api import client
from tower_cli.conf import with_global_options, P... | {
"content_hash": "9b22a4aa938918abe9f9d42a4fcf525a",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 117,
"avg_line_length": 39.56265984654731,
"alnum_prop": 0.625185855582132,
"repo_name": "AlanCoding/tower-cli",
"id": "cb96aad231df62804c2fb0e197def57d7c9c5cc4",
"size": ... |
"""
Tests for the orographic-enhancement CLI
"""
import pytest
from improver.constants import LOOSE_TOLERANCE
from . import acceptance as acc
pytestmark = [pytest.mark.acc, acc.skip_if_kgo_missing]
OE = "orographic_enhancement_high_resolution"
CLI = acc.cli_name_with_dashes(__file__)
run_cli = acc.run_cli(CLI)
@p... | {
"content_hash": "73ef37eaec244627d83e05da4fa1021c",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 74,
"avg_line_length": 25.844961240310077,
"alnum_prop": 0.5581883623275345,
"repo_name": "fionaRust/improver",
"id": "afa0adc2b942cd7e13d32c63fb8189d2f3909c5b",
"size": "... |
import csv,sys,os
import numpy as np
from networkx import Graph
sys.path.append(os.path.join("..","tests","data"))
## a basic class to handle distance matrices used to describe pairwise relationships between
# genes in a gene set.
class DistanceMatrix:
## Constructor. Makes an object reprensentation of a distanc... | {
"content_hash": "08dedff2f4f66e4ca44616967f40a9ce",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 93,
"avg_line_length": 33.95744680851064,
"alnum_prop": 0.5673558897243107,
"repo_name": "ksiomelo/cubix",
"id": "516bda72b27d5ad321df30bc6638c30e8ace7c74",
"size": "3192",... |
"""Handles all requests relating to compute resources (e.g. guest VMs,
networking and storage of VMs, and compute hosts on which they run)."""
import base64
import copy
import functools
import re
import string
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import j... | {
"content_hash": "85f0ef9a18feacea2d6ee49d5f6e3698",
"timestamp": "",
"source": "github",
"line_count": 4186,
"max_line_length": 79,
"avg_line_length": 44.338509316770185,
"alnum_prop": 0.5761499129853827,
"repo_name": "j-carpentier/nova",
"id": "c74920ba78632c95075deaad2282d222609427ac",
"size": "... |
from django.db import models
def esCUITValida(cuit):
cuit = str(cuit)
cuit = cuit.replace("-", "")
cuit = cuit.replace(" ", "")
cuit = cuit.replace(".", "")
if len(cuit) != 11:
return False
if not cuit.isdigit():
return False
base = [5, 4, 3, 2, 7, 6, 5, ... | {
"content_hash": "313255c2a0fc912684933781e1be5c5f",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 26.61111111111111,
"alnum_prop": 0.5391440501043842,
"repo_name": "yo-alan/horarios",
"id": "d428d7ab4026e18fd5cfac680a843d72d4c10901",
"size": "1944... |
"""Div. Utilities."""
from __future__ import absolute_import, unicode_literals, print_function
from .encoding import default_encode
import sys
def emergency_dump_state(state, open_file=open, dump=None, stderr=None):
"""Dump message state to stdout or file."""
from pprint import pformat
from tempfile imp... | {
"content_hash": "f04be9c075bda86bbb33dc55c2433c3b",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 28.794117647058822,
"alnum_prop": 0.5965270684371808,
"repo_name": "mdworks2016/work_development",
"id": "db52048c8bb92e9884c0dd12d61b7171be0266a1",
... |
'''
Home of the code which knows how to actually *draw* a graph which
has been layed out.
'''
class GraphRenderer:
'''
Only a "renderer" knows how big each node will end up based on metadata
in the graph which is specific to the renderer.
All renderers should be able to set the (x,y) "size" tuple
... | {
"content_hash": "02acd54c840642edddea26843dac1e5d",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 84,
"avg_line_length": 30.085714285714285,
"alnum_prop": 0.5826210826210826,
"repo_name": "HackerTool/vivisect",
"id": "2c4ef7cb850e544bff691fd3b6d724e4baacf46e",
"size": "... |
from __future__ import absolute_import
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the use... | {
"content_hash": "8491e087258fe1aed20df098a1f21186",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 82,
"avg_line_length": 40.65289256198347,
"alnum_prop": 0.6195364911567391,
"repo_name": "pogaku9/aws-datalake-quickstart-looker-isv-integration",
"id": "a166e8da478f2fe1c3d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.