text stringlengths 4 1.02M | meta dict |
|---|---|
__author__ = 'Krishna Mudragada'
import logging,time
class EuclidGCD:
def __init__(self):
logging.basicConfig(format='%(asctime)s %(message)s')
logging.getLogger().setLevel(logging.INFO)
logging.info("Initializing EuclidGCD..")
self.numberList = []
def addToList(self, number ):
... | {
"content_hash": "16ec3ddc653bc4733fe5d7fb06fc775f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 31.74418604651163,
"alnum_prop": 0.5545787545787546,
"repo_name": "mudragada/util-scripts",
"id": "a9a88f0d60e53323a72d744ceb789e8ddc98087e",
"size":... |
import os
path_to_target_dir = "./target/"
# function to run shell command
def run_command(com):
print com
output = os.popen(com).read()
a = output.split('\n')
for b in a:
print b
# function to run shell command but no output to screen
def run_command_n(com):
newc = com + ' >> log.out 2>&... | {
"content_hash": "c491139e5a70993c1b15d72af97c58bb",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 93,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.6076433121019108,
"repo_name": "nimisha-srinivasa/RTP",
"id": "0ee00b8a0f56e6362fcc291aeed26c640cd0ecc8",
"size":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pubbrain_app', '0005_auto_20150401_1046'),
]
operations = [
migrations.CreateModel(
name='SearchToRegion',
fields=[
... | {
"content_hash": "05cc1128d02afda08fbec788da059402",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 134,
"avg_line_length": 34.93181818181818,
"alnum_prop": 0.5543266102797658,
"repo_name": "jbwexler/PubBrain",
"id": "9a816a1b372f2196f7324a3f24330d952903796c",
"size": "15... |
from datetime import date
from openerp.tests.common import TransactionCase
from openerp.osv.orm import except_orm
class TestPeriodState(TransactionCase):
"""
Forbid creation of Journal Entries for a closed period.
"""
def setUp(self):
super(TestPeriodState, self).setUp()
cr, uid = sel... | {
"content_hash": "e17cb5a6129e2541078411f13b41e7b2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 122,
"avg_line_length": 39.390243902439025,
"alnum_prop": 0.5226006191950464,
"repo_name": "cristianquaglio/odoo",
"id": "4e88994f2d20847730d046ceb8837b2c7e48a879",
"size":... |
import logging
import pickle
from sklearn.datasets import fetch_20newsgroups
import numpy as np
from lda2vec import preprocess, Corpus
logging.basicConfig()
# Fetch data
remove = ('headers', 'footers', 'quotes')
texts = fetch_20newsgroups(subset='train', remove=remove).data
# Remove tokens with these substrings
bad... | {
"content_hash": "501ae4b0ab1455176192665752f23784",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 76,
"avg_line_length": 35.152542372881356,
"alnum_prop": 0.7227579556412729,
"repo_name": "cemoody/lda2vec",
"id": "af3281758cc38ca3f5c9110e121fb56805140cc7",
"size": "2233... |
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import default_backend
from cry... | {
"content_hash": "df86e2635596ba718e7e8df579693241",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 30.891666666666666,
"alnum_prop": 0.6808740221203129,
"repo_name": "biowonks/bitkPy",
"id": "0196821b3ed550f54a1d87ad225369569fdb8258",
"size": "375... |
"""@@@
Main Module: Cluster.py
Objects: Cluster
ClustData
Author: Wayne Dawson
creation date: parts 2016 (in chreval), made into a separate object 170426
last update: 200210 (upgrade to python3), 170719, 190812
version: 0
Purpose:
This is used to prepare data for heat-maps an... | {
"content_hash": "347031a88228118cb6ba4569f7b2ab6d",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 81,
"avg_line_length": 30.17391304347826,
"alnum_prop": 0.45381043868075566,
"repo_name": "4dnucleome/looper",
"id": "e4e37628843e4c5b0713dd3493afdeb9229d17c2",
"size": "1... |
from django.contrib import admin
from config.models import OpenstackSettings, NodeSettings
admin.site.register(OpenstackSettings)
admin.site.register(NodeSettings)
| {
"content_hash": "d6165736a172adc48831732cecf1cb3a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 57,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.8554216867469879,
"repo_name": "Havate/havate-openstack",
"id": "2ff9eff0f848189b6422effb1f8550fc91ec40ea",
"size"... |
"""
Django settings for shredshyft project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | {
"content_hash": "661b8f3eaba8ed94335c5d7e8d925617",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 91,
"avg_line_length": 26.404761904761905,
"alnum_prop": 0.682897505259994,
"repo_name": "gerricchaplin/shredshyft",
"id": "be878f19591aa33b0c784e8552271e93e89d6e60",
"siz... |
"""
========================================
Interpolation (:mod:`scipy.interpolate`)
========================================
.. currentmodule:: scipy.interpolate
Sub-package for objects used in interpolation.
As listed below, this sub-package contains spline functions and classes,
1-D and multidimensional (univari... | {
"content_hash": "42bf1f2568cac360fee5f5ecec7140e3",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 72,
"avg_line_length": 17.510204081632654,
"alnum_prop": 0.6960955710955711,
"repo_name": "matthew-brett/scipy",
"id": "cf81c88d63ead6a83b76fa91cd615ecefb46f539",
"size": ... |
"""
Example Airflow DAG for Google Cloud Dataflow service
"""
import os
from typing import Callable, Dict, List
from urllib.parse import urlparse
from airflow import models
from airflow.exceptions import AirflowException
from airflow.providers.google.cloud.hooks.dataflow import DataflowJobStatus
from airflow.providers... | {
"content_hash": "52f401314ebdec4611f53d539637e13e",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 105,
"avg_line_length": 37.467811158798284,
"alnum_prop": 0.6502863688430699,
"repo_name": "sekikn/incubator-airflow",
"id": "6e58ff4d67ffef43402f9a17d7e26512bf209522",
"s... |
import re
from collections import Iterable
from io import StringIO
from itertools import groupby
from typing import List, Tuple, Callable, Any, IO, cast
from smartchangelog import datetools
from smartchangelog.commit import Commit
class Node:
def __init__(self, name: str = None, criterion: property = None, chil... | {
"content_hash": "1fdb890c7b97039fa6dcfbacc8b420f1",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 120,
"avg_line_length": 34.42384105960265,
"alnum_prop": 0.5802231627549057,
"repo_name": "ngouzy/commitmsg",
"id": "afe6d81f8b9e87a5ca6ec61cf0516a2ff4815017",
"size": "51... |
"""
A python script to get all job positions from an xls file.
"""
from openpyxl import load_workbook
import pickle
if __name__ == '__main__':
wb = load_workbook('positions.xlsx')
ws = wb.get_sheet_by_name(wb.get_sheet_names()[0])
jobs = {}
job_titles = ws.__getitem__("A")
job_categories = ws.__getitem__("... | {
"content_hash": "024c8f4319cb4842c426d027d539cc63",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 63,
"avg_line_length": 26.4,
"alnum_prop": 0.6401515151515151,
"repo_name": "skcript/cvscan",
"id": "607ae246accacc0607719f0581756f651c41f81f",
"size": "550",
"binary": f... |
"""Contains base class for iterative batch optimization procedures."""
from heuristic_optimization.base import IterativeOptimizer
# It's possible that this is sort of unnecessary, as in: every
# IterativeOptimizer is a (possibly trivial) BatchOptimizer.
# But I think this is somewhat convenient and mostly it'll help... | {
"content_hash": "b5577a0e581daccacd19ae73a5264f3d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 41.303030303030305,
"alnum_prop": 0.7212032281731474,
"repo_name": "tjanson/heuristic_optimization",
"id": "7b312414eecd0ee2ad1dd0c7688cf1353bf644ca",
... |
"""Cloud Datastore helper functions."""
import sys
from google.cloud.proto.datastore.v1 import datastore_pb2
from google.cloud.proto.datastore.v1 import entity_pb2
from google.cloud.proto.datastore.v1 import query_pb2
from googledatastore import PropertyFilter, CompositeFilter
from googledatastore import helper as dat... | {
"content_hash": "64a16d4830bb6624c1b0ed6f4ad0c0f3",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 79,
"avg_line_length": 29.812,
"alnum_prop": 0.6846907285656783,
"repo_name": "axbaretto/beam",
"id": "1497862a0b903033e6b0c28788589833fba15d85",
"size": "8238",
"binary... |
"""Signs and aligns an APK."""
import argparse
import logging
import shutil
import subprocess
import sys
import tempfile
from util import build_utils
def FinalizeApk(apksigner_path,
zipalign_path,
unsigned_apk_path,
final_apk_path,
key_path,
... | {
"content_hash": "820e340eec489de3f552b4e03ed61337",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 79,
"avg_line_length": 32.17333333333333,
"alnum_prop": 0.5797762121840033,
"repo_name": "nwjs/chromium.src",
"id": "f7581c7e9429034c1e297a80a754cbba57bbb6eb",
"size": "255... |
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('kbadge', '0002_auto_20181023_1319'),
]
operations = [
migrations.AlterModelManagers(
name='award',
m... | {
"content_hash": "8fd81d0a698dc088d51856ce8fc2b816",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 21.65,
"alnum_prop": 0.581986143187067,
"repo_name": "mozilla/kitsune",
"id": "2553c4671de1a0d7229d2f170959e207d47271fe",
"size": "507",
"binary": ... |
"""Tests for msgutil module."""
import array
import Queue
import struct
import unittest
import zlib
import set_sys_path # Update sys.path to locate mod_pywebsocket module.
from mod_pywebsocket import common
from mod_pywebsocket.extensions import DeflateFrameExtensionProcessor
from mod_pywebsocket.extensions import... | {
"content_hash": "5da380ad8c138a11aebaff2a2c739eac",
"timestamp": "",
"source": "github",
"line_count": 1059,
"max_line_length": 78,
"avg_line_length": 40.961284230406044,
"alnum_prop": 0.6391488773110794,
"repo_name": "XiaonuoGantan/pywebsocket",
"id": "4a6922f07cb30d06851404e13f5d78cefc7baf38",
"... |
import time
import datetime
import mock
from factory import SubFactory
from factory.fuzzy import FuzzyDateTime, FuzzyAttribute, FuzzyChoice
from mock import patch, Mock
import factory
import pytz
import factory.django
from factory.django import DjangoModelFactory
from django.apps import apps
from django.utils import ... | {
"content_hash": "1301dc1221170e71bf1399b74b1cb0e4",
"timestamp": "",
"source": "github",
"line_count": 1114,
"max_line_length": 170,
"avg_line_length": 33.58886894075404,
"alnum_prop": 0.6459992516970442,
"repo_name": "baylee-d/osf.io",
"id": "a8d41b3b22155cb5e038c5374f52d118bcdcd749",
"size": "37... |
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import do_change_stream_invite_only, get_client
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, UserMessage, get_realm, get_stream
class TopicHistoryTest(ZulipTestCase):
def test_topics_history_zeph... | {
"content_hash": "50377203849f75c64c07c7e609cee56f",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 100,
"avg_line_length": 38.530434782608694,
"alnum_prop": 0.6029113067027759,
"repo_name": "brainwane/zulip",
"id": "a8516d6b247639f8899816408b68030099c21d99",
"size": "88... |
from .years import YearPeriod
from .months import MonthPeriod
class PeriodError(Exception):
pass
def period_factory(period_type, value):
if period_type == 'month':
return MonthPeriod(value)
elif period_type == 'year':
return YearPeriod(value)
else:
raise PeriodError("Unknown ... | {
"content_hash": "ded3365a58ee2a440de5242962ae4ddd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 26.73913043478261,
"alnum_prop": 0.6715447154471544,
"repo_name": "davidmarquis/pyperiods",
"id": "551d14ab450e5ad12e8ba50abfe888bdd47b362a",
"size":... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "ef4a988902202142595ba586761ec6f9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 34.642857142857146,
"alnum_prop": 0.7680412371134021,
"repo_name": "arenadata/ambari",
"id": "a86fa405a8f9091ea3a14fdf8eec86d5d5a4aaea",
"size": "970... |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from ._configuration import KustoManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations ... | {
"content_hash": "5141d81f113bc8fec6b284dcc834675e",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 111,
"avg_line_length": 50.214723926380366,
"alnum_prop": 0.7337813072693953,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6b9922457ce33124aa989c8601785abc3043e1a9",
... |
"""This class extends pexpect.spawn to specialize setting up SSH connections.
This adds methods for login, logout, and expecting the shell prompt.
$Id$
"""
from pexpect import *
import pexpect
import time
import os
__all__ = ['ExceptionPxssh', 'pxssh']
# Exception classes used by this module.
class ExceptionPxssh(E... | {
"content_hash": "49aefb83aa812b3e9c6a25f5610bffba",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 255,
"avg_line_length": 46.45092024539877,
"alnum_prop": 0.6235884567126725,
"repo_name": "rockaboxmedia/pexpect",
"id": "9dd67b30d73a2bc40a700a0912d1139684258d19",
"size"... |
from tg import config
from tg import hooks
from tg.configuration import milestones
import logging
log = logging.getLogger('tgext.pyutilservice')
# This is the entry point of your extension, will be called
# both when the user plugs the extension manually or through tgext.pluggable
# What you write here has the same ... | {
"content_hash": "8120dab71b9bfc96d2a48414ea8031ed",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 244,
"avg_line_length": 40.721311475409834,
"alnum_prop": 0.7363123993558777,
"repo_name": "tongpa/tgext.pyutilservice",
"id": "c55cf70f738940ac66c40a0f74ca376ffddf774c",
"... |
"""SQL Lexer"""
# This code is based on the SqlLexer in pygments.
# http://pygments.org/
# It's separated from the rest of pygments to increase performance
# and to allow some customizations.
import re
import sys
from sqlparse import tokens
from sqlparse.keywords import KEYWORDS, KEYWORDS_COMMON
from cStringIO impor... | {
"content_hash": "b79ada2d07a4118e03070120d3c720c1",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 77,
"avg_line_length": 36.983379501385045,
"alnum_prop": 0.47060145307467605,
"repo_name": "dayutianfei/impala-Q",
"id": "4d200a608f7aa20298939556fbded98a2afc67d3",
"size"... |
from unittest import TestCase
from mock import patch
class Product(object):
pass
@patch('__main__.Product')
class MyTest(TestCase):
def test_one(self, MockSomeClass):
self.assertTrue(Product is MockSomeClass)
print "Success in mock class"
def test_two(self, MockSomeClass):
self... | {
"content_hash": "99d8d2e8498f0e4ed6242e1c57d0767b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 49,
"avg_line_length": 21.92,
"alnum_prop": 0.6751824817518248,
"repo_name": "peter-wangxu/python_play",
"id": "a8eb0efdcf59355b7615324ae7f2cff2e0d6f917",
"size": "548",
... |
import json
import csv
print("Opening location history data...")
inf = open("Takeout/LocationHistory.json", 'r')
in_data = json.load(inf)
inf.close()
print("Parsing...")
out_data = []
for x in in_data["locations"]:
out_row = [x["latitudeE7"] / 10000000, x["longitudeE7"] / 10000000, x["timestampMs"], x["accuracy"]]... | {
"content_hash": "928026b0053c561eae0c9e61c0119fd9",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 101,
"avg_line_length": 21.692307692307693,
"alnum_prop": 0.6631205673758865,
"repo_name": "jacobjiggler/Location-Visualizer",
"id": "abeabc64e14b49a3c9cebd26c89452c4873069c6... |
import warnings
warnings.simplefilter('ignore', Warning)
from gencmd.tests.new import *
from gencmd.tests.controller import *
from gencmd.tests.model import *
from gencmd.tests.scaffold import *
| {
"content_hash": "7aab5d3e32ebbd9c813393e3da4fa1e7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 18.181818181818183,
"alnum_prop": 0.785,
"repo_name": "ikeikeikeike/django-spine",
"id": "ba19c9bfe113a874a2491979c7ab249f4f9d5079",
"size": "200",
... |
"""Plugin for Disney (Channel) Germany
Supports:
- http://video.disney.de/sehen/*
- http://disneychannel.de/sehen/*
- http://disneychannel.de/livestream
"""
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api.utils import parse_json
from stream... | {
"content_hash": "b6e2875bc7e3578b66b4ab09f6f69864",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 73,
"avg_line_length": 27.41025641025641,
"alnum_prop": 0.6379794200187091,
"repo_name": "sbstp/streamlink",
"id": "e60e2632eec63b5e1c0948f9039c12e018ed593f",
"size": "1069... |
extensions = [
'oslosphinx',
'reno.sphinxext',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
ma... | {
"content_hash": "1fc67482b6de0063f1a7a5c947a5dd9a",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 79,
"avg_line_length": 32.08898305084746,
"alnum_prop": 0.7060610062062591,
"repo_name": "cernops/keystone",
"id": "6df2e041d0685ba82360d1b35370b500f4119711",
"size": "915... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/intangible/vehicle/shared_speederbike_pcd.iff"
result.attribute_template_id = -1
result.stfName("monster_name","speederbike")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "f83ac7a01f9183f32b00bd87814abb96",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 23.846153846153847,
"alnum_prop": 0.7064516129032258,
"repo_name": "obi-two/Rebelion",
"id": "019bd344a9863cd79ab725fa2aa078b4a83ccd66",
"size": "455... |
"""
Functions that ignore NaN.
Functions
---------
- `nanmin` -- minimum non-NaN value
- `nanmax` -- maximum non-NaN value
- `nanargmin` -- index of minimum non-NaN value
- `nanargmax` -- index of maximum non-NaN value
- `nansum` -- sum of non-NaN values
- `nanprod` -- product of non-NaN values
- `nancumsum` -- cumul... | {
"content_hash": "60d4b937fb17e8a84528daa6764125a3",
"timestamp": "",
"source": "github",
"line_count": 1633,
"max_line_length": 89,
"avg_line_length": 35.35884874464176,
"alnum_prop": 0.6269721688228469,
"repo_name": "ryfeus/lambda-packs",
"id": "d73d844672da08bc4f50247b21817814d604ceff",
"size": ... |
"""Factories to help in tests."""
from factory import PostGenerationMethodCall, Sequence
from factory.alchemy import SQLAlchemyModelFactory
from just.database import db
from just.user.models import User
class BaseFactory(SQLAlchemyModelFactory):
"""Base factory."""
class Meta:
"""Factory configurati... | {
"content_hash": "b069f2b08d57af53cf884de7c54e2a30",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 66,
"avg_line_length": 24.366666666666667,
"alnum_prop": 0.6812585499316005,
"repo_name": "kenhancoder/just",
"id": "86e4826fd7e3a55a57bc7dbddb38e9f2d8198258",
"size": "755... |
from .user import UserAdminModel
| {
"content_hash": "0d267fc3c9629c5614fd2140b4a886b2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.8484848484848485,
"repo_name": "yevgnenll/but",
"id": "72934cd731c0551daca0e67d6d3ebf32074457f1",
"size": "33",
"binary": false,... |
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('home', '0002_create_homepage'),
]
operations = [
migrations.AddField(
model_name='homepage',
name=... | {
"content_hash": "6f89167f57820cd3a540cb9e30eb8a0f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 21.94736842105263,
"alnum_prop": 0.6235011990407674,
"repo_name": "registerguard/celebrate",
"id": "cda9dcefaa4ad2e5d39f53f10ca234d0cd15c308",
"size"... |
from nose.tools import * # flake8: noqa
from tests.base import ApiTestCase
from osf_tests.factories import (
ProjectFactory,
PreprintFactory,
AuthUserFactory,
SubjectFactory,
PreprintProviderFactory
)
from osf.models import PreprintService, Node
from website.util import permissions
from api.base... | {
"content_hash": "d160c93c069c0ce8b54c88b5e81c3cb4",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 119,
"avg_line_length": 43.90833333333333,
"alnum_prop": 0.676029607136079,
"repo_name": "Nesiehr/osf.io",
"id": "facb942ef9c4844249e1ef681f8d6eb2966ce5e2",
"size": "5293"... |
import os,json
import shutil
import tempfile
import zipfile
class Template():
dir_path = os.path.dirname(os.path.realpath(__file__))
template_folder = "metadata-templates"
config_file = "package.json"
def __init__(self):
if is_installed_package(self.dir_path):
self.root_path = os.p... | {
"content_hash": "ca2283a2bd7d2b6d7243d787b538c466",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 121,
"avg_line_length": 46.23076923076923,
"alnum_prop": 0.6019134775374376,
"repo_name": "exiahuang/SalesforceXyTools",
"id": "d4d811ecd72ebf958774b8248550f0bf611d40aa",
... |
from typing import Any, Dict, List, Optional
from azure.core.exceptions import HttpResponseError
import msrest.serialization
class ErrorFieldContract(msrest.serialization.Model):
"""Error Field contract.
:ivar code: Property level error code.
:vartype code: str
:ivar message: Human-readable represen... | {
"content_hash": "c46ce0e95c7e53090bfc2c1de7f27d11",
"timestamp": "",
"source": "github",
"line_count": 416,
"max_line_length": 107,
"avg_line_length": 37.87980769230769,
"alnum_prop": 0.6328848838685113,
"repo_name": "Azure/azure-sdk-for-python",
"id": "fccf4cbe4e44e360afc0266dcee456b565a098c7",
"... |
def load_names(filename):
with open(filename) as f:
names = f.read().replace("\"", "").split(",")
return names
def calc_alphabetical_value(str):
ret = 0
for char in str.upper():
ret = ret + ord(char) - 64
return ret
def sum_namescores(names):
ret = i = 0
for i, name in enu... | {
"content_hash": "80573bc56d4c0a7c177a52c2391d1c9f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 68,
"avg_line_length": 26.045454545454547,
"alnum_prop": 0.5828970331588132,
"repo_name": "fbcom/project-euler",
"id": "ff36cc24214176ba9e22d45bbb82f41667ecb9e9",
"size": "... |
import setuptools
setuptools.setup(
author='Stuart B. Wilkins',
description='Read SPE files',
license='GPL v3',
name='spefile',
py_modules=['spefile'],
version='1.6',
)
| {
"content_hash": "7296fbc94d8cb9f8104acfcf649bdd0c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 33,
"avg_line_length": 19.4,
"alnum_prop": 0.6288659793814433,
"repo_name": "NSLS-II/lightsource2-recipes",
"id": "31e5f78ee6ef23698b839e3fe74e6161d1dbe2e1",
"size": "194",... |
"""Continually polls and evaluates new checkpoints."""
import time
from absl import app
from absl import flags
from absl import logging
import gin
import tensorflow as tf
from uflow import uflow_data
# pylint:disable=unused-import
from uflow import uflow_flags
from uflow import uflow_main
from uflow import uflow_plo... | {
"content_hash": "8112e4b75901918a7c371ca8e23c218f",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 80,
"avg_line_length": 32.373493975903614,
"alnum_prop": 0.7018980275400074,
"repo_name": "google-research/google-research",
"id": "1b40ab2a20885f0f46ba958399e1293b1abe9a96",... |
"""
Talon.One API
Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage ap... | {
"content_hash": "38778c4913bd3dea1a5a2f49b0f30684",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 732,
"avg_line_length": 35.03888888888889,
"alnum_prop": 0.6066275566830506,
"repo_name": "talon-one/talon_one.py",
"id": "e5eab9ebf04206d332f6be7e769a5d0ab7dd1c42",
"size... |
"""
If you want to save message as .eml file, work with MailMessage.obj - it is email.message.EmailMessage
python email lib docs:
https://docs.python.org/3/library/email.message.html#email.message.EmailMessage.as_string
https://docs.python.org/3/library/email.message.html#email.message.EmailMessage.as_bytes
... | {
"content_hash": "729d31b1b64f56100171569a89a58a5c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 102,
"avg_line_length": 32.5,
"alnum_prop": 0.7569230769230769,
"repo_name": "ikvk/imap_tools",
"id": "9b9a57855081feb1493ff85b73222211c01c3d64",
"size": "325",
"binary":... |
from core.himesis import Himesis
import uuid
class HcopersonsSolveRefCountryFamilyParentCommunityMan(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule copersonsSolveRefCountryFamilyParentCommunityMan.
"""
# Flag this instance as co... | {
"content_hash": "a8f3f94bc63494d1701934365c89dca6",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 160,
"avg_line_length": 35.87068965517241,
"alnum_prop": 0.509973564047104,
"repo_name": "levilucio/SyVOLT",
"id": "3430a3f3154af9fa53198c943be819ed0178a564",
"size": "416... |
"""
WSGI config for suqashexamples project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | {
"content_hash": "967ed073722376c193118a8ddbc2b014",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.3125,
"alnum_prop": 0.7777777777777778,
"repo_name": "riklaunim/django-examples",
"id": "870db208567098b4d8a9adbe9d39bd87ae747464",
"size": "405",... |
"""
survey - Assessment Data Analysis Tool
@author: Graeme Foster <graeme at acm dot org>
For more details see the blueprint at:
http://eden.sahanafoundation.org/wiki/BluePrint/SurveyTool/ADAT
"""
"""
@todo: open template from the dataTables into the section tab not update
@todo: in the pages... | {
"content_hash": "070223deeb24e7ab8c8b8b5e1b0dc0bc",
"timestamp": "",
"source": "github",
"line_count": 1338,
"max_line_length": 137,
"avg_line_length": 36.89611360239163,
"alnum_prop": 0.5185852897684688,
"repo_name": "flavour/iscram",
"id": "3ebef66d511278b8dae1c961a19973508525b28e",
"size": "493... |
import logging
import eventlet
from oslo_messaging._drivers.zmq_driver import zmq_poller
LOG = logging.getLogger(__name__)
class GreenPoller(zmq_poller.ZmqPoller):
def __init__(self):
self.incoming_queue = eventlet.queue.LightQueue()
self.thread_by_socket = {}
def register(self, socket, r... | {
"content_hash": "151124382fd361ea2c5762c3e93c1d00",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 72,
"avg_line_length": 27.955882352941178,
"alnum_prop": 0.5860073645449764,
"repo_name": "ozamiatin/oslo.messaging",
"id": "fdf9b442d95a6cb8cd2c321ec719f066b528ab1e",
"siz... |
import multiprocessing
import optparse
import os
from os.path import join
import shlex
import subprocess
import sys
import time
from testrunner.local import execution
from testrunner.local import progress
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.local import verbose
fro... | {
"content_hash": "580e24c6247ee36ea0de4c1c44c3fd84",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 80,
"avg_line_length": 35.84788732394366,
"alnum_prop": 0.6064749332076065,
"repo_name": "espadrine/opera",
"id": "959fe48579ec2e0eb55e19358a15f64590167b9a",
"size": "1432... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['NoCycle'] , ['SVR'] ); | {
"content_hash": "9e26adb0b10e6971e3d6ed8fbb73b688",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 75,
"avg_line_length": 37,
"alnum_prop": 0.6959459459459459,
"repo_name": "antoinecarme/pyaf",
"id": "be8a95f7ae82176c895f699a8768e09c1e91d816",
"size": "148",
"binary": f... |
from django.contrib import admin
from recognize_albums.models import Album, Image
class ImageInline(admin.TabularInline):
model = Image
extra = 1
fields = ['thumbnail','image',]
readonly_fields = ['thumbnail',]
class AlbumAdmin(admin.ModelAdmin):
inlines = [ImageInline]
admin.site.register(Album... | {
"content_hash": "868675e32d8f98d0983b0cc676329af8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 48,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.7245508982035929,
"repo_name": "NCSUWebClass/fall14-recognize4",
"id": "ffe25db0325620139bb9f4da3133872a40bf2aa0",
... |
import copy
import numpy
import wendy
import hom2m
########################## SELF-GRAVITATING DISK TOOLS ########################
def sample_sech2(sigma,totmass,n=1):
# compute zh based on sigma and totmass
zh= sigma**2./totmass # twopiG = 1. in our units
x= numpy.arctanh(2.*numpy.random.uniform(size=n)-1... | {
"content_hash": "c9c9d85a358d839d004b79433a1461a5",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 170,
"avg_line_length": 44.94897959183673,
"alnum_prop": 0.5394627317442301,
"repo_name": "jobovy/simple-m2m",
"id": "dc95f90b77127cafb6f99cfbff0b0e1dbdb7274e",
"size": "1... |
"""Tests for `tf.data.Dataset.random()`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops import dataset_ops
from tensorflow.p... | {
"content_hash": "ba16f66c67673796fc1a1419ac0e7085",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 34.65853658536585,
"alnum_prop": 0.7283603096410978,
"repo_name": "frreiss/tensorflow-fred",
"id": "b1b06cf439fafd4f81b6a4cd8aa80212ac015050",
"size"... |
import mraa
class Romeo():
""" Class for controlling the DFRobot Romeo for Edison
To drive motors, use ADC, PWM, etc., interface with AtMega8 board
byte array format:
( 0x55, 0xaa, 0x[cmd][x], 0x[arg] )
"""
# encoder counters
lCount = 0
rCount = 0
def __init__(self):
# set u... | {
"content_hash": "0ecfe68d32b7efa8262528b1140d0c69",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 69,
"avg_line_length": 31.604395604395606,
"alnum_prop": 0.5914464534075105,
"repo_name": "SSG-DRD-IOT/commercial-iot-security-system",
"id": "f63db324379305f8a6e467829edfacb... |
""" ifaddrs for Android
"""
from os.path import join, exists
import sh
from pythonforandroid.logger import info, shprint
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.toolchain import current_directory
class IFAddrRecipe(CompiledComponentsPythonRecipe):
version = '8f9a87... | {
"content_hash": "20dcce49b25840833dbf2851e747ef66",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 82,
"avg_line_length": 39.148148148148145,
"alnum_prop": 0.5998107852412489,
"repo_name": "PKRoma/python-for-android",
"id": "7d44f9cd72a621a5f8923ff403497c9a2a32498b",
"si... |
from msrest.serialization import Model
class Operation(Model):
"""Operation.
:param id: Operation ID.
:type id: str
:param name: Operation name.
:type name: str
:param status: The current status of the operation. Possible values
include: 'InProgress', 'Failed', 'Succeeded', 'TimedOut', '... | {
"content_hash": "0709c62ca679d49a7fdd22c908375ef9",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 160,
"avg_line_length": 42.234042553191486,
"alnum_prop": 0.6387909319899244,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "faa4405e95312f7c3c94c0dcb8e9a1ccb94c7b90",
"s... |
from wagtail.wagtailcore.models import Page
from wagtail.tests.utils import WagtailPageTests
from wagtail_box.pages.models import StaticPage
class PagesModelTest(WagtailPageTests):
def test_static_page_child_of_anything(self):
"""
Ensures that a Static page can be child of any kind of Page
... | {
"content_hash": "b3c022032a52f4bf5a60e7c027d157d8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 31.25,
"alnum_prop": 0.7333333333333333,
"repo_name": "palazzem/wagtail-nesting-box",
"id": "6e6e2c3a24c346cf81b9146c9467d305036ceb7f",
"size": "375"... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SVC_poly" , "BreastCancer" , "postgresql")
| {
"content_hash": "f481a4b3f9e5b1927026259c2a3f2318",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 35,
"alnum_prop": 0.7785714285714286,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "943c153350bf7e6fb7d1616225f302d13b26133a",
"size": "140",... |
from webvita import db, models
from passlib.apps import custom_app_context as pwd_context
def db_setup_dev(name, realname, pw, email):
db.drop_all()
db.create_all()
admin = models.User(name, realname, pwd_context.encrypt(pw), email)
db.session.add(admin)
db.session.commit()
def db_reset():
... | {
"content_hash": "f56ff2435ede7650afe8b6277f4c58cc",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 24.473684210526315,
"alnum_prop": 0.6129032258064516,
"repo_name": "niijv/webvita-heroku",
"id": "5703139576e2948c324ec76f66a5522e3cd43ca3",
"size": ... |
"""
Django settings for Lab3 project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... | {
"content_hash": "6310b4434a512be6999148ba265a33ea",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 26.264,
"alnum_prop": 0.6886993603411514,
"repo_name": "sanchaez/python_labs",
"id": "9e21f152dd137250e6b006c7346da2e411999986",
"size": "3283",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goals', '0144_auto_20160517_2104'),
]
operations = [
migrations.AddField(
model_name='action',
name='external_resource_type'... | {
"content_hash": "846cdcbde4c13d1ba68bc0236506cce4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 274,
"avg_line_length": 34.111111111111114,
"alnum_prop": 0.6400651465798045,
"repo_name": "izzyalonso/tndata_backend",
"id": "6d2c5eaee66adf0dd4327119e7d7ace411a866bc",
"s... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='pages/home.htm... | {
"content_hash": "958f82cafe7c100b09c825a6ef8b5c38",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 83,
"avg_line_length": 35.166666666666664,
"alnum_prop": 0.6824644549763034,
"repo_name": "Kayra/atlas",
"id": "26c8aed360a437c52c5f09b30f40b158bc61913c",
"size": "1290",
... |
import mock
from mox3 import mox
from oslo.config import cfg
from oslo.utils import timeutils
from nova.compute import claims
from nova.compute import task_states
from nova.compute import vm_states
from nova import db
from nova.tests.unit.compute import test_compute
from nova.tests.unit.image import fake as fake_image... | {
"content_hash": "d4b66e1de1c857a94453b9a97e239442",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 79,
"avg_line_length": 43.77777777777778,
"alnum_prop": 0.5982764726714673,
"repo_name": "shakamunyi/nova",
"id": "f5985974dc8b6b898962f6317e3d1be224e759c6",
"size": "1751... |
"""
This script is to test Google Cloud Vision OCR (text detect) API
Example CLI:
> python GoogleCloudOCR.py ./ch4_test/
Notice: need to create folders out_file, out_file3, out_file4 before run this.
"""
# for CLI parameter
import argparse
# for seraching folder and file IO
import base64
import os
import re
import ... | {
"content_hash": "9a3687cfed4eefd06989de86b586fec7",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 91,
"avg_line_length": 33.69607843137255,
"alnum_prop": 0.5245853942391621,
"repo_name": "RobinCPC/CE264-Computer_Vision",
"id": "2cab9a9366e4c4db6ca8a65586eb0aa187c8e8c1",
... |
from django.contrib.auth.models import User
from django.db import models
class Oauth20Service(models.Model):
access_token = models.CharField(max_length=255, unique=True)
unique_id = models.CharField(max_length=255, unique=True)
user = models.ForeignKey(User, related_name="%(class)ss")
class Meta:
... | {
"content_hash": "ce64445f0aca7a85db09cc422137dd49",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 31,
"alnum_prop": 0.7243401759530792,
"repo_name": "dgouldin/django-socialite",
"id": "5d2618e18f87cda6c6ffccdd88faf765564a8344",
"size": "341",
"b... |
from _socket import error as soc_error
import logging
import struct
import traceback
import gevent
import gevent.server
import gevent.socket
from gevent import Timeout
from recall.codec import serialize_message, parse_message, parse_meta
from recall.controller import RpcController
from recall.proto import rpc_meta_pb2
... | {
"content_hash": "961385b4fa4888e8bcbf678d1f072353",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 100,
"avg_line_length": 35.96734693877551,
"alnum_prop": 0.5306400363141172,
"repo_name": "airekans/recall",
"id": "5551597b014949fe69c2149835921c6d39cf95ca",
"size": "881... |
import numpy as np
from hmis.general import calc_age
from datetime import datetime
################################################################################
# Gets IDs within a certain age range.
################################################################################
def select_by_age(master_dictionary... | {
"content_hash": "44fbd541e937b07e3041829489ae43e0",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 133,
"avg_line_length": 33.07719298245614,
"alnum_prop": 0.5732470563275698,
"repo_name": "mattbellis/hmis",
"id": "a5733fb4283c04ee748eae129d63810b862b7493",
"size": "942... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('bus', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='TicketBooking... | {
"content_hash": "59c8493a844a8721fbfc5c3a44018a1f",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 128,
"avg_line_length": 38.911764705882355,
"alnum_prop": 0.5691609977324263,
"repo_name": "warlock57/bus_reservation",
"id": "ad50eded6325dacbae4fcd2d15494a3f437b048b",
"s... |
import os
import re
import shutil
import tempfile
from xml.dom import minidom
from oslo.config import cfg
from nova.image import glance
from nova.openstack.common import jsonutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutil... | {
"content_hash": "b28916a8bae1fe95164e86c8cb7f0d24",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 79,
"avg_line_length": 35.23376623376623,
"alnum_prop": 0.5851455952819756,
"repo_name": "CloudServer/pcs-nova-driver",
"id": "eb72103ef658b526c1c9914e9cbc0d08adbb556c",
"... |
from stellar.models import get_unique_hash, Table, Snapshot
def test_get_unique_hash():
assert get_unique_hash()
assert get_unique_hash() != get_unique_hash()
assert len(get_unique_hash()) == 32
def test_table():
table = Table(
table_name='hapsu',
snapshot=Snapshot(
snaps... | {
"content_hash": "6d517506d98e7f1fbbfd961554ce1753",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 59,
"avg_line_length": 26.31578947368421,
"alnum_prop": 0.612,
"repo_name": "Wanderfalke/stellar",
"id": "234d7e5a30a3331056a29c2623f76f58b47c2913",
"size": "500",
"binar... |
from .core import guess
| {
"content_hash": "eb55a97da1407e826a3e6b208d1031c4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.7916666666666666,
"repo_name": "spulec/guesser",
"id": "47c687de153b21b2adea483c3d24c5390ccde259",
"size": "24",
"binary": false... |
from troposphere import Base64, FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Template
import troposphere.ec2 as ec2
import troposphere.elasticloadbalancingv2 as elb
def AddAMI(template):
template.add_mapping("RegionMap", {
"us-east-1": {"AMI": "ami-6411e20d"},
"us-west-1... | {
"content_hash": "feb112e3dc231b527d5ca51ce9516e6b",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 29.159763313609467,
"alnum_prop": 0.5549918831168831,
"repo_name": "pas256/troposphere",
"id": "b721f66c5deb2fda445d599633dd1d629b798cd0",
"size": "... |
from base import BaseStore
from voodoo import VoodooStore
from facet import FacetStore
from django import DjangoStore
from memory import BaseMemoryStore
from obj import BaseMemoryObject
| {
"content_hash": "59a0e25235debd2e628560a12998d6e7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 34,
"avg_line_length": 31,
"alnum_prop": 0.8709677419354839,
"repo_name": "prior/cynq",
"id": "89e901b4eefb2d21c0af6781de2956901bccdba5",
"size": "186",
"binary": false,
... |
import yaml
import os.path
import re
import sys
kwarg_pattern = re.compile('<([a-zA-Z0-9_]+=?[a-zA-Z0-9_, \(\)\'\"]*)>')
def to_string(value):
if type(value) in (list, tuple):
return ",".join(map(str, value))
elif value is None:
return ""
else:
return str(value)
def indent(text,... | {
"content_hash": "dc30d5c9f35ffaeb078bec28516473a9",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 112,
"avg_line_length": 32.68456375838926,
"alnum_prop": 0.5935318275154005,
"repo_name": "Ttl/scikit-rf",
"id": "4eef8d90fe3b75eb1ee4968fe3002c971b00a481",
"size": "9740"... |
import cx_Oracle
import time
print ("About to sleep")
time.sleep(30)
dsnStr = cx_Oracle.makedsn("oradb", 1521, "xe")
print ("No mo sleeping brah")
connection = cx_Oracle.connect(user="hr", password="hr", dsn=dsnStr)
cursor = connection.cursor()
cursor.execute("select sysdate from dual")
today, = cursor.fetchone()
... | {
"content_hash": "d7a1f5cbdcff5ed22f2aaff5f8498498",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 68,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.7211267605633803,
"repo_name": "chembl/surechembl-data-client",
"id": "3f3f381a9778b88e31142e47cb10d536e9f6ecda",
... |
import copy
from django.conf import settings
from olympia.constants.promoted import RECOMMENDED
import olympia.core.logger
from olympia import amo
from olympia.amo.indexers import BaseSearchIndexer
from olympia.amo.utils import attach_trans_dict
from olympia.amo.celery import create_chunked_tasks_signatures
from olym... | {
"content_hash": "3e92b580c6721436cc7a8ba15d1e625e",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 88,
"avg_line_length": 39.62157809983897,
"alnum_prop": 0.41459053038000404,
"repo_name": "mozilla/olympia",
"id": "0e5ab023b158574a0613a6b59ff5d765b62e2cf0",
"size": "246... |
"""Test UTXO set hash value calculation in gettxoutsetinfo."""
import struct
from test_framework.blocktools import create_transaction
from test_framework.messages import (
CBlock,
COutPoint,
FromHex,
)
from test_framework.muhash import MuHash3072
from test_framework.test_framework import BitcoinTestFramew... | {
"content_hash": "deacefbbe08ac8d13f873b18d2ad638e",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 142,
"avg_line_length": 37.792682926829265,
"alnum_prop": 0.6453694740238787,
"repo_name": "Sjors/bitcoin",
"id": "6e6046d84df8ef9b11b6dd00f41c832ca38047d2",
"size": "3313"... |
from rllab.spaces.base import Space
import numpy as np
from rllab.misc import special2 as special
import tensorflow as tf
class Discrete(Space):
"""
{0,1,...,n-1}
"""
def __init__(self, n):
self._n = n
@property
def n(self):
return self._n
def sample(self):
retur... | {
"content_hash": "5ae97030c6a51467f7b983ff7362ee3e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 101,
"avg_line_length": 23.64788732394366,
"alnum_prop": 0.5902322811197142,
"repo_name": "brain-research/mirage-rl-qprop",
"id": "6cbfc70ed9f6133948916bda7f5eeee323adc03a",
... |
import numpy as np
from pyodesys.util import import_
from pyodesys.core import integrate_chained
from pyodesys.symbolic import SymbolicSys, PartiallySolvedSystem, symmetricsys, TransformedSys
from pyodesys.tests._robertson import get_ode_exprs
sp = import_('sympy')
def _test_chained_multi_native(NativeSys, integrato... | {
"content_hash": "35840ddbe5f239e164b46428e59f0c30",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 115,
"avg_line_length": 38.46376811594203,
"alnum_prop": 0.5813865862848531,
"repo_name": "bjodah/pyodesys",
"id": "eea21d7019c3e0c03bd27b3148e8f1c4445ad55e",
"size": "2679... |
"""
This module holds models related to the Sponsor entity.
"""
from allauth.account.models import EmailAddress
from django.conf import settings
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.template.defaultfilters import slugify
from django.urls import reverse
from djan... | {
"content_hash": "c46499bf36adf7568124c8b34973e569",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 119,
"avg_line_length": 34.56357388316151,
"alnum_prop": 0.650526943726387,
"repo_name": "python/pythondotorg",
"id": "ad2c4b8b1f4e3fdb8931d16a72bcb117a7a6a237",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('data_analytics', '0003_auto_20150810_1710'),
]
operations = [
migrations.RemoveField(
model_name='maltrow',
name='is_web_user',
... | {
"content_hash": "bb0a1b7d4e579a1720ff618ec7b6c0e3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 19.58823529411765,
"alnum_prop": 0.5915915915915916,
"repo_name": "qedsoftware/commcare-hq",
"id": "e8872d01ad756fe5dd1b6f949c81ccee618088f3",
"size"... |
from django.db import models
from django.utils import timezone
from django.template import Template
from django.core.exceptions import ValidationError
from .constants import *
import hashlib, re
class Agent(models.Model):
protocol = models.CharField(max_length=16)
host = models.CharField(max_length=128)
... | {
"content_hash": "d630ff9e0b4a67561cd04fe3722cd5b1",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 149,
"avg_line_length": 40.883720930232556,
"alnum_prop": 0.64419795221843,
"repo_name": "rodrigozc/mockatron",
"id": "34bdccf9fc48b0c1b2f1e61de937ff5582dcdf0c",
"size": "... |
"""
Tellstick Component.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tellstick/
"""
import logging
import threading
import voluptuous as vol
from homeassistant.helpers import discovery
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from h... | {
"content_hash": "89e7310fa827774eb5dd36de4de88e62",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 33.36538461538461,
"alnum_prop": 0.6498559077809798,
"repo_name": "srcLurker/home-assistant",
"id": "d2e296d61b6d6cb30cacf401de0954aee3a8c899",
"siz... |
from ..azure_common import BaseTest, arm_template
class VMSSTest(BaseTest):
def setUp(self):
super(VMSSTest, self).setUp()
def test_validate_vmss_schemas(self):
with self.sign_out_patch():
p = self.load_policy({
'name': 'test-azure-vmss',
'resource... | {
"content_hash": "39446f5716e0a7c5ffd7ae373db61d4b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 49,
"avg_line_length": 27.266666666666666,
"alnum_prop": 0.48166259168704156,
"repo_name": "capitalone/cloud-custodian",
"id": "507f09e16f788632923fb49da18a5d902ee8548b",
"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PodcastCategory'
db.create_table('podcasts_podcastcategory', (
('id', self.gf('django.db.models.... | {
"content_hash": "56cd682b116bd54ab1493efb820de15c",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 134,
"avg_line_length": 60.43089430894309,
"alnum_prop": 0.5806538409794161,
"repo_name": "mollyproject/mollyproject",
"id": "41d7e92d7c5534e7e4b6c7cc1b949bc7d1d884b7",
"s... |
import rados, sys
cluster = rados.Rados(conffile='ceph.conf')
cluster.connect()
cluster_stats = cluster.get_cluster_stats()
pools = cluster.list_pools()
for pool in pools:
print pool
| {
"content_hash": "83c165f2d25a8cc70e8a4dbaefa63afb",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 43,
"avg_line_length": 17.181818181818183,
"alnum_prop": 0.7354497354497355,
"repo_name": "motobyus/moto",
"id": "f40a265ea80b7d788710d6f90a7e84f0e6a681d7",
"size": "190",
... |
import os
import unittest
from captcha import fields
from django.forms import Form
class TestForm(Form):
captcha = fields.ReCaptchaField(attrs={'theme': 'white'})
class TestCase(unittest.TestCase):
def setUp(self):
os.environ['RECAPTCHA_TESTING'] = 'True'
def test_envvar_enabled(self):
... | {
"content_hash": "0555c35e2bc1e809d7a3cae9191c5513",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 61,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.6577540106951871,
"repo_name": "JioCloud/django-recaptcha",
"id": "622ef7cee193285d48d8fcb755094b907ebf288d",
"si... |
import mock
from webob import exc
from nova.api.openstack import common
from nova.api.openstack.compute import attach_interfaces \
as attach_interfaces_v21
from nova.compute import api as compute_api
from nova import exception
from nova import objects
from nova import test
from nova.tests.unit.api.openstack im... | {
"content_hash": "05b2f80d5af0431d5b5c178692a95d27",
"timestamp": "",
"source": "github",
"line_count": 557,
"max_line_length": 79,
"avg_line_length": 43.050269299820464,
"alnum_prop": 0.5807581633929688,
"repo_name": "jianghuaw/nova",
"id": "3b13cd78e0d06d1fc9106653138b0f898bdaaea5",
"size": "2460... |
class HTTPError(IOError):
"""Unified HTTPError used across all http_client implementations.
"""
def __init__(self, response, message=None, swagger_result=None):
"""
:type response: :class:`bravado_core.response.IncomingResponse`
:param message: Optional string message
:param... | {
"content_hash": "37465c797cff9d43c0127f1e2eba997b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 43.28,
"alnum_prop": 0.6312384473197782,
"repo_name": "MphasisWyde/eWamSublimeAdaptor",
"id": "39c33c0bb323b8a8ec351d1970f52ce1e89f4291",
"size": "11... |
'''
Return/control aspects of the grains data
'''
# Import python libs
from __future__ import print_function
import collections
import math
import operator
import os
import random
import yaml
import logging
# Import salt libs
import salt.utils
import salt.utils.dictupdate
from salt.exceptions import SaltException
__... | {
"content_hash": "3ccc00452a1bb2a4bd3f4d5ac59fe3aa",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 111,
"avg_line_length": 27.358299595141702,
"alnum_prop": 0.5985941546429893,
"repo_name": "MadeiraCloud/salt",
"id": "abf7529f743a65ada92c85c477d861ebc1dd8a62",
"size": "... |
class CarCompany(object):
has_money = True
def create_factory(self):
while self.has_money:
yield "wrrrooommm... a brand new car rolled out!"
def test():
from simpletest import _assert, _assert_raises
gm = CarCompany()
detroit_factory = gm.create_factory()
_assert(detroit_f... | {
"content_hash": "4b88807308bfe48b4a52b724360f3666",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 80,
"avg_line_length": 30.541666666666668,
"alnum_prop": 0.6507503410641201,
"repo_name": "pgularski/snippets",
"id": "d96ee300fc81f1b079a81a1ed4c549bb656a1040",
"size": "7... |
"""
A file to contain specific logic to handle version upgrades in Kolibri.
"""
import logging
from django.db.models import F
from django.db.models import OuterRef
from django.db.models import Subquery
from morango.models.core import UUIDField
from kolibri.core.auth.models import Collection
from kolibri.core.exams.mo... | {
"content_hash": "c17b6188f37a77af73cac24760e75e2e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 95,
"avg_line_length": 36.04651162790697,
"alnum_prop": 0.7187096774193549,
"repo_name": "learningequality/kolibri",
"id": "403b6ec8c701759b78ae6cf4133f5a5b8094263e",
"size... |
import xml.etree.ElementTree as ET
class brocade_vswitch(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def get_vnetwork_hosts_input_vcenter(self, **kwargs):
"""Auto Generated Code
"""
config = E... | {
"content_hash": "95da5b6afed7dbe5d3c9f0d67c2eec03",
"timestamp": "",
"source": "github",
"line_count": 2436,
"max_line_length": 96,
"avg_line_length": 40.6871921182266,
"alnum_prop": 0.6161591702484008,
"repo_name": "BRCDcomm/pynos",
"id": "e9f44070afe3ed3627fb05b72cdf617630d4e801",
"size": "99136... |
import sys
from link_analyzer import Analyzer
from link_file import LinkFile
if __name__ == "__main__":
for arg in sys.argv[1:]:
file = arg.split(",")
decode = True if (len(file) > 1) else False
print "Parsing file '{}' with decoder '{}'".format(file[0], decode)
link_file = LinkF... | {
"content_hash": "b12366b620c82d285d00a1a14b7deaf0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 24,
"alnum_prop": 0.5979166666666667,
"repo_name": "salkinium/bachelor",
"id": "ef109a1a65fd9893ed19ae4518e61a476a5646cf",
"size": "825",
"binary":... |
import numpy as np
import pytest
from keras import backend as K
from keras.layers import Input
from keras.models import Sequential, Model
from numpy.testing import assert_allclose
from keras_contrib.layers import InstanceNormalization
from keras_contrib.utils.test_utils import layer_test
input_1 = np.arange... | {
"content_hash": "64323c0d89d9b3528863585561695707",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 73,
"avg_line_length": 34.5736040609137,
"alnum_prop": 0.5831742769050066,
"repo_name": "keras-team/keras-contrib",
"id": "67c25b86a155f7507e94c11e8cfa36ac583f3533",
"size... |
"""
This package contains the actual wikicode parser, split up into two main
modules: the :mod:`.tokenizer` and the :mod:`.builder`. This module joins them
together into one interface.
"""
from .builder import Builder
from .errors import ParserError
try:
from ._tokenizer import CTokenizer
use_c = True
except I... | {
"content_hash": "ed861a874a1eeec0cb3a9a9deedee29b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 38.14754098360656,
"alnum_prop": 0.6574989256553503,
"repo_name": "jayvdb/mwparserfromhell",
"id": "3fad93baec47b294b60806b70aba879402a98e15",
"size"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0028_auto_20141022_1603'),
]
operations = [
migrations.AlterField(
model_name='taxsaveinputs',
name='dividends',... | {
"content_hash": "ab64b24555564f2eca27efecc3396860",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 221,
"avg_line_length": 39.63636363636363,
"alnum_prop": 0.5848623853211009,
"repo_name": "nolanzandi/webapp-public",
"id": "7eb7e5ff9934c534edc9721606301b25dc856a59",
"siz... |
import matplotlib as mpl
mpl.use('pdf')
import pylab as plt
import numpy as np
import glob
import sys
import argparse
from crrlpy import crrls
from scipy import interpolate
def show_coverage(spec, out, x_col, y_col, t_col):
"""
Shows the coverage of spec in percentage.
"""
data = np.loadtxt(spec)... | {
"content_hash": "6e1aa4e21908ce81afccef6558b6775f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 83,
"avg_line_length": 35.682539682539684,
"alnum_prop": 0.5195729537366548,
"repo_name": "astrofle/CRRLpy",
"id": "89d618606fdc3358550380e728220d7cab669c27",
"size": "2271... |
"""Provides deal object for PMP-E and Global Deals."""
from __future__ import absolute_import
from functools import partial
from .. import t1types
from ..entity import Entity
class Deal(Entity):
"""docstring for deals."""
collection = 'deals'
resource = 'deal'
_post_format = 'json'
_bill_types ... | {
"content_hash": "6313c102c09864aa961d3b1ea54c8fc8",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 30.46153846153846,
"alnum_prop": 0.5681818181818182,
"repo_name": "MediaMath/t1-python",
"id": "3e144600e7e06606a8323e74af36a2ded2ff4a52",
"size": "1... |
from rdflib import Graph, Literal, BNode, Namespace, RDF, XSD
import queries
from dateutil import parser
global SSN
global GEO
global DUL
# SSN Namespace
SSN = Namespace('https://www.w3.org/2005/Incubator/ssn/ssnx/ssn#')
# Geo Namespace
GEO = Namespace('http://www.w3.org/2003/01/geo/wgs84_pos#')
# DUL Namespace
DUL... | {
"content_hash": "39f99f318bcec3cad9e2e90524579ffe",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 74,
"avg_line_length": 31.102272727272727,
"alnum_prop": 0.689806357325539,
"repo_name": "nikha1/nyc-taxi",
"id": "ce191aa699631d342c422d71b5262e884b9af385",
"size": "2737"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.