text stringlengths 4 1.02M | meta dict |
|---|---|
"""Embeds Xwalk user data files in C++ code."""
import optparse
import os
import sys
import xwalk_paths
import cpp_source
sys.path.insert(0, os.path.join(xwalk_paths.GetSrc(), 'build', 'util'))
import lastchange
def main():
parser = optparse.OptionParser()
parser.add_option('', '--version-file')
parser.add_o... | {
"content_hash": "bd31117307609b8ae31d91f394a0d443",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 24.945945945945947,
"alnum_prop": 0.6370530877573131,
"repo_name": "chenhengjie123/crosswalk-web-driver",
"id": "c8fe19fceca27108e309fe5431ad8153c2034c... |
import csv
import datetime
import json
import logging
import urlparse
from cStringIO import StringIO
from django.conf import settings
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.urlresolvers import reverse
from django.core.validators import validate_ipv4_address, valida... | {
"content_hash": "17a5294018b4e836f93a1755fd9d9444",
"timestamp": "",
"source": "github",
"line_count": 1319,
"max_line_length": 122,
"avg_line_length": 39.25549658832449,
"alnum_prop": 0.5615705511993511,
"repo_name": "0x3a/crits",
"id": "a00a599d25e9b3118547c1698a04d199627b9816",
"size": "51778",... |
"""
Michael duPont
Primary routing controller
"""
import functools
import os
from json import load
from flask import jsonify
from TutorMatch import app
import TutorMatch.dbconn as db
##--- Custom Decorators ---##
def output_str(func):
"""This decorator adds the 'raw' boolean keyword to functions.
When applie... | {
"content_hash": "92803159faaa4e12bae7a3d9b3c09f19",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 87,
"avg_line_length": 32.58441558441559,
"alnum_prop": 0.6478676763650857,
"repo_name": "flyinactor91/Tutor-Match",
"id": "f9cf7e9fa5dee564a9ce2e58b1da42ffdf175842",
"siz... |
import numpy as np
from sklearn import preprocessing
from datetime import datetime
def _corr(C):
R=np.empty_like(C)
#compute correlation from covariance
for i,ci in enumerate(C):
for j,cij in enumerate(ci):
R[i,j] = cij / np.sqrt(C[i,i] * C[j,j])
return R
def pcaFun(x, whiten=False,e=0, type='cov', method='s... | {
"content_hash": "eb203333c666f974a9142dae4116da54",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 91,
"avg_line_length": 22.79230769230769,
"alnum_prop": 0.6270671616604793,
"repo_name": "Chiroptera/QCThesis",
"id": "7ecc13d3eec24f28aa8c95e4724d7b62446f2af5",
"size": "... |
from scipy.integrate import cumtrapz
from scipy.interpolate import griddata
from scipy.stats import lognorm
from scipy.optimize import curve_fit
import numpy as np
def fitLogNormParticleDistribution(D10, D50, D90):
'''
Fitting function to get the mu and sigma -parameters of the Log-normal
distribution fro... | {
"content_hash": "2cd8c73d04b53bf0e6c7792fba03bcc6",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 129,
"avg_line_length": 33.71212121212121,
"alnum_prop": 0.5941573033707865,
"repo_name": "ollitapa/MMP-TracerApi",
"id": "ab83042019f17b51c429a84a2a525cf15584ad2d",
"size... |
__docformat__ = "restructuredtext"
# Let users know if they're missing any of our hard dependencies
hard_dependencies = ("numpy", "pytz", "dateutil")
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(... | {
"content_hash": "ee1a2592bb7dcc80b46845b0ddc56d51",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 88,
"avg_line_length": 24.35799522673031,
"alnum_prop": 0.6286498138349991,
"repo_name": "rs2/pandas",
"id": "9505d0481ee197b190c5c911d9c04c6913bc6755",
"size": "10222",
... |
"""Data analysus
:copyright: Copyright (c) 2018-2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcollections
from pykern import pkconfig
from pykern.pkcollections import PKDict
f... | {
"content_hash": "de83ec1768173cffb40422a373fed210",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 88,
"avg_line_length": 30.685185185185187,
"alnum_prop": 0.6270368135184068,
"repo_name": "radiasoft/sirepo",
"id": "0c9d684696f0b22121240a906fcfa913a09314ca",
"size": "33... |
'''@file dbgru.py
contains de DBGRU class'''
import tensorflow as tf
import model
from nabu.neuralnetworks.components import layer
class LeakyDBGRU(model.Model):
'''A deep bidirectional GRU classifier with memory leakage'''
def _get_outputs(self, inputs, input_seq_length, is_training):
'''
C... | {
"content_hash": "3b24212a9a076d1cdc4689fd9409a7df",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 80,
"avg_line_length": 30.895522388059703,
"alnum_prop": 0.618840579710145,
"repo_name": "JeroenZegers/Nabu-MSSS",
"id": "648503496d6f2a4af808e2754973ca364957a348",
"size":... |
"""Unit tests for scripts/pylint_extensions."""
import os
import sys
import tempfile
import unittest
_PARENT_DIR = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
_PYLINT_PATH = os.path.join(_PARENT_DIR, 'oppia_tools', 'pylint-1.9.4')
sys.path.insert(0, _PYLINT_PATH)
# Since these module needs to be imported a... | {
"content_hash": "9eb1ad056841a7fdd7d8ef35d4e5f054",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 95,
"avg_line_length": 36.57142857142857,
"alnum_prop": 0.5879557291666667,
"repo_name": "souravbadami/oppia",
"id": "5445d35f4a59ff33ce7aadf76b169deda9caea5b",
"size": "1... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('conferences', '0001_initial'),
migrations.swappable_dependency(settings... | {
"content_hash": "6a635113f1ae17ff31459e7083193065",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 166,
"avg_line_length": 44.63157894736842,
"alnum_prop": 0.6079009433962265,
"repo_name": "jnayak1/osf-meetings",
"id": "1b452994037c1e36902de076ea556ce6aa8cdb81",
"size": ... |
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloudbreak is a RESTfu... | {
"content_hash": "e95d6704375953b9a2b168be8f48a2e0",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 984,
"avg_line_length": 30.386481802426342,
"alnum_prop": 0.60554383163178,
"repo_name": "Chaffelson/whoville",
"id": "4d2f26a539a50e60a90a2ec729d5c96419e2b995",
"size": "... |
'''
NAPALM CLI Tools: validate
===========================
Validating deployments from the shell.
'''
# Python3 support
from __future__ import print_function
from __future__ import unicode_literals
# import helpers
from napalm_base import get_network_driver
from napalm_base.clitools.helpers import build_help
from na... | {
"content_hash": "f5e0b8e8f52a86981b5933daa4578ae2",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 28.76595744680851,
"alnum_prop": 0.7085798816568047,
"repo_name": "napalm-automation/napalm-base",
"id": "825d79d729d55e1ef174c7a892a52aab7fe6490e",
... |
"""
neighbor/__init__.py
Created by Thomas Mangin on 2015-06-04.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
# import sys
import socket
from copy import deepcopy
from exabgp.protocol.family import AFI
from exabgp.protocol.family import SAFI
from exabgp.bgp.neighbor import Neighbor
from exabgp.bg... | {
"content_hash": "9bd9d5d5874a185515a75f5ec19a2d89",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 142,
"avg_line_length": 32.14049586776859,
"alnum_prop": 0.6799948572897917,
"repo_name": "blablacar/exabgp",
"id": "bbf5e7418e390463e55a6dc04948b3f62783b7ac",
"size": "77... |
import os
import argparse
import multiprocessing
import itertools
from datetime import datetime
import xarray as xr
from scipy.stats import moment
def get_stats(obs_dataarray):
noise_var = obs_dataarray['noise_var'].values
obs_arr = obs_dataarray['obs'].stack(s=['y', 'x']).values
m2_biased = moment(obs_a... | {
"content_hash": "0cf654151188c43eb5a93630f15bb7f6",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 78,
"avg_line_length": 38.13812154696133,
"alnum_prop": 0.581776039403158,
"repo_name": "piyanatk/sim",
"id": "7adec985e68d9a084f8ddab1581ba9252017970b",
"size": "6903",
... |
from panda3d.core import NodePath
from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from toontown.battle.BattleProps import globalPropPool
from direct.directnotify import DirectNotifyGlobal
SFX = PythonUtil.Enum('poof, magic')
SFXPATHS = {SFX.poof: 'phase_4/audio/sfx/firework_dis... | {
"content_hash": "a7ce255f5b846d943389a2aeab9001ec",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 291,
"avg_line_length": 33.94252873563219,
"alnum_prop": 0.5997290890619709,
"repo_name": "DedMemez/ODS-August-2017",
"id": "e4eec4891fa06d691ff83db004c0caaf1a5a5d4e",
"siz... |
import os
import tqdm
# Clean these folders and saved parsed version of them.
clean_folders = ["bnwiki", "arwiki", "ruwiki", "ptwiki", "idwiki"]
for i in range(len(clean_folders)):
clean_folder = clean_folders[i]
output_folder = clean_folders[i]+"_parsed"
os.mkdir(output_folder)
for folder in tqdm.tqd... | {
"content_hash": "5f643e7fe269fa3d8bfebc895fbb8aea",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 38.958333333333336,
"alnum_prop": 0.5508021390374331,
"repo_name": "keras-team/keras-nlp",
"id": "1caddcf8e3afbd1df8f33b1322baa6b2f0771fed",
"size": ... |
from django.dispatch import Signal
user_created = Signal(providing_args=['user'])
user_updated = Signal(providing_args=['user'])
user_deleted = Signal(providing_args=['user'])
user_groups_updated = Signal(providing_args=['user'])
user_confirmed = Signal(providing_args=['request', 'user'])
user_rejected = Signal(provi... | {
"content_hash": "e8ee137b321d40238f34034ae34aebe9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 59,
"avg_line_length": 44,
"alnum_prop": 0.7253787878787878,
"repo_name": "aipescience/django-daiquiri",
"id": "4f4cdc776e318b94fd2ace7c409a5e2076840584",
"size": "528",
... |
from kuai import Kuai, set_backend
set_backend('signal')
def hello(name):
print(f"Hello, {name}")
signal = Kuai.on('signal', hello)
signal("cymrow")
| {
"content_hash": "5b66cbd4e3a007c113663d1a3c4c7666",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 34,
"avg_line_length": 15.7,
"alnum_prop": 0.6751592356687898,
"repo_name": "Duroktar/Kuai",
"id": "975aeafb0c7d6ed50502f326bd5469b9110160e4",
"size": "157",
"binary": fa... |
from google.cloud import texttospeech_v1beta1
def sample_synthesize_speech():
# Create a client
client = texttospeech_v1beta1.TextToSpeechClient()
# Initialize request argument(s)
input = texttospeech_v1beta1.SynthesisInput()
input.text = "text_value"
voice = texttospeech_v1beta1.VoiceSelect... | {
"content_hash": "f5412f33a574c3b9e7b98fb57cf9d40a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 27.433333333333334,
"alnum_prop": 0.7193195625759417,
"repo_name": "googleapis/python-texttospeech",
"id": "a82e3d2b59bfe1ebcae416532d27baac06b2b189",
... |
import copy
from unittest import mock
import netaddr
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
from webob import exc
from nova.api.openstack.compute import hypervisors as hypervisors_v21
from nova import exception
from nova import objects
from nova import test
from ... | {
"content_hash": "4547c9e709db783c6ebe1b2a254d1ae0",
"timestamp": "",
"source": "github",
"line_count": 1533,
"max_line_length": 79,
"avg_line_length": 39.69341161121983,
"alnum_prop": 0.5717830731306491,
"repo_name": "openstack/nova",
"id": "a908988811f5d792e89a96aefd1b3d250bc0c1a6",
"size": "6149... |
import urllib2
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('url', help='The URL of the running Zuul instance')
parser.add_argument('pipeline_name', help='The name of the Zuul pipeline')
parser.add_argument('comment', help='The text of the Gerrit comment')
parser.add_argument('--r... | {
"content_hash": "88dce55ca1350152ec264732cb703344",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 36.56,
"alnum_prop": 0.6258205689277899,
"repo_name": "devdattakulkarni/zuul_messaging",
"id": "7fc541b1efc02351e50a9afcaa002999f99e8f4e",
"size": "1... |
"""This script handles all of the processing for versioning packages.
package_version.py manages all of the various operations done between
packages, including archiving, extracting, uploading, and downloading
packages. For a list of options and commands, see the help for the script.
Glossary:
Package: A list of ar... | {
"content_hash": "af8a6d6c845234af814c3cba416d16a0",
"timestamp": "",
"source": "github",
"line_count": 1293,
"max_line_length": 80,
"avg_line_length": 40.124516627996904,
"alnum_prop": 0.6715560609857173,
"repo_name": "endlessm/chromium-browser",
"id": "4a96086ca1621722c639aede0072547a750fa600",
"... |
from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import render_to_response
# Create your views here.
def index(request):
return render(request,'account/login.html')
| {
"content_hash": "7c4d9a65162871d6d931a9efb7f5a7c5",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.8009259259259259,
"repo_name": "cmput404wi16/metablog",
"id": "4029d3b58b979f3aac8ee175576901dc7da9fe42",
"size": ... |
"""Utilities for computing accuracy metrics on retrieved neighbors."""
import collections
import json
import os
from absl import flags
import numpy as np
from sklearn.metrics import average_precision_score
import tensorflow.compat.v1 as tf
flags.DEFINE_integer("max_examples", 1000, "Max num of candidates in records."... | {
"content_hash": "1585cd75fa7530771a1728669320b6e9",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 30.227027027027027,
"alnum_prop": 0.6389484978540773,
"repo_name": "google-research/language",
"id": "8cdb0a77571c9ce86ba748125a93c2c04f132f65",
"si... |
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import ... | {
"content_hash": "2ff49598cb7f9d6454c827ffd9c6fa55",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 114,
"avg_line_length": 51.59375,
"alnum_prop": 0.7201695941853422,
"repo_name": "Azure/azure-sdk-for-python",
"id": "057dc74d9708363de1bc864613da62efdce82dde",
"size": "37... |
from numpy import array, zeros, zeros_like, sqrt, diagflat, repeat
from .parsers import PdbParser
class UniverseFactory(object):
"""docstring for UniverseFactory"""
def __init__(self):
self.atoms = []
self.pdb_parser = PdbParser()
def add_atom(self, atom):
"""docstring"""
i... | {
"content_hash": "38269a73ea913496961cd55900401923",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 70,
"avg_line_length": 29.45614035087719,
"alnum_prop": 0.5848719475878499,
"repo_name": "grollins/sardine",
"id": "ba6432e55f2aa3ae4452079ce88ae2643549df2f",
"size": "1679... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "elevendance.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "dc136c46893e98266b328f3394cb9751",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.7155172413793104,
"repo_name": "paulmand3l/elevendance",
"id": "d65dfe9a62dcb5868277f45503a5c2e062a7d176",
"size": ... |
"""
Created on Mon Apr 24 12:25:17 2017
@author: dongyu
"""
import os
import utm
import glob
import shutil
import time
import lib
import lib.SUNTANS
import hydro_wrapper
import oilspill_wrapper
from DownloadTool import downloadROMS
from FileTool import increaseT2
from WindTool import NCEP_wind, TAMU_NCEP_wind
from Pro... | {
"content_hash": "f8cdbce6d1aa123bbf290e7403f2145a",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 135,
"avg_line_length": 34.411764705882355,
"alnum_prop": 0.5493477282950967,
"repo_name": "UT-CWE/Hyospy",
"id": "ef72809a074b652ab2bd20c68a02550118279837",
"size": "1113... |
from __future__ import unicode_literals
from xml.dom.minidom import parseString
from xml.etree.ElementTree import tostring, SubElement, Element
from datetime import datetime
from dateutil.parser import parse
from decimal import Decimal
import requests
from six.moves.urllib.parse import parse_qs
import six
from .constan... | {
"content_hash": "4b08e1047a9aac127118ebe9f7dcfd6c",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 105,
"avg_line_length": 37.39950980392157,
"alnum_prop": 0.5284749983616226,
"repo_name": "jacobg/pyxero",
"id": "f588fe4190d6f5b3f6f8feb2e66e29381c745716",
"size": "15259... |
from antlr4.RuleContext import RuleContext
from antlr4.Token import Token
from antlr4.error.ErrorListener import ProxyErrorListener, ConsoleErrorListener
# need forward delcaration
RecognitionException = None
class Recognizer(object):
tokenTypeMapCache = dict()
ruleIndexMapCache = dict()
def __init__(se... | {
"content_hash": "06920ea85cb4e95b9773531df708ec81",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 113,
"avg_line_length": 36.21935483870968,
"alnum_prop": 0.6442821517634485,
"repo_name": "damorim/compilers-cin",
"id": "01017351f62a7646e8a78e87a5c7ca2f11e0f35e",
"size"... |
import time
#path to
test_dataset = "/home/admin/compresion/dataset/test_set_tweets.txt"
training_dataset = "/home/admin/compresion/dataset/training_set_tweets.txt"
tweetstest = []
tweetstrai = []
#open files
try:
t1 = time.clock()
#output filename
w1 = open("todostweets", "a")
f1 = open(test_dataset, "r")
lin... | {
"content_hash": "7266313b4445fcaaea002e7b702aeb86",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 75,
"avg_line_length": 22.4,
"alnum_prop": 0.6180555555555556,
"repo_name": "pasilvagh/U",
"id": "8142c7386d009c30155c59b5e58ee40a3c4f69b3",
"size": "1029",
"binary": fal... |
"""Utils for manipulating program data.
"""
from datetime import date
from soc.models.document import Document
from soc.models.org_app_survey import OrgAppSurvey
from soc.models.site import Site
from soc.models.sponsor import Sponsor
from soc.models.user import User
from soc.modules.gci.models.organization import G... | {
"content_hash": "32d163e08308adfa173ee2bc3233a534",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 77,
"avg_line_length": 33.34444444444444,
"alnum_prop": 0.6551149616794402,
"repo_name": "adviti/melange",
"id": "ded354c6397f8d13b3d6e473b441c0f36e78b3c3",
"size": "9614"... |
def make_it_proper_to_grammar(transitions_str):
"""
:param transitions_str: {string} grammar
"""
grammar = transitions_str.split(' ')
initial_simbol = grammar[0]
non_terminals = set()
terminals = set()
temporary_alfa = ''
temporary_beta = set()
... | {
"content_hash": "85133f09ce5ecfc284a9ed30761f26d2",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 108,
"avg_line_length": 31.514705882352942,
"alnum_prop": 0.49416705552963136,
"repo_name": "w2srobinho/formais",
"id": "351d34d57c9a8e63b2cd23c0b7c800fd93ac3f76",
"size": ... |
import os
import sys
from pyqode.core.api import CodeEdit
from pyqode.core.backend import NotRunning
from pyqode.qt import QtWidgets
import pytest
from pyqode.qt.QtTest import QTest
from pyqode.core import backend
from pyqode.core.managers.backend import BackendManager
from ..helpers import cwd_at, python2_path, server... | {
"content_hash": "2e91c0b626d70c47758bc3a866102d9d",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 81,
"avg_line_length": 30.02061855670103,
"alnum_prop": 0.6854395604395604,
"repo_name": "pyQode/pyqode.core",
"id": "cf354b14e764ef4cad9cb4aba1cc7a167d69ca29",
"size": "29... |
import sys, os
sys.path.insert(0, os.path.normpath(os.path.join(os.getcwd(), '..', '..')))
import synctools
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make i... | {
"content_hash": "8808b8891f8d37b08c4739a829609471",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 80,
"avg_line_length": 32.35983263598327,
"alnum_prop": 0.7020946470131885,
"repo_name": "garcia/synctools",
"id": "04fee73aefb3d681154d027e6487485f31c85512",
"size": "815... |
'''OpenGL extension VERSION.GL_1_3_DEPRECATED
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_1_3_DEPRECATED to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_1_3_DEPRECATED.txt
'''
from OpenGL impo... | {
"content_hash": "1b240b349d50db4373f0bc1520453eb5",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 35,
"alnum_prop": 0.8,
"repo_name": "frederica07/Dragon_Programming_Process",
"id": "fedb384f3fc511676ffe261914e8c9aaa366bdb9",
"size": "525",
"bin... |
import unittest
from dedupe import predicates
from future.builtins import str
class TestPuncStrip(unittest.TestCase):
def test_sevenchar(self) :
s1 = predicates.StringPredicate(predicates.sameSevenCharStartPredicate,
'foo')
assert s1({'foo' : u'fo,18v*1vaad80... | {
"content_hash": "bb7516627ee7730546f6311c1b0af976",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 34.13636363636363,
"alnum_prop": 0.6168442077230359,
"repo_name": "01-/dedupe",
"id": "6d81e1abf1a195beb4831a85e4688394dd3dd0af",
"size": "3004",
"... |
from django.utils.encoding import smart_str
from hashlib import sha1
class Generator(object):
def generate_version(self, key, url, content):
return sha1(smart_str(content)).hexdigest()
def get_output(self):
"""
Generates content for production mode.
Yields tuples of... | {
"content_hash": "7254d0aa2cffcd7f2bdb6f06a79b9bf0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 65,
"avg_line_length": 27.55263157894737,
"alnum_prop": 0.5740210124164279,
"repo_name": "brunogamacatao/portalsaladeaula",
"id": "fe039cc182344df3ecc036db2980fd1090282c79",
... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "digits" , "oracle")
| {
"content_hash": "9d3e1bcc0e19ca463b86a16ebfbe6151",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 33.75,
"alnum_prop": 0.7777777777777778,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "312db9304b937fb63b458879fc6f3cab46577749",
"size": "13... |
__author__ = 'CubexX'
import hashlib
import time
from sqlalchemy import Boolean, Column, Integer, Text
from config import CONFIG
from confstat import cache
from main import make_db_session
from . import Base
class User(Base):
__tablename__ = 'users'
id = Column('id', Integer, primary_key=True)
uid = ... | {
"content_hash": "b683aa455ba7de154197bcfe40739ad4",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 85,
"avg_line_length": 27.096774193548388,
"alnum_prop": 0.515079365079365,
"repo_name": "CubexX/confstat-bot",
"id": "96bdc8f69e3c70f35672852eb73a7be8a8c3463c",
"size": "2... |
import snowflake.connector
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from airflow.hooks.dbapi_hook import DbApiHook
class SnowflakeHook(DbApiHook):
"""
Interact with Snowflake.
get_sqlalchemy_engine() depends on snowflake-sqlalchemy... | {
"content_hash": "e4924e6ff2b987916f1ce325e5144789",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 105,
"avg_line_length": 37.60176991150443,
"alnum_prop": 0.5900211814544599,
"repo_name": "r39132/airflow",
"id": "685d94c347e7ff23af667e82a91f5842bce05e6e",
"size": "5061... |
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Connect"
prefix = "connect"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
super().__init__(prefix, action)
class ARN(BaseARN):
def __init__(self, resource: str = "", region: str = "", a... | {
"content_hash": "8627c8be190853d76755b94ee2633ed2",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 88,
"avg_line_length": 51.55721393034826,
"alnum_prop": 0.8458940461256393,
"repo_name": "cloudtools/awacs",
"id": "53fab37fbfcc58bc196075ea1e5bcffd9f8705c4",
"size": "104... |
from __future__ import division, unicode_literals
"""
This is essentially just a clone of the MPRester object in pymatgen with
slight modifications to work with MaterialsWeb.
This module provides classes to interface with the MaterialsWeb REST
API v2 to enable the creation of data structures and pymatgen objects usin... | {
"content_hash": "24dfd3653ef21940786f68d3a1921108",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 80,
"avg_line_length": 36.6,
"alnum_prop": 0.5568439290950287,
"repo_name": "joshgabriel/MPInterfaces",
"id": "2c599b3d4bb757ebbb85ba2a62a2331595135a73",
"size": "7503",
... |
from __future__ import annotations
from functools import partial
from django.http import Http404
from waffle import switch_is_active, flag_is_active, sample_is_active
class BaseWaffleMixin:
def validate_waffle(self, waffle, func):
if waffle.startswith('!'):
active = not func(waffle[1:])
... | {
"content_hash": "5319d8947a43388e42ae08073a70b8f9",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 76,
"avg_line_length": 25.27777777777778,
"alnum_prop": 0.6434065934065935,
"repo_name": "rsalmaso/django-waffle",
"id": "1896ca3e762025d98642c86585f12d73bcdb9112",
"size":... |
"""
workplane
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from OpenGL import GL
from mcedit2.rendering.scenegraph import scenenode
from mcedit2.rendering.scenegraph.matrix import TranslateNode
from mcedit2.rendering.scenegraph.vertex_array import VertexNod... | {
"content_hash": "3dcadff7a415a0f77c3bfd2a490ae55c",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 86,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.6408573928258967,
"repo_name": "vorburger/mcedit2",
"id": "886cd08e38a57b1c642009401611a813495ffd69",
"size": "228... |
"""Tests for swift.obj.server"""
import six.moves.cPickle as pickle
import datetime
import json
import errno
import operator
import os
import mock
import six
from six import StringIO
import unittest
import math
import random
from shutil import rmtree
from time import gmtime, strftime, time, struct_time
from tempfile i... | {
"content_hash": "306e11300b309a20bc45ad963a101f84",
"timestamp": "",
"source": "github",
"line_count": 7838,
"max_line_length": 79,
"avg_line_length": 44.178744577698396,
"alnum_prop": 0.5278118709804114,
"repo_name": "nadeemsyed/swift",
"id": "a692a27b72f98d517420ac452729d2fa6062b936",
"size": "3... |
import logging
import peewee
from tornado.options import options
from src.models.vote import Vote, PlaylistVote
from src.models.media_item import MediaItem
from src.models.playlist_item import PlaylistItem
__all__ = (
'MediaItem', 'Vote'
)
models = [MediaItem, PlaylistItem, Vote, PlaylistVote]
if options.create_... | {
"content_hash": "40a5bd26a45919ecbcb916194678cea9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 31.608695652173914,
"alnum_prop": 0.6781292984869326,
"repo_name": "cthit/playIT-python",
"id": "e91b2c26c05cdefa0fa3178c13531beb74ad8758",
"size": "... |
import json
import aiohttp
from .settings import TELEGRAM_BOT_KEY
async def send_tg_message(chat_id, message):
async with aiohttp.ClientSession() as session:
async with session.post(
f'https://api.telegram.org/bot{TELEGRAM_BOT_KEY}/sendMessage',
json={"chat_id": chat_id, "text": ... | {
"content_hash": "7437843a38665864faeafea1cc490422",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 27.5,
"alnum_prop": 0.6415584415584416,
"repo_name": "sirmaahe/juan-the-manager",
"id": "9de7e2647a29afcccc19163739d48c825cabc9c5",
"size": "385",
... |
"""
Builder for Nordic nRF51 series ARM microcontrollers.
"""
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))... | {
"content_hash": "133c66b1747ef45866b2213539e37d2c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 20.170212765957448,
"alnum_prop": 0.6951476793248945,
"repo_name": "bkudria/platformio",
"id": "15e67cc23f5eeb08a1ccc6d0a7dbbcf0b9505993",
"size": "1... |
"""Support for exposing a templated binary sensor."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAM... | {
"content_hash": "b4fb758fef7bab748c4011cde2629529",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 88,
"avg_line_length": 32.91776315789474,
"alnum_prop": 0.5786949135605076,
"repo_name": "robbiet480/home-assistant",
"id": "94d0f9d597bcb4f46affb2fc6addf488a7ffaba1",
"si... |
from __future__ import unicode_literals
import hashlib
from django.db import migrations, models
def setPassword( user, password ):
user.password = hashlib.sha256( password.encode( 'utf-8' ) ).hexdigest()
user.save()
def load_users( app, schema_editor ):
User = app.get_model( 'User', 'User' )
u = User( use... | {
"content_hash": "93345da19e1a24d40b667913fdc5b56b",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 97,
"avg_line_length": 33.15094339622642,
"alnum_prop": 0.5737051792828686,
"repo_name": "Virtustream-OSS/packrat",
"id": "8fbb0678143c858fc4ac92a9eb8a1bfef13d8b3c",
"size"... |
"""
https://github.com/imlucas/flask-virtualenv
"""
from setuptools import setup
setup(
name='Flask-Virtualenv',
version='0.2.0',
url='http://imlucas.com',
license='BSD',
author='Lucas Hrabovsky',
author_email='hrabovsky.lucas@gmail.com',
description='Manage a virtualenv for your flask app... | {
"content_hash": "c9f148f5b2b992484d0613b9acb34c21",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 70,
"avg_line_length": 28.771428571428572,
"alnum_prop": 0.6067527308838133,
"repo_name": "marchon/flask-virtualenv",
"id": "aeef0823ee712dce0bd735f13a903bba37565c03",
"siz... |
from cactus.deployment.auth import BaseKeyringCredentialsManager
class CloudFilesCredentialsManager(BaseKeyringCredentialsManager):
_username_config_entry = "cloudfiles-username"
_password_display_name = "API Key"
_keyring_service = "cactus/cloudfiles"
| {
"content_hash": "3ece156141f98efdce0bfcdb585bdf92",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 66,
"avg_line_length": 38.142857142857146,
"alnum_prop": 0.797752808988764,
"repo_name": "koenbok/Cactus",
"id": "fc2c1f2127b70bddd78ee083acc068d8da76dfd2",
"size": "281",
... |
import numpy
import os.path
import glob
import re
import config
import util
import split
def components(arr):
'''Finds connected components of 2d array. Returns (mask,component_number) where:
mask: 2d array of the same size, where non-empty cell is marked by corresponding component number
component_numbe... | {
"content_hash": "e26a8376eee0712df9e70514f429cddd",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 117,
"avg_line_length": 34.8159509202454,
"alnum_prop": 0.5806167400881057,
"repo_name": "nekomiko/wkcaptcha",
"id": "fc456ca3838efefaf533db8db3db5a6119facd69",
"size": "5... |
from test_collective_base import TestCollectiveRunnerBase, runtime_main
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
from paddle.fluid import core
paddle.enable_static()
class TestCollectiveReduce(TestCollectiveRunnerBase):
def __init__(self):
self.global_ring_id = 0
... | {
"content_hash": "232adb7380092b88973efe3a348db45b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 71,
"avg_line_length": 31.591836734693878,
"alnum_prop": 0.5167958656330749,
"repo_name": "PaddlePaddle/Paddle",
"id": "7d122764f5d4da6b9a094faa4bbc9760e36c3774",
"size": "... |
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import password_reset_confirm, password_reset
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts... | {
"content_hash": "88a4f620dc7143b4506dd92f8803cb22",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 92,
"avg_line_length": 35.02105263157895,
"alnum_prop": 0.6299969942891493,
"repo_name": "MajinBui/django-portal",
"id": "9037b3c39d594f85a5d29612e237caf27d8af27f",
"size":... |
from runner.koan import *
class AboutStringManipulation(Koan):
def test_use_format_to_interpolate_variables(self):
value1 = 'one'
value2 = 2
string = "The values are {0} and {1}".format(value1, value2)
self.assertEqual("The values are one and 2", string)
def test_formatted_va... | {
"content_hash": "99706824374dc7bdf64f6bbc363f15f5",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 37.45205479452055,
"alnum_prop": 0.6185076810534016,
"repo_name": "klintwood/python_koans",
"id": "c9b5e8672a8ce806c6d09218a8041506b60f19e1",
"size":... |
import errno
import rospy
def wait_for(test, timeout=1.0, raise_on_error=True, rate=100,
timeout_msg="timeout expired", body=None):
"""
Waits until some condition evaluates to true.
@param test: zero param function to be evaluated
@param timeout: max amount of time to wait. negative/inf... | {
"content_hash": "e407b470f877dbf447fa35fe734cabdf",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 34.42424242424242,
"alnum_prop": 0.6214788732394366,
"repo_name": "UCRoboticsLab/BaxterTictactoe",
"id": "d3676d6014a1e83050429963623bd912879b5226",
... |
import ansible.runner
import ansible.inventory
import sys
import os
class AnsibleRunner(object):
def __init__(self, host=None, remote_user=None, remote_pass=None):
self.host_list = [host]
self.remote_user = remote_user
self.remote_pass = remote_pass
self.inventory = ansible.invent... | {
"content_hash": "fa8435cb83d04f9cf65e81a9d46a1ad8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 33.55357142857143,
"alnum_prop": 0.591271953166578,
"repo_name": "cisco-oss-eng/Cloud99",
"id": "059e00e54830a6a2204f34aafb2a7e67397818a7",
"size": "... |
from oneview_redfish_toolkit.api.redfish_json_validator \
import RedfishJsonValidator
class VLanNetworkInterface(RedfishJsonValidator):
"""Creates a VLanNetworkInterface Redfish dict
Populates self.redfish with ethernet network data retrieved
from OneView
"""
SCHEMA_NAME = 'VLanNetwo... | {
"content_hash": "968b2d09d11a423b09fa766521e8ff8b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 33.256410256410255,
"alnum_prop": 0.6368542791056284,
"repo_name": "HewlettPackard/oneview-redfish-toolkit",
"id": "646fa97403998d169cc8417ddf56769b21f... |
from __future__ import print_function
import copy
import os
import sys
import time
import unittest
from nose.plugins.skip import SkipTest
from nose.tools import assert_raises
import numpy
from six.moves import xrange
import theano
from theano import tensor, config
from theano.sandbox import rng_mrg
from theano.sandbo... | {
"content_hash": "2ba8d083669993ddbed24d843ad009d2",
"timestamp": "",
"source": "github",
"line_count": 1011,
"max_line_length": 79,
"avg_line_length": 35.56478733926805,
"alnum_prop": 0.5646345533429747,
"repo_name": "cmdunkers/DeeperMind",
"id": "ee064447cf6a382182dff9c1d91d459641ec04fc",
"size":... |
from trac.ticket.model import Ticket
from trac.core import Component, implements, TracError, ExtensionPoint
from trac.perm import IPermissionPolicy, IPermissionGroupProvider, PermissionSystem
from trac.util import as_bool
class SecretCheckboxTicketPolicy(Component):
implements(IPermissionPolicy)
def check_per... | {
"content_hash": "18d879bddb04da847c7a32d0a2b77a32",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 83,
"avg_line_length": 31.069767441860463,
"alnum_prop": 0.5718562874251497,
"repo_name": "104corp/trac-secret-checkbox-ticket",
"id": "1679068a5c17dadbee28bfed9e2f91a72a54ac... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_virtualmachineextension_info
version_added: "2.9"
... | {
"content_hash": "7a4de187b82e72427316baf8b703026a",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 150,
"avg_line_length": 31.483471074380166,
"alnum_prop": 0.5529597059981625,
"repo_name": "thaim/ansible",
"id": "de9d7975c20466abffa39c0f7fe4bfcad75abb6d",
"size": "7784... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SurveyQuestionResponse.positive_response'
db.add_column(u'survey_surveyquestionre... | {
"content_hash": "90d329f4d62772388810abddd6d12306",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 195,
"avg_line_length": 78.03030303030303,
"alnum_prop": 0.5511456310679612,
"repo_name": "myvoice-nigeria/myvoice",
"id": "dada04aa4ce6d6f6e64d8a9a4b9dce4006a272e7",
"siz... |
"""
command_line_runner.py
Created by Scott on 2014-08-14.
Copyright (c) 2014 Scott Rice. All rights reserved.
"""
import argparse
from pysteam.steam import get_steam, Steam
import tasks
from ice import decorators
from ice import debug
from ice import settings
from ice.logs import logger
from ice.filesystem import... | {
"content_hash": "c78042c343db84d363313452ee66d8a4",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 144,
"avg_line_length": 30,
"alnum_prop": 0.6895833333333333,
"repo_name": "scottrice/Ice",
"id": "c431470d4df534dfb99adef875135f74440cbad6",
"size": "2880",
"binary": fa... |
'''
Created on 08.02.2016.
@author: Lazar
'''
from textx.exceptions import TextXSemanticError
def selector_object_processor(selector_object):
if selector_object.property not in selector_object.object.properties:
line, col = selector_object._tx_metamodel.parser.pos_to_linecol(
selector... | {
"content_hash": "3af41523d670b8a943e81ede1904bdeb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 105,
"avg_line_length": 30.70967741935484,
"alnum_prop": 0.6386554621848739,
"repo_name": "theshammy/GenAn",
"id": "14a8db1d6581a44cb18ff8a6d176ccd91bc29b5d",
"size": "952"... |
"""Registers functions to be called if an exception or signal occurs."""
import functools
import logging
import signal
import traceback
from types import TracebackType
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Type
f... | {
"content_hash": "9b96fca3403636d160d91f40cd62d757",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 100,
"avg_line_length": 41.4,
"alnum_prop": 0.6600912506709609,
"repo_name": "lmcro/letsencrypt",
"id": "24ab46d9d19b583937dc5bdd7bdad6d44b9bdcf9",
"size": "7452",
"bina... |
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, ListView, UpdateView
from pretix.base.models import Organizer, OrganizerPermission
fr... | {
"content_hash": "fd2b0a659175c438430dbb420bb1caa4",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 80,
"avg_line_length": 34.470588235294116,
"alnum_prop": 0.6941126279863481,
"repo_name": "akuks/pretix",
"id": "4bb36da0034c6b34fe17c540c1103a82693cb9ef",
"size": "2344",
... |
class Node:
def __init__(self, value):
self._value = value
self._next = None
def value(self):
return self._value
def next(self):
return self._next
class LinkedIterator:
def __init__(self, linked_list):
self.current = linked_list._head
def __iter__(self):
... | {
"content_hash": "4393ff7c5d9a9261909dfdc9ced9caa6",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 58,
"avg_line_length": 22.157894736842106,
"alnum_prop": 0.5546318289786223,
"repo_name": "exercism/python",
"id": "f87b155e79ec80752120654634a37295b4a46e9b",
"size": "1684... |
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://pythonhosted.org/setuptools/easy_install.html
"""
from glob import glob
from ... | {
"content_hash": "7dd35f20c97b825d23ec21eaf1b8c751",
"timestamp": "",
"source": "github",
"line_count": 2323,
"max_line_length": 139,
"avg_line_length": 37.32199741713302,
"alnum_prop": 0.5776652556546211,
"repo_name": "harshita-gupta/Harvard-FRSEM-Catalog-2016-17",
"id": "0e0dc2c4f469839165b0ac820a4... |
x = input("Please insert the first number ")
y = input("Please insert the second number ")
print "The score is =", x + y
quit() | {
"content_hash": "5a7def16bd5ed29e4a2822d62bf098a9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 45,
"avg_line_length": 25.6,
"alnum_prop": 0.671875,
"repo_name": "codingsmartschool/PyMaIn",
"id": "0ac6deea136b17b4c2f0348be8c08f3025ab9673",
"size": "147",
"binary": fa... |
import os
from abc import abstractmethod
from pants.backend.jvm.tasks.classpath_entry import ClasspathEntry
from pants.base.build_environment import get_buildroot
from pants.engine.fs import Digest, PathGlobs, PathGlobsAndRoot
from pants.task.task import Task
from pants.util.dirutil import fast_relpath
class Resourc... | {
"content_hash": "b1872f963cd57a7c55bc7aca17a630da",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 100,
"avg_line_length": 37.6,
"alnum_prop": 0.6340868794326241,
"repo_name": "tdyas/pants",
"id": "9e6f06e337d86e22cfcb20bce284fefe8a6137fb",
"size": "4644",
"binary": f... |
"""
Тестового варианта доступа не существует, поэтому проверим отказ в доступе.
"""
from .common import CommonTestCase
class DenyTest(CommonTestCase):
def test_that_client_has_session(self):
self.assertTrue(self.client.session)
| {
"content_hash": "c1897ba8c7f2a539ea3921f3c3fc6e25",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 26.88888888888889,
"alnum_prop": 0.756198347107438,
"repo_name": "tigrus/dadata-python",
"id": "b32153a07f5bb584a0e46944d0cd1ac3a1719a7c",
"size": "32... |
import logging
import os
import sys
import tempfile
import unittest
# TODO: No idea why pytype cannot find names from this module.
# pytype: disable=name-error
import iree.compiler.tools.tf
if not iree.compiler.tools.tf.is_available():
print(f"Skipping test {__file__} because the IREE TensorFlow compiler "
... | {
"content_hash": "cd746dac47b0b19a2ec69129b0b8cfef",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 29.38961038961039,
"alnum_prop": 0.692001767565179,
"repo_name": "iree-org/iree",
"id": "fc1ee71660391b3f1369b4cb1e227a8f4eb153c6",
"size": "2481",
... |
from ctypes import *
import ctypes.util
import usb.util
from usb._debug import methodtrace
import logging
import errno
import sys
import usb._interop as _interop
import usb.util as util
import usb.libloader
from usb.core import USBError
__author__ = 'Wander Lairson Costa'
__all__ = [
'get_backend'
... | {
"content_hash": "0913049bfb1946c819dd462b75320e51",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 84,
"avg_line_length": 36.68941504178273,
"alnum_prop": 0.515051436814334,
"repo_name": "1upon0/rfid-auth-system",
"id": "c9b31c1504ee0fce59832ca433a958fcec924ba8",
"size"... |
"""
.. py:currentmodule:: pymcxray.FileFormat.Results.test_XraySpectraRegionEmitted
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module `XraySpectraRegionEmitted`.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = "0.1"... | {
"content_hash": "7e8063d4110a547cdbf98b1fcba6827b",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 114,
"avg_line_length": 43.38244514106583,
"alnum_prop": 0.6756268516511309,
"repo_name": "drix00/pymcxray",
"id": "1bda62fad712b1c510ca44d2b17bdb4c979f3ce9",
"size": "138... |
from . import fn
compile_fns_to_bash = fn.compile_fns_to_bash
compile_fn_spec_to_bash = fn.compile_fn_spec_to_bash
| {
"content_hash": "21c466c9822ffbd51630557b5d2a8e39",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 52,
"avg_line_length": 23.4,
"alnum_prop": 0.7350427350427351,
"repo_name": "themattrix/bashup",
"id": "b9501fb6ab842c8828aadbb7ec69dcd552ed6117",
"size": "117",
"binary":... |
from __future__ import absolute_import
from datetime import datetime, timedelta
from itertools import count
from time import time
from celery.schedules import schedule, crontab
from celery.utils.timeutils import timedelta_seconds
from djcelery import schedulers
from djcelery import celery
from djcelery.models import... | {
"content_hash": "1e8082e7e2ffe9e36a6173835007d8ab",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 79,
"avg_line_length": 36.07612456747405,
"alnum_prop": 0.5834452330711682,
"repo_name": "alexhayes/django-celery",
"id": "85a1042b0c54ef1c3cdbd041dbd0521023f71d1d",
"size... |
__author__ = 'chengxue'
from taskflow import task
from utils.db_handlers import tenants as db_handler
from utils.helper import *
from keystoneclient import exceptions as keystone_exceptions
LOG = logging.getLogger(__name__)
class UpdateProjectsQuotasTask(task.Task):
"""
Task to update quotas for all migrate... | {
"content_hash": "5cf870a04d47decaf52a483cdd1e99e4",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 78,
"avg_line_length": 40.888888888888886,
"alnum_prop": 0.5007411067193676,
"repo_name": "Phoenix1708/OpenAcademy_OpenStack_Flyway",
"id": "43fd134b1219779069a4d6fbd7edb40b6... |
"""Support for RESTful API."""
import logging
import httpx
DEFAULT_TIMEOUT = 10
_LOGGER = logging.getLogger(__name__)
class RestData:
"""Class for handling the data retrieval."""
def __init__(
self,
method,
resource,
auth,
headers,
data,
verify_ssl,
... | {
"content_hash": "723559a3a5368a353e5a48679a09db16",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 87,
"avg_line_length": 27.815384615384616,
"alnum_prop": 0.5459070796460177,
"repo_name": "sdague/home-assistant",
"id": "9d9e802c2a043c3b36c7c761c39be301025293de",
"size":... |
'''
Copyright (c) 2009, Patrick Maupin, Austin, Texas
A wrapper around subprocess that performs two functions:
1) Adds non-blocking I/O
2) Adds process killability and timeouts
Currently only works under Linux.
'''
import sys
import subprocess
import select
import os
import time
import textwrap
from signal impo... | {
"content_hash": "bd0d5784c5bb28345029d6ebbda21621",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 81,
"avg_line_length": 32.286842105263155,
"alnum_prop": 0.5513896813106203,
"repo_name": "openpolis/rst2pdf-patched-docutils-0.8",
"id": "d34e980891dc5f39af5962566cbc27ab41... |
import logging
from flask import current_app
from boiler.feature.orm import db
class AbstractService:
"""
Abstract service
Base class for services that encapsulates common model operations.
Extend your concrete services from this class and define __model__
"""
__model__ = None
__create_vali... | {
"content_hash": "69d36a36d3cf154fc7726effe18dab89",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 78,
"avg_line_length": 28.44927536231884,
"alnum_prop": 0.5453387671930718,
"repo_name": "projectshift/shift-boiler",
"id": "8d69bc250b08a13dd10633b1b7464415cc20ce6a",
"si... |
from django.db import models
class Airport(models.Model):
iata = models.CharField(max_length=3, null = True, blank=True)
icao = models.CharField(max_length=4, null = True, blank=True)
name = models.CharField(max_length=255)
city = models.CharField(max_length=255)
country = models.CharField(max... | {
"content_hash": "293a7564a7ffae257d83a3c0592cce81",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 43.8125,
"alnum_prop": 0.6904422253922967,
"repo_name": "illing2005/django-airports-apis",
"id": "75c679cfaa9c7fa4e08a1dfdc2672955f359c73f",
"size": ... |
import json
import warnings
import requests
class Connection:
"""
Handle connections to the KF5 API.
"""
def __init__(self, baseUrl, username, password):
self.valid = False
if baseUrl[-1:] != '/':
warnings.warn('Adding / to baseUrl', RuntimeWarning)
baseUrl = ... | {
"content_hash": "831707690ce0b2f9f38dcd0b7b0f9057",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 100,
"avg_line_length": 41.03225806451613,
"alnum_prop": 0.5932389937106918,
"repo_name": "problemshift/kf5py",
"id": "374bd2c8981feccfcd76df688f4a27de621b732a",
"size": "... |
import sys, rospy, math
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
class Motor():
def __init__(self):
if not self.set_power(True): sys.exit(1)
rospy.on_shutdown(self.set_power)
self.sub_raw = rospy.Subscriber('motor_raw', MotorFreqs, self.callback_raw_freq)
self.sub_cmd_vel = ... | {
"content_hash": "6d2438b861209e74796a8fa97511244c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 82,
"avg_line_length": 27.7,
"alnum_prop": 0.6582430806257521,
"repo_name": "HiroyukiAbe/pimouse_ros",
"id": "0ce468b46cf14bfd8c590e0ddda16d5c2aae76df",
"size": "1700",
"... |
import unittest
import iot_button
class FunctionalTest(unittest.TestCase):
def test_1(self):
event = {"batteryVoltage": "testing", "serialNumber": "testing", "not_a_real_clickType": "LONG"}
context = {"aws_request_id": "foo",
"log_stream_name": "foo",
"invoke... | {
"content_hash": "64395b4fdd5af341db3df582559afc25",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 104,
"avg_line_length": 27.78125,
"alnum_prop": 0.5140607424071991,
"repo_name": "nanderson/iot_button_lambda_handler",
"id": "7c56bb4611bc95c22744313f32e98d1c22c030f0",
"s... |
from __future__ import annotations
import ssl
import typing as t
import pytest
from neo4j import (
AsyncBoltDriver,
AsyncGraphDatabase,
AsyncNeo4jDriver,
ExperimentalWarning,
TRUST_ALL_CERTIFICATES,
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES,
TrustAll,
TrustCustomCAs,
TrustSystemCAs,
)
f... | {
"content_hash": "ab29262fd53db06b24680e41f7fc76a4",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 84,
"avg_line_length": 34.635,
"alnum_prop": 0.6271834849141043,
"repo_name": "neo4j/neo4j-python-driver",
"id": "693adf94ab6c726b23b9c3ceb64dc3c4f661ad98",
"size": "14497... |
def main():
parking_lots = get_array("../data/parkinglots.dat")
buildings = get_array("../data/buildings.dat")
print(buildings)
print(parking_lots)
def get_array(filename):
print(filename)
data_array = []
in_file = open(filename,"r")
max = len(in_file.readline().split())
... | {
"content_hash": "2facc66e56a15bb28907f9e23263bdb5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 55,
"avg_line_length": 27.68421052631579,
"alnum_prop": 0.5722433460076045,
"repo_name": "sremedios/ParkMT",
"id": "8bc60bb23d8090180c7087c96e417e4f31a1bb2d",
"size": "526"... |
"""
Simple Line Chart
-----------------
This chart shows the most basic line chart, made from a dataframe with two
columns.
"""
# category: simple charts
import altair as alt
import numpy as np
import pandas as pd
x = np.arange(100)
source = pd.DataFrame({
'x': x,
'f(x)': np.sin(x / 5)
})
alt.Chart(source).mark_... | {
"content_hash": "130b067a263862c61632df592ca567be",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 74,
"avg_line_length": 16.40909090909091,
"alnum_prop": 0.6177285318559557,
"repo_name": "jakevdp/altair",
"id": "7461362257f18c47c5d23aef81a44b7a1ba67677",
"size": "361",
... |
from __future__ import print_function, division
from sympy.logic.boolalg import And
from sympy.core import oo
from sympy.core.basic import Basic
from sympy.core.compatibility import as_int, with_metaclass, range, PY3
from sympy.sets.sets import (Set, Interval, Intersection, EmptySet, Union,
... | {
"content_hash": "2e5e2315d347c791d0646eee7f4926fb",
"timestamp": "",
"source": "github",
"line_count": 945,
"max_line_length": 99,
"avg_line_length": 29.72275132275132,
"alnum_prop": 0.5315793221304471,
"repo_name": "Curious72/sympy",
"id": "4f2c46c112a1139a59027f767060fd6ec3afa3ed",
"size": "2808... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
import os
from nose.plugins.attrib import attr
from jnpr.junos.device import Device
from jnpr.junos.rpcmeta import _RpcMetaExec
from jnpr.junos.facts.swver import version_info
from ncclient.manager import Manager, make_device_han... | {
"content_hash": "d26991d6f2b1e8908074c729428c1759",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 79,
"avg_line_length": 40.910828025477706,
"alnum_prop": 0.5881986610618091,
"repo_name": "fostasha/pynet_test",
"id": "8df095fdb8b3cde787749f11d30683f9e478e8dc",
"size": ... |
''' Tasks related to our celery functions '''
import time
import random
import datetime
import numpy as np
from io import BytesIO
from celery import Celery, current_task
from celery.result import AsyncResult
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figur... | {
"content_hash": "07dd8f60d8a7612175f7f25ccf3fb7a5",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 114,
"avg_line_length": 35.56818181818182,
"alnum_prop": 0.6442492012779553,
"repo_name": "will-jj/strava_flask",
"id": "bc76b2d7ce0aac53d45d167de42a496e23ca0510",
"size":... |
"""
For more details, see the class documentation.
"""
class LegislatorFilter:
"""
This class encapsulates functionality and data entities for filtering legislator data
based on the client's query.
"""
def __init__(self, north_east, south_west):
"""
Initializes the C{LegislatorFilt... | {
"content_hash": "b28426797a98f611e2d597ae4651028c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 89,
"avg_line_length": 23.352941176470587,
"alnum_prop": 0.6347607052896725,
"repo_name": "tushar-agarwal/map_annotate",
"id": "26441078a457a936ac1aac90f1a535a9a1c78dbf",
"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('job', '0022_jobtype_configuration'),
]
operations = [
migrations.AddField(
model_name='jobtype',
name='shared_mem_required',... | {
"content_hash": "31294fceb6d90533dacd997e1a2dc135",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 49,
"avg_line_length": 22.263157894736842,
"alnum_prop": 0.5933806146572104,
"repo_name": "ngageoint/scale",
"id": "f36487987176cbf1024f31ea9edf2694d460f063",
"size": "447"... |
"""Main API for Authbox.
Your business logic should subclass BaseDispatcher and set up your peripherals
in its __init__ method. Most simple uses will use callbacks for everything.
See two_button.py as an example workflow.
Peripherals are kept in other files in this same package, and should be listed
in CLASS_REGISTR... | {
"content_hash": "b3c14e04b576ea1ef5574ad54f6d8933",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 90,
"avg_line_length": 32.52261306532663,
"alnum_prop": 0.5894622991347342,
"repo_name": "thatch/makerspace-auth",
"id": "f8ec85ecc7addd67ebb5f22abbdb32538ce59999",
"size"... |
from django.utils.module_loading import import_string
from .app import AppConfig # noqa: F401
from .appmodel import AppModelConfig # noqa: F401
from .legacy import LegacyConfig # noqa: F401
from ..settings import PUSH_NOTIFICATIONS_SETTINGS as SETTINGS # noqa: I001
manager = None
def get_manager(reload=False):... | {
"content_hash": "e6902652e9459a4421a986116de46be6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 76,
"avg_line_length": 23.954545454545453,
"alnum_prop": 0.7647058823529411,
"repo_name": "rsalmaso/django-push-notifications",
"id": "4e798ccdc9b99b8140904d546fce1cce5342c32... |
"""Simple REST service for creating users with useradd"""
from __future__ import print_function
import json
import os
import sys
from pwd import getpwnam
from subprocess import Popen, PIPE
from tornado import gen, web
from tornado.log import app_log
from tornado.httpserver import HTTPServer
from tornado.ioloop impor... | {
"content_hash": "8c37592373a9242b7a213593670f7355",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 97,
"avg_line_length": 31.693877551020407,
"alnum_prop": 0.5943335479716677,
"repo_name": "kylemvz/nbhub",
"id": "911d6a3a84eba403d6cf607a2888567f5907f1d0",
"size": "3106",... |
"""Configuration system for CherryPy.
Configuration in CherryPy is implemented via dictionaries. Keys are strings
which name the mapped value, which may be of any type.
Architecture
------------
CherryPy Requests are part of an Application, which runs in a global context,
and configuration data may apply ... | {
"content_hash": "7a116c9b7c56015f07204cbf8f394f6d",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 79,
"avg_line_length": 37.08311688311688,
"alnum_prop": 0.5746305246200182,
"repo_name": "cread/ec2id",
"id": "f40e4fbfb5230a5036ba0cd5bf4ddd2ef2aa6db6",
"size": "14277",
... |
"""Unit tests for the API version support."""
import path_initializer
path_initializer.InitSysPath()
import unittest
from gcutil_lib import gcutil_unittest
from gcutil_lib import version
class VersionTest(gcutil_unittest.GcutilTestCase):
def testApiVersion(self):
api_version = version.get(self.version)
s... | {
"content_hash": "a5038592c23d60dadbd44acd6da95a62",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 73,
"avg_line_length": 28.702380952380953,
"alnum_prop": 0.6744089589382,
"repo_name": "ychen820/microblog",
"id": "0c8bf71685c89dc926b83702b4c47ab156571698",
"size": "3028... |
'''
The MIT License (MIT)
Copyright (c) 2016 Sean UN Wood
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 rights
to use, copy, modify, merge,... | {
"content_hash": "3d8803cbb24b54c94b9471b2d8d1d8bd",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 163,
"avg_line_length": 48.18181818181818,
"alnum_prop": 0.7835579514824798,
"repo_name": "seanwood/gcc-nmf",
"id": "7ea7a9e6d33edf7c57719c8fe8c740b9af8874c4",
"size": "371... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.