text stringlengths 4 1.02M | meta dict |
|---|---|
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request
from flask_login import UserMixin, AnonymousUse... | {
"content_hash": "2496faea389fc0e64725d33ad4a5fff2",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 91,
"avg_line_length": 36.486486486486484,
"alnum_prop": 0.6117592592592592,
"repo_name": "DonYum/LogAna",
"id": "456b2fa9073df33ff17c400cc7dc62f5f19ae4ec",
"size": "10800... |
from __future__ import division, print_function, absolute_import
import sys
import traceback
import time
import socket
from naoqi import ALProxy
from ..environments import Environment
__all__ = ['NaoEnvFactory', 'PhysicalWorld', 'Webots']
class NaoEnvFactory(object):
"""The NAO environment factory.
An in... | {
"content_hash": "85b3b0f8a9820f1786e05ae2d9c5cd12",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 100,
"avg_line_length": 29.7492795389049,
"alnum_prop": 0.5647583066937906,
"repo_name": "evenmarbles/mlpy",
"id": "a3c6378d56710f14eb1416102b909d34be29aaf5",
"size": "103... |
import os
import time
import pytool
from nose import SkipTest
from nose.tools import ok_, eq_
import pyconfig
def setup():
if not pyconfig.etcd().module:
raise SkipTest("etcd not installed")
if not pyconfig.etcd().configured:
raise SkipTest("etcd not configured")
pyconfig.set('pyconfig... | {
"content_hash": "0cda3984d95c19b2b2a835276fea1f42",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 85,
"avg_line_length": 31.636363636363637,
"alnum_prop": 0.6592432950191571,
"repo_name": "shakefu/pyconfig",
"id": "1b8e97433cb4bf0afdaba6add177560c2bac94f2",
"size": "41... |
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPT... | {
"content_hash": "52110936c0f1a4d658d1b86de764fe0e",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 99,
"avg_line_length": 30.234375,
"alnum_prop": 0.5074935400516796,
"repo_name": "bruecksen/isimip",
"id": "689251e52e8b68b139aeb165ea37551fa23b0e9a",
"size": "1959",
"bi... |
from c7n_gcp.provider import resources
from c7n_gcp.query import QueryResourceManager, TypeInfo
@resources.register('project-role')
class ProjectRole(QueryResourceManager):
"""GCP Project Role
https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles#Role
"""
class resource_type(TypeInfo... | {
"content_hash": "611b4e6ad255ec9704011cbc2e087d3c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 91,
"avg_line_length": 34.9078947368421,
"alnum_prop": 0.5571051639653223,
"repo_name": "capitalone/cloud-custodian",
"id": "c990dd2aa256ad6e8baaae48cafbefee57cb3c96",
"siz... |
import argparse
import json
import logging
import os
logging_format = '[%(levelname)s] %(message)s'
logging.basicConfig(level=logging.INFO, format=logging_format)
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
REPO_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, "../.."))
def get_files_to_compile(jso... | {
"content_hash": "467d4e0b46febc82256be4d6e4277e9c",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 76,
"avg_line_length": 28.607142857142858,
"alnum_prop": 0.599250936329588,
"repo_name": "tburgin/osquery",
"id": "0d36bf7507ceb5dc5510cc05e6f16245107c6e30",
"size": "3227... |
from Foundation import *
from PyObjCTools import Conversion
def myNewParser(result):
tempResult = NSString.alloc().initWithString_(unicode(result))
print tempResult
resultDict = tempResult.nsstring().propertyListFromStringsFileFormat()
return Conversion.pythonCollectionFromPropertyList(resultDict)
| {
"content_hash": "60a85f74f7eec31a711f5754ae35dfcf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.804416403785489,
"repo_name": "jweede/pyxg",
"id": "adb21d079ea907c6e76e83f8c29eaca4c605c2aa",
"size": "317",
"bi... |
from iptest.assert_util import *
from iptest.warning_util import warning_trapper
import sys
AreEqual(sys.exc_info(), (None, None, None))
def test_exception_line_no_with_finally():
def f():
try:
raise Exception() # this line should correspond w/ the number below
finally:
p... | {
"content_hash": "d44639559014ff73355c2c64694ea39e",
"timestamp": "",
"source": "github",
"line_count": 1038,
"max_line_length": 159,
"avg_line_length": 27.886319845857418,
"alnum_prop": 0.5230774545705797,
"repo_name": "paweljasinski/ironpython3",
"id": "8d2fe7d8439d4d2899904619bcea32fd4a452e07",
... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^addpayment$', views.addPayment.as_view(), name='addpayment'),
url(r'^paymentmethods$', views.paymentMethods.as_view(), name='paymentmethods'),
]
| {
"content_hash": "165044fb5ebf936ad148cd314c5b8811",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 85,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6735537190082644,
"repo_name": "The-Akatsuki/thirdp",
"id": "7a4975fee8762dacbbad362858bd19c2c4d01b69",
"size": "24... |
"""Class CollectiveAllReduceStrategy implementing DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distribute.python import cross_tower_ops as cross_tower_ops_lib
from tensorflow.contrib.distribute.python impo... | {
"content_hash": "aa0d049ce2a3b7381de0cef75cd1326b",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 101,
"avg_line_length": 39.410071942446045,
"alnum_prop": 0.6482292807594012,
"repo_name": "dongjoon-hyun/tensorflow",
"id": "d9339f8f75acda3695d33c55409e921a9627bac7",
"s... |
'''
Copyright 2015 Planet Labs, 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 by applicable law or agreed to in writing, software
... | {
"content_hash": "e0df141be6cf449b6408c64da10663fe",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 40.65079365079365,
"alnum_prop": 0.6884029675907849,
"repo_name": "planetlabs/radiometric_normalization",
"id": "d0bf9c089a0cbccb23636a4c0d210f2ad8670c... |
import matplotlib
# use the Tk backend
matplotlib.use('TkAgg')
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from mpl_toolkits.mplot3d import Axes3D
import os
import subprocess
import sys
import time
import Tkinter as tk
# Map fractals to ... | {
"content_hash": "c8bcc3ac20444f94ce783dd08a34d921",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 88,
"avg_line_length": 36.33125,
"alnum_prop": 0.5690693273696886,
"repo_name": "pauljxtan/fractals",
"id": "a267a29b34aa450f04e994a420ec0b927e402ec3",
"size": "5859",
"... |
from PyQt5.uic import loadUiType
from PyQt5.QtWidgets import QDataWidgetMapper
import os
ROOT_PATH = os.getcwd()
DynVarBase, DynVarForm = loadUiType(os.path.join(ROOT_PATH, 'CycleControl', 'dynamic_var_widget.ui'))
class DynamicVariableEditor(DynVarForm, DynVarBase):
def __init__(self, parent = None):
sup... | {
"content_hash": "607fb3a4cf3cdc383d75b1282dd6794b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 101,
"avg_line_length": 36.270270270270274,
"alnum_prop": 0.6788375558867362,
"repo_name": "ultracoldYEG/cycle-control",
"id": "9c668ed74872cefcf7e270e42934aa764a3576dd",
"... |
from financial_data_utils.libor.globalrates.service import Service
from financial_data_utils.libor.globalrates.parser import ParserHeaders, ParserValues
from collections import namedtuple
import datetime
class Libor :
Libor = namedtuple("Libor", ['date', 'overnight', 'week', 'month', 'month2', 'month3', 'month6'... | {
"content_hash": "2620351cefcac39ea0b5af0b7e25dfd6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 113,
"avg_line_length": 36.625,
"alnum_prop": 0.5537542662116041,
"repo_name": "creative-quant/financial-data-utils",
"id": "39b1dde44d18d567e98be4c950a603bf3641c06d",
"siz... |
"""
Development settings and globals.
"""
from .base import *
""" DEBUG CONFIGURATION """
# Disable debugging by default.
DEBUG = True
""" END DEBUG CONFIGURATION """
""" ALLOWED HOSTS CONFIGURATION """
ALLOWED_HOSTS = ['127.0.0.1',]
""" END ALLOWED HOSTS CONFIGURATION """
""" EMAIL CONFIGURATION "... | {
"content_hash": "5c64ed1c1a9d2ea42c617aeea824e8d2",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 80,
"avg_line_length": 25.78481012658228,
"alnum_prop": 0.605301914580265,
"repo_name": "ocefpaf/ODM2-Admin",
"id": "6710d10eac5c4eec71d1fe2c5321641600ac94c1",
"size": "203... |
'''
This script, when passed with location of a web log, returns the 10 most requested objects and their cumulative bytes transferred.
It only include GET requests with Successful (HTTP 2xx) responses.
To run:
python top10ObjectTransferred.py /path/to/web.log
'''
import sys
from collections import Counter
#Create new ... | {
"content_hash": "2545c35d16558ead9f488110deecca3a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 130,
"avg_line_length": 37,
"alnum_prop": 0.7719594594594594,
"repo_name": "singhjaideep/Stuff",
"id": "34b9e9cd1d871b39f80b3331b0476d6cfeb7b744",
"size": "1184",
"binary... |
from __future__ import division
__author__ = "Kishori M Konwar"
__copyright__ = "Copyright 2013, MetaPathways"
__credits__ = ["r"]
__version__ = "1.0"
__maintainer__ = "Kishori M Konwar"
__status__ = "Release"
try:
from os import makedirs, sys, remove, rename
from sys import path
import re, math, trace... | {
"content_hash": "ecae11476eaa06ea2f7e4fbb4526effb",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 203,
"avg_line_length": 33.15042735042735,
"alnum_prop": 0.5450420254731089,
"repo_name": "Koonkie/MetaPathways_Python_Koonkie.3.0",
"id": "613cf09d418c6792c95c41295161131b2... |
import codecs
import os.path
import xml.etree.ElementTree as ET
from contextlib import contextmanager
from io import BytesIO
import requests_mock
import six
__here__ = os.path.abspath(os.path.dirname(__file__))
def _parse_xml(data, strip_ns=False):
if six.PY2 and isinstance(data, six.text_type):
data = ... | {
"content_hash": "11c0d643cd19207b9e92e72fda279002",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 90,
"avg_line_length": 28.56,
"alnum_prop": 0.6162464985994398,
"repo_name": "beardypig/streamlink",
"id": "0a096e5c1694e326b4ecdb9801815f0f18ec36c5",
"size": "1428",
"bi... |
import json
from abc import abstractmethod
from django.utils.six import with_metaclass
from django.utils.html import format_html, mark_safe
from .utils import DateTimeEncoder, OptionsDict
class ChartMeta(type):
def __new__(cls, name, bases, attrs):
if 'options' in attrs:
options = OptionsDi... | {
"content_hash": "1fd8d2d0c81a5017a17fad410ec58399",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 69,
"avg_line_length": 19.87719298245614,
"alnum_prop": 0.6015004413062666,
"repo_name": "danpalmer/django-google-charts",
"id": "6ed9977468b6aa79181b08ea520fe9e3616a141d",
... |
import shutil
from cses.tasks.base import Base
template = """#!/usr/bin/env python3
# task: {0}
"""
class Py3Task(Base):
def __init__(self):
super().__init__("Python3", ["py3"], template)
def _prepare(self, filename):
shutil.copy2(filename, self.getfile())
return "", "", 0
def _... | {
"content_hash": "4ac4893cc655ae65edc8f8e2a56acd11",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 54,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.5837696335078534,
"repo_name": "JuhaniImberg/cses.py",
"id": "14018237835d8409e25d4dc4bff2a1a8e9f98d59",
"size": "... |
import string
import logging
from setup_logger import create_logger
logger = create_logger(name="aws_api_tools.py")
def api_response(statusCode=500, headers={'Content-Type':'text/html'}, body='Internal Service Error'):
if statusCode < 100 or statusCode > 599:
raise ValueError('Invalid HTTP statusCode')
... | {
"content_hash": "eb6cc6d0c298798c376984d04ef22cd7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 108,
"avg_line_length": 35.224137931034484,
"alnum_prop": 0.6079295154185022,
"repo_name": "1Strategy/security-fairy",
"id": "25d6505de5398b4d3ecf70177ac1a207334d307b",
"si... |
import distutils
from oslo_log import log as logging
import six
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine ... | {
"content_hash": "de3abe20fd8328335fc003694c7e17de",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 79,
"avg_line_length": 36.84324324324324,
"alnum_prop": 0.5283157276995305,
"repo_name": "dims/heat",
"id": "a87fc6ec26758f0b14acca6d1758d7a190ae6b92",
"size": "21082",
... |
from __future__ import division, unicode_literals
import numpy as np
from pymatgen.core.structure import Structure
from pymatgen.util.coord_utils import get_linear_interpolated_value
from monty.json import MSONable
"""
This module defines classes to represent the phonon density of states, etc.
"""
class PhononDos(M... | {
"content_hash": "5c575ddaaa865957328e407b65ccdb2b",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 77,
"avg_line_length": 30.31413612565445,
"alnum_prop": 0.573747841105354,
"repo_name": "xhqu1981/pymatgen",
"id": "03b099df6b0c1af8c108838bd71e9789524703b5",
"size": "590... |
from importlib import import_module
def __dir__():
"""
Using the __dir__ and __getattr__ functions allows
to inspect the availability of modules without loading them
:return:
"""
import pkgutil
names = [
name
for importer, name, ispkg in pkgutil.iter_modules(__path__)
... | {
"content_hash": "4e3f2737541590f8d527b2cf41f74fc6",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 26.846153846153847,
"alnum_prop": 0.5931232091690545,
"repo_name": "thouska/spotpy",
"id": "89ed286f7f280585f68117941cec6cbfd9622867",
"size": "1047"... |
import skbio
from ..plugin_setup import plugin
from . import NewickFormat
@plugin.register_transformer
def _1(data: skbio.TreeNode) -> NewickFormat:
ff = NewickFormat()
with ff.open() as fh:
data.write(fh, format='newick')
return ff
@plugin.register_transformer
def _2(ff: NewickFormat) -> skbio... | {
"content_hash": "d3a2cd4aa0d8991a020753685bdc9a8a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 23.72222222222222,
"alnum_prop": 0.6908665105386417,
"repo_name": "qiime2/q2-types",
"id": "cfa5e93485781135167fa00203c319d4d9e980e8",
"size": "777",... |
import unittest
from bok_choy.web_app_test import WebAppTest
from pages import GitHubSearchPage, GitHubSearchResultsPage
class TestGitHub(WebAppTest):
"""
Tests for the GitHub site.
"""
def setUp(self):
"""
Instantiate the page object.
"""
super().setUp()
self.g... | {
"content_hash": "9691bc13ddcabbccd294032f631c01be",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 90,
"avg_line_length": 24.612903225806452,
"alnum_prop": 0.6081258191349934,
"repo_name": "edx/bok-choy",
"id": "52fda6b14dab0e5f33fb9dd8990fd8a9ac9b0e04",
"size": "763",
... |
"""
Base Service class, which acts as a descriptor for an OpenStack service
in the test environment
"""
class Service(object):
def __init__(self, config):
"""
Initializes the service.
:param config: `tempest.config.Config` object
"""
self.config = config
def get_clie... | {
"content_hash": "34cbcf92d4af2a6bd1ced8aecbdcc7a9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 21.40909090909091,
"alnum_prop": 0.5944798301486199,
"repo_name": "armando-migliaccio/tempest",
"id": "e21092677d1f837c4c344330fd80f9aa0059c2a2",
"si... |
import os
import re
import numpy as np
import pytest
from astropy.table import Table
import astropy.coordinates as coord
import astropy.units as u
from astroquery.utils.testing_tools import MockResponse
from astroquery.utils import commons
from astroquery.ipac.irsa import Irsa, conf
from astroquery.ipac import irsa
... | {
"content_hash": "fcae81da23c13c8e6d1ac4f22a5bbe1f",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 80,
"avg_line_length": 33.89772727272727,
"alnum_prop": 0.6015755950385518,
"repo_name": "ceb8/astroquery",
"id": "abc7064168777408c31663bb3f522a388cadf532",
"size": "6031... |
"""
test_tokenizer
~~~~~~~~~~~~~~
Tests for the :mod:`~pai_parser.tokenizer` module.
"""
import collections
import pytest
import shlex
from pai_parser import tokenizer
@pytest.mark.parametrize('data', [
int(),
float(),
list(),
tuple(),
dict(),
set(),
object()
])
def test_lex... | {
"content_hash": "390d2ffbb3edf2a8986d1015cd069e8c",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 114,
"avg_line_length": 26.765432098765434,
"alnum_prop": 0.6646678966789668,
"repo_name": "ahawker/pai-parser",
"id": "97460cba50e317fedeb9a34a09038e25e8740c0f",
"size": "... |
from django.contrib.auth.models import User
from django.contrib import messages
from django.contrib.auth.signals import user_logged_in
from django.utils.translation import ugettext_lazy as _
from django.dispatch import receiver
from django.db import models
from easy_thumbnails.fields import ThumbnailerImageField
from... | {
"content_hash": "468d211d4d8a18766de2f15550caec9b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 116,
"avg_line_length": 45.87179487179487,
"alnum_prop": 0.6327557294577977,
"repo_name": "zerok/pyconde-website-mirror",
"id": "28be9f51543d274e59aeecd6b7a7bc46b167e603",
... |
"""Unicode string helper functions for UTF-16/32 variability.
Python has changed from always-16-bit Unicode strings to
sometimes-16-bit/sometimes-32-bit Unicode strings,
as indicated by sys.maxunicode.
The helper functions here deal with the differences.
"""
__author__ = "Markus Scherer"
import sys
class _UTF16(ob... | {
"content_hash": "2da27fdf41a507597c45dec4e4c87e66",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 71,
"avg_line_length": 22.64516129032258,
"alnum_prop": 0.7222222222222222,
"repo_name": "zentertainzhaomingliang/emoji4unicode",
"id": "92bd875c6ba033796551e13a7315a3a34c532... |
from __future__ import print_function
import contextlib
import json
import uuid
import sys
try:
from ipywidgets import DOMWidget
from traitlets import Unicode, Dict
except ImportError as err:
new_err = ImportError(
"vega.widget requires ipywidgets, which could not be imported. "
"Is ipywi... | {
"content_hash": "31f93ea24d410ed5005afd0f8110bdcf",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 78,
"avg_line_length": 29.96551724137931,
"alnum_prop": 0.6197928653624856,
"repo_name": "uwdata/ipython-vega",
"id": "d87486bcbe298d834027bfdcc2d64de1e5fd4222",
"size": "... |
"""
Created on Wed Jun 8 12:02:40 2016
@author: ericgrimson
"""
cube = 27
epsilon = 0.01
guess = 0.0
increment = 0.0001
num_guesses = 0
while abs(guess**3 - cube) >= epsilon:
guess += increment
num_guesses += 1
print('num_guesses =', num_guesses)
if abs(guess**3 - cube) >= epsilon:
print('Failed on cube ... | {
"content_hash": "51c6a41782b4aab4c0d03711a0ab15bf",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 54,
"avg_line_length": 19.9,
"alnum_prop": 0.6407035175879398,
"repo_name": "mkhuthir/learnPython",
"id": "6886f1d51cad05fdafd8d0a317defe170832c955",
"size": "422",
"bina... |
""" Defines a client class for working with a specific BitBucket repository's services. """
from bitbucket.urls import repository_services_url, repository_service_url
class BitBucketRepositoryServicesClient(object):
""" Client class representing the services under a repository in bitbucket. """
def __init__(self,... | {
"content_hash": "72f69d2831773bb6136db76107d29fc4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 46.723404255319146,
"alnum_prop": 0.6598360655737705,
"repo_name": "coreos/py-bitbucket",
"id": "ecc3de19c2eedab512438e874448c1cadd5a384d",
"size": "... |
"""Test generic alias support with mix of typing.py and stdlib types.
Possible with postponed evaluation enabled, starting with PY37.
"""
# flake8: noqa
# pylint: disable=missing-docstring,pointless-statement
# pylint: disable=too-few-public-methods,multiple-statements,line-too-long
from __future__ import annotations
... | {
"content_hash": "6e5f4f17a1707b4d442750b57fe07efd",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 136,
"avg_line_length": 32.31707317073171,
"alnum_prop": 0.780377358490566,
"repo_name": "ruchee/vimrc",
"id": "cb7a4d0f43a62f2d743f15e26872f10e3ee9f082",
"size": "1325",
... |
"""Package init file for telluride_decoding.
"""
# No imports here, instead use
# from telluride_decoding import XXX
# where XXX is the individual file name.
| {
"content_hash": "0bb204a291dcb0b5d3b1ad39f060567a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 27,
"alnum_prop": 0.7345679012345679,
"repo_name": "google/telluride_decoding",
"id": "b0f7080797f68e2de9774f10e236fb174306798b",
"size": "819",
"bi... |
from datetime import datetime
import os.path
import random
import re
from HTMLParser import HTMLParser
try:
import markdown
except ImportError:
pass
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse, Http404
from django.utils.functio... | {
"content_hash": "2841a35a209675c2f4cf3fee7d97e9a5",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 93,
"avg_line_length": 30.301003344481604,
"alnum_prop": 0.5934878587196468,
"repo_name": "SBillion/aegroupware",
"id": "3d8d43b3dd4da7661b3bd046373b3e5b10ff2b40",
"size":... |
"""
.. module:: test_mayer
:synopsis: Tests the ingestion of Mayer database
.. moduleauthor:: Ian Thomas <Ian.Edward.Thomas@rmit.edu.au>
"""
from django.test import TestCase
from smra.smra_portal.ReposPlugin import ReposPlugin
from smra.smra_portal.models import Repository
from smra.smra_portal.models import Syst... | {
"content_hash": "3347f8e87dd2c428b546e93537452077",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 384,
"avg_line_length": 38.177083333333336,
"alnum_prop": 0.5778990450204639,
"repo_name": "tectronics/mavrec",
"id": "5963ebb27936bc5d2721a545fe945ca0b74abeb4",
"size": "5... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | {
"content_hash": "b538e62976c38f1df98e84e9cf9264cf",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 37.023809523809526,
"alnum_prop": 0.7401929260450161,
"repo_name": "Diti24/python-ivi",
"id": "6ffc8a6d9de82802e86e17ea986fa974d435d4aa",
"size": "15... |
from flask import url_for
from flask_login import current_user
from werkzeug.exceptions import Unauthorized
from config import TRACKER_PASSWORD_LENGTH_MIN
from tracker.form.login import ERROR_ACCOUNT_DISABLED
from tracker.form.login import ERROR_INVALID_USERNAME_PASSWORD
from .conftest import DEFAULT_USERNAME
from .c... | {
"content_hash": "04fcb1d48422f097255dcd7c50e678ed",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 115,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.7186963979416809,
"repo_name": "anthraxx/arch-security-tracker",
"id": "823917baa1bbdbf8b90c56b9d4288ae38df24a62",... |
import copy
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from ceilometer import sample
def get_metadata_from_host(host_url):
return {'resource_url': urlparse.urlunsplit(host_url)}
def make_resource_metadata(res_metadata=None, host_url=None):
resource_metadata = dict()
... | {
"content_hash": "63af74002f928e68f01a38b7e9bb2870",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 31.404761904761905,
"alnum_prop": 0.6588324488248674,
"repo_name": "yanheven/ceilometer",
"id": "61c2159edb97ba7ad42adfb90dc44af023ebee7c",
"size": "... |
"""
Interpreting trees to graphs and configuring graphs to trees.
In order to serialize graphs into the PENMAN format, a tree-like
layout of the graph must be decided. Deciding a layout includes
choosing the order of the edges from a node and the paths to get to a
node definition (the position in the tree where a node... | {
"content_hash": "9c50be41f8d69399ef0bb8e15c4290a9",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 79,
"avg_line_length": 33.17462686567164,
"alnum_prop": 0.5581499977504837,
"repo_name": "goodmami/penman",
"id": "fc569dd3d9c7afc6efe70b29b21d1c9c8af2815b",
"size": "2225... |
import subprocess
from shlex import split
import sys
CGI = 'http://lain.sfc.wide.ad.jp/qkd/result.cgi'
cmd = "wget -q -O - --no-check-certificate --post-data 'result=" + sys.argv[1] + "' " + CGI
subprocess.call( split(cmd) )
| {
"content_hash": "c01e2a67a87741147fba2e7d93efc1ab",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 91,
"avg_line_length": 28.375,
"alnum_prop": 0.6740088105726872,
"repo_name": "iomz/qkd-laser-experiment",
"id": "a3d720745c71d9466467b81fe55e6f8861450909",
"size": "244",
... |
from rdlm.request_handler import RequestHandler, admin_authenticated
from rdlm.lock import LOCK_MANAGER_INSTANCE
from rdlm.hal import Resource
class ResourceHandler(RequestHandler):
"""Class which handles the /resources/[resource] URL"""
SUPPORTED_METHODS = ['GET', 'DELETE']
@admin_authenticated
def... | {
"content_hash": "91486d1cbb60e9567c583b9a28ce3a69",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 92,
"avg_line_length": 37.05555555555556,
"alnum_prop": 0.6251874062968515,
"repo_name": "thefab/restful-distributed-lock-manager",
"id": "04d58c7bf063c361a51f94804c5b06f41b6... |
from TileCache.Service import Request, Capabilities
import TileCache.Layer as Layer
class WorldWind (Request):
def parse (self, fields, path, host):
param = {}
for key in ['t', 'l', 'x', 'y', 'request']:
if fields.has_key(key.upper()):
param[key] = fields[key.upper()] ... | {
"content_hash": "842c19c4537d60684800a9be641c71df",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 105,
"avg_line_length": 39.06818181818182,
"alnum_prop": 0.4985456660849331,
"repo_name": "pcucurullo/groot",
"id": "665adc37d38968429c6bd3eb07c99b4b1269d71d",
"size": "350... |
import configparser
config = configparser.ConfigParser()
config.read('config.cfg')
main_pool = config.get('perf_tests', 'main_pool')
# zfs filesystems start with a pool name and have their paths seperated by
# forward slashes
test_filesystem_path = main_pool + '/' + config.get('perf_tests', 'test_filesystem')
# This... | {
"content_hash": "0eda528ceb3c4469fc9b6d1fd0f71b35",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 84,
"avg_line_length": 34.42307692307692,
"alnum_prop": 0.7418994413407821,
"repo_name": "stevenburgess/zfs-tests",
"id": "be875fdb1a09e4a4919d2e6ed8288270ec83e585",
"size"... |
from twilio.rest import TwilioRestClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)
# A list of account objects with the properties described above
accounts = client... | {
"content_hash": "3375b5d6bf3e0e45ffae9a93c5b90167",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 39.111111111111114,
"alnum_prop": 0.8039772727272727,
"repo_name": "teoreteetik/api-snippets",
"id": "b695abdf90b18e3460813128bf600d8cbe396efa",
"size... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import plot, figure, ion, Line2D, draw, arange #@UnresolvedImport
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class SimpleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
... | {
"content_hash": "6d97499c3be10ea3dcc04f05789744c3",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 76,
"avg_line_length": 27.8125,
"alnum_prop": 0.5420224719101123,
"repo_name": "daanwierstra/pybrain",
"id": "7be0a6dec36c84ac56dfb03958b8f7e504689594",
"size": "2225",
"... |
class PublicationFailed(Exception):
pass
| {
"content_hash": "8a11586414937d6530aa0b201a541d56",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 35,
"avg_line_length": 22.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "ONSdigital/eq-survey-runner",
"id": "d3a05faaadf1d86f12d9704bf4885fe804ee0a07",
"size": "45",
... |
"""Converts MSCOCO data to TFRecord file format with SequenceExample protos.
The MSCOCO images are expected to reside in JPEG files located in the following
directory structure:
train_image_dir/COCO_train2014_000000000151.jpg
train_image_dir/COCO_train2014_000000000260.jpg
...
and
val_image_dir/COCO_val2014... | {
"content_hash": "439b0910cf7347eff272232598493424",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 84,
"avg_line_length": 37.51716738197425,
"alnum_prop": 0.6609849568151919,
"repo_name": "MeteorKepler/RICGA",
"id": "d3f422f754d71886d52977f571eba39997a21645",
"size": "1... |
import json
from .visualization_user_query import visualization_user_query
from SBaaS_base.sbaas_template_io import sbaas_template_io
# Resources
from io_utilities.base_importData import base_importData
from io_utilities.base_exportData import base_exportData
from ddt_python.ddt_container import ddt_container
class vi... | {
"content_hash": "39d244bd590a44031ad50c10787f31c9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 35.56,
"alnum_prop": 0.6996625421822272,
"repo_name": "dmccloskey/SBaaS_visualization",
"id": "c3f6afe75097403ac5d6fd168e30b96ff83c0e9f",
"size": "89... |
from pyroman.document import Document
from pyroman.page import Page, Layout
from pyroman.box import Box
from pyroman.paragraph import Paragraph
from pyroman.construct import Construct
import pyroman.json as json
from pyroman.pdf.dimension import A4, MarginDefault
from tests.fixture import a4doc
from pyroman.parameters ... | {
"content_hash": "286e1c928404dbc40481bf81120cc0d4",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 31.65714285714286,
"alnum_prop": 0.6331227436823105,
"repo_name": "eblade/pyroman2",
"id": "fcd33da800edad60568694962958a5f82d07469e",
"size": "2216"... |
from django.contrib import admin
from snippets.models import Snippet
class SnippetAdmin(admin.ModelAdmin):
pass
admin.site.register(Snippet, SnippetAdmin) | {
"content_hash": "71cacc87baa7fa47161121bd39be166e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 20.125,
"alnum_prop": 0.8136645962732919,
"repo_name": "rishatsharafiev/crm",
"id": "6138c2e8a9e99b4482b676fb8f493355d2642f0c",
"size": "186",
"bina... |
"""Tests for tensor2tensor.envs.time_step."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensor2tensor.envs import time_step
import tensorflow.compat.v1 as tf
class TimeStepTest(tf.test.TestCase):
def test_create_time_step(self):
ts = ti... | {
"content_hash": "912f460accde9e7e467a3ec762c63e89",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 28.555555555555557,
"alnum_prop": 0.6747081712062257,
"repo_name": "tensorflow/tensor2tensor",
"id": "98476bb219027439d65cc77414ad6b3e89b65abf",
"siz... |
"""
Tools for drawing Python object reference graphs with graphviz.
You can find documentation online at https://mg.pov.lt/objgraph/
Copyright (c) 2008-2017 Marius Gedminas <marius@pov.lt> and contributors
Released under the MIT licence.
"""
# Permission is hereby granted, free of charge, to any person obtaining a
#... | {
"content_hash": "ec10514dbef81b5efdc566235f2da942",
"timestamp": "",
"source": "github",
"line_count": 1259,
"max_line_length": 79,
"avg_line_length": 34.5758538522637,
"alnum_prop": 0.5882015115664698,
"repo_name": "mgedmin/objgraph",
"id": "6c2c9417bb79e044fdcdcd862260a58bf649f1cd",
"size": "435... |
"""
Helper functions used in views.
"""
import calendar
import csv
import logging
import time
import locale
from datetime import datetime
from flask import Response
from functools import wraps
from json import dumps
from threading import Lock
from presence_analyzer.main import APP
locale.setlocale(locale.LC_COLLATE... | {
"content_hash": "552cd1ef17b2c97c0384d2cf717dfc65",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 79,
"avg_line_length": 27.83177570093458,
"alnum_prop": 0.537441235728677,
"repo_name": "stxnext-kindergarten/presence-analyzer-gderdak",
"id": "5ae45c814ded50f0a51088aa6721... |
import _plotly_utils.basevalidators
class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bgcolor", parent_name="histogram.hoverlabel", **kwargs
):
super(BgcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | {
"content_hash": "f876b2c149a3bea9077ad4f5557bfc4b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 81,
"avg_line_length": 34.6,
"alnum_prop": 0.5915221579961464,
"repo_name": "plotly/python-api",
"id": "0295abca82b3f62a6188071d1281ef13bf7cb937",
"size": "519",
"binary"... |
"""Tests for remote_executor_grpc_stub."""
from unittest import mock
from absl.testing import absltest
import grpc
import portpicker
import tensorflow as tf
from google.protobuf import any_pb2
from tensorflow_federated.proto.v0 import executor_pb2
from tensorflow_federated.proto.v0 import executor_pb2_grpc
from tens... | {
"content_hash": "420eb4a31d8bcc39e36c979f655170ff",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 85,
"avg_line_length": 38.49230769230769,
"alnum_prop": 0.7437050359712231,
"repo_name": "tensorflow/federated",
"id": "f143f8128eadd6580b3a4bba9ce60c5c9bc1edd3",
"size": ... |
"""
.. module:: server
:synopsis: SFlow UDP server
.. moduleauthor:: Colin Alston <colin@imcol.in>
"""
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from duct.protocol.sflow import protocol
from duct.protocol.sflow.protocol import flows, counters
class DatagramReceiv... | {
"content_hash": "701b316c7b3057c6f2893461550361df",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 73,
"avg_line_length": 31.796610169491526,
"alnum_prop": 0.6210021321961621,
"repo_name": "ducted/duct",
"id": "4ee70d52a7b79f341bf95dac9843f976d001e691",
"size": "1876",
... |
''' dbrev.nv_arg can be thought of as a bean or a template. It
has only attributes with getters and setters.
'''
import logging
LOG = logging.getLogger(__name__)
# LOG.setLevel(logging.INFO)
# Long lines expected.
# pylint: disable=C0301
# Cyclic imports protected by functions
# pylint: disable=R0401
class NvAr... | {
"content_hash": "08e964114ad70a86f4511cf1f7b5f042",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 91,
"avg_line_length": 35.41269841269841,
"alnum_prop": 0.5934558493948902,
"repo_name": "genevolv/dbrev",
"id": "2a41094c8eaa4c70c000af275969572f34f8ba41",
"size": "2231",... |
from oslo.config import cfg
class AgentModes:
AGENT = 'agent'
# TODO(armando-migliaccio): support to be added, maybe we could add a
# mixed mode to support no-downtime migrations?
AGENTLESS = 'agentless'
class MetadataModes:
DIRECT = 'access_network'
INDIRECT = 'dhcp_host_route'
nvp_opts =... | {
"content_hash": "a927fa5d5d98480348f12b762fc83d54",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 78,
"avg_line_length": 45.666666666666664,
"alnum_prop": 0.5724713242961418,
"repo_name": "ntt-sic/neutron",
"id": "12306b030fcb8fc588a0eade4b9f65f6f7b0859f",
"size": "736... |
"""
byceps.util.jobqueue
~~~~~~~~~~~~~~~~~~~~
An asynchronously processed job queue based on Redis_ and RQ_.
.. _Redis: http://redis.io/
.. _RQ: http://python-rq.org/
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from contextlib import contextmanager
from flask ... | {
"content_hash": "ec2cc497540f2bb84a78568949884a04",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 62,
"avg_line_length": 20.945945945945947,
"alnum_prop": 0.672258064516129,
"repo_name": "m-ober/byceps",
"id": "986ea4f067dad9c228713d9e7017ba6b28cff32f",
"size": "775",
... |
from clld.web.app import get_configurator
# we must make sure custom models are known at database initialization!
from autotyp import models
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = get_configurator('autotyp', settings=settings)
config.in... | {
"content_hash": "4fc305f5fc4b6658af697eb587b7403e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 32.38461538461539,
"alnum_prop": 0.7363420427553444,
"repo_name": "clld/autotyp",
"id": "0590e97614cce057479548f4409427ee826a6c4c",
"size": "421",
... |
"""Module containing flags applicable across benchmark run on IBM Cloud."""
from absl import flags
flags.DEFINE_string('ibmcloud_azone', None,
'IBMCloud internal DC name')
flags.DEFINE_integer('ibmcloud_volume_iops', 20000,
'Desired volume IOPS.')
flags.DEFINE_integer('ibmcl... | {
"content_hash": "19a63d68ace0419ada77c700ebc5b83e",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 75,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.6087275394206088,
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"id": "37964fe5ef397296275522b31af654802f9... |
""" TensorFlow ResNet model."""
from typing import Dict, Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACT2FN
from ...modeling_tf_outputs import (
TFBaseModelOutputWithNoAttention,
TFBaseModelOutputWithPoolingAndNoAttention,
TFImageClassifierOutputWithNoAttention,
)
from ..... | {
"content_hash": "6b53df25f36c403e7ccc7734cfaaf8d5",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 119,
"avg_line_length": 40.98973305954826,
"alnum_prop": 0.6520388738603347,
"repo_name": "huggingface/transformers",
"id": "4cf0d21ec777dbd0355f52ac808112b03ed15f5e",
"si... |
"""Module for the program settings pages.
"""
__authors__ = [
'"Sverre Rabbelier" <sverre@rabbelier.nl>',
]
from django.conf.urls.defaults import url
from django.core.urlresolvers import reverse
from soc.logic.models.document import logic as document_logic
from soc.views.forms import ModelForm
from soc.modules... | {
"content_hash": "a3cce4e15b2c13f411d84720ca994dc8",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 67,
"avg_line_length": 25.86813186813187,
"alnum_prop": 0.6265930331350892,
"repo_name": "SRabbelier/Melange",
"id": "9badef269509b44198c669ad3ce4bb9fd26c98a6",
"size": "29... |
from git.exc import InvalidGitRepositoryError, NoSuchPathError
from git.cmd import Git
from git.util import Actor
from git.refs import *
from git.index import IndexFile
from git.objects import *
from git.config import GitConfigParser
from git.remote import (
Remote,
digest_process_messages,
finalize_p... | {
"content_hash": "01d3f57ae0adaf1d56e89d7604757469",
"timestamp": "",
"source": "github",
"line_count": 762,
"max_line_length": 144,
"avg_line_length": 32.351706036745405,
"alnum_prop": 0.6875709881551193,
"repo_name": "ArnoVanLumig/set-seminar",
"id": "8882f66455240c660fd9679f71349b65b1481ae1",
"s... |
import os
import sys
import socket
from utils import *
import conf
class Base:
'''
Sub class should implement:
_alive, _pre_deploy, status, and init self.args
'''
def __init__(self, name, host, port, path):
self.args = {
'name' : name,
'host' : host,
... | {
"content_hash": "f2058c8ec02d9b01e59973cb38bd4ba2",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 87,
"avg_line_length": 32.58307210031348,
"alnum_prop": 0.5299211083317299,
"repo_name": "vipshop/twemproxies",
"id": "8771dc96ceeed63d765c20fb06566441e03d1c44",
"size": "... |
'''
Created on Oct 27, 2015
Logistic Regression Working Module
@author: Gu
'''
from numpy import *
def loadDataSet():
dataMat = []; labelMat = []
fr = open('testSet.txt')
for line in fr.readlines():
lineArr = line.strip().split()
dataMat.append([1.0, float(lineArr[0]), float(lineArr[1])])
... | {
"content_hash": "36743bf2ee1a5f151926206ec8fa01dc",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 102,
"avg_line_length": 34.93043478260869,
"alnum_prop": 0.6163803833706746,
"repo_name": "nicepear/machine-learning",
"id": "bfc79b975ad61c333078d17afe085f6d94547a86",
"s... |
"""Manage security group rules."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
COLUMNS = ['id',
'remoteIp',
'remoteGroupId',
'direction',
... | {
"content_hash": "92fc2990e39077d3a39db016a5e7feb2",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 82,
"avg_line_length": 32.63101604278075,
"alnum_prop": 0.5981645362176335,
"repo_name": "kyubifire/softlayer-python",
"id": "6d6c33c62bcfb997c28d2882a7b66cef9a39d26d",
"s... |
"""
Python Implementation for the Cavro XP3000 GUI.
The GUI is designed with regards to the MVC (Model View Controller)
Ui architectural pattern. Inside this module the View - Controller behaviors
are implemented while the Model behavior is implemented in the imported module:
pump_model.py
"""
# Sat May 24 10:5... | {
"content_hash": "ae09e0b8a4f591ff2bdf3ce4092f765f",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 89,
"avg_line_length": 34.23175965665236,
"alnum_prop": 0.5962888665997994,
"repo_name": "bergercookie/Pump3000",
"id": "9a18bfcaaac8ab72ad37e8d1d992dbd58cb152d0",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0012_auto_20161012_1218'),
]
operations = [
migrations.AlterField(
model_name='organization',
name='sou... | {
"content_hash": "887780acdd40b95eaf88119183554203",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 23.444444444444443,
"alnum_prop": 0.6137440758293838,
"repo_name": "datamade/django-councilmatic",
"id": "258843f4776a650eb3e9bdf6318977a5570de31a",
... |
r"""Conformer.
This model uses a conformer network to convert speech to text.
paper : https://arxiv.org/abs/2005.08100
high-level overview of Conformer encoder layer.
x = x + 0.5 * FeedForward(x)
x = x + MHSA(x)
x = x + ConvolutionBlock(x)
x = x + 0.5 * FeedForward(x)
y = layer_norm(x)
"""
import math
fro... | {
"content_hash": "3130d0577c92be8f18e6eebebb8b5e8c",
"timestamp": "",
"source": "github",
"line_count": 875,
"max_line_length": 127,
"avg_line_length": 34.753142857142855,
"alnum_prop": 0.6491499227202473,
"repo_name": "google/init2winit",
"id": "3898807fb153c3ca8e453793d19f42d6169a1297",
"size": "... |
from django.db import migrations
def drop_dynamic_theme_tag(apps, schema_editor):
Tag = apps.get_model('tags', 'Tag')
Tag.objects.filter(tag_text='dynamic theme').delete()
class Migration(migrations.Migration):
dependencies = [
('tags', '0002_auto_20210713_1131'),
]
operations = [
... | {
"content_hash": "fcea428846fba9151a85e37a627f028c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 22.058823529411764,
"alnum_prop": 0.656,
"repo_name": "wagnerand/addons-server",
"id": "9bf03ea2207f1a3281c3086baac39e36f3c2f5b1",
"size": "424",
"... |
import fileinput
import sys
from datetime import date
import time
import signal
import subprocess as sub
from ConfigParser import SafeConfigParser
from optparse import OptionParser
import argparse
from scapy.all import *
import select
from impacket import ImpactDecoder
from impacket import ImpactPacket
def printLine(... | {
"content_hash": "7c5537f4f2f1ae06a11f8d56cff440f6",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 117,
"avg_line_length": 32.66120218579235,
"alnum_prop": 0.583068428977748,
"repo_name": "nocow4bob/PiX-C2",
"id": "9dbd95091fef3f8613888ec43ee1fe6984dabafe",
"size": "122... |
import json
import os
import spacy
from nlaugmenter.interfaces.SentenceOperation import SentenceOperation
from nlaugmenter.tasks.TaskTypes import TaskType
from nlaugmenter.utils.initialize import spacy_nlp
class DyslexiaWordsSwap(SentenceOperation):
"""Altering some words with mistakes that are likely to happen... | {
"content_hash": "3266de5f4d6b91d8de1577ded98f3bd1",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 94,
"avg_line_length": 31.6984126984127,
"alnum_prop": 0.586379569354031,
"repo_name": "GEM-benchmark/NL-Augmenter",
"id": "28158fb788c07d1d1209b520e60441dfa13503e4",
"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": "75b67f27a058b367339c076dc17b07c7",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 194,
"avg_line_length": 49.065843621399175,
"alnum_prop": 0.7139981548268053,
"repo_name": "oleewere/ansible-ambari-manager",
"id": "e786bac353310cd70f399ea02ea0e22a5596bf7f... |
from setuptools import setup, find_packages
import sys, os
version = '2.3.0'
setup(name='fusionstorbackupstorage',
version=version,
description="ZStack FUSIONSTOR backup storage agent",
long_description="""\
ZStack FUSIONSTOR backup storage agent""",
classifiers=[], # Get strings from http://p... | {
"content_hash": "16083d52262f0064b654176deb42c809",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 95,
"avg_line_length": 31.153846153846153,
"alnum_prop": 0.6234567901234568,
"repo_name": "live4thee/zstack-utility",
"id": "47596947e18e7ccfa7572de4e6b2fba7404c8609",
"siz... |
"""Tests for manipulating AttachHandle via the DB API"""
from oslo_utils import uuidutils
from cyborg.common import exception
from cyborg.tests.unit.db import base
from cyborg.tests.unit.db import utils
class TestDbAttachHandle(base.DbTestCase):
def test_create(self):
random_uuid = uuidutils.generate_u... | {
"content_hash": "ad46992d22e4b3d09999b3fac6606cee",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 74,
"avg_line_length": 37.41732283464567,
"alnum_prop": 0.5875420875420876,
"repo_name": "openstack/nomad",
"id": "de0cae3ec83aaa15c9b1b7604890dc338f88b7ac",
"size": "5384... |
from __future__ import division
import numpy as np
from chainer.training import extension
class LinearShift(extension.Extension):
"""Trainer extension to change an optimizer attribute linearly.
This extension changes an optimizer attribute from the first value to the
last value linearly within a speci... | {
"content_hash": "59e9036a0a2e1cfda9f85a61c32a3dca",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 35.379746835443036,
"alnum_prop": 0.6221824686940965,
"repo_name": "kashif/chainer",
"id": "f021e974115526354b2b26516e61b15447abfa4c",
"size": "2795"... |
from subprocess import *
import os
##
## check datasets
##
print ("// check datasets \\\\")
c = "find ./datasets -name 'out.*' -type f"
handle = Popen(c, stdin=PIPE, stderr=PIPE, stdout=PIPE, shell=True)
stdout_value = handle.communicate()[0]
print stdout_value
dataset_files = stdout_value
print "-"*10
##
## check o... | {
"content_hash": "1b941f4686063925d4fd5a43cda86166",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 68,
"avg_line_length": 28.049180327868854,
"alnum_prop": 0.6633547632963179,
"repo_name": "nddsg/TreeDecomps",
"id": "1cc3b1d96ddafb288b04f5100a2e7297ac4c350e",
"size": "17... |
import nova.conf
from nova import context
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FloatingIpsBulkTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True
extension_name = "os-floating-ips-bulk"
def _get_flags(self):
f = super(FloatingIps... | {
"content_hash": "5d56fc7d5f67831451a9fce35f9c6382",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 73,
"avg_line_length": 37.9054054054054,
"alnum_prop": 0.5130124777183601,
"repo_name": "bigswitch/nova",
"id": "0af432e95f4cec13cbc9e31afcc2d05a2088a2e2",
"size": "3409",
... |
'''
Demonstration of learning how to play a VGDL game, when full state information
is *not* available, only observations are, and furthermore,
we don't have access to a model of the dynamics, only to a finite number of rollout sequences.
We use a neural network controller trained by the SNES algorithm.
@author: Tom... | {
"content_hash": "3b1320b6a3a765b13efd82dcd3210f20",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 156,
"avg_line_length": 33.229166666666664,
"alnum_prop": 0.6478578892371996,
"repo_name": "iKrishneel/py-vgdl",
"id": "5c59a20076fb070fbf199ba2388389bf03b31b82",
"size": ... |
from django import forms
from django.core import exceptions
from django.forms.models import inlineformset_factory
from django.utils.translation import ugettext_lazy as _
from treebeard.forms import movenodeform_factory
from oscar.core.loading import get_class, get_model
from oscar.core.utils import slugify
from oscar.... | {
"content_hash": "c47858ea8f156c4c176df57571053073",
"timestamp": "",
"source": "github",
"line_count": 478,
"max_line_length": 87,
"avg_line_length": 35.80962343096234,
"alnum_prop": 0.6164631652742887,
"repo_name": "okfish/django-oscar",
"id": "bc93f02d44d7b89d50904e18fa369a414c6ee298",
"size": "... |
from __future__ import (absolute_import, unicode_literals, division,
print_function)
from ... import units as u
from ..representation import SphericalRepresentation
from ..baseframe import (BaseCoordinateFrame, RepresentationMapping,
TimeFrameAttribute,
... | {
"content_hash": "2cc599a398bb1fdebf10547a60bc4550",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 106,
"avg_line_length": 46.827338129496404,
"alnum_prop": 0.6656936549393148,
"repo_name": "tbabej/astropy",
"id": "12e995b24f2b91752c512b7ea9ddedb5eb64696f",
"size": "659... |
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams.update(matplotlib.rcParamsDefault)
import matplotlib.style
matplotlib.style.use('seaborn-ticks')
from mpl_ic import image_comparison
from nose.tools import assert_raises
from nose.tools import raises
import numpy.testing... | {
"content_hash": "622f3e0d93c513a5502129ddc12ecfdb",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 79,
"avg_line_length": 34.233050847457626,
"alnum_prop": 0.632132689689318,
"repo_name": "urinieto/msaf",
"id": "8e775fa7b8daf3df926c374f98ba2d3fbf26fc09",
"size": "8176",... |
"""
pydoop.hdfs.file -- HDFS File Objects
-------------------------------------
"""
import os
import common
def _complain_ifclosed(closed):
if closed:
raise ValueError("I/O operation on closed HDFS file object")
class hdfs_file(object):
"""
Instances of this class represent HDFS file objects.
Objects... | {
"content_hash": "129571f72f2bff6771909353051a39f3",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 80,
"avg_line_length": 25.813031161473088,
"alnum_prop": 0.6209394205443372,
"repo_name": "jkahn/pydoop-code",
"id": "569cd45915d128dd90bd73cf6f509fce359eda3e",
"size": "9... |
import os
import io
import logging
import requests
from mimetypes import guess_type
from PIL import Image
from PIL import ImageOps
from django.db import migrations, models
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state i... | {
"content_hash": "3206a62f6d0dbf92c0d7f58e1a1abb3c",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 97,
"avg_line_length": 34.70175438596491,
"alnum_prop": 0.6199865183687226,
"repo_name": "amanharitsh123/zulip",
"id": "9a88727767687552cf4326ddc04d4d95a894ff04",
"size": ... |
"""
Object to represent a quantum circuit as a directed acyclic graph.
The nodes in the graph are either input/output nodes or operation nodes.
The operation nodes are elements of a basis that is part of the circuit.
The QASM definitions of the basis elements are carried with the circuit.
The edges correspond to qubit... | {
"content_hash": "af04033fdd471a0b9d72e789ae3bd51e",
"timestamp": "",
"source": "github",
"line_count": 1267,
"max_line_length": 91,
"avg_line_length": 45.4127861089187,
"alnum_prop": 0.5127741666377003,
"repo_name": "ChristopheVuillot/qiskit-sdk-py",
"id": "5a6770110654929ac4dc8d4d8c08d90a33c2af48",... |
''' Sample usage of function 'inventory_summary' to print a list of the inventory, with the connected status and number
of Netconf capabilities.
Print the function's documentation then invoke the function and print the output.
The related function `inventory()` returns only the name of each network d... | {
"content_hash": "f7280937eef6d240128c0ea8f001851f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 120,
"avg_line_length": 39.21739130434783,
"alnum_prop": 0.7283813747228381,
"repo_name": "tbarrongh/cosc-learning-labs",
"id": "077b70251960d03d499b6d13b3de9f94d6b83537",
... |
"""
Neural sheet objects and associated functions.
The Sheet class is the base class for EventProcessors that simulate
topographically mapped sheets of units (neurons or columns). A Sheet
is an EventProcessor that maintains a rectangular array of activity
values, and sends the contents of this array as the data eleme... | {
"content_hash": "3bb470af0b81f4aa6f9d9072ee3c4477",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 136,
"avg_line_length": 39.442567567567565,
"alnum_prop": 0.6613276231263383,
"repo_name": "jesuscript/topo-mpi",
"id": "290c894989cbb1a624925cba9517b665527f55b2",
"size":... |
import random
from django.contrib.auth.models import User
from notification.models import NoticeType, NoticeSetting, ObservedItem
def generate():
for user in User.objects.all():
for notice_type in NoticeType.objects.all():
en = random.random() <= 0.1
notice_setting = NoticeSetting... | {
"content_hash": "8dad6d692e53b21ebb680787ab5d0834",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 29.61904761904762,
"alnum_prop": 0.5562700964630225,
"repo_name": "ingenieroariel/pinax",
"id": "215b9c1051dc21554fd07b8ff6468ca8cd59b599",
"size": "... |
'''
Created on 2015-07-02
@author: mizhon
'''
import os
import time
import subprocess
from ADT.common import CommonActions
from Utility import util
from Logs import logger
log = logger.Log()
def main():
try:
console_args = CommonActions.ca_receive_console_args()
args_tpl = CommonActions.ca_g... | {
"content_hash": "5c420acff01b1aca74b196b8a381b348",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 73,
"avg_line_length": 26.464285714285715,
"alnum_prop": 0.5222672064777328,
"repo_name": "mizhon/tools",
"id": "94084e61a5afe630fcef3d72c43a6685d2c93cd6",
"size": "1528",
... |
import os
import unittest
from tethys_apps.static_finders import TethysStaticFinder
class TestTethysStaticFinder(unittest.TestCase):
def setUp(self):
self.src_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
self.root = os.path.join(self.src_dir, 'tests', 'apps', ... | {
"content_hash": "cc06e66391b137255eeaf527e3c3f7a5",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 99,
"avg_line_length": 35.23880597014925,
"alnum_prop": 0.6340533672172808,
"repo_name": "CI-WATER/tethys",
"id": "ea0bb1a414e3fb30af58b9a192adf729e36356e2",
"size": "2361"... |
import mock
import pytest
from datadog_checks.base import ConfigurationError
from datadog_checks.redis_sentinel import RedisSentinelCheck
METRICS = [
'redis.sentinel.odown_slaves',
'redis.sentinel.sdown_slaves',
'redis.sentinel.ok_slaves',
'redis.sentinel.ok_sentinels',
'redis.sentinel.known_senti... | {
"content_hash": "59c0de3df59bc46cd32525ef4828ff50",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 118,
"avg_line_length": 31.161616161616163,
"alnum_prop": 0.6774716369529984,
"repo_name": "DataDog/integrations-extras",
"id": "703152be9b964a6d51e28aa63537dcbf4eaca1c3",
... |
from .. import settings
from copy import copy
def _get_group_id_by_name(group_name, connection):
group = connection.getObject('ExperimenterGroup', attributes={'name': group_name})
if group:
return group.id
else:
return None
def _get_current_group_id(connection):
return connection.get... | {
"content_hash": "a74101a924965cabbe225698d3ba9dd0",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 86,
"avg_line_length": 27.651162790697676,
"alnum_prop": 0.6274179983179142,
"repo_name": "crs4/ome_seadragon",
"id": "f2c7dbd547b58e9a0fcd2906d95cd248d868a7d7",
"size": "2... |
from gzip import open as gzip_open
from shutil import copyfileobj, move
from Bio.bgzf import open as bgzf_open
def gzip_decompress_and_bgzip_compress_file(gzip_file_path):
with gzip_open(gzip_file_path) as gzip_file:
bgzip_file_path = gzip_file_path
bgzip_file_path_temporary = "{}.temporary".f... | {
"content_hash": "fd9108f0ac74a18db1b11c91eb49df48",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 85,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.7070175438596491,
"repo_name": "UCSD-CCAL/ccal",
"id": "aeb1971a6ae25fbc73836fe0a80fab9e3751ad64",
"size": "570",... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
# '-Wc++98-compat',
'-Wno-long-long',
'-Wno-v... | {
"content_hash": "f3fc80c1d8ae5a37c04c69eb0c0f6289",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 80,
"avg_line_length": 28.635467980295566,
"alnum_prop": 0.675038706347841,
"repo_name": "chxuan/samples",
"id": "aba10f84d0e813a3d4d062e30ac7f0f6a4f1c9f4",
"size": "7213"... |
from datetime import datetime
import sys
import time
import sqlite3
import hashlib
#TODO: make this as class
#class Utils:
pythonV2 = sys.version_info[0] == 2
DEBUG=True
DEBUG_FILE="debug.log"
ERROR_FILE="error.log"
def debug(str):
if DEBUG:
msg="%s: %s" % (datetime.now(),str)
if DEBUG_FILE is n... | {
"content_hash": "f426ab957be07637a55312c37301ac99",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 74,
"avg_line_length": 22.660377358490567,
"alnum_prop": 0.6353039134054954,
"repo_name": "samisalkosuo/mazingame",
"id": "99e548822a640b6cb70d8730d9ab243affe6efc9",
"size... |
import datetime
from django.test import TestCase
from django.urls.base import reverse
from mock import patch
from oauthlib.common import generate_token
from bridge_lti.models import LtiContentSource, LtiLmsPlatform
from module.mixins.views import GroupEditFormMixin
from module.models import (
Activity, BridgeUser... | {
"content_hash": "663fe6089620e75eed9ea51f5ed9eefb",
"timestamp": "",
"source": "github",
"line_count": 572,
"max_line_length": 117,
"avg_line_length": 44.57167832167832,
"alnum_prop": 0.6407138654638165,
"repo_name": "harvard-vpal/bridge-adaptivity",
"id": "64bf31ef0864dd09cdc945040d603d7b12a6cbc8",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.