text stringlengths 4 1.02M | meta dict |
|---|---|
"""Run GlobalFoundries 180nm MCU LVS.
Usage:
run_lvs.py (--help| -h)
run_lvs.py (--design=<layout_path>) (--net=<netlist_path>) (--gf180mcu=<combined_options>) [--thr=<thr>] [--run_mode=<run_mode>] [--lvs_sub=<sub_name>] [--no_net_names] [--set_spice_comments] [--set_scale] [--set_verbose] [--set_schematic_sim... | {
"content_hash": "e4c193294e03b7c0293b3647ef1423f7",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 339,
"avg_line_length": 50.66101694915254,
"alnum_prop": 0.5904984944797591,
"repo_name": "google/globalfoundries-pdk-libs-gf180mcu_fd_pr",
"id": "e9a6bddd5a6c683ed461d070d1... |
"""Learning rate schedules."""
import jax.numpy as jnp
def target_ema(global_step: jnp.ndarray,
base_ema: float,
max_steps: int) -> jnp.ndarray:
decay = _cosine_decay(global_step, max_steps, 1.)
return 1. - (1. - base_ema) * decay
def learning_schedule(global_step: jnp.ndarray,
... | {
"content_hash": "42e23c325e763d49fe9c1838b00a0582",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 36.13157894736842,
"alnum_prop": 0.6067006554989075,
"repo_name": "deepmind/deepmind-research",
"id": "773d40cfc3781c3e6943cd568350700162b9c11b",
"si... |
import sys
sys.path.insert(1, "../../")
import h2o
def upload_import_small(ip, port):
# Connect to a pre-existing cluster
various_datasets = ["smalldata/iris/iris.csv", "smalldata/iris/iris_wheader.csv", "smalldata/prostate/prostate.csv",
"smalldata/prostate/prostate_woheader.csv.... | {
"content_hash": "c6db93ce7b9e8554a9c3becb5852b430",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 120,
"avg_line_length": 38.46153846153846,
"alnum_prop": 0.597,
"repo_name": "PawarPawan/h2o-v3",
"id": "98cb837d525dc2819b9f4257629b06ce5b9ab7a9",
"size": "1000",
"binar... |
import os
import requests
api_url = 'https://marketplace.firefox.com/api/v1/apps/category/?lang=%s'
english_categories = { # Stolen from fireplace's categories.js
'games': 'Games',
# 'books': 'Books', # Commented because already present in .po files.
'business': 'Business',
'education': 'Education',... | {
"content_hash": "b7779c69f0e48bebf8365b0c7dd5cbe3",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 33.0253164556962,
"alnum_prop": 0.5986968187044844,
"repo_name": "clouserw/zamboni",
"id": "979d32f1b0b6ae659f6f958a3e5a1aa0b7b5483b",
"size": "2631"... |
from contrail_vrouter_api.vrouter_api import ContrailVRouterApi
def interface_register(vm, vmi, iface_name):
api = ContrailVRouterApi()
mac = vmi.virtual_machine_interface_mac_addresses.mac_address[0]
api.add_port(vm.uuid, vmi.uuid, iface_name, mac, port_type='NovaVMPort')
def interface_unregister(vmi_uu... | {
"content_hash": "1fc59a42aef62220994b6226ff2afd41",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 35.09090909090909,
"alnum_prop": 0.7409326424870466,
"repo_name": "pedro-r-marques/opencontrail-netns",
"id": "a92584828683d0e435f376e891ab108c423000fe... |
import sys
import pytz
import datetime
BASE_DATE = datetime.datetime(year=2009,month=1,day=1,
tzinfo=pytz.timezone('UTC'))
def main():
cols = sys.stdin.readline().rstrip('\n').split('\t')
offset_rows = []
name_rows = []
print '%% @copyright 2010 Mochi Media, Inc.'
pr... | {
"content_hash": "d8098ac114d824e5c401af4edc9e4288",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 96,
"avg_line_length": 39.30612244897959,
"alnum_prop": 0.5332294911734164,
"repo_name": "tsharju/egeoip",
"id": "9912894ca68e9f6f4a7f33538d70b7a4151c7b91",
"size": "1948",... |
import os.path
from unittest import TestCase
from trtools.io.cacher import cacher
from trtools.util.tempdir import TemporaryDirectory
td = TemporaryDirectory()
class TestClass(object):
def __init__(self):
self.count = 0
@cacher(td.name + '/test/test_meth', method=True)
def test_meth(self):
... | {
"content_hash": "1c6d2a1602d88678d72ff16276e0f7d0",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 116,
"avg_line_length": 25.987179487179485,
"alnum_prop": 0.50419338924519,
"repo_name": "dalejung/trtools",
"id": "69a18f413ede3faa9d891a9cc4e2cf25b94801b8",
"size": "2027... |
"""
Functions which are common and require SciPy Base and Level 1 SciPy
(special, linalg)
"""
from __future__ import division, print_function, absolute_import
import numpy
import numpy as np
from numpy import (exp, log, asarray, arange, newaxis, hstack, product, array,
zeros, eye, poly1d, r_, sum, ... | {
"content_hash": "30c61586d75a48dd6b8ad257bc119c51",
"timestamp": "",
"source": "github",
"line_count": 477,
"max_line_length": 93,
"avg_line_length": 27.870020964360588,
"alnum_prop": 0.559350082744095,
"repo_name": "piyush0609/scipy",
"id": "79c14081ebfb2c7a9c9520df6da97459cd1a31b0",
"size": "132... |
from pytest_django.lazy_django import get_django_version
class DisableMigrations(object):
def __init__(self):
self._django_version = get_django_version()
def __contains__(self, item):
return True
def __getitem__(self, item):
if self._django_version >= (1, 9):
return N... | {
"content_hash": "a55f241a5b9c9bef7f14b4a9374bc5eb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 56,
"avg_line_length": 24.866666666666667,
"alnum_prop": 0.5924932975871313,
"repo_name": "kawamon/hue",
"id": "3c39cb9f644875294ff363d0a8128c760c3c942a",
"size": "453",
... |
from numpy import average
from numpy import float64
from numpy import sum
from numpy import zeros
from gwlfe.Memoization import memoize
def Precipitation(NYrs, DaysMonth, Prec): # TODO: change internal "Precipitation" to "result"
Precipitation = zeros((NYrs, 12))
for Y in range(NYrs):
for i in range... | {
"content_hash": "534148e8875a5005fd7589fe4230d3a1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 94,
"avg_line_length": 25.8,
"alnum_prop": 0.689922480620155,
"repo_name": "WikiWatershed/gwlf-e",
"id": "e7fda728d1dbc25dc17ac2c3e79d28bb33251bf2",
"size": "645",
"binar... |
"""
Resource traversal integration with L{twisted.cred} to allow for
authentication and authorization of HTTP requests.
"""
from __future__ import division, absolute_import
# Expose HTTP authentication classes here.
from twisted.web._auth.wrapper import HTTPAuthSessionWrapper
from twisted.web._auth.basic import Basic... | {
"content_hash": "e9e09594859d94c1e9d670c63f5e0a5b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 31.25,
"alnum_prop": 0.796,
"repo_name": "bdh1011/wau",
"id": "0e580815edff195e3c61fe14bc29b4db7b988d14",
"size": "630",
"binary": false,
"copies... |
import scrapy
from report_crawler.spiders.__Global_function import get_localtime
from report_crawler.spiders.__Global_variable import now_time, end_time
class CSU001_Spider(scrapy.Spider):
name = 'CSU001'
start_urls = ['http://sise.csu.edu.cn/index/xsxx.htm']
domain = 'http://sise.csu.edu.cn/'
def parse(self, re... | {
"content_hash": "2ac4d767856b70f036bf97692583808c",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 113,
"avg_line_length": 41.93333333333333,
"alnum_prop": 0.670906200317965,
"repo_name": "HeadCow/ARPS",
"id": "3d8cf2130cbe920254b8d908f8dcdd8c550e64c5",
"size": "1327",
... |
import os
from sys import path
from os.path import join
import datetime
from django.core.urlresolvers import reverse_lazy
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path.append(join(BASE_DIR, 'apps'))
ALLOWED_HOSTS ... | {
"content_hash": "a1ee58fa8a57be82d627865707c5750e",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 91,
"avg_line_length": 26.75496688741722,
"alnum_prop": 0.6693069306930693,
"repo_name": "CSyllabus/webapp",
"id": "9b028e5b3a509d5f1b0cb3e4cbd5b9cb5792e5ea",
"size": "404... |
from trac.dist import get_l10n_cmdclass, get_l10n_js_cmdclass
try:
from trac.dist import extract_javascript_script
except ImportError:
pass
| {
"content_hash": "0019ec866c73898a967509fcd75fb0a1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 61,
"avg_line_length": 29.6,
"alnum_prop": 0.777027027027027,
"repo_name": "pkdevbox/trac",
"id": "623df0acd3f70b7430fef26054507e4197194c78",
"size": "677",
"binary": fals... |
import json
from unittest import mock
from ddt import ddt
from pylxd.deprecated import connection
from pylxd.deprecated.tests import LXDAPITestBase, annotated_data, fake_api
@ddt
class LXDAPICertificateTest(LXDAPITestBase):
def test_list_certificates(self):
with mock.patch.object(connection.LXDConnectio... | {
"content_hash": "11a154c68cd45db2e5cddc5a870e2521",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 84,
"avg_line_length": 42.90625,
"alnum_prop": 0.6562272396212673,
"repo_name": "lxc/pylxd",
"id": "e408190239fac68702d2dfe2ccda901c660d349d",
"size": "1983",
"binary": f... |
import logging
from azure.mgmt.resource.resources.models import GenericResource, ResourceGroupPatchable
class TagHelper:
log = logging.getLogger('custodian.azure.utils.TagHelper')
@staticmethod
def update_resource_tags(tag_action, resource, tags):
client = tag_action.session.client('... | {
"content_hash": "4868730c5960b0cb069945546c28f10f",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 95,
"avg_line_length": 39.07920792079208,
"alnum_prop": 0.5353432987078794,
"repo_name": "taohungyang/cloud-custodian",
"id": "4744c66fc74538b6b61624f4dd599329cebd008f",
"... |
"""
MySQL database backend for Django.
Requires mysqlclient: https://pypi.python.org/pypi/mysqlclient/
MySQLdb is supported for Python 2 only: http://sourceforge.net/projects/mysql-python
"""
from __future__ import unicode_literals
import datetime
import re
import sys
import warnings
from django.conf import settings... | {
"content_hash": "1fd6ad9c383da70ee4277a7427c07935",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 117,
"avg_line_length": 42.24932975871314,
"alnum_prop": 0.6255473063011613,
"repo_name": "IKholopov/HackUPC2017",
"id": "880508221eab2a71417252e81e3174eb0941be58",
"size"... |
from flask import Blueprint
blueprint = Blueprint('ticket_module', __name__, template_folder='templates',
static_folder='static', url_prefix='/tickets')
from slick import app
from . import views, widgets
for widget in widgets.get_widgets():
app.add_widget(widget)
# Tickets List
blueprint.a... | {
"content_hash": "3d8cc443dba9ae87a8e6ffa4311df35a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.6995192307692307,
"repo_name": "underscorephil/slick",
"id": "6e2c6df8745eb12414d5e0960f35c5c7e13815f4",
"size": ... |
"""This module handles rendering QWebPage into PNG and JPEG images."""
import sys
import array
from abc import ABCMeta, abstractmethod, abstractproperty
from io import BytesIO
from math import ceil, floor
import six
from PIL import Image
from PyQt5.QtCore import QBuffer, QPoint, QRect, QSize, Qt
from PyQt5.QtGui impor... | {
"content_hash": "e9f04aa8a6009ce531a42637c7ef4e49",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 89,
"avg_line_length": 40.052529182879375,
"alnum_prop": 0.5892067809782873,
"repo_name": "Youwotma/splash",
"id": "b7bc7fe880d0ecfbb3a413cf00b9ca408b24e553",
"size": "205... |
import vim
import os
import re
import string
import subprocess
import threading
import zlib
import base64
import zipfile
def __GetBootstrapClassPath():
## mkdir
temp_dir = "/tmp/JavaAutoImport.%s.%s" % (os.getlogin(), os.getpid())
os.mkdir(temp_dir)
## write class file
temp_classfile = temp_dir + ... | {
"content_hash": "7435d00ca4846e1db207bd97804a583d",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 104,
"avg_line_length": 36.252,
"alnum_prop": 0.6067527308838133,
"repo_name": "vim-scripts/vim-javacompleteex",
"id": "18f47430010b4d97b51ea41e48206c6fead472af",
"size": ... |
import os
import re
from fabric import colors
from fabric.api import task
from fabric.api import local
from fabric.api import env
from fabric.api import run
from fabric.api import cd
env.hosts = ['cloudtun.es']
env.user = 'cloudtunes'
env.key_filename = '~/.ssh/id_dsa'
GITHUB = 'git@github.com:jkbrzt/cloudtunes.git... | {
"content_hash": "fd18d256bab27b159913c6bef1d8756a",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 76,
"avg_line_length": 24.025316455696203,
"alnum_prop": 0.619072708113804,
"repo_name": "sheafferusa/cloudtunes",
"id": "be4f0091a2db475a3ad08f86928b43db65ce0500",
"size":... |
import getpass
import json
import requests
import util
import auth
import compose
from service import Service
from backup import Backup
from organization import Organization
def login(username, password, cloud, endpoint):
if not username:
username = raw_input('Username: ')
if not password:
pa... | {
"content_hash": "21c841ddb8d335f65abfdb2bd9c6ecef",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 109,
"avg_line_length": 28.923766816143498,
"alnum_prop": 0.6742635658914728,
"repo_name": "yanheven/alauda-CLI",
"id": "6b59a3adadf54322ece519912a7a406c97696791",
"size":... |
from __future__ import print_function
import argparse
import re
import sys
from Bio import SeqIO
parser = argparse.ArgumentParser()
parser.add_argument('--numfiles', type=int, metavar='N', default=1,
help='number of files to create')
parser.add_argument('--out', metavar='PFX', default='out',
... | {
"content_hash": "06a391859af3fe3a76611bf972ed710c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 89,
"avg_line_length": 37,
"alnum_prop": 0.6486486486486487,
"repo_name": "dib-lab/kevlar",
"id": "3878fa7d408007c256ccf1a6b3d9855b709dc8a6",
"size": "800",
"binary": fal... |
"""Processes for stemming.
"""
from copy import deepcopy
from dataclasses import dataclass
import cltk.stem.akk
import cltk.stem.enm
import cltk.stem.fro
import cltk.stem.gmh
import cltk.stem.lat
from cltk.core.data_types import Doc, Process, Word
@dataclass
class StemmingProcess(Process):
"""To... | {
"content_hash": "da99c12403852b602928089c36d96e38",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 148,
"avg_line_length": 36.232,
"alnum_prop": 0.6699050563038198,
"repo_name": "cltk/cltk",
"id": "6ca8b3f9508c995e74bfb88d0fc1545e2ea44f1a",
"size": "4530",
"binary": f... |
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(532, 431)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/media/default/32x32/icons/polygon-area.png"), QtGui.QIcon.Normal, QtGu... | {
"content_hash": "d0dfac341cd08a81282b48efb3bd8bc9",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 148,
"avg_line_length": 68.11020408163266,
"alnum_prop": 0.72487565170492,
"repo_name": "nycholas/polygon-area",
"id": "eba30d6824494d16392a8aafb395effb4e363c25",
"size": ... |
from yattag import Doc
doc, tag, text = Doc().tagtext()
#with tag('h1'):
# text('hello world')
#
#print(doc.getvalue())
doc.asis("<!DOCTYPE html>")
with tag('html'):
with tag('head'):
# basic page needs
doc.stag('meta', charset='utf-8')
doc.stag('meta', name='viewport', content='width=d... | {
"content_hash": "4988c2fe854642c28cbf0dddc4a6b5b7",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 186,
"avg_line_length": 49.03846153846154,
"alnum_prop": 0.6278431372549019,
"repo_name": "dsp-nurho/dsp-nurho.github.io",
"id": "e6d0f3f206e3ecac14c463ee0b901a453438496f",
... |
import cPickle
import pickle
import cStringIO
import StringIO
import gzip
import urllib
# NCBI data ftp.
NCBI_URL = 'http://mirrors.vbi.vt.edu/mirrors/ftp.ncbi.nih.gov/gene/DATA/'
NCBI_ORGANISM_GENE_DATA = 'GENE_INFO/Mammalia/'
# for gene_info file
FORMAT_LINE_START = '#Format:'
ENTREZ_ID = 'GeneID'
GENE_SYMBOL = 'Sy... | {
"content_hash": "a08b759a67869fead7642e295fd7fe23",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 122,
"avg_line_length": 30.30263157894737,
"alnum_prop": 0.5788102475032566,
"repo_name": "xflows/textflows",
"id": "c3d371ddc6d4cf6130186f0fc3094ed113c1ae9c",
"size": "46... |
"""Support for collecting data from the ARWN project."""
from __future__ import annotations
import json
import logging
from homeassistant.components import mqtt
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import (
DEGREE,
PRECIPITATION_INCHES,
TEMP_... | {
"content_hash": "e4fd727e9f8c6f8d3d03f1ec789024e6",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 88,
"avg_line_length": 32.87898089171974,
"alnum_prop": 0.5836884928322356,
"repo_name": "nkgilley/home-assistant",
"id": "45db805d1de5b0350be9e865ea86471ef43f3ff4",
"size... |
from scout.parse.omim import (
get_mim_phenotypes,
parse_genemap2,
parse_genemap2_phenotypes,
parse_mim2gene,
parse_mim_titles,
parse_omim_line,
)
def test_parse_omim_line():
## GIVEN a header and a line
header = ["a", "b", "c"]
line = "1\t2\t3"
## WHEN parsing the omim line
... | {
"content_hash": "330b6d7c35c8e329b8621eb08e77e910",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 91,
"avg_line_length": 29.59633027522936,
"alnum_prop": 0.6596404215747055,
"repo_name": "Clinical-Genomics/scout",
"id": "93e315ad50ae79c1b3698eab27de99a1678238ca",
"size... |
"""
.. _tut-raw-class:
The Raw data structure: continuous data
=======================================
This tutorial covers the basics of working with raw EEG/MEG data in Python. It
introduces the :class:`~mne.io.Raw` data structure in detail, including how to
load, query, subselect, export, and plot data from a :cla... | {
"content_hash": "74e965e391873ea14f39be443815fec4",
"timestamp": "",
"source": "github",
"line_count": 563,
"max_line_length": 79,
"avg_line_length": 45.854351687388984,
"alnum_prop": 0.6492097923768205,
"repo_name": "bloyl/mne-python",
"id": "c8d48241016a8f5314fafb238a81646bce321160",
"size": "25... |
import pymongo
from flask import session, flash
import datetime
from bson.objectid import ObjectId
import ipdb
def db_connection():
client=pymongo.MongoClient(host="mongodb://ds040489.mlab.com:40489")
db = client.sanikaclouddb
db.authenticate("sanika","sanika")
return db
db = db_connection()
faresList... | {
"content_hash": "47f1f042e3c42771162efd2a9c185603",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 123,
"avg_line_length": 28.573033707865168,
"alnum_prop": 0.6331104994101455,
"repo_name": "sanikasudhalkar/Projects",
"id": "8f17e349d5026969a06ffab51777a6bc144b7ceb",
"si... |
import abc
from oslo_config import cfg
from oslo_log import log
import requests
from requests import auth
import six
from ceilometer.i18n import _
CONF = cfg.CONF
CONF.import_opt('http_timeout', 'ceilometer.service')
LOG = log.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class _Base(object):
"""Base ... | {
"content_hash": "52c58db5f553631ae79f3a23a560bbb6",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 76,
"avg_line_length": 25.884444444444444,
"alnum_prop": 0.5616414835164835,
"repo_name": "r-mibu/ceilometer",
"id": "24e6be696edf3268730413c24cd2f5c5e0c7df77",
"size": "6... |
"""
QUESTION:
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as a separator for each node, and , as a separator for node label and each neighbor of the node.
As an example, consider the serializ... | {
"content_hash": "88a24b9f8fbb9ef4dd2146e6056c3076",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 105,
"avg_line_length": 30.632911392405063,
"alnum_prop": 0.5574380165289257,
"repo_name": "tktrungna/leetcode",
"id": "0d46da0b0038cd479fc0b852651b0e44b8975115",
"size": "... |
import optparse, os, sys, re, ConfigParser, time, warnings
# 2to3
import StringIO
logging = None
__all__ = 'parser', 'configure', 'options',
db = None
db_label, db_url, db_opts = None, None, {}
options = None
file_config = None
base_config = """
[db]
sqlite=sqlite:///:memory:
sqlite_file=sqlite:///querytest.db
po... | {
"content_hash": "613254e713a9bd7776176aab1c070217",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 96,
"avg_line_length": 31.664739884393065,
"alnum_prop": 0.6445783132530121,
"repo_name": "igemsoftware/SYSU-Software2013",
"id": "7d528a04b048265178ce1dead9e2bed2e1f9ca3d",... |
import os
import mopidy
from mopidy import config, ext
class Extension(ext.Extension):
dist_name = "Mopidy-Stream"
ext_name = "stream"
version = mopidy.__version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
return config.read(conf_f... | {
"content_hash": "3d9f1003f1139ec0a5e94daa9ca9db48",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 26.266666666666666,
"alnum_prop": 0.6395939086294417,
"repo_name": "mopidy/mopidy",
"id": "aaeaad1869ffe2af012c825a829f263125ff97ff",
"size": "788",
... |
from framework.dependency_management.dependency_resolver import ServiceLocator
"""
GREP Plugin for Cookies Attributes
NOTE: GREP plugins do NOT send traffic to the target and only grep the HTTP Transaction Log
"""
import string, re
import cgi
import logging
DESCRIPTION = "Searches transaction DB for Cookie attribute... | {
"content_hash": "4a31b39694d6675b36181a7a3161fdc0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 129,
"avg_line_length": 38.63636363636363,
"alnum_prop": 0.7776470588235294,
"repo_name": "sharad1126/owtf",
"id": "c752882527321c8c2dcdbd619c721bdbc253f6c5",
"size": "850"... |
from restservice.models import RestService
def call_service(parsed_instance):
# lookup service
instance = parsed_instance.instance
services = RestService.objects.filter(xform=instance.xform)
# call service send with url and instance id
for sv in services:
service = sv.get_service_definition... | {
"content_hash": "7f8d2a3a7c987290fb16accf4db07d41",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 38.5,
"alnum_prop": 0.7272727272727273,
"repo_name": "eHealthAfrica/formhub",
"id": "201fb853d17960ef244e18a0b2c78aa64c5efdaa",
"size": "385",
"bin... |
"""
plot.py
Created by Ryan Dwyer on 2013-10-15.
Copyright (c) 2013 Cornell University. All rights reserved.
"""
import numpy as np
from jittermodel.simulation import Simulation
from time import sleep
import datetime
import cPickle as pickle
import os
import errno
import glob
import matplotlib.pyplot as plt
from jitte... | {
"content_hash": "aa98ec3c56de64a1b506d47695957f9b",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 36.71024734982332,
"alnum_prop": 0.5538550389835403,
"repo_name": "ryanpdwyer/jittermodel",
"id": "3ac6596347e83182639355c7583da3c31753f403",
"size"... |
import numpy as np
import tensorflow as tf
import util
from conditional_dist import ConditionalDistribution
from transforms import DeterministicTransform
class BinaryTransform(DeterministicTransform):
"""
Define a random variable as the deterministic transform of another RV
already present in the mode... | {
"content_hash": "71a6b3067a7a1e99d24c3531f471621f",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 82,
"avg_line_length": 31.866666666666667,
"alnum_prop": 0.5769874476987448,
"repo_name": "davmre/bayesflow",
"id": "1d12b6e84c19f2536cb187d8a66a45b77ae50518",
"size": "71... |
from collections import OrderedDict
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.auth import credent... | {
"content_hash": "356d1e4bd266ca5aa81d6aafff583ce4",
"timestamp": "",
"source": "github",
"line_count": 495,
"max_line_length": 129,
"avg_line_length": 40.9010101010101,
"alnum_prop": 0.6109354934308011,
"repo_name": "googleads/google-ads-python",
"id": "a9d942dfa2c43cd27733304b0d2f2cf7f23f0320",
"... |
from setuptools import setup, find_packages
setup(name='photred',
version='1.0.0',
description='Generic PSF Photometry Pipeline',
author='David Nidever',
author_email='dnidever@montana.edu',
url='https://github.com/dnidever/PHOTRED',
packages=['photred'],
package_dir={'':'pyth... | {
"content_hash": "1df212506cdc0cc1bf183676884b1ea3",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 33.857142857142854,
"alnum_prop": 0.6286919831223629,
"repo_name": "dnidever/PHOTRED",
"id": "380a81c9d15941ecd1e5157b26624e9b7c713419",
"size": "531... |
"""Support for Tellstick Net/Telstick Live sensors."""
from homeassistant.components import sensor, tellduslive
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_TEMPERATURE,
LENGTH_MILLIMETERS,
LI... | {
"content_hash": "e53ec863f79e9c1cf72d30c624111145",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 87,
"avg_line_length": 31.87248322147651,
"alnum_prop": 0.6413981890924405,
"repo_name": "Danielhiversen/home-assistant",
"id": "35fc68095231fc9367ef844de6ca48ff7dad4118",
... |
import base64
import json
from cattle import ApiError, ClientApiError
from common_fixtures import * # NOQA
def test_container_create_count(client, context):
cs = client.create_container(image=context.image_uuid,
count=3)
assert len(cs) == 3
for c in cs:
c = cli... | {
"content_hash": "24f31ce28749de104957eafa7421a24e",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 78,
"avg_line_length": 30.236842105263158,
"alnum_prop": 0.6372765615585458,
"repo_name": "cjellick/cattle",
"id": "e8408dd966560a919a943dae34d1af185e80b7bb",
"size": "149... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_errorbars06.xlsx'... | {
"content_hash": "51ad02bd1a9e01f60a0cb01afe57e553",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 70,
"avg_line_length": 26.033898305084747,
"alnum_prop": 0.5462239583333334,
"repo_name": "mdeemer/XlsxWriter",
"id": "2166251be4a2bc6977b6bc60f98354160072ea32",
"size": "1... |
from Player import Player
class Game:
def __init__(self):
self.timebank = 0
self.timePerMove = 0
self.enemy = Player()
self.me = Player()
self.piece = None
self.piecePosition = None
self.nextPiece = None
self.round = 0
| {
"content_hash": "499fa213c06fb429ad4e198e7e18dea6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 33,
"avg_line_length": 18.25,
"alnum_prop": 0.5445205479452054,
"repo_name": "gtagency/tetris-python",
"id": "224c579d3e11f8f196c16f538d67ee8bcdd9cd6e",
"size": "292",
"b... |
from Py3dsMax import mxs
from cross3d.abstract.abstractscenemap import AbstractSceneMap
class StudiomaxSceneMap( AbstractSceneMap ):
#------------------------------------------------------------------------------------------------------------------------
# public methods
#-----------... | {
"content_hash": "f5bc38bdad192b7abe40aa831e349627",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 122,
"avg_line_length": 31.76595744680851,
"alnum_prop": 0.5626255860683188,
"repo_name": "blurstudio/cross3d",
"id": "c4f4605531d7e0de4680edda38f49a407de7af01",
"size": "1... |
from collections import OrderedDict
import numpy as np
import pytest
import torch
from ..internal_graph import (InternalTorchIRBlock, InternalTorchIRGraph,
InternalTorchIRNode)
from ..torchir_passes import (flatten_graph_input_values,
flatten_graph_output_va... | {
"content_hash": "5906a5402ac85a24ffbab32d832b25f7",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 94,
"avg_line_length": 33.693370165745854,
"alnum_prop": 0.4933180290235304,
"repo_name": "apple/coremltools",
"id": "8343968db1a1f19849dea36032097dcd80791dc0",
"size": "1... |
"""Define API Topics."""
import base64
import json
import time
from google.cloud._helpers import _datetime_to_rfc3339
from google.cloud._helpers import _NOW
from google.cloud._helpers import _to_bytes
from google.cloud.exceptions import NotFound
from google.cloud.pubsub._helpers import topic_name_from_path
from googl... | {
"content_hash": "3a09c12716e7eb8858fe13717977ff74",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 97,
"avg_line_length": 36.8342644320298,
"alnum_prop": 0.6033872598584429,
"repo_name": "tartavull/google-cloud-python",
"id": "92c323ed63d72fd49a76c433387b8734e7a3e7bc",
... |
from __future__ import unicode_literals
import logging
from django.template import Template, Variable, VariableDoesNotExist
from django.test import SimpleTestCase
class TestHandler(logging.Handler):
def __init__(self):
super(TestHandler, self).__init__()
self.log_record = None
def emit(self... | {
"content_hash": "ef5d034e6a0e09d66ca28aeee5564cb6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 81,
"avg_line_length": 32.056338028169016,
"alnum_prop": 0.6019332161687171,
"repo_name": "akaariai/django",
"id": "a8ac82ecba97bcd41c618a690b47d1802ff3f1a7",
"size": "2276... |
"""Tests for pad.rules.body"""
import unittest
try:
from unittest.mock import patch, Mock
except ImportError:
from mock import patch, Mock
import oa.rules.body
class TestBodyRule(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.mock_msg = Mock()
def tearDown(... | {
"content_hash": "97d81218b22bbb3725c9d16e2352d49c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 70,
"avg_line_length": 33.27272727272727,
"alnum_prop": 0.650663544106167,
"repo_name": "SpamExperts/OrangeAssassin",
"id": "6a7c2b686ada1150159e2729d5c630bd2652a514",
"siz... |
"""Test mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that spend (directly or indirectly) coinbase transactions.
"""
from test_framework.test_framework import DoriancoinTestFramework
from test_framework.util import *
# Create one-input, one-output, no-fee transaction:
clas... | {
"content_hash": "eb4e9c304ef14117fa2d27cbda469c61",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 122,
"avg_line_length": 47.634408602150536,
"alnum_prop": 0.6566591422121896,
"repo_name": "doriancoins/doriancoin",
"id": "7d638d56e47dafcf86aa748f9b9021eaebf9b7c4",
"size... |
import optparse
from color import Coloring
from command import PagedCommand
class Overview(PagedCommand):
COMMON = True
helpSummary = "Display overview of unmerged project branches"
helpUsage = """
%prog [--current-branch] [<project>...]
"""
helpDescription = """
The '%prog' command is used to display an ove... | {
"content_hash": "95639f5e0325ee8ef40a67461f456e4c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 84,
"avg_line_length": 32.64935064935065,
"alnum_prop": 0.6085918854415274,
"repo_name": "lewixliu/git-repo",
"id": "11dba95ff7ea84bde55d028465676ba3d18682aa",
"size": "311... |
from django.template import loader
from django.urls.base import reverse, NoReverseMatch
from django.utils.text import capfirst
from django.utils.translation import ugettext as _
from xadmin.filters import SEARCH_VAR
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, CommAdminView
class TopNavPlu... | {
"content_hash": "37a01af5fb7a1995bc45a2b1518257d0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 107,
"avg_line_length": 29.916666666666668,
"alnum_prop": 0.6727019498607242,
"repo_name": "alexsilva/django-xadmin",
"id": "9413d30b88f76278bdf2101115c19eacd55ff5e8",
"siz... |
from flask import Blueprint
from ..models import Permission
main = Blueprint('main', __name__)
from . import views, errors
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission) | {
"content_hash": "97247d6d033248b9739d25bc802b7ab7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 38,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.7534246575342466,
"repo_name": "TomSGao/blogTom",
"id": "ae42eef3c83594747d7651c00143596398b507d6",
"size": "219",... |
import codecs
import json
import os
import shutil
import socket
import subprocess
import tempfile
from contextlib import contextmanager
from cStringIO import StringIO
from django.conf import settings
from django.core import mail
from django.core.files.storage import default_storage as storage
from django.core.urlresol... | {
"content_hash": "45d2360ae8efb62f7a92952a701650d6",
"timestamp": "",
"source": "github",
"line_count": 642,
"max_line_length": 79,
"avg_line_length": 37.848909657320874,
"alnum_prop": 0.6075147125396106,
"repo_name": "eviljeff/zamboni",
"id": "39fa2b8cc42b97e71707f4c9e0f703e900b947fd",
"size": "24... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tratamientos', '0006_auto_20170201_1554'),
]
operations = [
migrations.AddField(
model_name='planificacion',
name='motivo_fi... | {
"content_hash": "e0ee5325bd761118e2971c72cf2d2bcf",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 97,
"avg_line_length": 24.88888888888889,
"alnum_prop": 0.6294642857142857,
"repo_name": "mava-ar/sgk",
"id": "06dcdc652b3c0ae184f084eb0b453eac63a2e81c",
"size": "521",
"... |
"""
Module. Includes functions that will modify the accelerator lattice by inserting the one teapot node accelerator node.
"""
# import the auxiliary classes
from orbit.utils import orbitFinalize
# import general accelerator elements and lattice
from orbit.lattice import AccLattice, AccNode, AccActionsContainer, AccNo... | {
"content_hash": "ff10267886b3a5aef92499c348d46641",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 130,
"avg_line_length": 49.80952380952381,
"alnum_prop": 0.7348629700446144,
"repo_name": "PyORBIT-Collaboration/py-orbit",
"id": "a0e91c1c64e11a5de8df866c47e6dc9b1dc8a86d",
... |
from sqlalchemy_utils import UUIDType
from annotator.extensions import db
from annotator.models.problem import Problem
class TrainingJob(db.Model):
__tablename__ = 'training_job'
id = db.Column(
UUIDType(binary=False),
server_default=db.func.uuid_generate_v4(),
primary_key=True
)... | {
"content_hash": "3643d70651281a0752dd49cbe31e3aff",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 63,
"avg_line_length": 22.43243243243243,
"alnum_prop": 0.6144578313253012,
"repo_name": "planbrothers/ml-annotate",
"id": "ef2813d844f00efdd0b09ad3e810667c44f1e26f",
"size... |
from LR import predict
from pickleMe import load_pickle
classifier_global = load_pickle('LRclassifier.txt')
vectorizer_global = load_pickle('LRvectorizer.txt')
def testPredict():
assert predict('I love Python')[0] == 'positive' | {
"content_hash": "35dbcc84b0746bddfed42f50d95fc1e8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 23.5,
"alnum_prop": 0.7489361702127659,
"repo_name": "sazlin/reTOracle",
"id": "55e4166535e31a78307257c5603ff36986a420b7",
"size": "235",
"binary":... |
def tsvread(filename, delimiter = "\t", endline = "\n", **kwargs):
""" Parses tsv file to an iterable of dicts.
Args:
filename (str):
File to read. First line is considered header.
delimiter (str, Optional):
String used to mark fields in file. Defaults to '\\t'
... | {
"content_hash": "5ecf9bff45f5405e5526af3c12221515",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 105,
"avg_line_length": 37.78431372549019,
"alnum_prop": 0.5853658536585366,
"repo_name": "btoth/utility",
"id": "6cc1ebd80d15821b23ddc609d2571d2a76d0de59",
"size": "1931",... |
from setuptools import setup, find_packages
setup(
name = 'django-fixturemigration',
packages = find_packages(),
version = '0.7',
description = 'An app to load fixtures inside a migration data step',
author = 'Emilio A. Sánchez',
author_email = 'emilio@commite.co',
url = 'https://github.com... | {
"content_hash": "6e58483d1c268b07e457f44712c1b499",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 37.08,
"alnum_prop": 0.6084142394822006,
"repo_name": "emiliosanchez/django-fixturemigration",
"id": "d4e8f8fbcf214508460860d1b58835b325cea648",
"siz... |
import requests
#import json library
import json
# Disable warnings
requests.packages.urllib3.disable_warnings()
#controller='sandboxapic.cisco.com'
controller='devnetapi.cisco.com/sandbox/apic_em'
#creates and returns a service ticket.
def getTicket():
print("\nCreating ticket")
# put the ip address or dns o... | {
"content_hash": "bfc93635b88b19909959c237c26d9f75",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 110,
"avg_line_length": 32.72649572649573,
"alnum_prop": 0.7278662836249673,
"repo_name": "CiscoDevNet/coding-skills-sample-code",
"id": "13e45c3051e8d21fd8183cf968b95571988... |
import unittest
import numpy as np
import chainer
from chainer.initializers import Zero
from chainer.testing import attr
from chainer import Variable
from chainercv.links import VGG16
from chainercv.utils import testing
@testing.parameterize(
{'pick': 'prob', 'shapes': (1, 200), 'n_class': 200},
{'pick': '... | {
"content_hash": "360c5bf479bba38828e874b4055fea13",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 70,
"avg_line_length": 27.205128205128204,
"alnum_prop": 0.5838831291234684,
"repo_name": "pfnet/chainercv",
"id": "2a0379eed5328a916c0c8fbe4a8175ded8a266d8",
"size": "2122... |
from .cavl import ComodoCAVL
from ..interface import AntivirusPluginInterface
from lib.plugins import PluginBase
from lib.plugins import BinaryDependency, PlatformDependency
from lib.irma.common.utils import IrmaProbeType
class ComodoCAVLPlugin(PluginBase, ComodoCAVL, AntivirusPluginInterface):
# ==============... | {
"content_hash": "13f9e80eede7d411e4a46c30c60f57b1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 73,
"avg_line_length": 29.0625,
"alnum_prop": 0.6408602150537634,
"repo_name": "hirokihamasaki/irma",
"id": "005ced081d55f84ffe035b4e8d5d738b129a84b8",
"size": "1455",
"b... |
"""Tests for SwarmSpawner"""
from getpass import getuser
import pytest
from jupyterhub.tests.mocking import public_url
from jupyterhub.tests.test_api import add_user, api_request
from jupyterhub.utils import url_path_join
from tornado.httpclient import AsyncHTTPClient
from dockerspawner import SystemUserSpawner
# Ma... | {
"content_hash": "2c6be48086d76e01983669de2a4b7291",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 33.583333333333336,
"alnum_prop": 0.7022332506203474,
"repo_name": "jupyter/dockerspawner",
"id": "801e0ad80b872e85c277637b8733592f4b3bbcd1",
"size":... |
r"""
The global state for ec.
Stores the gobal variables stored across modules.
Note:
The module should not depend on other modules, in order to avoid cross dependency issues.
"""
Settings = {
'silent': None,
'debug': None,
'errorHandler': None,
}
main_module_name = '__main__'
ModulesQ ... | {
"content_hash": "a0e0d229c434287a74c69633c4b4146b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 93,
"avg_line_length": 17.88888888888889,
"alnum_prop": 0.6645962732919255,
"repo_name": "Laufire/ec",
"id": "1573853aad87138c3748fa331d92b0a3a0b04489",
"size": "483",
"b... |
from django.contrib.auth.models import User
__author__ = 'hadock'
from rest_framework import serializers
class UserSerializer(serializers.Serializer):
# parecido a un form
id = serializers.ReadOnlyField() # campo solo lectura , no se indica id al crear user
first_name = serializers.CharField()
last_... | {
"content_hash": "8a9a48eb08547b62dbf94f0749d96473",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 111,
"avg_line_length": 38.089285714285715,
"alnum_prop": 0.6502578527894983,
"repo_name": "krainet/Frikr",
"id": "f8df0f6ec5b12788b416452ca0116f0cfef8d68d",
"size": "2158"... |
"""
################################################################################
#
# Copyright (c) 2016 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
################################################################################
#
# Filename: nppipes.py
#
# Decriptio... | {
"content_hash": "571dc36b69e3113fa0a59b61a79b1df1",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 80,
"avg_line_length": 21.414141414141415,
"alnum_prop": 0.5714622641509434,
"repo_name": "WojciechMigda/mlpipes",
"id": "e6a94c9f5e4dcd198756697aedc29b08b9a75190",
"size"... |
"""Unit tests for clactions methods."""
from __future__ import print_function
import datetime
import itertools
import random
from chromite.cbuildbot import constants
from chromite.cbuildbot import metadata_lib
from chromite.cbuildbot import validation_pool
from chromite.lib import fake_cidb
from chromite.lib import ... | {
"content_hash": "8eca43d34d803a54a36507fbf18f263e",
"timestamp": "",
"source": "github",
"line_count": 771,
"max_line_length": 80,
"avg_line_length": 44.18028534370947,
"alnum_prop": 0.6758653083991427,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "c8fe3f40eb930b4c13726d24c1523d1d540009c1... |
"""
Sphinx extension to add directives to allow files and code to include the
latest installable version of Flocker.
"""
import importlib
import os
from sphinx.directives.code import LiteralInclude
from sphinx.roles import XRefRole
from flocker import __version__ as version
from flocker.common.version import get_ins... | {
"content_hash": "3a35fa6142654fdf2e552fec72236493",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 31.958677685950413,
"alnum_prop": 0.6798551848978537,
"repo_name": "mbrukman/flocker",
"id": "5dbe38ae1f40bd57abcb02a077877d0da7b3a766",
"size": "39... |
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.1'
| {
"content_hash": "d9c8be190235524ca9a35cae23302a59",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 59,
"avg_line_length": 32.8,
"alnum_prop": 0.75,
"repo_name": "gnmiller/craig-bot",
"id": "2a3bf471423bbf789f13755d3dcb03826f7aff36",
"size": "239",
"binary": false,
"co... |
""" Utilities for authentication and authorization """
import binascii
from paste.httpheaders import AUTHORIZATION, WWW_AUTHENTICATE
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.httpexceptions import HTTPForbidden, HTTPUnauthorized
from pyramid.security import Everyone, authenticated_userid
... | {
"content_hash": "0b55f565e72e66c1d17ecb9825299262",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 83,
"avg_line_length": 35.541666666666664,
"alnum_prop": 0.6605258750628036,
"repo_name": "johnswanson/pypicloud",
"id": "c097f5eb96da089cb9114d24eb10c300a1e21530",
"size"... |
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 field 'Unit.title_en'
db.add_column('courses_unit', 'title_en',
self.gf('django.db.models.fields.Char... | {
"content_hash": "f3c659336405d68563d5c6a4f653a34c",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 232,
"avg_line_length": 81.59810126582279,
"alnum_prop": 0.5450455691293388,
"repo_name": "GeographicaGS/moocng",
"id": "cc78b9d0bd52b920c121c07049741cd4be1b86eb",
"size":... |
import datetime
import importlib
import io
import os
import shutil
import sys
from unittest import mock
from django.apps import apps
from django.core.management import CommandError, call_command
from django.db import (
ConnectionHandler,
DatabaseError,
OperationalError,
connection,
connections,
... | {
"content_hash": "aea6a6bedde8f2dd338194055b3d90c1",
"timestamp": "",
"source": "github",
"line_count": 3159,
"max_line_length": 88,
"avg_line_length": 41.0747071858183,
"alnum_prop": 0.5738507186620939,
"repo_name": "shaib/django",
"id": "61a914f8ce79535c49bfcf47391a76fbb1072cdb",
"size": "129799"... |
import sys, os
# 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 it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "a8c1e0aa15c545c884ead31b09e4c6f5",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 80,
"avg_line_length": 32.07772020725388,
"alnum_prop": 0.7095784202875142,
"repo_name": "Lemma1/MAC-POSTS",
"id": "6430c3442e9aad81a8a402e53ed0b76a70400210",
"size": "660... |
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 field 'RSVP.key'
db.add_column('meetings_rsvp', 'key',
self.gf('django.db.models.fields.CharField')(m... | {
"content_hash": "af71973d50f8c017bac47cdc3886a95f",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 182,
"avg_line_length": 74.36134453781513,
"alnum_prop": 0.5402870380833993,
"repo_name": "brianray/chipy.org",
"id": "248ecd21fd68cff559c77d8917df71a30fef8432",
"size": "... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Moderation',
fields=[
('id', models.AutoField(auto_created=... | {
"content_hash": "55f15b4afeee0e1074bb998f374a2022",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 124,
"avg_line_length": 39.972972972972975,
"alnum_prop": 0.5618661257606491,
"repo_name": "CareerVillage/slack-moderation",
"id": "e685b8dbb9be77ec0499a427b6b1696669429466",... |
__author__ = '7sDream'
import json
import datetime
from .common import *
class Author:
"""用户类,请使用``ZhihuClient.answer``方法构造对象."""
@class_common_init(re_author_url)
def __init__(self, url, name=None, motto=None, follower_num=None,
question_num=None, answer_num=None, upvote_num=None,
... | {
"content_hash": "f6a1b7ac92f45b4a427b81902bc89d03",
"timestamp": "",
"source": "github",
"line_count": 581,
"max_line_length": 79,
"avg_line_length": 36.88468158347676,
"alnum_prop": 0.48562762482501165,
"repo_name": "falseen/zhihu-py3",
"id": "4e606f7e5d46d63a11a529e901b9a1d3951fa3a4",
"size": "2... |
import copy
import re
from lxml import builder
from lxml import etree as ET
from oslo_concurrency import processutils
from oslo_log import log
import six
from manila.common import constants as const
from manila import exception
from manila.i18n import _, _LE, _LI, _LW
from manila.share.drivers.dell_emc.plugins.vnx im... | {
"content_hash": "0a066eb650cda7c8608f8dc9b9bdf2e1",
"timestamp": "",
"source": "github",
"line_count": 2039,
"max_line_length": 79,
"avg_line_length": 37.922020598332516,
"alnum_prop": 0.5152929917359648,
"repo_name": "vponomaryov/manila",
"id": "47cf3aa52fe2ee3b5b8b7b15a7f0ec0d1cd62e7d",
"size": ... |
import sys
import datetime, dateutil.parser, dateutil.tz
def runtest(repo, limits, repo_status, errormsg):
testname = 'gc'
warning_days = limits[testname + '-warning']
critical_days = limits[testname + '-critical']
if errormsg != "":
if errormsg.endswith('Not found'):
# ignore rep... | {
"content_hash": "d14f315047a07208fc344c41fb98c858",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 78,
"avg_line_length": 30.568181818181817,
"alnum_prop": 0.5732342007434944,
"repo_name": "DrDaveD/cvmfs-servermon",
"id": "ac83630d9b9a9bc19b484b15d47f5aacf58d51c7",
"size... |
from datetime import datetime
class MyHelper():
@classmethod
def days_ago(cls, d):
return (datetime.now().date() - d).days
| {
"content_hash": "d724914deced466a069368f222e77724",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 47,
"avg_line_length": 17.75,
"alnum_prop": 0.6338028169014085,
"repo_name": "bumper-app/bumper-bianca",
"id": "28fe3a4397c857d06cdc4720c031f29646ad3e23",
"size": "142",
"... |
"""
To go through json data and get total number of smells and sewer (and to combine with diptheria) for all year
Json file already mapped
"""
import json
import csv
totals = {}
with open('visualisation/leaflet/data/leaflet_markers.json') as json_data:
d = json.load(json_data)
# print(d)
for f in d:
... | {
"content_hash": "5f1ff566ef572873e543741067146f13",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 109,
"avg_line_length": 24.78048780487805,
"alnum_prop": 0.6417322834645669,
"repo_name": "Smelly-London/datavisualisation",
"id": "6f25b011aa7f51517501c4ce100c1d0debd90127",... |
from json import dumps
from circuits.web import Server, Controller
def json(f):
def wrapper(self, *args, **kwargs):
return dumps(f(self, *args, **kwargs))
return wrapper
class Root(Controller):
@json
def getrange(self, limit=4):
return list(range(int(limit)))
app = Server(("0.0.0.... | {
"content_hash": "c7d60170176170543f75c31620f051f6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 46,
"avg_line_length": 18.1,
"alnum_prop": 0.6408839779005525,
"repo_name": "eriol/circuits",
"id": "99c1ac6d9cd12c308446ccd03332e192930ecd6f",
"size": "385",
"binary": f... |
"""
Module for parsing SuSE update info metadata. This was introduced in SLES 11.
Refer to patchxml.py for previous versions.
"""
import os
import logging
log = logging.getLogger('repomd')
__all__ = ('UpdateInfoXml', )
from rpath_xmllib import api1 as xmllib
from repomd.packagexml import PackageCompare
from repom... | {
"content_hash": "f169ba7f2aeb948a883af5850e3605b7",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 78,
"avg_line_length": 30.574534161490682,
"alnum_prop": 0.5706449974606399,
"repo_name": "sassoftware/mirrorball",
"id": "0ba4c3bd5baed26790e46c82c9871a1edbb6d4ec",
"size... |
"""
Zonal Statistics
Vector-Raster Analysis
Copyright 2013 Matthew Perry
Usage:
zonal_stats.py VECTOR RASTER
zonal_stats.py -h | --help
zonal_stats.py --version
Options:
-h --help Show this screen.
--version Show version.
"""
#https://gist.github.com/perrygeo/5667173#file-zonal_stats-py-L10
from osg... | {
"content_hash": "e79166049df575abd986fd7dd26105b3",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 104,
"avg_line_length": 32.63636363636363,
"alnum_prop": 0.5745125348189415,
"repo_name": "BuddyVolly/OpenSARKit",
"id": "61a267515259732239b800f0167ecf1e615c094c",
"size"... |
age = 44
def info():
print age # Печатаем глобальную переменную age
def local_info():
age = 22 # создаем локальную переменную age
print age
info() # напечатает 44
local_info() # напечатает 22 | {
"content_hash": "bd150fa5f652977f405de4f3df66c77f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 50,
"avg_line_length": 19.09090909090909,
"alnum_prop": 0.6761904761904762,
"repo_name": "janusnic/py-21v",
"id": "976e0d5cc235a3d6e22cfe13b9652547c0974617",
"size": "360",... |
"""
Configuration options registration and useful routines.
"""
import sys
from oslo_config import cfg
import st2common.config as common_config
from st2common.constants.system import VERSION_STRING
CONF = cfg.CONF
def parse_args(args=None):
CONF(args=args, version=VERSION_STRING)
def register_opts():
_r... | {
"content_hash": "99db054674ac5498213c06c7847e1e19",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 99,
"avg_line_length": 30.573333333333334,
"alnum_prop": 0.6258177060619277,
"repo_name": "grengojbo/st2",
"id": "3768feb52ac4c26efcac49cb15b4bb08b1abb2b8",
"size": "3073",... |
"Memcached cache backend"
import pickle
import re
import time
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.utils.functional import cached_property
class BaseMemcachedCache(BaseCache):
def __init__(self, server, params, library, value_not_found_exception):
super().__... | {
"content_hash": "1542a6d08f922e924665071dcac68e20",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 108,
"avg_line_length": 38.946236559139784,
"alnum_prop": 0.6256212037548315,
"repo_name": "frankvdp/django",
"id": "bb27cb53bba4c4ef698dde2edb8bc57d1021ca8a",
"size": "72... |
from runner.koan import *
class AboutLambdas(Koan):
def test_lambdas_can_be_assigned_to_variables_and_called_explicitly(self):
add_one = lambda n: n + 1
self.assertEqual(11, add_one(10))
def make_order(self, order):
return lambda qty: str(qty) + " " + order + "s"
d... | {
"content_hash": "852adfd039c3de596251ff779dd76de2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 36.05263157894737,
"alnum_prop": 0.6204379562043796,
"repo_name": "akarambir/python-koans",
"id": "a6ee146e3eb72cffb5f626232dd9ead198c1c55a",
"size":... |
from itertools import chain
from django.db import (
connection,
migrations,
OperationalError,
ProgrammingError,
)
def squash_data(squashed):
'''Returns a tuple of the squashed_keys and the key position to begin
processing replace and operation lists'''
cm = current_migration()
squashe... | {
"content_hash": "14f063496efbc83c86b7e37075c3fed4",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 93,
"avg_line_length": 37.317460317460316,
"alnum_prop": 0.7056571671629094,
"repo_name": "wwitzel3/awx",
"id": "e2f19970b40a838363ae028e76f9e6b6c4fe4775",
"size": "2351",
... |
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
import decimal
class PositiveDecimalField(models.DecimalField):
__metaclass__ = models.SubfieldBase
default_error_messages = {
'positive': _(u'Add only positive numb... | {
"content_hash": "e2036d48dcd265f532bfee30ea6300eb",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 28.4,
"alnum_prop": 0.6507042253521127,
"repo_name": "gord1anknot/pyfitnesspal",
"id": "60d556ccefad2a78ea7ce194991bce711bd5c768",
"size": "1286",
... |
import redis
from uuid import uuid4
UUID = 'uuid'
class SimpleRedisDb(object):
def __init__(self, host, key, port=6379):
"""
:param host: database host
:param port: database port default 6397
:param key: hash set name default active_mail_filter
"""
self.host = hos... | {
"content_hash": "20988d035d4f1b96011f531e7306f664",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 112,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.5445331695331695,
"repo_name": "kfrodgers/active-mail-filter",
"id": "c65991ab6b28df522a4166fe9e33e47799614c92",
... |
import sys
import numpy as np
import warnings
if sys.version > '3':
xrange = range
basestring = str
from pyspark import SparkContext, since
from pyspark.mllib.common import callMLlibFunc, inherit_doc
from pyspark.mllib.linalg import Vectors, SparseVector, _convert_to_vector
from pyspark.sql import DataFrame
... | {
"content_hash": "8178e43f206f113cbb746abe7abac321",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 98,
"avg_line_length": 37.29941291585127,
"alnum_prop": 0.5955403987408184,
"repo_name": "DataReplyUK/datareplyuk",
"id": "48867a08dbfad8533b15f3e14923aa9ac61e9a98",
"size... |
import sys
class KernelException(Exception):
pass
class Kernel:
def __init__(self, ram, stack):
self.RAM = ram
self.stack = stack
self.filenumber_mapping = {
0: sys.stdin,
1: sys.stdout
}
def read_string(self, memory_address):
'''Helper fu... | {
"content_hash": "7e5a71627a3c605c2c9982b9dad191f0",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 88,
"avg_line_length": 33.32773109243698,
"alnum_prop": 0.537821482602118,
"repo_name": "redfast00/RCPU",
"id": "007d5577d0eaeffdd10a7b42e25c99fa9b01e22e",
"size": "3966",... |
"""
The Python parts of the Jedi library for VIM. It is mostly about communicating
with VIM.
"""
import traceback # for exception output
import re
import os
import vim
import jedi
import jedi.keywords
from jedi._compatibility import unicode
temp_rename = None # used for jedi#rename
class PythonToVimStr(unicode):... | {
"content_hash": "ae0de97013b69a44728b87fd1ef8e9ed",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 89,
"avg_line_length": 37.36011904761905,
"alnum_prop": 0.5422608141480124,
"repo_name": "w-cheng/vim-dotfiles",
"id": "cd34b29ab4f86f06196058e052d449ddc228766e",
"size": ... |
"""Urls definition for notification widget."""
from django.conf.urls import url, patterns
urlpatterns = patterns('apps.widgets.notifications.views',
url(r'^(\d+)/read/$', 'read', name="notifications_read"),
)
| {
"content_hash": "8e5a7de472fabe602721d40d88910bd6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.7069767441860465,
"repo_name": "yongwen/makahiki",
"id": "db1065e9f7e6c40e2763e2ad214b494b4842dd69",
"size": "215"... |
from elasticsearch import Elasticsearch
def es_create_indexes(data_index_name='data', metadata_index_name='metadata',
summary_index_name='summary', delete_previous_indexes=True, **kwargs):
"""
Creation of ElasticSearch Indexes to save a WaterFrame object.
Parameters
----------
... | {
"content_hash": "b167b6c8333f65e3129411b1b4b47818",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 92,
"avg_line_length": 42.8978102189781,
"alnum_prop": 0.46316147694401905,
"repo_name": "rbardaji/oceanobs",
"id": "e80b63f02da6ae3849295e3176724a66b1ff5482",
"size": "58... |
"""
This module allows persistent iteration of alerts. Some use cases include opening tickets based
on new alerts, or even automating responses for some high-confidence alerts.
"""
import json
from abc import ABCMeta, abstractmethod
from collections import Iterable, Iterator
from os.path import isfile
from six import ... | {
"content_hash": "a663df8514cf6d74f7b70b28349bdec1",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 122,
"avg_line_length": 40.34099616858238,
"alnum_prop": 0.6105043213980434,
"repo_name": "Niddel/magnet-api2-sdk-python",
"id": "21983469872ca6aecd2cd0f9627f1f26f0d6b3db",
... |
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
from google.datalab.utils._lru_cache import LRUCache
class TestCases(unittest.TestCase):
def test_cache_no_entry(self):
cache = LRUCache(3)
with self.assertRaises(KeyError):
cache['a']
def test_cache_lo... | {
"content_hash": "0a61507199900199f68fea3be9c930b5",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 52,
"avg_line_length": 21.3953488372093,
"alnum_prop": 0.5695652173913044,
"repo_name": "supriyagarg/pydatalab",
"id": "58b369c817607182924057b605ff5fe40ada2c48",
"size": "... |
"""
Tests for django.core.servers.
"""
from __future__ import unicode_literals
import contextlib
import errno
import os
import socket
from django.test import LiveServerTestCase, override_settings
from django.utils._os import upath
from django.utils.http import urlencode
from django.utils.six import text_type
from dja... | {
"content_hash": "1bb8ac5a4446b711f08f5ef1f3e04f8a",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 99,
"avg_line_length": 33.87591240875913,
"alnum_prop": 0.632191338073691,
"repo_name": "peterlauri/django",
"id": "03e05d0957e850af2d3fc3bb1e3ae73ea92acb95",
"size": "467... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.