text stringlengths 4 1.02M | meta dict |
|---|---|
import sys, numpy
import util.AOMLinterpolation as interp_helper
import util.AOMLnetcdf as read_netcdf
def test(p, parameters):
qc = numpy.zeros(p.n_levels(), dtype=bool)
# check for gaps in data
isTemperature = (p.t().mask==False)
isDepth = (p.z().mask==False)
isData = isTemperature & isDepth
... | {
"content_hash": "3b3770ef688b931ece68b0f1120237bc",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 193,
"avg_line_length": 40.5875,
"alnum_prop": 0.7182014166923314,
"repo_name": "s-good/AutoQC",
"id": "e72aa77c89e96e76455e206ccd6af165d63e8fcc",
"size": "3397",
"binary... |
import optparse
import os, sys
from biokbase.probabilistic_annotation.DataProcessor import *
usage="%prog [options] -f filedir organismid"
description="""Main driver to run probabilistic annotation.
First generates a list of Query-independent (i.e. same for all queries)
data from the KBase ER model. This includes lis... | {
"content_hash": "b9025279cd5054c6e6a4ed1467bc993c",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 144,
"avg_line_length": 46.86764705882353,
"alnum_prop": 0.7587072481957954,
"repo_name": "kbase/probabilistic_annotation",
"id": "e48c82d95dc33c79bfe160fd12070d9d97c28d8c",
... |
"""
This module provides several specific functions to save figures nicely. `fancy` means latex
interpreter and generates *.eps and *.pdf
"""
import numpy as np
import matplotlib
def get_colors():
return ['k', 'orange', 'skyblue', 'lightgrey', "royalblue", 'r', "#a65628", "#f781bf", "#4daf4a"]
#return ['k', 'orang... | {
"content_hash": "56115acc8721429df6d761688baf3e9b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 98,
"avg_line_length": 34.04225352112676,
"alnum_prop": 0.6681836988001655,
"repo_name": "kuntzer/binfind",
"id": "a6bb27d77c79bd4598e617e92b1fbf778ace1312",
"size": "2417"... |
class Solution:
def maximum69Number (self, num: int) -> int:
# Replace first 6 with 9 if exists
return(str(num).replace('6', '9', 1))
| {
"content_hash": "dac5b1aaac346cba151e3722d1d131e3",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 48,
"avg_line_length": 38.5,
"alnum_prop": 0.5974025974025974,
"repo_name": "qiyuangong/leetcode",
"id": "8caccebd87be206df06935954a32eead47328585",
"size": "154",
"binary... |
"""
kombu.pidbox
===============
Generic process mailbox.
"""
from __future__ import absolute_import
import socket
import warnings
from collections import defaultdict, deque
from copy import copy
from itertools import count
from threading import local
from time import time
from . import Exchange, Queue, Consumer, ... | {
"content_hash": "29f8c9d0966c03a2cd03f639900ef16f",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 78,
"avg_line_length": 34.924418604651166,
"alnum_prop": 0.5700016647244881,
"repo_name": "romank0/kombu",
"id": "a619ce28a749b34a42e911892b6ebd9d760f6367",
"size": "12014... |
from __future__ import absolute_import, division, print_function
import argparse
from transformers import BertTokenizer, XLMTokenizer, XLMRobertaTokenizer
import os
from collections import defaultdict
import csv
import random
import os
import shutil
import json
TOKENIZERS = {
'bert': BertTokenizer,
'xlm': XLMTok... | {
"content_hash": "5c60c0f066573791820f083d4a7dbad2",
"timestamp": "",
"source": "github",
"line_count": 548,
"max_line_length": 173,
"avg_line_length": 38.45255474452555,
"alnum_prop": 0.5668659832953683,
"repo_name": "google-research/xtreme",
"id": "1ef79a48f7ecb7bccc0672f4322bab3e8e4708c3",
"size... |
import requests
import json
import re
import sys, getopt
DEBUG = False
def get_json_data_from_request(subreddit, custom_headers, limit):
url = "http://www.reddit.com/r/" + subreddit + ".json?limit=" + `limit`
r = requests.get(url, headers=custom_headers)
if r.status_code!=200:
raise StandardError("Error wh... | {
"content_hash": "1928eb430e604461f86449265071abfa",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 288,
"avg_line_length": 28.470588235294116,
"alnum_prop": 0.6167355371900827,
"repo_name": "rboyboy/reddit-youtube-playlist",
"id": "0c04c265f6bb1ed5aaf33750e497643f7b260089... |
from sahara.plugins import utils as plugin_utils
from sahara.service.edp.spark import engine as shell_engine
class ShellEngine(shell_engine.SparkShellJobEngine):
def __init__(self, cluster):
super(ShellEngine, self).__init__(cluster)
self.master = plugin_utils.get_instance(cluster, "master")
... | {
"content_hash": "861559253a2b6f928fc8eb6b4a98f481",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 36.69230769230769,
"alnum_prop": 0.70020964360587,
"repo_name": "tellesnobrega/sahara",
"id": "77484271ad1a8daa00ab8f3ec5ead929e452dd27",
"size": "10... |
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.... | {
"content_hash": "3979ca8a139c137b11bc1a79a89cd853",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 87,
"avg_line_length": 33.86666666666667,
"alnum_prop": 0.6653543307086615,
"repo_name": "dbarchowsky/django-jinja2-gtm",
"id": "a2f8c0e5932fed4a26d9ac21473203a8be8cf5a4",
... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class Config(AppConfig):
name = 'apps.poll'
verbose_name = _(u'Poll')
| {
"content_hash": "e2eec64f7c18361b080211e77fc3de9f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 55,
"avg_line_length": 24.285714285714285,
"alnum_prop": 0.7235294117647059,
"repo_name": "dotKom/studlan",
"id": "4ce19c7b060d10d55da7d602bb3a4f77893dc48e",
"size": "195",
... |
import sys, os
sys.path.insert(0, os.path.abspath('..'))
import math
import logging
import spotipy
import spotipy.util
from spotipy.oauth2 import SpotifyClientCredentials
class SpotifyPlayer(object):
"""
Class for interacting with spotify. Relies on spotipy. Gets a token for a partiuclar
... | {
"content_hash": "c1270878e42519aed21f225a466fe75e",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 126,
"avg_line_length": 39.85470085470085,
"alnum_prop": 0.6013296161269569,
"repo_name": "jcgknudson/spotify-lib",
"id": "89bd32233e7ca65a6fd5c25a9b72322338cefd44",
"size... |
"""transformer (attention seq-seq model) with mixtures of experts.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports
from six.moves import xrange # pylint: disable=redefined-builtin
from DLT2T.layers import common_attention
from D... | {
"content_hash": "336f06de3369032551c9bfc221a91622",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 76,
"avg_line_length": 37.39906103286385,
"alnum_prop": 0.6351995982927442,
"repo_name": "renqianluo/DLT2T",
"id": "fb90df2f3dfbf97f15fb43b5f0023bf8a6ef1593",
"size": "856... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import mock
import pytest
from tornado import gen
from tchannel import (
TChannel, Request, Response,
thrift_request_builder, schemes,
)
from tchannel.response i... | {
"content_hash": "755cfa40be2fd521e302528475f148b7",
"timestamp": "",
"source": "github",
"line_count": 1165,
"max_line_length": 75,
"avg_line_length": 20.885836909871244,
"alnum_prop": 0.6091566661186915,
"repo_name": "Willyham/tchannel-python",
"id": "51225f5a3ea7990e07a5457b4b32aaa6d5faf493",
"s... |
"""Basic CRUD operations for the server.
===============================
Imports :
sqlalchemy.orm.with_polymorphic : Load columns for inheriting classes.
Ref : http://docs.sqlalchemy.org/en/latest/orm/query.html
sqlalchemy.exists : A convenience method that turns a query into an EXISTS subquery
... | {
"content_hash": "4cece668a7049f8256d77ffa579211ac",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 141,
"avg_line_length": 35.00162601626016,
"alnum_prop": 0.6611074979095047,
"repo_name": "HTTP-APIs/hydrus",
"id": "b8902cabb3fcec83a2b13e01fa313c4cdac2fea2",
"size": "21... |
import json
import logging
import socket
import time
from telemetry.core.backends.chrome import websocket
class DispatchNotificationsUntilDoneTimeoutException(Exception):
"""Exception that can be thrown from DispatchNotificationsUntilDone to
indicate timeout exception of the function.
"""
def __init__(self,... | {
"content_hash": "ec66b96efa3c87d5308a5bf8a172a91c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 80,
"avg_line_length": 31.685185185185187,
"alnum_prop": 0.6858562244301578,
"repo_name": "ondra-novak/chromium.src",
"id": "00c18a49646ac776d7cf000e2b159d76d98be74f",
"si... |
from __future__ import unicode_literals
import shutil
import pytest
from django.conf import settings
from django.core import management
from faker import Faker
from haystack.query import SearchQuerySet
from machina.apps.forum_search.forms import SearchForm
from machina.core.db.models import get_model
from machina.co... | {
"content_hash": "b7ea0751e445eaa27920859ad87e489e",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 90,
"avg_line_length": 34.05194805194805,
"alnum_prop": 0.5894991100940757,
"repo_name": "franga2000/django-machina",
"id": "ef96c93e483e1c94145e8cae385dce26a92c6b0b",
"si... |
import sys, os, time, atexit
from signal import SIGTERM
import errno
def pid_exists(pid):
"""Check whether pid exists in the current process table.
UNIX only.
"""
if(pid < 0):
return False
if(pid == 0):
# According to "man 2 kill" PID 0 refers to every process
# in the proce... | {
"content_hash": "9df32870386816ea99eb67149204b612",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 110,
"avg_line_length": 29.656050955414013,
"alnum_prop": 0.5148195876288659,
"repo_name": "sflis/plms",
"id": "e1bb5abc1a3a4d8b7f43110b1d5ed4e511e60ff9",
"size": "4679",
... |
def final_floor(input_string):
return input_string.count("(") - input_string.count(")")
if __name__=="__main__":
input_string = open("input.txt").read()
print final_floor(input_string)
| {
"content_hash": "86d921fb501873a8b900ff899193cc25",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 60,
"avg_line_length": 18.818181818181817,
"alnum_prop": 0.6038647342995169,
"repo_name": "mnestis/advent2015",
"id": "881836fcd2558df125098e66b0a69456cd1148e2",
"size": "2... |
pass
| {
"content_hash": "bf55909ad163b58236e44b86e8441b26",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 4,
"avg_line_length": 5,
"alnum_prop": 0.8,
"repo_name": "michaelhidalgo/7WCSQ",
"id": "5ea298dc1955b38dfcdfef6e989feea9a6ce709b",
"size": "319",
"binary": false,
"copie... |
""" Uploads a Cloud Function from the local source to a GS bucket. """
import zipfile
import hashlib
import base64
import uuid
from io import BytesIO
from copy import deepcopy
GS_SCHEMA_LENGTH = 5
def extract_source_files(imports, local_upload_path):
""" Returns tuples of the imported sources files. """
imp... | {
"content_hash": "8985dcbb7598937d7cea312c254fcc17",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 118,
"avg_line_length": 37.38194444444444,
"alnum_prop": 0.5036225153260264,
"repo_name": "GoogleCloudPlatform/serverless-log-trigger-demo",
"id": "6d0a76ad398e2fb5bf85f300b... |
"""
Reads csv file of streamed bid and ask prices, then ingests into
zipline data.bundle
- Set BID_ASK_STREAM_CSV_FOLDER=path, where path contains the csv data as seen
in _minute_iter docstring
"""
import os
import re
import zipfile
import pandas as pd
import numpy as np
from ..utils import resample
from zipline.utils.... | {
"content_hash": "0306e108b014b8609593c628f9ba7d3b",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 115,
"avg_line_length": 38.45161290322581,
"alnum_prop": 0.5687919463087249,
"repo_name": "bernoullio/toolbox",
"id": "aa05f50e48f848f6cafd5fb3bce14853bfda06d6",
"size": "... |
from msrest.serialization import Model
class ApplicationGatewaySku(Model):
"""SKU of an application gateway.
:param name: Name of an application gateway SKU. Possible values include:
'Standard_Small', 'Standard_Medium', 'Standard_Large', 'WAF_Medium',
'WAF_Large'
:type name: str or
~azure.... | {
"content_hash": "9a560fa88cb86df2378d4635e4407fe7",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 86,
"avg_line_length": 36.2,
"alnum_prop": 0.6344383057090239,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "a569cbf9ef5d9a181c09a4bd4566dac791677aa1",
"size": "1560"... |
import numpy as np
from pyspark.mllib.clustering import KMeans
import matplotlib.pyplot as plt
gpa_data = sc.textFile("../data/student.txt")
gpa_data.cache()
gpa_data.take(5)
# <codecell>
data = gpa_data.map(lambda row: row.split("\t")).map(lambda row: np.array([row[1], row[2]]))
data.take(5)
# <codecell>
model = ... | {
"content_hash": "d244deb4c8557401fef592a1e612ca66",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 92,
"avg_line_length": 17.833333333333332,
"alnum_prop": 0.677570093457944,
"repo_name": "anantasty/spark-examples",
"id": "52fa2093e8121fca994768eab02400ea13d35aa4",
"size... |
import soothsayer.urls
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^soothsayer/', include(soothsayer.urls)),
url(r'^admin/', include(admin.site.urls)),
)
| {
"content_hash": "8f4b69a90ebf8020002faac47a1489a3",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 51,
"avg_line_length": 22.083333333333332,
"alnum_prop": 0.7169811320754716,
"repo_name": "shawnhermans/soothsayer",
"id": "10d3d1ff0f7cc746f6e5236ea0dce6df23e9dd6e",
"size... |
"""
dyn_pages/user_upgrade.py
Author: Josh Williams
Date Added: Fri Mar 2 14:22:51 CST 2007
Give us yo money.
"""
## STD LIBS
## OUR LIBS
from zoto_base_page import zoto_base_page
## 3RD PARTY LIBS
class user_upgrade(zoto_base_page):
local_js_includes = [
"select_box.lib.js",
"subscribe.lib.js",
"states.... | {
"content_hash": "a79079aab87cf9b4e7c54ee7ada0141d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 45,
"avg_line_length": 15.517241379310345,
"alnum_prop": 0.6755555555555556,
"repo_name": "kordless/zoto-server",
"id": "c7894bc41ed86c8d3a3b18e9ecf32df192f73fe9",
"size": ... |
import random
from queue_3_12 import Queue
class Printer:
def __init__(self, page_pre_minute):
self.page_rate = page_pre_minute
self.current_task = None
self.remain_task = 0
def printing(self):
"""TODO: Docstring for print.
:returns: TODO
remain_time 剩余时间 单位 秒... | {
"content_hash": "48e5487f99afb23df5c6becf75f4fd5b",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 99,
"avg_line_length": 26.839506172839506,
"alnum_prop": 0.5827966881324746,
"repo_name": "sharkspeed/dororis",
"id": "d7a84bd53b3d9981621b503dd6bb9d15782a3d7e",
"size": "2... |
from test_framework import HivemindTestFramework
from hivemindrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
class EstimateFeeTest(HivemindTestFramework):
def setup_network(self):
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir,
... | {
"content_hash": "bb4d8572375ea9c3ccdc10834168e7c3",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 114,
"avg_line_length": 48.93975903614458,
"alnum_prop": 0.5829640571147218,
"repo_name": "brishtiteveja/truthcoin-cpp",
"id": "e5524e5ca7bd5bcec294fef3c30045055a4748e0",
"... |
"""
data_plot.py
SuperClass module for the YProfile and Table Classes
It contains numerous plot function for the YProfile and Table Classes
If one in the future wants their class to inherit this superclasses methods
this is what is required:
A. Place 'from data_table import *' at the top of the module
B. If the class... | {
"content_hash": "327abfeb4d192144db397339eb823dd1",
"timestamp": "",
"source": "github",
"line_count": 2866,
"max_line_length": 458,
"avg_line_length": 33.78855547801815,
"alnum_prop": 0.5857101551044012,
"repo_name": "mrawls/mesa-tools",
"id": "92f0744dc4b22b81efc3ea02f910e8438101ed7c",
"size": "... |
"""
Tests for Glance Registry's client.
This tests are temporary and will be removed once
the registry's driver tests will be added.
"""
import copy
import datetime
import os
import mox
from glance.common import config
from glance.common import exception
from glance import context
from glance.db.sqlalchemy import a... | {
"content_hash": "7fd2f46e1c720361fbbf92f52a75bcf7",
"timestamp": "",
"source": "github",
"line_count": 578,
"max_line_length": 79,
"avg_line_length": 37.24567474048443,
"alnum_prop": 0.5736714975845411,
"repo_name": "cloudbau/glance",
"id": "fd8fe827ffa59a850fbcdaf90d91dea1b0f0f4b7",
"size": "2220... |
import os.path
import subprocess
def get_usable_rtmpdump(cmd):
try:
p = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return cmd
except:
return None
RTMPDUMP = get_usable_rtmpdump('rtmpdump')
def has_rtmpdump_installed():
... | {
"content_hash": "436b8ed666d4809dbf58e0ce9895f782",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 83,
"avg_line_length": 26.32075471698113,
"alnum_prop": 0.6129032258064516,
"repo_name": "lcplj123/video-dl",
"id": "a395700413b91e3a2f73d3be1ef28ead14b0e095",
"size": "141... |
from optparse import OptionParser
def main():
#Gather input and output file paths
parser = OptionParser()
parser.add_option("-i", "--input", dest="i",
help="Input fasta file to be filtered for chimeras.",
metavar="INPUT")
parser.add_option("-n", "--non-chimeras", dest="nc",
help... | {
"content_hash": "0e2560d97ed2c765c5b339711cc493e9",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 31.98,
"alnum_prop": 0.6385240775484677,
"repo_name": "sjspence/epicPCR",
"id": "f9d28dfc96d73be29605c8d0501a461627c54299",
"size": "1827",
"binary... |
import os
from lib.base_plugin import BasePlugin
class FaerieSolitairePlugin(BasePlugin):
Name = "Faerie Solitaire"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Saves', os.environ['APPDATA'], 'Faerie Solitaire')
def restore(self, _):
_.restore_folder('Saves', os.enviro... | {
"content_hash": "a4994e87cb0cf0d79feb5c55160d3887",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 28.055555555555557,
"alnum_prop": 0.6356435643564357,
"repo_name": "Pr0Ger/SGSB",
"id": "f974fb841aa6a030630e6f31117f97e01a2eca13",
"size": "505",
... |
"""
An application for managing IPython profiles.
To be invoked as the `ipython profile` subcommand.
Authors:
* Min RK
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under ... | {
"content_hash": "b6ce6c9289dc0786878a69e2eec1c7fd",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 95,
"avg_line_length": 34.26198083067093,
"alnum_prop": 0.6010816859380828,
"repo_name": "lancezlin/ml_template_py",
"id": "b8e5fd26ac3fd343dd91305db51e5041dcae134c",
"siz... |
from django.test import TestCase
from django.http import QueryDict
# FILEBROWSER IMPORTS
from filebrowser.templatetags.fb_tags import get_file_extensions
class TemplateTagsTests(TestCase):
def test_get_file_extensions(self):
self.assertEqual(get_file_extensions(''),
['.pdf', '.doc', '.rtf', '... | {
"content_hash": "e34e6a2d659840dda22e8944e97bf17a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 86,
"avg_line_length": 40.35294117647059,
"alnum_prop": 0.5408163265306123,
"repo_name": "cbingos/cpro",
"id": "0db4a841958d8af939d03523d1b5818c6acce483",
"size": "720",
... |
"""Test for SQL component Init."""
from homeassistant import config_entries
from homeassistant.core import HomeAssistant
from . import init_integration
async def test_setup_entry(hass: HomeAssistant) -> None:
"""Test setup entry."""
config_entry = await init_integration(hass)
assert config_entry.state ==... | {
"content_hash": "ca1bca6fde1fa08ed5e284eb5d7f169b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 36.23809523809524,
"alnum_prop": 0.7516425755584757,
"repo_name": "w1ll1am23/home-assistant",
"id": "5c3f237ac498cf9775d10f0877a0c4cd69dfa6df",
"size... |
"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <gabriel.becedillas@gmail.com>
"""
from engine.stratanalyzer import returns
from engine import warninghelpers
from engine import broker
import datetime
class PositionState(object):
def onEnter(self, position):
pass
# Raise an exception if an orde... | {
"content_hash": "64d3c4a2b1f3cf20e06dcd1379a286e0",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 200,
"avg_line_length": 43.92948717948718,
"alnum_prop": 0.6735249768957634,
"repo_name": "Yam-cn/potato",
"id": "91ff6f0f407fdfb511caa14b5ad8b152e0db13bf",
"size": "21173... |
"""
An HTTP service for serving pages for tests, with
a configurable delay that can be passed as a
query parameter in a GET request.
"""
import os
from time import sleep
from urllib.parse import urlparse, parse_qs
from http.server import HTTPServer, SimpleHTTPRequestHandler
class DelayedRequestHandler(SimpleHTTPRequ... | {
"content_hash": "538fe50187616102aa0a3a01bc2e75a2",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 30.37704918032787,
"alnum_prop": 0.6475984889368591,
"repo_name": "edx/bok-choy",
"id": "930f67138c8f5f1b2d64f5dd7aed35d56cd6f53e",
"size": "1853",
... |
"""A libusb1-based fastboot implementation."""
import binascii
import collections
import logging
import os
import struct
from . import usb_exceptions
from openhtf.util import argv
import six
FASTBOOT_DOWNLOAD_CHUNK_SIZE_KB = 1024
ARG_PARSER = argv.ModuleParser()
ARG_PARSER.add_argument(
'--fastboot_download_ch... | {
"content_hash": "5ec28ee505a2a05bc150afd534de4721",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 86,
"avg_line_length": 35.06832298136646,
"alnum_prop": 0.6680835990081474,
"repo_name": "jettisonjoe/openhtf",
"id": "b2d958678ac13e8e6f0974886e3e696b0fb0a10e",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/dna/shared_dna_template_bol.iff"
result.attribute_template_id = -1
result.stfName("craft_dna_components_n","dna_template_bol")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
retur... | {
"content_hash": "905b29cc925eb09bd8c8a647243010a3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 25.23076923076923,
"alnum_prop": 0.7042682926829268,
"repo_name": "anhstudios/swganh",
"id": "97bc8b1fe1458a4bdf84a0c3b7004d4b7c137ae7",
"size": "473... |
__author__ = 'lsamaha'
import random
class Words(object):
def __init__(self, path='samples'):
self.path = path
self.nouns = self.load_words('nouns')
self.verbs = self.load_words('verbs')
self.adjectives = self.load_words('adjectives')
self.adverbs = self.load_words('adverb... | {
"content_hash": "932f51fcf2021e993b4862650b37d576",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 55,
"avg_line_length": 25.083333333333332,
"alnum_prop": 0.5592469545957918,
"repo_name": "lsamaha/dervisher",
"id": "a0a33523e246b3ed12a3e9ebbff8bf850952f99b",
"size": "90... |
from ccxt.async.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
class bter (Exchange):
def describe(self):
return self.deep_extend(super(bter, self).describe(), {
'id': 'bter',
'name': 'Bter',
'countries': ['VG', 'CN'], # Britis... | {
"content_hash": "8d3ddbe3a95867eef9ef078ce41341a3",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 126,
"avg_line_length": 37.59851301115241,
"alnum_prop": 0.48566343682024915,
"repo_name": "tritoanst/ccxt",
"id": "fd6fb60f0682d927f0373ba9935778dc2067150b",
"size": "101... |
"""The Minecraft Server sensor platform."""
import logging
from typing import Any, Dict
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TIME_MILLISECONDS
from homeassistant.helpers.typing import HomeAssistantType
from . import MinecraftServer, MinecraftServerEntity
from .const im... | {
"content_hash": "11079aa4c8872ba53a2473947eee9037",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 88,
"avg_line_length": 30.649717514124294,
"alnum_prop": 0.6431336405529954,
"repo_name": "titilambert/home-assistant",
"id": "20f9e98e5303c12cbdd28a22d823dc64e19cba98",
"... |
import argparse
import boto3
import datetime
import json, yaml
import logging
import os
import socket
import ssl
import sys
import urllib.request
# Logging: from https://docs.python.org/3/howto/logging-cookbook.html
# Lambda has read-only filesystem. So only create the filehandler when running locally (down in __main_... | {
"content_hash": "8a1fcbe627480d2f75e1724ee46bec86",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 129,
"avg_line_length": 36.39010989010989,
"alnum_prop": 0.6282651366450249,
"repo_name": "joehack3r/aws",
"id": "a8be76208e745a5ed8890618369d58b41a4f4cd0",
"size": "6647"... |
from google.cloud import redis_v1beta1
async def sample_list_instances():
# Create a client
client = redis_v1beta1.CloudRedisAsyncClient()
# Initialize request argument(s)
request = redis_v1beta1.ListInstancesRequest(
parent="parent_value",
)
# Make the request
page_result = clie... | {
"content_hash": "739220b1313722205f6ea328f833b638",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 62,
"avg_line_length": 25.45,
"alnum_prop": 0.7092337917485265,
"repo_name": "googleapis/python-redis",
"id": "5a766a26fc095ff90cf63fedeabf885ee69f93fe",
"size": "1893",
... |
from calvinextras.calvinsys.io.pwm import BasePWM
import pigpio
class PIGPIOPWM(BasePWM.BasePWM):
"""
Calvinsys object handling PWM for a pin using the pigpio package (& daemon)
"""
def init(self, pin,frequency, dutycycle, **kwargs):
self._pin = pin
self._dutycycle = dutycycle
s... | {
"content_hash": "5df8834011e56b39cdc50393480ed74a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 87,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.624468085106383,
"repo_name": "EricssonResearch/calvin-base",
"id": "6f922cd0eb4796571f8d8e475ffa31d2ce422807",
"... |
import datetime
import webob.exc
from nova.api.openstack import extensions
from nova import compute
import nova.conf
from nova import context as nova_context
from nova.i18n import _
from nova import utils
CONF = nova.conf.CONF
authorize = extensions.extension_authorizer('compute',
'instan... | {
"content_hash": "5e8de304517b71d1835de9481f23c931",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 79,
"avg_line_length": 41.4344262295082,
"alnum_prop": 0.5432245301681503,
"repo_name": "bigswitch/nova",
"id": "3918c711689610d70df620fbe68fbad5a65012a2",
"size": "5692",... |
try:
import json
except ImportError:
import simplejson as json
import logging
import time
import unittest
from nose.tools import assert_true, assert_false, assert_equal
from desktop.lib.django_test_util import make_logged_in_client
from desktop.lib.test_utils import grant_access
from jobsub.models import Oozi... | {
"content_hash": "925be825918317cf41af39e7fd13c1ab",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 147,
"avg_line_length": 43.71270718232044,
"alnum_prop": 0.6803589484327603,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "1f099d1b28e4ce5f0a71f9809d700c3904b1b99b"... |
from django import forms
from django.forms import ValidationError
from django.utils.translation import ugettext as _
# Import the device choice enums from the models package
from .models import *
class SnmpEditDeviceForm(forms.Form):
name = forms.CharField(
label=_('Name'),
required=True,
... | {
"content_hash": "671fcc7ecbb0b4e450da83e04782d757",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 98,
"avg_line_length": 24.208955223880597,
"alnum_prop": 0.5702836004932182,
"repo_name": "MikaelSchultz/dofiloop-sentinel",
"id": "25abc0f08dd76ffa18a707aa4e1d3454fb1b5b10",... |
"""Subsample reads from a pair of fastq or fastq.gz files using reformat.sh
Usage:
subsample_fastq.py (--sample=<N>) IN1 IN2 OUT1 OUT2
subsample_fastq.py (-h --help)
Inputs:
IN1, IN2 Input fastq(.gz) files
OUT1, OUT2 Output subsampled files
Options:
-h --help Show this screen
-n --sample=... | {
"content_hash": "bf4ab8962f5c17008988e890569846f1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 24.725,
"alnum_prop": 0.5854398382204247,
"repo_name": "fennerm/fmbiopy",
"id": "677072e81e37ec56921cd71fb7d9aadeef917873",
"size": "1011",
"binary... |
# coding: utf-8
from sqlalchemy.testing import eq_
from sqlalchemy import *
from sqlalchemy import types as sqltypes, exc, schema
from sqlalchemy.sql import table, column
from sqlalchemy.testing import fixtures, AssertsExecutionResults, AssertsCompiledSQL
from sqlalchemy import testing
from sqlalchemy.util import u, ... | {
"content_hash": "2c564adeaa2bb80210b4f3cd42b3cae7",
"timestamp": "",
"source": "github",
"line_count": 1875,
"max_line_length": 89,
"avg_line_length": 38.616,
"alnum_prop": 0.5185139147848905,
"repo_name": "michaelBenin/sqlalchemy",
"id": "758ae089db4c9830858c8dbe76be17bf11f93c2c",
"size": "72430"... |
'''
Node object representing each node in the binary tree
'''
class Node:
left = None
right = None
val = None
def __init__(self, value, left, right):
self.val = value
self.left = left
self.right = right
# BFS algortithm to traverse the tree and print the nodes at the given level
def bfs(root, level):
l = 1... | {
"content_hash": "69b801c9c8ba036f56111fcd41e05c88",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 122,
"avg_line_length": 20.9,
"alnum_prop": 0.6181818181818182,
"repo_name": "viveksubbarao/algorithms",
"id": "01a163fe943e89d3c01f621d1ad12c4fdbc65c06",
"size": "1045",
... |
"""
Build ag and run tests.
Run as: ./scripts/runtests.py (because I'm lazy and it's easier to
hard-code such things).
It'll use a temporary directory ../ag_tests during tests.
To make it easy and compact to write additional tests:
- test descriptions are in files in tests directory
- a single file describes multipl... | {
"content_hash": "6c4f4db0c3b974cd3efd6af6e6f3fe9e",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 107,
"avg_line_length": 26.076190476190476,
"alnum_prop": 0.6741234477720964,
"repo_name": "leeonix/the_silver_searcher",
"id": "db75c027324be57cff55f6d6b8a15a4be4e8efd7",
... |
__author__ = "Phil Hendren"
__copyright__ = "Copyright 2014, Mind Candy"
__credits__ = ["Phil Hendren"]
__license__ = "MIT"
__version__ = "1.0"
from app import db
import json
import cPickle
from app.models.schema import Dashboard, Graph, Users
def get_all_dashboards():
return Dashboard.query.all()
de... | {
"content_hash": "ffc467c662960ec753aae678475b2f99",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 78,
"avg_line_length": 21.454545454545453,
"alnum_prop": 0.652542372881356,
"repo_name": "mindcandy/graphite-boards",
"id": "5b81c6dc1455c7494b9d1b77854a269d86de202d",
"siz... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/intangible/pet/shared_falumpaset_hue.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "771d1775435e02d5c45aeca96386d160",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 68,
"avg_line_length": 21.692307692307693,
"alnum_prop": 0.6808510638297872,
"repo_name": "obi-two/Rebelion",
"id": "2b4f1f0b80343d4da502f14fb8745ea1f05f149b",
"size": "427... |
from setuptools import setup, find_packages
from setuptools.command.develop import develop
import glob
import os
class DownloadPolyglotData(develop):
def run(self):
os.system('polyglot download embeddings2.no ner2.no')
os.system('polyglot download embeddings2.en ner2.en')
data_files = []
... | {
"content_hash": "eda891bc6d1884e7fa9b202e93428ed4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 84,
"avg_line_length": 25.973684210526315,
"alnum_prop": 0.6433637284701115,
"repo_name": "pcbje/gransk",
"id": "f997059f28f885375f79fbc3525efbb60f5aca5f",
"size": "1010",
... |
import sys
sys.path.append('../')
import unittest
from suds.sax.date import Timezone as Tz
from suds.xsd.sxbuiltin import *
from unittest import TestCase
from tests import *
setup_logging()
class Date(XDate):
def __init__(self):
pass
class Time(XTime):
def __init__(self):
pass
class DateTime(... | {
"content_hash": "13f4a0acbe46e2e51e36cfde77d9182e",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 88,
"avg_line_length": 32.32645403377111,
"alnum_prop": 0.5174114915844458,
"repo_name": "TinajaLabs/tinajagate",
"id": "ca6c2e6ca8621ae883c6785d69abb392179c4783",
"size":... |
def cell_array_slicer(data):
""" Iterate over cell components on a vtk cell array
VTK stores the associated point index for each cell in a one
dimensional array based on the following template::
[n, id0, id1, id2, ..., idn, m, id0, ...]
The iterator takes a cell array and returns the point indi... | {
"content_hash": "cb0c8aea8355a3a90aaec3ce03ef92fb",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 69,
"avg_line_length": 26.956521739130434,
"alnum_prop": 0.5564516129032258,
"repo_name": "simphony/simphony-mayavi",
"id": "09518f34b46610f58c437af88e362efe018a3448",
"siz... |
class Solution:
def numRescueBoats(self, people: List[int], limit: int) -> int:
people.sort()
low = total = 0
high = len(people) - 1
while low <= high:
total += 1
if people[low] + people[high] <= limit:
low += 1
high -= 1
re... | {
"content_hash": "c130f81b4e16f4aad9c52cd245d7ed8f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 67,
"avg_line_length": 30.09090909090909,
"alnum_prop": 0.46827794561933533,
"repo_name": "jiadaizhao/LeetCode",
"id": "c05a548502e169c07a32edaa4563e973714e1fbd",
"size": "... |
import subprocess
import sys
from numba.tests.support import TestCase
import unittest
class TestNumbaImport(TestCase):
"""
Test behaviour of importing Numba.
"""
def test_laziness(self):
"""
Importing top-level numba features should not import too many modules.
"""
# ... | {
"content_hash": "94134298133850515090383ee388e359",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 84,
"avg_line_length": 32.1,
"alnum_prop": 0.5526479750778817,
"repo_name": "sklam/numba",
"id": "2d8fff741e75f2eb19bdadd97e2fc8e3fc6de3ae",
"size": "1605",
"binary": fal... |
"""Auto-generated file, do not edit by hand. 808 metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_808 = PhoneMetadata(id='001', country_code=808, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='\\d{8}', possible_length=(8,)),
s... | {
"content_hash": "3de6e9fcbe125f5cf0a99ea7d5081a51",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 115,
"avg_line_length": 67.875,
"alnum_prop": 0.7200736648250461,
"repo_name": "samdowd/drumm-farm",
"id": "a60a2a439c68fb04e60f9acd996d4498facb8fa2",
"size": "543",
"bina... |
from __future__ import unicode_literals
from django.db import models, migrations
import sorl.thumbnail.fields
from django.conf import settings
import cambiaahora.utils
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... | {
"content_hash": "de94f2c19e12da16e78b1136be2adcb5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 156,
"avg_line_length": 43.2,
"alnum_prop": 0.6044973544973545,
"repo_name": "shiminasai/plataforma_fadcanic",
"id": "d9c0394af60aaaafca6ce075a2728da491802c08",
"size": "15... |
import collections.abc
import difflib
import io
import mmap
import platform
from typing import BinaryIO, Callable, Collection, Sequence, TypeVar, Union
import numpy as np
import torch
from torchvision._utils import sequence_to_str
__all__ = [
"add_suggestion",
"fromfile",
"ReadOnlyTensorBuffer",
]
def ... | {
"content_hash": "2ae03eedb842fd3ed31be20d3b7cf6c5",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 119,
"avg_line_length": 41.70634920634921,
"alnum_prop": 0.6390104662226451,
"repo_name": "pytorch/vision",
"id": "3dee4b59a7aa8d1046504d8320728bb31a04942c",
"size": "5255... |
from java.sql import Connection
from com.ziclix.python.sql import zxJDBC
from datetime import datetime
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.bac... | {
"content_hash": "9ddb18d36109ef2af9ec686087400094",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 97,
"avg_line_length": 31.589830508474577,
"alnum_prop": 0.6538255177594162,
"repo_name": "beachmachine/django-jython",
"id": "f66cb987d5f1635ee39f968e03aa898086921ccc",
"... |
""" Preprocessing script for the PANACEA corpus. """
import sys, os, re, argparse, codecs, unicodedata
from xml.dom.minidom import parseString
from unidecode import unidecode
import treetaggerwrapper as ttw
def replace_oelig(string):
""" Replace oe ligatures (which are not present in Latin-1). """
string = re.... | {
"content_hash": "6d6f71f2b4cc27a23828a551d138eb94",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 90,
"avg_line_length": 35.59911894273128,
"alnum_prop": 0.5851998515035268,
"repo_name": "gbcolborne/exp_phd",
"id": "8a55d9731323ff522712b37921b9b8e3dc9fee9c",
"size": "8... |
from .score_cache import ScoreCache
class Empty(ScoreCache):
def lookup(self, *args, **kwargs):
raise KeyError()
def store(self, *args, **kwargs):
return None
| {
"content_hash": "ba861a5f849f4935898a0ffb20f4d0a4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 18.7,
"alnum_prop": 0.6310160427807486,
"repo_name": "aetilley/ores",
"id": "875a73b9e15be9c060246a868712c6b4fa08d518",
"size": "187",
"binary": fa... |
import base64
import gzip
import hashlib
import io
import logging
import zlib
from metrics import Metric
from telemetry.page import page_test
# All network metrics are Chrome only for now.
from telemetry.core.backends.chrome_inspector import inspector_network
from telemetry.value import scalar
class NetworkMetricExc... | {
"content_hash": "fb18043c7108889868c58aaee4a3c6d0",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 80,
"avg_line_length": 31.668316831683168,
"alnum_prop": 0.65655776145068,
"repo_name": "hefen1/chromium",
"id": "9c41dcce37d83164f4e227a54418ff52e1ed40a6",
"size": "6560"... |
#!/usr/bin/python3 -i
#
# Copyright (c) 2013-2016 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | {
"content_hash": "38b2cb30590e2d36ed8bf4d5b55924f6",
"timestamp": "",
"source": "github",
"line_count": 3661,
"max_line_length": 300,
"avg_line_length": 47.16962578530456,
"alnum_prop": 0.5809899935143148,
"repo_name": "Radamanthe/VulkanSamples",
"id": "0b97305eb733247be9f04b4d0e61b39c0c0c7850",
"s... |
"""Tests related to assigning workers to specific compute units"""
from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl import python_app
import pytest
import os
local_config = Config(
execut... | {
"content_hash": "86f767f358cc6e29165635667461d239",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 107,
"avg_line_length": 30.375,
"alnum_prop": 0.649519890260631,
"repo_name": "Parsl/parsl",
"id": "b5e412aea7142b99a2fca8b7961db4f82c53214b",
"size": "1458",
"binary": f... |
import _plotly_utils.basevalidators
class TickfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickfont", parent_name="contour.colorbar", **kwargs
):
super(TickfontValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "76d1bdab87ee057cf7c4daf18e284028",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 78,
"avg_line_length": 39.61538461538461,
"alnum_prop": 0.5411003236245955,
"repo_name": "plotly/python-api",
"id": "db2b1bacc648d52306550c18b963d94fe9d995a0",
"size": "154... |
import os
import imp
import argparse
import tabulate
i = imp.find_module(u"mallet", [u".."])
imp.load_module(u"mallet", *i)
import mallet.class_dump as class_dump
_whitespace = u"\u200b"
def normalize_type(type_32bit, type_64bit):
if type_32bit is None:
type_32bit = type_64bit
elif type_64bit is No... | {
"content_hash": "1df81c13813147ef5cba7aaa44ffe830",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 153,
"avg_line_length": 37.62043795620438,
"alnum_prop": 0.6125339542103221,
"repo_name": "bartoszj/Mallet",
"id": "d9602a49e179497b79f8c11425cf1a7974f8ec66",
"size": "631... |
import clr
clr.AddReference("ZeroMQ") # installed in build folder via NuGet.
import ZeroMQ
# make an object to force static class initializations
ZeroMQ.ZFrame()
#from IronPython.Runtime.Types import DynamicHelpers
#_libzmq = DynamicHelpers.GetPythonTypeFromType(ZeroMQ.lib.zmq)
zmq_version_info = ZeroMQ.lib.... | {
"content_hash": "b7b995e23098ce0c944b53519699a07f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 65,
"avg_line_length": 22.645833333333332,
"alnum_prop": 0.6669733210671573,
"repo_name": "swn1/pyzmq",
"id": "c57e47e54fbf95fe483213a2e89a4972c57eb056",
"size": "1087",
... |
import dbus, gobject, subprocess, glib
from dbus.mainloop.glib import DBusGMainLoop
def send_notifier(dbus, message):
if message.get_member() == "Notify":
subprocess.check_call(['/home/maschmann/git/libnotifyCapture/test'])
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_match_string_n... | {
"content_hash": "1c0ba0bd593c68c0e916a8285b5408ab",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.7592997811816192,
"repo_name": "maschmann/libnotifyListener",
"id": "f3319e2a6495aced5865e308de28e6790eac920d",
"... |
from pylab import *
import scipy.interpolate
import sklearn.metrics
#Our libraries
import pathutils
pathutils.add_relative_to_current_source_file_path_to_sys_path("../..")
from coord_system import *
from flashlight.splineutils import *
from flashlight.curveutils import *
from flashlight.quadrotorcamera3d import *
fr... | {
"content_hash": "50132ee905dfc02780fe39c4465f3c08",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 490,
"avg_line_length": 46.52232142857143,
"alnum_prop": 0.659629594088859,
"repo_name": "stanford-gfx/Horus",
"id": "12640924dabe2e8d9b06bd6c24486b93ea3b1322",
"size": "1... |
from __future__ import print_function
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
import mock
import os
os.environ["NUM_BUDGET_YEARS"] = '2'
from ...taxbrain.models import TaxSaveInputs
from ...taxbrain.models import convert_to_floats
from ...taxbrain.hel... | {
"content_hash": "be428e9288e7a71414047d5e1a55c43e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 102,
"avg_line_length": 42.79012345679013,
"alnum_prop": 0.586266589728794,
"repo_name": "zrisher/webapp-public",
"id": "c481f8d08b6d97faae8c95abd5a935d50c9cb4bc",
"size":... |
import os
import frappe
class DbManager:
def __init__(self, db):
"""
Pass root_conn here for access to all databases.
"""
if db:
self.db = db
def get_current_host(self):
return self.db.sql("select user()")[0][0].split('@')[1]
def create_user(self, user, password, host=None):
# Create user if it d... | {
"content_hash": "96f3195602e1a7248df62d8a0f62e83e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 84,
"avg_line_length": 23.5,
"alnum_prop": 0.6320116054158608,
"repo_name": "RicardoJohann/frappe",
"id": "0954657b28d1888559116ee8e39ff821b13af315",
"size": "2068",
"bin... |
from fiber_properties import polynomial_fit, polynomial_array, FiberImage, crop_image, plot_overlaid_cross_sections
import numpy as np
import matplotlib.pyplot as plt
# image = np.meshgrid(np.arange(100), np.arange(100))
# coeffs = np.random.rand(10) * 10.0
# print coeffs
# image = polynomial_array(image, *coef... | {
"content_hash": "9d7639af5683e9aa4f70479b0abdcc7b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 115,
"avg_line_length": 33.25925925925926,
"alnum_prop": 0.7182628062360802,
"repo_name": "rpetersburg/fiber_properties",
"id": "4e61e7fa0f656ebd8747e67d7a980c4df06d237f",
... |
import json
from dateutil import parser
from datetime import datetime
from utils.date import get_year, get_month, get_weeknumber, get_weekday
def extract_month(utc_timestamp):
"""
Extracts month from utc timestamp string.
"""
datetime = parser.parse(utc_timestamp)
return '{0}-{1}'.format(dat... | {
"content_hash": "e3b64213ab5c42ff6ac432ce40b8dc35",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 113,
"avg_line_length": 34.479674796747965,
"alnum_prop": 0.6286253242159868,
"repo_name": "Djacket/djacket",
"id": "4048f06562f31ee2b9f2afc8a47d3f3f0ce0ffde",
"size": "42... |
from flask import _app_ctx_stack
from sqlalchemy import engine, orm
from sqlalchemy.orm.exc import UnmappedClassError
class _QueryProperty:
def __init__(self, sa):
self.sa = sa
def __get__(self, obj, type):
try:
mapper = orm.class_mapper(type)
if mapper:
... | {
"content_hash": "d280c241a1b4ca74d11b1903f0fd0b06",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 29.063492063492063,
"alnum_prop": 0.6324412889131622,
"repo_name": "EclecticIQ/OpenTAXII",
"id": "a534862cc2eb3cc524b68f910855ca2df5e19922",
"size": ... |
__author__ = "Vivek Dhayaal"
__copyright__ = "Copyright 2014, Reliance Jio Infocomm Ltd."
from django import shortcuts
from django.core.urlresolvers import reverse
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard.openstack.common import timeutils
... | {
"content_hash": "1c98879fb6f5f7578ffafcb0f634addb",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 143,
"avg_line_length": 42.95238095238095,
"alnum_prop": 0.6341463414634146,
"repo_name": "JioCloud/horizon",
"id": "e5f8007b3f593a4995a0b0e4c35ac4e41d9df3d4",
"size": "275... |
import uuid
import base64
import time
from boto.compat import json
from boto.cloudfront.identity import OriginAccessIdentity
from boto.cloudfront.object import Object, StreamingObject
from boto.cloudfront.signers import ActiveTrustedSigners, TrustedSigners
from boto.cloudfront.logging import LoggingInfo
from boto.cloud... | {
"content_hash": "466946ce8d1bdfc67e0528f33eae0915",
"timestamp": "",
"source": "github",
"line_count": 726,
"max_line_length": 137,
"avg_line_length": 41.09228650137741,
"alnum_prop": 0.56112358797305,
"repo_name": "jameslegg/boto",
"id": "fb8309f266467d307ba145996841dbf2d2a79b70",
"size": "30937"... |
"""
.. module: security_monkey.watcher
:platform: Unix
:synopsis: Slurps the current config from AWS and compares it to what has previously
been recorded in the database to find any changes.
.. version:: $$VERSION$$
.. moduleauthor:: Patrick Kelley <pkelley@netflix.com> @monkeysecurity
"""
from common.ut... | {
"content_hash": "374e75372b1900fe1384746046b785ed",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 172,
"avg_line_length": 41.22008547008547,
"alnum_prop": 0.5879425638898969,
"repo_name": "airbnb/security_monkey",
"id": "a8e5688c8fb3453c4178afa40fb906780387749c",
"size... |
from flask import request
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as JWT
from app.haulers.models import Haulers, HaulersSchema, db
from config import SECRET_KEY, GH_VD_SECRE... | {
"content_hash": "c5cfbe189d7705a344f8d068be7d931e",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 181,
"avg_line_length": 44.08730158730159,
"alnum_prop": 0.5449144914491449,
"repo_name": "konstantinKim/vd-backend",
"id": "deb6f3912b330d096222e50c5c5ab90daf648061",
"si... |
import sys
import argparse
from PyQt4 import QtGui
from PyQt4 import QtCore
app = QtGui.QApplication(sys.argv)
class ScreenShot(QtGui.QWidget):
def __init__(self):
super(ScreenShot, self).__init__()
self.outPath = None
screen_rect = app.desktop().screenGeometry()
width, height = sc... | {
"content_hash": "c542d4aa4ae5af79a3f500166926a269",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 111,
"avg_line_length": 35.12903225806452,
"alnum_prop": 0.6437098255280074,
"repo_name": "cgarjun/utilities",
"id": "0b55e3df771e24e1ea84f9c8578a0a036e66ee42",
"size": "21... |
from django.apps import AppConfig
class TextCkeditorConfig(AppConfig):
name = 'djangocms_text_ckeditor'
verbose_name = 'django CMS Text CKEditor'
| {
"content_hash": "b1ed64c51167d6a392048bf14f2f2168",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 45,
"avg_line_length": 26,
"alnum_prop": 0.7564102564102564,
"repo_name": "yakky/djangocms-text-ckeditor",
"id": "aa44b17507b75d6d45db01e82f70ec5ebc32daff",
"size": "180",
... |
from google.cloud import binaryauthorization_v1
def sample_create_attestor():
# Create a client
client = binaryauthorization_v1.BinauthzManagementServiceV1Client()
# Initialize request argument(s)
attestor = binaryauthorization_v1.Attestor()
attestor.user_owned_grafeas_note.note_reference = "note... | {
"content_hash": "39c34002a45c25f56ee1bfd015db71ab",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 88,
"avg_line_length": 30.12,
"alnum_prop": 0.7330677290836654,
"repo_name": "googleapis/python-binary-authorization",
"id": "e51ea8d06cd61d2688e655321b6c72845d9a48c5",
"si... |
class Student:
def __init__(self, name):
self.name = tuple(name.split())[::-1]
myStudentList = []
def addStudent(name):
myStudentList.append(Student(name))
def removeStudent(name):
for student in myStudentList:
if tuple(student.name) == tuple(name.split())[::-1]:
myStudentLis... | {
"content_hash": "3891530c0d8ec75afa977a9ad6e2ad69",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 60,
"avg_line_length": 24.5,
"alnum_prop": 0.5846938775510204,
"repo_name": "pranavsb/Python-SIG-2015",
"id": "07df948d2651fe6587bd07d5a9bcd39b262d5c75",
"size": "1394",
... |
from base_classes import *
from config import *
from dadict import *
from data import *
from error import *
from themes import *
from arch import *
from plist import *
from fields import *
from packet import *
from asn1fields import *
from asn1packet import *
from utils import *
from route import *
if conf.ipv6_enabl... | {
"content_hash": "aab684ad02f3d35e2116b78d55dec708",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 26,
"avg_line_length": 17.5,
"alnum_prop": 0.7473684210526316,
"repo_name": "RiskSense-Ops/CVE-2016-6366",
"id": "fd64c33ba60ff96ce5b394d95755dc6ed92ab78d",
"size": "865",
... |
"""The IPython HTML Notebook"""
# check for tornado 2.1.0
msg = "The IPython Notebook requires tornado >= 2.1.0"
try:
import tornado
except ImportError:
raise ImportError(msg)
try:
version_info = tornado.version_info
except AttributeError:
raise ImportError(msg + ", but you have < 1.1.0")
if version_in... | {
"content_hash": "6171c8fb0d1522b91d6675b493ae8cc5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 27.35,
"alnum_prop": 0.70018281535649,
"repo_name": "sodafree/backend",
"id": "bfa5317531ca44c41d5af84be1a01cec330c3382",
"size": "547",
"binary": ... |
import random
import requests
import shutil
import logging
import os
import traceback
import ujson
from typing import List, Dict, Any, Optional, Set, Callable, Iterable, Tuple, TypeVar
from django.forms.models import model_to_dict
from zerver.models import Realm, RealmEmoji, Subscription, Recipient, \
Attachment,... | {
"content_hash": "d2d9171b66a5390c3cf4182d696000e1",
"timestamp": "",
"source": "github",
"line_count": 601,
"max_line_length": 97,
"avg_line_length": 36.42595673876872,
"alnum_prop": 0.5992143248675316,
"repo_name": "dhcrzf/zulip",
"id": "d45a1277fa68898d9e5485d11167b29bd11f6a27",
"size": "21892",... |
"""
This module contains the definition of the `Device` class, used to represent a
physical storage device connected to the system.
Once initialized, class members contain all relevant information about the
device, including its model, serial number, firmware version, and all SMART
attribute data.
Methods are provided... | {
"content_hash": "4f51d9b7d035ca8539064c8bbcaba01d",
"timestamp": "",
"source": "github",
"line_count": 607,
"max_line_length": 80,
"avg_line_length": 48.047775947281714,
"alnum_prop": 0.5020058289045088,
"repo_name": "raysguy/HTPC-Manager",
"id": "060b71930b1eb7e8668edefcef161d797dcec473",
"size":... |
"""Utilities and helper functions."""
import calendar
import datetime
import decimal
from ceilometer.openstack.common import timeutils
def recursive_keypairs(d, separator=':'):
"""Generator that produces sequence of keypairs for nested dictionaries.
"""
for name, value in sorted(d.iteritems()):
... | {
"content_hash": "f7658c2da2863eeaf9e170de14e82ca9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 33.9080459770115,
"alnum_prop": 0.6247457627118644,
"repo_name": "rackerlabs/instrumented-ceilometer",
"id": "31abb43560c015f05049fc1be973636bfe05f43f"... |
from setuptools import setup
setup(
name='Pyganim',
version=__import__('pyganim').__version__,
url='http://inventwithpython.com/pyganim',
author='Al Sweigart',
author_email='al@inventwithpython.com',
description=('A sprite animation module for Pygame.'),
license='BSD',
packages=['pygan... | {
"content_hash": "6d6822036c957f34407b535ef1eaf0cc",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 58,
"avg_line_length": 34.483870967741936,
"alnum_prop": 0.6005612722170253,
"repo_name": "asweigart/pyganim",
"id": "9fe8736d9e661e7543c907350a7ff8a3f7ef3acc",
"size": "10... |
from tools import BaseTool
class MyTool(BaseTool):
def __init__(self):
BaseTool.__init__(self, "Hello")
def run(self, browser):
print "ok"
| {
"content_hash": "4a419d2b87e69af84489d3124c7f439d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 34,
"avg_line_length": 15,
"alnum_prop": 0.6533333333333333,
"repo_name": "Gr1ph00n/staticwebanalyzer",
"id": "98e5d167a4f88867dd7525bd20126d3239d9cf69",
"size": "302",
"... |
from sqlalchemy.ext.associationproxy import association_proxy
from octoprint_dashboard.app import db
class User(db.Model):
"""
Instance of this class equals single record of config in database
Class behaves like repository of Config records
User represents human being, logged into app at least once
... | {
"content_hash": "bfa3f4cdd40e1aecbe5930a3bb66f94f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 119,
"avg_line_length": 34.97385620915033,
"alnum_prop": 0.5954027284619697,
"repo_name": "meadowfrey/OctoPrint-Dashboard",
"id": "ac674119de64fa86b8153dff1de4cd2ebb69e0f0",... |
import re
import json
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from robobrowser import RoboBrowser
import requests
import dateutil.parser
from pivoteer.models import ExternalSessions
from core.utilities import discover_type
import lxml.html
from bs4 import BeautifulSoup
... | {
"content_hash": "2d58549e767a95eae1d7f1f7199c90c5",
"timestamp": "",
"source": "github",
"line_count": 608,
"max_line_length": 194,
"avg_line_length": 34.05427631578947,
"alnum_prop": 0.5365853658536586,
"repo_name": "LindaTNguyen/RAPID",
"id": "0519bc0705cb7747d279a37c38c072516c25bfb8",
"size": "... |
import unittest
from mock import patch
import gevent
import gevent.queue
from steam.core.cm import CMClient
class CMClient_Scenarios(unittest.TestCase):
test_channel_key = b'SESSION KEY LOL'
def setUp(self):
# mock out crypto
patcher = patch('steam.core.crypto.generate_session_key')
s... | {
"content_hash": "980bf76ce6345bf34d70e64057016a03",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 621,
"avg_line_length": 38.707142857142856,
"alnum_prop": 0.6401550101494741,
"repo_name": "ValvePython/steam",
"id": "b2c8413f65643cf629ad928629dbc0f3bdf4760d",
"size": "... |
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest import test
CONF = config.CONF
class VolumesTestJSON(base.BaseV2ComputeTest):
"""
This test creates a number of 1G volumes. To run successfully,
ens... | {
"content_hash": "3090b6283846f5e2e328cdf6b119a39f",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 45.42948717948718,
"alnum_prop": 0.5738676449837731,
"repo_name": "xbezdick/tempest",
"id": "f0ed141d7a592e9ec4676868b3615a5119f37188",
"size": "772... |
"""Define MySQL permissions.
This module implements a domain-specific language (in Python) for defining MySQL
permissions.
A permissions file can use this framework by running::
SetAllowedFields(['ssl_cipher', 'x509_issuer', 'x509_subject'])
user = Account(username='droid', password_hash='*ABD2189031289051',
... | {
"content_hash": "f06abe5f4c169cfb9d3de8f513d0b1a4",
"timestamp": "",
"source": "github",
"line_count": 1081,
"max_line_length": 80,
"avg_line_length": 32.723404255319146,
"alnum_prop": 0.6590150958330978,
"repo_name": "vincentor/google-mysql-tools",
"id": "2ee041f6c187d45ed062b68a16fc37974399ea1f",
... |
from __future__ import print_function, division
import argparse
import time
import string
import random
import jinja2
import numpy as np
import pyopencl as cl
import subprocess
import os
from os.path import join
from gpuexperiments.callkernel import call_cl_kernel
from gpuexperiments.timecheck import inittime, timechec... | {
"content_hash": "772f67a174ee30570c4c6fba0aaf3b55",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 112,
"avg_line_length": 31.287037037037038,
"alnum_prop": 0.5984018940514946,
"repo_name": "hughperkins/gpu-experiments",
"id": "fde65edefe8fa5eef526d8ccfd237aca58ceff7d",
... |
import pymel.core as pymel
from omtk.core.classCtrl import BaseCtrl
from omtk.core import classCtrlModel
from omtk.modules import rigFaceAvar
from omtk.modules import rigFaceAvarGrps
from omtk.libs import libRigging
class AvarEye(rigFaceAvar.AvarSimple):
"""
Deprecated, defined for backward compatibility (so ... | {
"content_hash": "93d10e23330310590ccbb70f8ee7e078",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 119,
"avg_line_length": 38.17883211678832,
"alnum_prop": 0.6095975528152184,
"repo_name": "SqueezeStudioAnimation/omtk",
"id": "1f8b496d3b3a819176545bd60e1e8056170f345d",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.