text stringlengths 4 1.02M | meta dict |
|---|---|
import json
import mimetypes
import os
import re
import sys
from copy import copy
from functools import partial
from importlib import import_module
from io import BytesIO
from urllib.parse import unquote_to_bytes, urljoin, urlparse, urlsplit
from django.conf import settings
from django.core.handlers.base import BaseHa... | {
"content_hash": "0a132932fbb32f6d57576fa290b6c9d3",
"timestamp": "",
"source": "github",
"line_count": 691,
"max_line_length": 112,
"avg_line_length": 38.894356005788715,
"alnum_prop": 0.6063402292007739,
"repo_name": "uranusjr/django",
"id": "6406f8309e7e28f9f88847f7cad7b611335c9de2",
"size": "26... |
import logging
import os
import pathlib
import time
import attr
import pytest
import salt.channel.client
import salt.config
import salt.master
import salt.utils.files
import salt.utils.platform
import salt.utils.user
log = logging.getLogger(__name__)
@attr.s(slots=True, hash=True, frozen=True)
class UserInfo:
... | {
"content_hash": "f3e008379daf2c9cb12b152acc73112e",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 90,
"avg_line_length": 31.909420289855074,
"alnum_prop": 0.5847621210400817,
"repo_name": "saltstack/salt",
"id": "e235864d088dcd277b1f61bdacbe294dcf00f3a3",
"size": "8807... |
from functools import wraps
from uuid import UUID
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
from django.utils.six.moves.urllib.parse import urlparse
from django.shortcuts import resolve_url, redi... | {
"content_hash": "a9dc9414b53022db50b3c86788f5b2a5",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 114,
"avg_line_length": 50.16326530612245,
"alnum_prop": 0.5921480878763222,
"repo_name": "gcrahay/fir_irma_plugin",
"id": "c1f802052fb3a4b6cb89b1af5848848a941b5570",
"size... |
from cairosvg import svg2png
from colour import Color
from flask import (abort, Blueprint, send_from_directory, render_template,
Response)
from findaconf import app
from random import choice, randrange
files = Blueprint('file_routes', __name__, static_folder='')
@files.route('/poster.png', method... | {
"content_hash": "69ed917b8a2ea3a70c487ddd5763194b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 30.423076923076923,
"alnum_prop": 0.6769911504424779,
"repo_name": "cuducos/findaconf",
"id": "32b056a1abe8d1816a913952623f9d432fa6be6d",
"size": "15... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Project'
db.create_table('todo_project', (
('id', self.gf('django.db.models.fields.AutoField')(p... | {
"content_hash": "993b264748577e7103622db849c1d468",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 189,
"avg_line_length": 61.04054054054054,
"alnum_prop": 0.5520256807615674,
"repo_name": "pythonbyexample/PBE",
"id": "638f4abae6b1b4886a4d86f47c3095925dd44993",
"size": ... |
'''
Created on 26 Oct. 2018
@author: alex
'''
from datetime import datetime
def date_string2datetime(date_string):
'''
Helper function to convert date string in one of several possible formats to a datetime object
@param date_string: date string in one of several possible formats
@ret... | {
"content_hash": "032f2c1b4701dd9b7d3c1e9b5ab7b334",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 99,
"avg_line_length": 35.78125,
"alnum_prop": 0.6218340611353712,
"repo_name": "alex-ip/geophys_utils",
"id": "af5e4c78f245fe6a721af70524cbb1be81dfb914",
"size": "1145",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('boundaries', '0003_auto_20180413_2120'),
]
operations = [
migrations.AddField(
model_name='city',
... | {
"content_hash": "f52a53a684899e8df65edcb936de3f70",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 117,
"avg_line_length": 28.78125,
"alnum_prop": 0.5819761129207384,
"repo_name": "hacklabr/geodjango-boundaries",
"id": "1a16e71d84f56b776cfe6ad263c5729ed860e5e6",
"size": ... |
import binascii
from botocore.utils import calculate_tree_hash
import click
__version__ = '0.1'
@click.command()
@click.option('--output', type=click.Choice(['ascii', 'binary']),
default='ascii', help='output format of Merkle Tree')
@click.argument('filename', type=click.File('rb'))
def cli(filename, o... | {
"content_hash": "9df8d917e25ad3639ee577fce323b9a9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 67,
"avg_line_length": 28.77777777777778,
"alnum_prop": 0.666023166023166,
"repo_name": "quiver/merkle_tree",
"id": "ea53e6c0e833a4d4cbb1d2b5ae98ddade6aaf3f9",
"size": "518... |
"""
WSGI config for zulip project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... | {
"content_hash": "232be63580e6812d805908bd1a198c26",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 38.97222222222222,
"alnum_prop": 0.7911617961511048,
"repo_name": "amanharitsh123/zulip",
"id": "9fbbafc5618b57e69c59e16102e661d68926402f",
"size": "... |
import __builtin__
openfiles = set()
oldfile = __builtin__.file
class newfile(oldfile):
def __init__(self, *args):
self.x = args[0]
#print "### OPENING %s ###" % str(self.x)
oldfile.__init__(self, *args)
openfiles.add(self)
def close(self):
#print "### CLOSI... | {
"content_hash": "c410cffce7df12e572475c64264579a3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 89,
"avg_line_length": 24.511111111111113,
"alnum_prop": 0.6436990027198549,
"repo_name": "cropleyb/pentai",
"id": "b36afc34843ae666fe7d115764d7178eb921f2fd",
"size": "1263... |
import _plotly_utils.basevalidators
class ShowlineValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showline", parent_name="layout.ternary.aaxis", **kwargs
):
super(ShowlineValidator, self).__init__(
plotly_name=plotly_name,
pare... | {
"content_hash": "a60d03bd86ef710a4a3f8b5ddf3498da",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 32.92307692307692,
"alnum_prop": 0.6121495327102804,
"repo_name": "plotly/plotly.py",
"id": "b48e7e1fa9fd78c05ebb1982fb1b9378ba1b9506",
"size": "428"... |
from __future__ import print_function, division, unicode_literals
__doc__="""
(GUI) Nudge-moves selected nodes by the values specified in the window. Vanilla required.
"""
import vanilla
import GlyphsApp
GSSteppingTextField = objc.lookUpClass("GSSteppingTextField")
class ArrowEditText (vanilla.EditText):
nsTextField... | {
"content_hash": "ab38e24c24ee215d8576037fd6c09697",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 151,
"avg_line_length": 36.189189189189186,
"alnum_prop": 0.6549663928304705,
"repo_name": "Tosche/Glyphs-Scripts",
"id": "d82b7a409766e92e61bf546377205e67bc9eeb43",
"size... |
from .utils import *
from .zap import *
| {
"content_hash": "d5a5daceb4ab3bf78112aa59baf1ebaf",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 20,
"avg_line_length": 20,
"alnum_prop": 0.7,
"repo_name": "musevlt/zap",
"id": "34995e4351765aba87e30937fd1021b8f8dbcbb4",
"size": "40",
"binary": false,
"copies": "1",... |
__author__ = 'popov.sn'
class ContactHelper:
def __init__(self, app):
self.app = app
def add_new_contact(self, contact):
wd = self.app.wd
self.go_to_new_contact_page()
self.fill_contact_form(contact)
wd.find_element_by_xpath("//div[@id='content']/form/input[21]").click... | {
"content_hash": "b0a9bde87dd9e27e771761f022f23ffd",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 92,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.5925242270419936,
"repo_name": "popovsn777/python_training_2",
"id": "476f661cd7ab51a807a266faddd5bd1c596778b5",
... |
"""
PySCeS - Python Simulator for Cellular Systems
(http://pysces.sourceforge.net)
Copyright (C) B.G. Olivier, J.M. Rohwer, J.-H.S. Hofmeyr
Stellenbosch, 2004-2015.
Triple-J Group for Molecular Cell Physiology
Stellenbosch University, South Africa
Author: Brett G. Olivier
PySCeS is Open Source Soft... | {
"content_hash": "9b809b875295ed222dae4431c88cee79",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 31.142857142857142,
"alnum_prop": 0.731651376146789,
"repo_name": "asttra/pysces",
"id": "f7c74a54cd8649d856acedbda8484c1b3677737c",
"size": "436",
... |
from handlers.base_handler import BaseHandler
class CatHandler(BaseHandler):
def get(self):
if self.request.cookies.get('remember'):
self.render("cats/index.html")
else:
self.render("cats/form.html")
def post(self):
if self.request.params.get('remember') == "on"... | {
"content_hash": "4000c6fc0b6acc931e3229ca91ad0be2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 55,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.6169429097605893,
"repo_name": "xstrengthofonex/code-live-tutorials",
"id": "cacead8374f8c7e6dd37ae151ec2affdb1ae47... |
"""Helpers for working with signatures in tf.saved_model.save."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import logging
from tensorflow.python.eager import def_function
from tensorflow.python.eager import function as defun
from tensorflo... | {
"content_hash": "daf6e873d1aa261db26ca638a1a7f007",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 116,
"avg_line_length": 43.06060606060606,
"alnum_prop": 0.705137227304715,
"repo_name": "freedomtan/tensorflow",
"id": "4250efd7c01e7e36e630b34b5f58d2959ea85e4a",
"size":... |
import unittest
import jsch
class KeywordAccessTestCase(unittest.TestCase):
def assertRaisesAttributeError(self, message):
regex = '^{0}$'.format(message)
return self.assertRaisesRegex(AttributeError, regex)
class TestAdditionalItemsKeywordAccess(KeywordAccessTestCase):
def test_read_proper... | {
"content_hash": "ff86fb440636578558380d43bb05b943",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 77,
"avg_line_length": 32.98272552783109,
"alnum_prop": 0.6656191806331471,
"repo_name": "rob-earwaker/jsch",
"id": "3ded4c8a43ad481f459c89a7dbf49a1cfc0f7efa",
"size": "17... |
import test.test_support, unittest
from sets import Set
import UserDict
class TestMappingProtocol(unittest.TestCase):
# This base class can be used to check that an object conforms to the
# mapping protocol
# Functions that can be useful to override to adapt to dictionary
# semantics
_tested_clas... | {
"content_hash": "9618ed0b464df5a15b2ab848809f022e",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 91,
"avg_line_length": 32.23132530120482,
"alnum_prop": 0.555622009569378,
"repo_name": "babble/babble",
"id": "41b9669effdbdaac38ce160ab8f691aea3ad7244",
"size": "13429",... |
import sys
from typing import List
from sinter._csv_out import CSV_HEADER
from sinter._existing_data import ExistingData
def main_combine(*, command_line_args: List[str]):
if command_line_args:
total = ExistingData()
for path in command_line_args:
total += ExistingData.from_file(path)... | {
"content_hash": "b5b5a2dff0465af33efd002d51b77a03",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 50,
"avg_line_length": 26.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "quantumlib/Stim",
"id": "f61e3086699aed851332d83ffcb0a86eb36ab052",
"size": "477",
"binary": ... |
from generateData import *
from gmm3 import *
X0train = generateDataCat('data/train.txt',0)
X1train = generateDataCat('data/train.txt',1)
# training
k0 = 4
k1 = 4
gmm0 = GMM(k0,X0train)
# train GMM0
gmm0.gmm(X0train,k0)
gmm1 = GMM(k1,X1train)
gmm1.gmm(X1train,k1)
X0dev = generateDataCat('data/dev.txt',0)
X1dev = ge... | {
"content_hash": "f62433c76becd0ba492ba9f898c9f798",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 45,
"avg_line_length": 20.375,
"alnum_prop": 0.6840490797546013,
"repo_name": "yysherlock/gmm-classifier",
"id": "7e7b52b8d31f1a879e14ff67cdfb2851d2f2bdb7",
"size": "978",
... |
"""
run with: sudo fig run web nosetests geolocator/app/tests/test_weighter.py
"""
from app.weighter import *
from app.geolocator import *
import unittest
from sqlalchemy import text
from nose.tools import nottest
class LocationAdminNamesTestCase(unittest.TestCase):
"""
Tests app.weighter.LocationAdminNames
... | {
"content_hash": "298bb13e5e243db69fe579e9c9110a36",
"timestamp": "",
"source": "github",
"line_count": 2161,
"max_line_length": 79,
"avg_line_length": 31.92133271633503,
"alnum_prop": 0.4299237482241744,
"repo_name": "gios-asu/text-geolocator",
"id": "1892a55377f11fa9d8fcd48b0b935fa3e30f4e40",
"si... |
"""
Django settings for SED project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bui... | {
"content_hash": "65c977646ca9698e671e3daf51ac9e9e",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 91,
"avg_line_length": 26.143939393939394,
"alnum_prop": 0.6879165459287163,
"repo_name": "abulbakha/sed",
"id": "ed71abf75a4407cdb7a37863f41a934c210a8685",
"size": "3451"... |
from bs4 import BeautifulSoup
import urllib
import urllib2
url = "http://www.portal.state.pa.us/portal/server.pt/community/2014/21611/february_2014_warn_notices/1725222"
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content)
for link in soup.find_all('a'):
print(link.get('href'))
for table in soup.... | {
"content_hash": "c3530a7372681ac21f72aee055df6653",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 110,
"avg_line_length": 25.928571428571427,
"alnum_prop": 0.7327823691460055,
"repo_name": "frankcash/Misc",
"id": "1ed8fb579d1011445f5a1793a216f93c740a41fb",
"size": "363"... |
"""
flexstation.py
.. moduleauthor:: Guillaume Prevost <[email protected]>
"""
import logging
from itertools import izip_longest, imap
from struct import unpack
from tardis.tardis_portal.models import Schema, DatafileParameterSet
from tardis.tardis_portal.models import ParameterName, DatafileParameter
... | {
"content_hash": "051a690eaf031a9abb4dc880ec6086d3",
"timestamp": "",
"source": "github",
"line_count": 908,
"max_line_length": 279,
"avg_line_length": 41.01211453744494,
"alnum_prop": 0.586589328392277,
"repo_name": "guillaumeprevost/hiri-tardis-filter",
"id": "316d2419884684d3d016cb51e03b3ea2cd7113... |
catNames = []
while True:
print('Enter the name of cat ' + str(len(catNames) + 1) + ' (Or enter nothing to stop.):')
name = input()
if name == '':
break
catNames = catNames + [name] # list concatenation
print('The cat names are:')
for name in catNames:
print(' ' + name)
| {
"content_hash": "950c8c7f85bf1cd0ec02df8bb23a1f6a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 94,
"avg_line_length": 30.1,
"alnum_prop": 0.584717607973422,
"repo_name": "vdrey/Toolbox",
"id": "ced2f3bb9d3dde93908930f41e84de47fa36665b",
"size": "301",
"binary": fal... |
import os
import sys
sys.path.insert(0, os.path.abspath('../../accelerometer/'))
# -- Project information -----------------------------------------------------
project = u'accelerometer'
copyright = u'2018, Aiden Doherty'
author = u'Aiden Doherty'
# The short X.Y version
version = u''
# The full version, including ... | {
"content_hash": "3f322326583d23a3224dffd2a71428a3",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 78,
"avg_line_length": 28.910714285714285,
"alnum_prop": 0.6403129503808935,
"repo_name": "aidendoherty/biobankAccelerometerAnalysis",
"id": "f37d73e8d0fca8aa3cb68394c9b37e0... |
"""SciPy: Scientific Library for Python
SciPy (pronounced "Sigh Pie") is open-source software for mathematics,
science, and engineering. The SciPy library
depends on NumPy, which provides convenient and fast N-dimensional
array manipulation. The SciPy library is built to work with NumPy
arrays, and provides many user-... | {
"content_hash": "d6b2b1c7d263bebb842501ca8e96da53",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 85,
"avg_line_length": 35.97342995169082,
"alnum_prop": 0.6082723427113409,
"repo_name": "gdooper/scipy",
"id": "6df8dbb2c0e84300a460c74685b40e359d96843f",
"size": "14915"... |
"""
Tracking of rotating point.
Rotation speed is constant.
Both state and measurements vectors are 1D (a point angle),
Measurement is the real point angle + gaussian noise.
The real and the estimated points are connected with yellow line segment,
the real and the measured points are connected with re... | {
"content_hash": "fee3516940c528cb97355d08aad0c785",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 88,
"avg_line_length": 34.694736842105264,
"alnum_prop": 0.5640169902912622,
"repo_name": "zzjkf2009/Midterm_Astar",
"id": "96a6fa6fe48d2f2d27c55aac698f8ae9ec5fb650",
"size... |
import os
import urllib
import urllib2
import elementtree.ElementTree as ET
import time
from datetime import datetime, timedelta
try:
from hashlib import md5
except ImportError:
from md5 import md5
__all__ = ['ApiClient']
def _local_date(string):
dt = datetime.strptime(string[0:25], '%a, %d %b %Y %H:%M... | {
"content_hash": "76877b2c030d5794d961028304c58699",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 106,
"avg_line_length": 30.264367816091955,
"alnum_prop": 0.5399734143562476,
"repo_name": "felixr/poodledo",
"id": "1b7cbecf518ad09fdfc9894d7f11cdc5edcbd1e0",
"size": "10... |
"""Tests for jax_cfd.equations."""
from absl.testing import absltest
from absl.testing import parameterized
import jax.numpy as jnp
from jax_cfd.base import advection
from jax_cfd.base import boundaries
from jax_cfd.base import diffusion
from jax_cfd.base import equations
from jax_cfd.base import finite_differences a... | {
"content_hash": "05b16e298dc2a25f9dcd1502df15dbe0",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 79,
"avg_line_length": 33.029535864978904,
"alnum_prop": 0.621486969851814,
"repo_name": "google/jax-cfd",
"id": "79bfeafe8cb54e97d91290bfe5d9458da367069e",
"size": "8404"... |
import numpy
import matplotlib.pyplot as plot
import time
import instrument
""" Example program to plot the Y-T data from Channel 1"""
# Initialize our scope
test = instrument.RigolScope("/dev/usbtmc0")
# Stop data acquisition
test.write(":STOP")
# start a single acquisition
#
test.write(":SINGLE")
# wait to com... | {
"content_hash": "e6af449a6a2acd68ae3c7d50560a99b2",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 78,
"avg_line_length": 24.74418604651163,
"alnum_prop": 0.6879699248120301,
"repo_name": "dboonz/DSO1002A",
"id": "fac04ce3da3ffbb8f776c01a9372220b833c69de",
"size": "2147"... |
import logging
import urllib.parse
from .stealth_engine import StealthEngine
log = logging.getLogger(__name__)
class AttackException(Exception):
pass
class Attack(object):
attack_name = None
def __init__(self, config_entry):
self.attack = None
for k, v in config_entry.items():
... | {
"content_hash": "44cb349f534d4c962a7f812713cfeb52",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 97,
"avg_line_length": 31,
"alnum_prop": 0.6031507876969242,
"repo_name": "glawler/rabidsqrl",
"id": "5fb84fdef2318b766b75340fd51de1d97afbfe9e",
"size": "1333",
"binary":... |
import torch
import progressbar
import math
import random
def normalize_with_singularity(x):
r"""
Normalize the given vector across the third dimension.
Extend all vectors by eps=1e-12 to put the null vector at the maximal
cosine distance from any non-null vector.
"""
S, H = x.size()
norm_... | {
"content_hash": "5dd6754a3b2bdee3c88513ec4bc3a3d5",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 120,
"avg_line_length": 35.47785547785548,
"alnum_prop": 0.5128777923784494,
"repo_name": "facebookresearch/libri-light",
"id": "51d46325e3a93ff6a724168119c43c35439bc76c",
... |
"""The CPIO directory implementation."""
from dfvfs.path import cpio_path_spec
from dfvfs.vfs import directory
class CPIODirectory(directory.Directory):
"""File system directory that uses CPIOArchiveFile."""
def _EntriesGenerator(self):
"""Retrieves directory entries.
Since a directory can contain a va... | {
"content_hash": "3fd867ffd78c2e55b786a92272dde023",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 33.93333333333333,
"alnum_prop": 0.6719056974459725,
"repo_name": "log2timeline/dfvfs",
"id": "f9e5615b9d5cd2a74ccc7f87b0b2d145b335f8ea",
"size": "15... |
from measurements import smooth_gesture_util
from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options
from telemetry.timeline.model import TimelineModel
from telemetry.page.actions import action_runner
from telemetry.value import trace
from telemetry.web_perf impo... | {
"content_hash": "ac4ead537188c525a6eac02a266399b2",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 78,
"avg_line_length": 36.23157894736842,
"alnum_prop": 0.720801859384079,
"repo_name": "sgraham/nope",
"id": "2348ec4a89d9f5db5850c3362b8f02b0ab9ff507",
"size": "3604",
... |
"""
Author: P Shreyas Shetty
Implementation of Newton-Raphson method for solving equations of kind
f(x) = 0. It is an iterative method where solution is found by the expression
x[n+1] = x[n] + f(x[n])/f'(x[n])
If no solution exists, then either the solution will not be found when iteration
l... | {
"content_hash": "b90eea83d9ff9250ee6218e8826dd1c3",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 87,
"avg_line_length": 33.77777777777778,
"alnum_prop": 0.6080043859649122,
"repo_name": "wuweilin/python",
"id": "f2b7cb9766d23ef8a1acb5b90b3841722be60257",
"size": "1824"... |
import sys
import os
import paramiko
remote_machines = os.environ['REMOTE_MACHINES']
remote_machines = remote_machines.split(', ')
print 'remote_machines', remote_machines
remote_dir=os.environ['REMOTE_DIR']
remote_dir=remote_dir.split(', ')
print 'remote_dir',remote_dir
remote_ip=os.environ['REMOTE_IP']
remote_ip=r... | {
"content_hash": "6ff5d4868e36948ab177750dfe7c60d1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 29.375,
"alnum_prop": 0.6345153664302601,
"repo_name": "hsiaoyi/Melo",
"id": "a35ce631e4e2af91e0e74d503ee234a9c06dbd13",
"size": "2133",
"binary": ... |
"""
py.test will automatically detect this file.
"""
import random
import pytest
from . import utils
from librmm_cffi import librmm_config as rmm_cfg
rmm_cfg.use_pool_allocator = True
from librmm_cffi import librmm as rmm
# Setup a fixture that is executed once for every test session to set
# a constant seed for the ... | {
"content_hash": "7bf2d1ba8f5bcb83b0af176f402a778a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 82,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.7215346534653465,
"repo_name": "gpuopenanalytics/libgdf",
"id": "8fb8a1ad4729b8b165e3d2e20f6470b354b6caf2",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('draftin', '0010_auto_20160904_1549'),
]
operations = [
migrations.AddField(
model_name='draft',
name='canonical_url',
... | {
"content_hash": "ae8fb6bc6d170e7ddd593544ea0c4732",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 26.25,
"alnum_prop": 0.5619047619047619,
"repo_name": "whatisjasongoldstein/django-draftin",
"id": "0b1c20e92f41841fa82ed27cf3300c34eb6d3627",
"size"... |
"""The IPython Core Notification Center.
See docs/source/development/notification_blueprint.txt for an overview of the
notification module.
"""
__docformat__ = "restructuredtext en"
#--------------------------------------------------------... | {
"content_hash": "14fc8b5e37fe4e5aea81e2b54c7edf44",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 102,
"avg_line_length": 35.3089430894309,
"alnum_prop": 0.5477780336173153,
"repo_name": "toomoresuch/pysonengine",
"id": "ee9701eccb9ed31cb0df1556598a825b003c0644",
"size... |
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Realm, UserProfile
class TestRealmInternalBotCreation(ZulipTestCase):
def test_create_if_missing_realm_internal_bots(self) -> None:
realm_internal_bots_dict =... | {
"content_hash": "9dae0405f2a2c40e51380fcf792a62eb",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 89,
"avg_line_length": 42.40909090909091,
"alnum_prop": 0.6516613076098606,
"repo_name": "zulip/zulip",
"id": "9ef66210b3c920c66a8961ab4e545d32a7871023",
"size": "933",
"... |
import rospy
import math
from tf import transformations
from geometry_msgs.msg import PoseWithCovarianceStamped
class PoseSetter(rospy.SubscribeListener):
def __init__(self, pose):
self.pose = pose
def peer_subscribe(self, topic_name, topic_publish, peer_publish):
p = PoseWithCovarianceStamp... | {
"content_hash": "aab7802a2f7cb7c28bf2a9cce1fd5341",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 95,
"avg_line_length": 34.096774193548384,
"alnum_prop": 0.641438032166509,
"repo_name": "OSUrobotics/privacy-interfaces",
"id": "997a0ffccac41b70c17b2b119693e881e02e6619",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('skalvi', '0010_participatein_user_profile_id'),
('skalvi', '0012_merge_20170313_1449'),
]
operations = [
]
| {
"content_hash": "d888a8434611504262396174046388a9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 57,
"avg_line_length": 19.642857142857142,
"alnum_prop": 0.6436363636363637,
"repo_name": "ung-it/UngIT",
"id": "7ca6de41fc2353a4d4b12d6116ad035d9cb84792",
"size": "348",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AccessRecord',
fields=[
... | {
"content_hash": "fd0547652fb8806792e877f5031f23b4",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 323,
"avg_line_length": 50.27272727272727,
"alnum_prop": 0.516998191681736,
"repo_name": "pobear/django-xadmin",
"id": "a1cacdfe6fdbc88d52d5c69f497953275dac3bf5",
"size": ... |
import numpy as np
import pandas as pd
from blight_risk_prediction import util, colmap
def make_owner_features(db_connection):
"""
Get the number of years that a home was owned by a corporation in last three years.
Input:
db_connection: connection to postgres database. "set schema ..." must have be... | {
"content_hash": "0dbc0d8d07924b252df08b2c74284fb3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 109,
"avg_line_length": 35.16279069767442,
"alnum_prop": 0.6084656084656085,
"repo_name": "dssg/cincinnati2015-public",
"id": "8b1527c7a39b0d2d2e74d80035fa2f30da2b84e1",
"s... |
import mock
from oslo_serialization import jsonutils
import six
from heat.common import exception
from heat.engine import constraints
from heat.engine.hot import functions as hot_funcs
from heat.engine.hot import parameters as hot_param
from heat.engine import parameters
from heat.engine import plugin_manager
from hea... | {
"content_hash": "46c2d2278ae09744397851eacce6bf17",
"timestamp": "",
"source": "github",
"line_count": 1923,
"max_line_length": 79,
"avg_line_length": 39.269890795631824,
"alnum_prop": 0.5152020763811642,
"repo_name": "noironetworks/heat",
"id": "cf5dd14ece1e9575fc0f90dd07ac082b3242c2ad",
"size": ... |
import json
import numpy as np
import pandas as pd
def get_json_data(filename):
with open(filename) as data_file:
return json.load(data_file)
class Batch():
def __init__(self, data, batch_size=None):
self.data = np.array(data)
self.batch_size = batch_size
self.shuffle().split(... | {
"content_hash": "557978c26736371dc8e0afb3e844ff50",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 31.625,
"alnum_prop": 0.5764163372859025,
"repo_name": "ansteh/strapping",
"id": "116092105af4f37b7537c61048b08f027302085e",
"size": "1518",
"binar... |
"""Implementation of the review subsystem."""
__author__ = [
'[email protected] (John Cox)',
]
import datetime
import random
from models import counters
from models import custom_modules
from models import entities
from models import student_work
from models import utils
import models.review
from modules.review... | {
"content_hash": "dfd8b956cdb5a42b66940c90c1427a22",
"timestamp": "",
"source": "github",
"line_count": 1066,
"max_line_length": 80,
"avg_line_length": 42.37523452157598,
"alnum_prop": 0.645333392366953,
"repo_name": "graemian/ami-mooc-pilot",
"id": "95865b297bb467393e65bd2e5a97e860408ccd97",
"size... |
from setuptools import setup
import asdoc2dash
def join_files(*files):
content = ""
for name in files:
f = open(name)
content += f.read() + "\n"
f.close()
return content
setup(
name = 'asdoc2dash',
version = asdoc2dash.__version__,
description = asdoc2dash.__doc__.stri... | {
"content_hash": "a980ad4ed93a95bb63add5f0cf6f0c45",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 30.128205128205128,
"alnum_prop": 0.5914893617021276,
"repo_name": "ton1517/asdoc2dash",
"id": "990b628b70254a7c4d5e9ee381409ac20ac6ff3d",
"size": "1... |
from oslo_config import cfg
CONF = cfg.CONF
class FakeVolume(object):
def __init__(self, **kwargs):
self.id = kwargs.pop('id', 'fake_vol_id')
self.status = kwargs.pop('status', 'available')
self.device = kwargs.pop('device', '')
for key, value in kwargs.items():
setatt... | {
"content_hash": "e0323d58f45f2de0e47f3fe8f66db3f5",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 55,
"avg_line_length": 22.982142857142858,
"alnum_prop": 0.567987567987568,
"repo_name": "NetApp/manila",
"id": "c4f87b34581dc437f5d377db5f3b01992d4317e0",
"size": "1923",
... |
__all__ = [
'HTML5TreeBuilder',
]
import warnings
from bs4.builder import (
PERMISSIVE,
HTML,
HTML_5,
HTMLTreeBuilder,
)
from bs4.element import NamespacedAttribute
import html5lib
from html5lib.constants import namespaces
from bs4.element import (
Comment,
Doctype,
NavigableStr... | {
"content_hash": "a7a307cdf3eaf6147b54eba631df8b85",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 159,
"avg_line_length": 35.44303797468354,
"alnum_prop": 0.6202380952380953,
"repo_name": "eclipselu/ppurl-alfred-workflow",
"id": "6ed505550e6dcc3f0263230c4513a646298ca69b"... |
from google.cloud import dialogflowcx_v3beta1
async def sample_delete_flow():
# Create a client
client = dialogflowcx_v3beta1.FlowsAsyncClient()
# Initialize request argument(s)
request = dialogflowcx_v3beta1.DeleteFlowRequest(
name="name_value",
)
# Make the request
await client... | {
"content_hash": "aa056f79a007bf9b979add7674f77ba3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 59,
"avg_line_length": 24.235294117647058,
"alnum_prop": 0.7233009708737864,
"repo_name": "googleapis/python-dialogflow-cx",
"id": "62341ff64555bc4f4a7d339eb9ece94bcc8bca02",... |
"""
Test exceptions in LTI provider.
"""
import logging
from django.http.response import Http404
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls.base import reverse
import mock
from mock import Mock
import pytest
from bridge_lti.provider import learner_f... | {
"content_hash": "ee61751559bd136fae005615c6351f61",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 112,
"avg_line_length": 36.24590163934426,
"alnum_prop": 0.681592039800995,
"repo_name": "harvard-vpal/bridge-adaptivity",
"id": "335b99b11c093df66cc624aec3eb02db3c645021",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('tokens', '0003_auto_20170224_0334'),
]
operations = [
migrations.AlterField(
model_name='abstracttoken',
name='t... | {
"content_hash": "74e9a3c27852f14906c5ed0225e49fef",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 105,
"avg_line_length": 23.68421052631579,
"alnum_prop": 0.6222222222222222,
"repo_name": "sebastienbarbier/723e_server",
"id": "c4fbf6339d687a25af5841d45bd0120c3683eece",
... |
import os
import sys
# Replace {{HDFS_MASTER}} with hdfs://freestyle
# Replace {{HDFS_PORT}} with 8020
# Replace {{EDGES_PATH}} and {{VERTICES_PATH}} with what you want to copy .e.g /home/icg27/lj_edges/ and /home/icg27/lj_pr/ . They are paths on hdfs.
# For testing you can comment out: ascii_to_binary("/tmp{{VERTICE... | {
"content_hash": "4b7e768bbedd40efec35b60359506900",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 173,
"avg_line_length": 43.95652173913044,
"alnum_prop": 0.5914935707220573,
"repo_name": "camsas/Musketeer",
"id": "491b0834320e1b398d76b56cf624d26dd9f0487a",
"size": "103... |
try:
import weechat, re #sys
except Exception:
print("This script must be run under WeeChat.")
print("Get WeeChat now at: http://www.weechat.org/")
quit()
SCRIPT_NAME = "spell_correction"
SCRIPT_AUTHOR = "nils_2 <[email protected]>"
SCRIPT_VERSION = "1.0"
SCRIPT_LICENSE = "GPL"
SCRIPT_DESC ... | {
"content_hash": "d7ff217f20e4c959b32624bef31f9b29",
"timestamp": "",
"source": "github",
"line_count": 658,
"max_line_length": 236,
"avg_line_length": 47.11854103343465,
"alnum_prop": 0.6388853051219198,
"repo_name": "MatthewCox/dotfiles",
"id": "155c39ab7d75fd1af22d880ee4e98bdee9752871",
"size": ... |
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import os
from django.core.management.base import BaseCommand
from optparse import make_option
from py3compat import PY2
from snisi_core.models.Entities import (
Entity, HealthEntity, Admini... | {
"content_hash": "c8115549100a8da906dd1309a0faf0b6",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 78,
"avg_line_length": 37.495652173913044,
"alnum_prop": 0.4837662337662338,
"repo_name": "yeleman/snisi",
"id": "c5dc3192fc0cbdc5a86db50020425f5df9fb08b4",
"size": "4391"... |
from geocode import getGeocodeLocation
import json
import httplib2
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
foursquare_client_id = "PASTE_CLIENT_ID_HERE"
foursquare_client_secret = "PASTE_CLIENT_SECRET_HERE"
def findARestaurant(meal... | {
"content_hash": "8533d23643d39815e9085d622250ea16",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 192,
"avg_line_length": 47.43076923076923,
"alnum_prop": 0.7314304249108011,
"repo_name": "tuanvu216/udacity-course",
"id": "12eb11dc8a7b4c6472aa1980482795e05fb406f9",
"siz... |
from __future__ import absolute_import
import math
from st2common.runners.base_action import Action
from six.moves import range
class PascalRowAction(Action):
def run(self, **kwargs):
# We call list values to verify that log messages are not duplicated when
# datastore service is used
tr... | {
"content_hash": "1664e05e88afd9217c3471ff14c5a932",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 81,
"avg_line_length": 32.24528301886792,
"alnum_prop": 0.545348156816852,
"repo_name": "StackStorm/st2",
"id": "cacb89d00532bd09f9b22a260b0090ab6bdf4da2",
"size": "2337",
... |
import sys
from stix.core import STIXPackage
def parse_stix(pkg):
print("== Campaign ==")
for camp in pkg.campaigns:
print("---")
print("Campaign: " + str(camp.title))
for tactic in camp.related_ttps:
ttp = pkg.find(tactic.item.idref)
print("RelatedTTP: " + st... | {
"content_hash": "83b5446c3c2e138f8b25fb306affcb57",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 68,
"avg_line_length": 25.25,
"alnum_prop": 0.562942008486563,
"repo_name": "jburns12/stixproject.github.io",
"id": "058114bc6fdc401f46a5b40265c52677ee863b54",
"size": "834... |
from exp_tools import Trial
from psychopy import visual, event
class FlashInstructions(Trial):
"""
Class that runs an Instructions trial. This is a parent for FlashInstructionsPractice.
A FlashInstructions trial draws a *single* text screen, records keyboard responses (response_keys,
scanner pulses, a... | {
"content_hash": "6f42ae228ae37871cbb329222414bc19",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 113,
"avg_line_length": 41.1044776119403,
"alnum_prop": 0.5498668603243767,
"repo_name": "StevenM1/flashtask",
"id": "f7a446188d1643b189372753a2a7b2e2b0d8d757",
"size": "8... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('server', '0010_team_courseorder'),
]
operations = [
migrations.AddField(
model_name='game',
name='initialVenueId',
... | {
"content_hash": "bc5bb28947aaaf873277b0e03c5c89c3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 96,
"avg_line_length": 23.61111111111111,
"alnum_prop": 0.6070588235294118,
"repo_name": "zackzachariah/scavenger",
"id": "8981d6d31c3d2cd5322ddd27ea42f1d2c1dfd136",
"size"... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Source',
fields=[
('id', models.AutoField(... | {
"content_hash": "f41d1248359311e2fde6d2b0ef106de7",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 201,
"avg_line_length": 53.64,
"alnum_prop": 0.5764354958985831,
"repo_name": "michaelkuty/django-newswall",
"id": "2d2434609ee2fb3bb9dabf8f16984376ca1bdf3e",
"size": "2706... |
import os
from binascii import hexlify
from torba.coin.bitcoinsegwit import MainNetLedger
from torba.client.wallet import Wallet
from client_tests.unit.test_transaction import get_transaction, get_output
from client_tests.unit.test_headers import BitcoinHeadersTestCase, block_bytes
class MockNetwork:
def __ini... | {
"content_hash": "06e1da6968a37bac1a01ed5a35aa9378",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 100,
"avg_line_length": 42.09036144578313,
"alnum_prop": 0.64219264348075,
"repo_name": "lbryio/lbry",
"id": "0e077b441e8ce6e9a1cce91898819c4767279434",
"size": "6987",
... |
from django.test import TestCase
from django.urls import reverse
# Create your tests here.
import datetime
from django.utils import timezone
from django.test import TestCase
from .models import Question
class QuestionMethodTests(TestCase):
def test_was_published_recently_with_future_question(self):
"... | {
"content_hash": "8dd755fa3b967a0607b2991c50a1fdfc",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 83,
"avg_line_length": 39.625,
"alnum_prop": 0.6510252365930599,
"repo_name": "kingartjr/example_django",
"id": "f7c596a90a013e13467712641980f6798ad56a78",
"size": "5072",... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.conf import settings
from django.apps import apps
@login_required
def index(request):
cd = {'apps': []}
for app in settings.JSONBENCH_APPS:
_app = apps.get_app_config(app)
cd['app... | {
"content_hash": "58b97ab3c2ace3aeebc1bf4500f91d95",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 70,
"avg_line_length": 37.92857142857143,
"alnum_prop": 0.6629001883239172,
"repo_name": "jonmsawyer/jsonbench",
"id": "cf4b97e1248c759d4de6b998a7931d620b71f0fe",
"size": "... |
from boto.ec2.elb.listelement import ListElement
# Namespacing issue with deprecated local class
from boto.ec2.blockdevicemapping import BlockDeviceMapping as BDM
from boto.resultset import ResultSet
import boto.utils
import base64
# this should use the corresponding object from boto.ec2
# Currently in use by depreca... | {
"content_hash": "83c2ddccd065933a7cc39ea2185cc095",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 132,
"avg_line_length": 38.1,
"alnum_prop": 0.6170261326029899,
"repo_name": "kyleknap/boto",
"id": "6d897fd2e31144fb45fa97e01e7158ada9b184f3",
"size": "9941",
"binary":... |
"""The synologydsm component."""
| {
"content_hash": "7a34496aa5a04aaf360d65eb50dfe841",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.696969696969697,
"repo_name": "jnewland/home-assistant",
"id": "137a3975b99e343dd92232000fb9c5600abcd515",
"size": "33",
"binary... |
import datetime
import time
try:
from pysqlcipher.libsqlite import *
except ImportError:
from pysqlcipher._sqlite import *
paramstyle = "qmark"
threadsafety = 1
apilevel = "2.0"
Date = datetime.date
Time = datetime.time
Timestamp = datetime.datetime
def DateFromTicks(ticks):
return Date(*time.localt... | {
"content_hash": "6f843495994aac5e1528b3fc9f47bf53",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 88,
"avg_line_length": 24.61764705882353,
"alnum_prop": 0.6678614097968937,
"repo_name": "hoffmabc/OpenBazaar",
"id": "78f340eeb6503e4d2825b674a8d6549f0f692254",
"size": "2... |
import os
from os.path import normpath
from unittest import mock
from mitmproxy.tools.console import pathedit
from mitmproxy.test import tutils
class TestPathCompleter:
def test_lookup_construction(self):
c = pathedit._PathCompleter()
cd = os.path.normpath(tutils.test_data.path("mitmproxy/compl... | {
"content_hash": "91b3b69096b24761200436fc6e6d9230",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 31.23611111111111,
"alnum_prop": 0.5775900400177857,
"repo_name": "StevenVanAcker/mitmproxy",
"id": "b9f51f5aa510f9c75303cb79b7a2d02578b59aaf",
"size... |
from qds_sdk.qubole import Qubole
from qds_sdk.sensors import FileSensor, PartitionSensor
from airflow.exceptions import AirflowException
from airflow.hooks.base_hook import BaseHook
from airflow.sensors.base_sensor_operator import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
class QuboleSe... | {
"content_hash": "e921859b9a15d640125db3f2ab06fec0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 89,
"avg_line_length": 33.18840579710145,
"alnum_prop": 0.6406113537117903,
"repo_name": "yk5/incubator-airflow",
"id": "d67fa8557e7ad3fc0db99208f6e72a2b26cb8865",
"size": ... |
from PIL import Image
from PIL import ImageFile
from io import BytesIO
from PIL import _webp
_VALID_WEBP_MODES = {
"RGB": True,
"RGBA": True,
}
_VP8_MODES_BY_IDENTIFIER = {
b"VP8 ": "RGB",
b"VP8X": "RGBA",
b"VP8L": "RGBA", # lossless
}
def _accept(prefix):
is_riff_file_format = pref... | {
"content_hash": "0820a1178e10504d9c1d40a03b6e01bd",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 92,
"avg_line_length": 24.636363636363637,
"alnum_prop": 0.6099103848181339,
"repo_name": "poojavade/Genomics_Docker",
"id": "90e2b540e64d7a4902ebc481d1ae886efd1fa7fa",
"si... |
import math
import os
import tensorflow as tf
from im2txt import configuration
from im2txt import inference_wrapper
from im2txt.inference_utils import caption_generator
from im2txt.inference_utils import vocabulary
# Directory containing model checkpoints.
CHECKPOINT_DIR="/home/oleg/Desktop/ImageCaptioning/im2txt/m... | {
"content_hash": "480110d75c5adbfda11cc907468c5f31",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 92,
"avg_line_length": 30.821428571428573,
"alnum_prop": 0.727694090382387,
"repo_name": "BAILOOL/Assistant-for-People-with-Low-Vision",
"id": "25ba8afd9809415683cf2a244acb51... |
log_new = True
log_updated = True
log_unchanged = True
import os
import filecmp
jpeg_files = []
# Walk the hd directory to get a list of files in hd-textures.
for root, _, files in os.walk('hd'):
for f in files:
if f.endswith('.jpg'):
# Since this is a jpeg file, we want to consider it.
... | {
"content_hash": "8515f9c191aec42d98cd0fd4087d490e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 103,
"avg_line_length": 36.53191489361702,
"alnum_prop": 0.6022131624927198,
"repo_name": "ttws4/RESOURCESFORNIGGERS",
"id": "d7454dd681db98993cb2f9bbefe59db7988af8fd",
"si... |
"""empty message
Revision ID: 822389978719
Revises: None
Create Date: 2017-10-17 15:49:01.970182
"""
# revision identifiers, used by Alembic.
import sqlalchemy_utils
revision = '822389978719'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by A... | {
"content_hash": "136a462409c7b0b447dad26428d00aca",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 94,
"avg_line_length": 51.3189448441247,
"alnum_prop": 0.6564018691588785,
"repo_name": "lina9527/easybi",
"id": "d18a3920b4a38fe3503028b5c7567169f4a55886",
"size": "21400... |
"""
raven.contrib.django.handlers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from raven.handlers.logging import SentryHandler as BaseSentryHandler
class S... | {
"content_hash": "419af02943a9850ba3ac01aa19fcdddc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 98,
"avg_line_length": 28.25,
"alnum_prop": 0.6891592920353983,
"repo_name": "alex/raven",
"id": "275aa2769d16647d3716eb91043949de447e937c",
"size": "904",
"binary": fals... |
"""
Created on 02/02/2014
@author: Miguel Otero
"""
class Value(object):
"""
classdocs
"""
MISSING = "obsStatus-M"
AVAILABLE = "obsStatus-A"
FLOAT = "float"
INTEGER = "int"
STRING = "str"
def __init__(self, value=None, value_type=None, obs_status=None):
"""
Cons... | {
"content_hash": "31288d121e602f3b3152b88e3b41f924",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 120,
"avg_line_length": 27.945454545454545,
"alnum_prop": 0.5406636304489265,
"repo_name": "landportal/landbook-importers",
"id": "588fc90b77f51e17070ed3789ca2cde56611867c",
... |
"""Starter script for Cinder Scheduler."""
import eventlet
eventlet.monkey_patch()
import sys
import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()
# Need to register global_opts
from cinder.common import config # noqa
from cinder... | {
"content_hash": "c82b57ee83f3e771c1bacd7468dd38cb",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 62,
"avg_line_length": 21.058823529411764,
"alnum_prop": 0.7430167597765364,
"repo_name": "Accelerite/cinder",
"id": "8ef5b37b3ed5c5edc40048a43fb25182adf0d93e",
"size": "14... |
"""
Mixins that provide inheriting classes with the basic columns and
relationships for non-DB storage of files.
``StoredFileMixin`` defines a pointer to a "physical" file that exists in some
kind of storage backend. As for ``VersionedResourceMixin``, it allows do define
an abstract resource with multiple versions (fi... | {
"content_hash": "1ebf5d3f0a283655c54abff358758002",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 108,
"avg_line_length": 33.1359649122807,
"alnum_prop": 0.6181336863004633,
"repo_name": "pferreir/indico",
"id": "8dffde656cbc59c9fbcae7a6840677ec7cb915da",
"size": "7769... |
"""
Support for ZoneMinder.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zoneminder/
"""
import logging
from urllib.parse import urljoin
import requests
import voluptuous as vol
from homeassistant.const import (
CONF_PATH, CONF_HOST, CONF_SSL, C... | {
"content_hash": "d5267e1edcc18e4de2aa6d4ddcff39a1",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 78,
"avg_line_length": 27.853846153846153,
"alnum_prop": 0.6396023198011599,
"repo_name": "JshWright/home-assistant",
"id": "8870b4713e0312523efbda0a6292ec89ec56bc46",
"si... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 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": "afd0c9cbab8062486f9ed8ec8c887615",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 86,
"avg_line_length": 38.29545454545455,
"alnum_prop": 0.7364985163204748,
"repo_name": "python-ivi/python-ivi",
"id": "cd3c8d6a3bd8cc887bde32c5f7be9b3f649d63cc",
"size": ... |
"""Classification Model Class for Estimating Propensity Score and Importance Weight."""
from dataclasses import dataclass
from typing import Optional
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.base import clone
from sklearn.calibration import CalibratedClassifierCV
from sklearn.model_select... | {
"content_hash": "8964cbd733286cdca7c84f61a8f6347f",
"timestamp": "",
"source": "github",
"line_count": 630,
"max_line_length": 184,
"avg_line_length": 42.86349206349206,
"alnum_prop": 0.5879869648940897,
"repo_name": "st-tech/zr-obp",
"id": "b2c307c933ed65a1bbda66280f8c2170011dda78",
"size": "2713... |
from nova import exception
from nova.network import model
from nova import test
from nova.tests import fake_network_cache_model
from nova.virt import netutils
class RouteTests(test.TestCase):
def test_create_route_with_attrs(self):
route = fake_network_cache_model.new_route()
ip = fake_network_cac... | {
"content_hash": "522b3391ad822ff2fee6d94eaf12827c",
"timestamp": "",
"source": "github",
"line_count": 435,
"max_line_length": 79,
"avg_line_length": 44.236781609195404,
"alnum_prop": 0.5684144883853869,
"repo_name": "plumgrid/plumgrid-nova",
"id": "38a27b51c7a8a370d2aa1d89e2c0c99da85fcadc",
"size... |
import os
import subprocess
from .base import CorePlatform
class LinuxPlatform(CorePlatform):
def create_shortcut(self, path, target):
os.symlink(target, path)
def add_to_path(self, path):
if path not in os.environ['PATH']:
line = 'export PATH=$PATH:{}'.format(path)
... | {
"content_hash": "82c23d49bb5c46ea341472a291fa4728",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 29.357142857142858,
"alnum_prop": 0.610705596107056,
"repo_name": "kalail/packer",
"id": "0bf9bee4df28c58ce254b7aa732d0a6164c6059a",
"size": "411",
... |
import logging
import unittest
from config_test import build_client_from_configuration
_logger = logging.getLogger(__name__)
class TestSpaces(unittest.TestCase):
def test_list(self):
cpt = 0
client = build_client_from_configuration()
for space in client.v2.spaces.list(organization_guid=c... | {
"content_hash": "3312d22a15a1c7069b5fe4ccdef6c6f2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 115,
"avg_line_length": 37.04761904761905,
"alnum_prop": 0.6105398457583547,
"repo_name": "antechrestos/cf-python-client",
"id": "5d791c0a731432494d793702af055c4b40058cce",
... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, time
from operator import itemgetter
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
allChampionsUsed = []
f = open('loChampionPa... | {
"content_hash": "fe8857cc3db606485414f2d5da277444",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 732,
"avg_line_length": 41.35036496350365,
"alnum_prop": 0.6833186231244484,
"repo_name": "Murkantilism/LoL_API_Research",
"id": "04575834ede00735e3f9bba4d7906600a4c24218",
... |
import socket
class Connection(object):
"""
Class responsible for managing an API connection to the mod-host process via socket
"""
client = None
def __init__(self, socket_port=5555, address='localhost'):
self.client = socket.socket()
self.client.connect((address, socket_port))
... | {
"content_hash": "1de94f7a2c16655c80be217b5a76fe49",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 87,
"avg_line_length": 25.38888888888889,
"alnum_prop": 0.5831509846827133,
"repo_name": "PedalPi/PluginsManager",
"id": "5b8a6167423e081c136090348c421fa8b0e0fd67",
"size":... |
import sys
import serial
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **kwargs):
print 'test command'
print 'serial: {}'.format(serial)
with serial.Serial('/dev/tty.usbserial-FTH9JD2V', 4800) as ser:
n_reads = 0
... | {
"content_hash": "7e32c31071b0cd8b66437276b051fc9a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 33.36,
"alnum_prop": 0.46402877697841727,
"repo_name": "opentrv/ors",
"id": "b1a598591778798e63e263d97cb6ac530aca4bd6",
"size": "834",
"binary": fa... |
"""
RpcTest class and help functions which create Disabled/Skipped tests
>>> sometest=RpcTest("name")
>>> repr(sometest)
'name.py'
>>> sometest.is_disabled()
False
>>> sometest.reason is None
True
>>> sometest.skip_platforms
[]
>>> disabled_test=Disabled("foo", "foo does not work right now")
>>> disabled_test.is_disab... | {
"content_hash": "8aa9ed9e4c8f5e2b80aa8a25a605fe1d",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 102,
"avg_line_length": 31.0625,
"alnum_prop": 0.596327967806841,
"repo_name": "arruah/ensocoin",
"id": "16b00ea9184dd8df420e5bf196865da9f6127b10",
"size": "4163",
"bina... |
job_block = 5
# If it takes ~30 minutes per docking, then 5 docking should take 2.5 hours
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--ligand', \
default='../ligand/dock_in', \
help='The root directory to look for ligand mol2 files or a single file (SYBYL atom types)')
parser.add_argum... | {
"content_hash": "07d20645c52c3baa2e9cac02f274c33b",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 122,
"avg_line_length": 40.57142857142857,
"alnum_prop": 0.6558561897702001,
"repo_name": "gkumar7/AlGDock",
"id": "79fd40f701263b0a2b7e84aed3938c3b90ca4814",
"size": "551... |
import datetime
import os
import smtplib
import socket
from email.MIMEText import MIMEText
from logging.handlers import SMTPHandler
from logging import Formatter, LogRecord, CRITICAL
now = datetime.datetime.now
class SubjectFormatter(Formatter):
def format(self,record):
record.messag... | {
"content_hash": "a751a53c8463de1264f5194a41fb815d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 136,
"avg_line_length": 36.604395604395606,
"alnum_prop": 0.5719003302311618,
"repo_name": "pydotorg/pypi",
"id": "63d16c83864d59a7e8f3c4c08ffdc1739e7359c2",
"size": "3577"... |
"""Using Acton to test uncertainty sampling on the iris libsvm dataset."""
import logging
import os.path
import tempfile
import acton.acton
import acton.plot
import h5py
import requests
import sklearn.datasets
import sklearn.preprocessing
with tempfile.TemporaryDirectory() as tempdir:
# Download the dataset.
... | {
"content_hash": "d72330bff05809f763f7cfe12c39bbdd",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 35.622950819672134,
"alnum_prop": 0.6723423838011965,
"repo_name": "chengsoonong/acton",
"id": "1bd8792b7420830d4ef21b6f596d861bcfc595af",
"size": "2... |
from __future__ import print_function
import argparse
import functools
import os
import re
import sys
import subprocess
import traceback
from multiprocessing import Pool
import multiprocessing
args = None
def parse_line(line):
question = line.find('?')
if question == -1:
return None, None
open_p... | {
"content_hash": "bb8f99211b1cb98f0d751405d5c6bfba",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 121,
"avg_line_length": 32.013513513513516,
"alnum_prop": 0.5923737160545941,
"repo_name": "endlessm/chromium-browser",
"id": "00de72b2a18d7158969c21bdf7d5ca62de1a7890",
"... |
"""
making borders for images - padding
create a border around the image (like photo frame) - cv2.copyMakeBorder()
- has more apps for convolution operation, zero padding, etc.
function arguments for cv2.copyMakeBorder() :
- src - input image
- top, bottom, left, right - border width in # of pixels in corre... | {
"content_hash": "168b6c43e0cea127472a98ea2c853ba7",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 96,
"avg_line_length": 46.22727272727273,
"alnum_prop": 0.6927236971484759,
"repo_name": "SSG-DRD-IOT/commercial-iot-security-system",
"id": "3826c0d633489ff0d1082d24229d0f34... |
"""Asynchronous WSGI_ Remote Procedure Calls middleware. It implements a
JSON-RPC_ server and client. Check out the
:ref:`json-rpc tutorial <tutorials-calculator>` if you want to get started
quickly with a working example.
To quickly setup a server::
class MyRpc(rpc.JSONRPC):
def rpc_ping(self, request):... | {
"content_hash": "0ad004bdd960f3a712f8fb6c32f9ae4f",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 74,
"avg_line_length": 20.540816326530614,
"alnum_prop": 0.61698956780924,
"repo_name": "quantmind/pulsar",
"id": "b405a877ce83c8877cdfd061447e8d4743e76f71",
"size": "2013"... |
class Solution:
# if seeing the element again in dict, delete it
# things left are the single elements
def singleNumber(self, nums):
resultDict = {}
for i in nums:
if i in resultDict.keys():
del resultDict[i]
else:
resultDict[i] = 1
... | {
"content_hash": "a5b3fc94c10b3e1376c7d8f5fac79746",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 55,
"avg_line_length": 26.85,
"alnum_prop": 0.48417132216014896,
"repo_name": "gengwg/leetcode",
"id": "e7b09b4bcdb03db41bbd37a543fedce66687074d",
"size": "1455",
"binary... |
import requests
import json
def main():
url = "http://localhost:4000/jsonrpc"
headers = {'content-type': 'application/json'}
# Example echo method
payload = {
"method": "echo",
"params": ["echome!"],
"jsonrpc": "2.0",
"id": 0,
}
response = requests.post(
... | {
"content_hash": "b56fafa99d2d0b7fedc4e56b6e689e03",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 62,
"avg_line_length": 24.914634146341463,
"alnum_prop": 0.534997552618698,
"repo_name": "pavlov99/json-rpc",
"id": "97d97fb1d58ac0fb62d7323bbe33e84bdcff94d9",
"size": "204... |
"""This sample uses Rok as an example to show case how VolumeOp accepts
annotations as an extra argument, and how we can use arbitrary PipelineParams
to determine their contents.
The specific annotation is Rok-specific, but the use of annotations in
such way is widespread in storage systems integrated with K8s.
"""
i... | {
"content_hash": "16c0d66094ef62625ebdade6f81fed85",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 31.984126984126984,
"alnum_prop": 0.630272952853598,
"repo_name": "kubeflow/pipelines",
"id": "4ba7d60ebc3d61e381d5e326e09374e131cf8f79",
"size": "26... |
from rest_framework import serializers
from nospoil.constants import MAX_PLAYOFF_ROUNDS
from .models import Playoff
from .services import create_matches, update_matches
# different serializers because rounds and double filds are needed to create,
# but they should not be changed when editing,
# also grid is needed to... | {
"content_hash": "f5c74038d37000ae6707a104c9fcfbb8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 80,
"avg_line_length": 40.69047619047619,
"alnum_prop": 0.6986541837331773,
"repo_name": "RomanOsadchuk/nospoil",
"id": "ea0936ce1e4a683db86f18923bbfcd4bd76de9c1",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.