text stringlengths 4 1.02M | meta dict |
|---|---|
from oslo_policy import policy
from managesf.policies import base
BASE_POLICY_NAME = 'managesf.node'
POLICY_ROOT = BASE_POLICY_NAME + ':%s'
rules = [
policy.RuleDefault(
name=POLICY_ROOT % 'get',
check_str=base.RULE_ANY),
policy.RuleDefault(
name=POLICY_ROOT % 'hold',
check_... | {
"content_hash": "854af5b95b41cd71e9c3781a6f2ae4bb",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 49,
"avg_line_length": 26.63888888888889,
"alnum_prop": 0.6360792492179353,
"repo_name": "enovance/managesf",
"id": "e9c4c5681891da8ec739b5499f688d19e9bb6cdd",
"size": "156... |
import logging
import pytest
from tests.common.test_vector import *
from tests.common.test_dimensions import *
from tests.common.impala_test_suite import ImpalaTestSuite
from tests.common.impala_cluster import ImpalaCluster
from CatalogService import CatalogService
from CatalogService.CatalogService import TGetFunctio... | {
"content_hash": "0a4968653624b9b4363c63eb1ffc28f6",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 88,
"avg_line_length": 42.05833333333333,
"alnum_prop": 0.7259758272240935,
"repo_name": "kapilrastogi/Impala",
"id": "033b17670c13f22537736c6cfeb53cd80b7c42ce",
"size": "... |
"""Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.5"
import os
import string
import posixpath
import BaseHTTPServer
import urllib
import cgi
import shutil
from StringIO import StringIO
class Sim... | {
"content_hash": "3ac12165debd63842c6d9434125045cf",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 78,
"avg_line_length": 32.03030303030303,
"alnum_prop": 0.5849889624724062,
"repo_name": "MalloyPower/parsing-python",
"id": "4cfedbc9fe9ba8b1962fee713d163f4f6039ec2a",
"s... |
import sys
import numpy as np
from astropy.io.fits.column import FITS2NUMPY, ColDefs, Column
from astropy.io.fits.fitsrec import FITS_rec, FITS_record
from astropy.io.fits.util import _is_int, _is_pseudo_integer, _pseudo_zero
from astropy.utils import lazyproperty
from .base import DELAYED, DTYPE2BITPIX
from .image ... | {
"content_hash": "2ff79c9071aa8e0f70891483550ef0bb",
"timestamp": "",
"source": "github",
"line_count": 643,
"max_line_length": 87,
"avg_line_length": 33.28615863141524,
"alnum_prop": 0.5317478858104004,
"repo_name": "pllim/astropy",
"id": "16c465238b60623bdcb8108e969b932f3fd9ddc0",
"size": "21467"... |
"""Test GatewayClient"""
import os
import json
import uuid
from datetime import datetime
from io import StringIO
from unittest.mock import patch
import nose.tools as nt
from tornado import gen
from tornado.web import HTTPError
from tornado.httpclient import HTTPRequest, HTTPResponse
from notebook.gateway.managers imp... | {
"content_hash": "29868316620e346e575065297bbefd31",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 149,
"avg_line_length": 42.621468926553675,
"alnum_prop": 0.6371288441145281,
"repo_name": "sserrot/champion_relationships",
"id": "bc42014e449c4c029f2b45f6d8e56ce80b3049ac"... |
"""
Author: Mitchell Blowey
Constants for use in the fields of different headers.
This list is not complete, being only composed of the first ten protocol
options for IP headers, since it did not seem necessary to add in all possible 255 values,
most of which will never be used by this program.
I may one day reach t... | {
"content_hash": "6ef7b12f29d980a121eaf1e6490b4fc8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 90,
"avg_line_length": 19.463414634146343,
"alnum_prop": 0.6441102756892231,
"repo_name": "mblowey/PacketOps",
"id": "b06988d77af99f14e073bc2afb4060a643c5fefb",
"size": "79... |
import os
import time
import boto
import boto.ec2
from tabulate import tabulate
from jinja2 import Environment, FileSystemLoader
import sys, argparse
import yaml
def launch_instance(ec2, ami, instance_type, region, groups, key_name ):
print 'Launch instance [ami=%s, type=%s, groups=%s, key=%s'%(ami, instance_typ... | {
"content_hash": "65c28fb23798c3508b5a930bfccab3fd",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 131,
"avg_line_length": 36.76093294460642,
"alnum_prop": 0.5866444603061305,
"repo_name": "arrawatia/ansible-homebase",
"id": "7e5f2cdebe4eb7d287e1607be58daf4c903b5039",
"... |
import _plotly_utils.basevalidators
class LenmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="lenmode", parent_name="funnel.marker.colorbar", **kwargs
):
super(LenmodeValidator, self).__init__(
plotly_name=plotly_name,
pa... | {
"content_hash": "06fdfd739b922c57f9ba063e0c410f2a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 83,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.608,
"repo_name": "plotly/plotly.py",
"id": "184ff1f12865c1221132d7ee0193f867f5289e68",
"size": "500",
"binary"... |
__version__='''$Id: test_encrypt.py 3959 2012-09-27 14:39:39Z robin $'''
__doc__="""Testing to encrypt a very minimal pdf using a Canvas and a DocTemplate.
TODO: Automatiocally test that this pdf is really encrypted.
"""
import unittest
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, pri... | {
"content_hash": "28f4596ba9f60070a2e6c974ae1c3a69",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 96,
"avg_line_length": 37.69642857142857,
"alnum_prop": 0.6925627664613927,
"repo_name": "nakagami/reportlab",
"id": "e37caeefe5f628c563847aeb181988f2be86b508",
"size": "22... |
import errno
import os
from swift import gettext_ as _
from swift import __version__ as swiftver
from swift.common.swob import Request, Response
from swift.common.utils import get_logger, config_true_value, json
from swift.common.constraints import check_mount
from resource import getpagesize
from hashlib import md5
... | {
"content_hash": "c9f3496d16f3e95815044882e21b1194",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 79,
"avg_line_length": 41.69526627218935,
"alnum_prop": 0.5097566167600937,
"repo_name": "xiaoguoai/ec-dev-swift",
"id": "357a431fd4980443f04e669ff58c416bf7bcb83c",
"size"... |
"""Standard HTTP request handlers for an HTTP server."""
__author__ = 'mqian@google.com (Mike Qian)'
import gc
import linecache
import logging
import os
import re
import sys
import threading
import traceback
import db
import vars_common
import vars_export
import vars_helper
_HTML_HEADER = """<HTML>
<HEAD><TITLE>%... | {
"content_hash": "ca58d557c6b8046bae007cfb08103ccb",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 80,
"avg_line_length": 28.919298245614034,
"alnum_prop": 0.6705896627032274,
"repo_name": "dbarobin/google-mysql-tools",
"id": "9d88e58057499d45a394b609b7ca78c03ca1508b",
... |
'''
makes a dictionary of geographic location found in flubase name strings.
these name strings are submitted to google geocoder to obtain full
geographic information including longitude and latidue. based on this,
regions like south america are defined
'''
from Bio import SeqIO
import pickle
import time,gzip
fname ... | {
"content_hash": "55f8e36b77567bc1a0b1928bdf0751f4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 81,
"avg_line_length": 33.67741935483871,
"alnum_prop": 0.6154214559386973,
"repo_name": "rneher/FitnessInference",
"id": "0452d02dca650fd7049f8a18485cd507e4e32cd5",
"size"... |
from txServiceRegistry.client import Client
from twisted.internet import reactor
RACKSPACE_USERNAME = '' # your username here
RACKSPACE_KEY = '' # your API key here
SERVICE_REGISTRY_URL = 'https://dfw.registry.api.rackspace.com/v1.0/'
client = Client(username=RACKSPACE_USERNAME,
apiKey=RACKSPACE_KEY,
... | {
"content_hash": "ad4c26b3879d17d6af5780184de4c400",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 69,
"avg_line_length": 35.90909090909091,
"alnum_prop": 0.6835443037974683,
"repo_name": "racker/service-registry",
"id": "34d1ee765721feca87198d711fee84c649f3d75b",
"size"... |
from __future__ import print_function
import argparse
import os
import random
import sys
sys.path.append(os.getcwd())
import pdb
import time
import numpy as np
import json
import progressbar
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.backends.cudnn as cudn... | {
"content_hash": "87091a6003c1259f9c312b0d05c04d7f",
"timestamp": "",
"source": "github",
"line_count": 618,
"max_line_length": 128,
"avg_line_length": 41.859223300970875,
"alnum_prop": 0.5816614480652519,
"repo_name": "jiasenlu/visDial.pytorch",
"id": "65ea077ef591df269b740d1487ccb068564c595b",
"s... |
from __future__ import print_function, division
# 第三方
import tensorflow as tf
from sklearn.metrics import confusion_matrix
import numpy as np
# 我们自己
import load
train_samples, train_labels = load._train_samples, load._train_labels
test_samples, test_labels = load._test_samples, load._test_labels
print('Training se... | {
"content_hash": "a5116782606f19b287f4afd958b530af",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 107,
"avg_line_length": 31.915422885572138,
"alnum_prop": 0.6807482462977397,
"repo_name": "karst87/ml",
"id": "03040f2741cf92f54d6eb1580bb152a002df5778",
"size": "6702",
... |
"""Parser for syslog formatted log files.
Also see:
* https://www.rsyslog.com/doc/v8-stable/configuration/templates.html
"""
import re
from dfdatetime import time_elements as dfdatetime_time_elements
import pyparsing
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import... | {
"content_hash": "cc88b3a64f3c62baa7e0d3ba9f440109",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 79,
"avg_line_length": 36.62282878411911,
"alnum_prop": 0.651737922623484,
"repo_name": "kiddinn/plaso",
"id": "c211781f88b65136b483cc395466b8da9d685406",
"size": "14783",... |
"""Denmark specific Form helpers."""
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms import fields, widgets
from django.utils.translation import ugettext_lazy as _
from localflavor.deprecation import DeprecatedPhoneNumberFormFieldMixin
from .dk_municipali... | {
"content_hash": "33e283620006199f5cbcd443e36bb831",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 94,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6577708006279435,
"repo_name": "thor/django-localflavor",
"id": "83305ad4b438b4eed0c44748cb0ad5c82e9f68e1",
"size... |
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
import yamlstratus
here = os.path.abspath(os.path.dirname(__file__))
long_description = """
YAML Stratus provides extensions to YAML that make it amenable to use with AWS
CloudFormation, as well as a python bin... | {
"content_hash": "9fc6807d8ec9878cd8499d59058b5632",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 29.063291139240505,
"alnum_prop": 0.6750871080139372,
"repo_name": "kikinteractive/yaml-stratus",
"id": "37ddea3f4f41d6e4c9765fbb38de7579e3cdc532",
"... |
from __future__ import with_statement, print_function
import pytest
try:
from unittest import mock
except ImportError:
import mock
from k2catalogue import proposal_urls
@pytest.fixture
def campaign():
return 1
@pytest.fixture
def mapper(campaign):
return proposal_urls.BuildCampaignMapping(campaign)... | {
"content_hash": "301466bc0a45a4e50e1819b23ceb46bc",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 99,
"avg_line_length": 27.17283950617284,
"alnum_prop": 0.6456156292594275,
"repo_name": "mindriot101/k2catalogue",
"id": "8ecce0f5cd0d8a77b03aff479ea4446107156798",
"size"... |
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
PEM_FILE = os.path.join(jupyter_data_dir(), 'notebook.pem')
c = get_config()
c.NotebookApp.ip = os.getenv('INTERFACE', '') or '*'
c.NotebookApp.port = int(os.getenv('PORT', '') or 8888)
c.NotebookApp.open_browser = Fa... | {
"content_hash": "b511b87e94a63047cf5286a67468789c",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 69,
"avg_line_length": 36.078947368421055,
"alnum_prop": 0.6258205689277899,
"repo_name": "torz/docker-stacks",
"id": "e8343b35e5ad5687242143fbbd98cd732ce31379",
"size": "1... |
from __future__ import unicode_literals
from django.contrib.auth.models import User, Group
from categories.models import CategoryBase
from django.db import models
from datetime import datetime
class Skill(CategoryBase):
class Meta:
verbose_name = 'Skill'
verbose_name_plural = 'Skills'
def __s... | {
"content_hash": "0475cab061d06ece180bb223d1e761ef",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 121,
"avg_line_length": 31.817460317460316,
"alnum_prop": 0.6482913444749314,
"repo_name": "foraliving/pilot",
"id": "04c15734eb1d02dcc1b467a30ecd4a0840bc381c",
"size": "1... |
from django.conf.urls import url
from . import views
app_name = 'evening_program'
urlpatterns = [
url(r'^$', views.evening_program, name='index'),
url(r'^neu/$', views.ProgramCreate.as_view(success_url='/heimabende'), name='add'),
url(r'^(?P<slug>[\w-]+)/$', views.evening_program_details, name='details')... | {
"content_hash": "41ac61517079f2910013bfb74a96ff63",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 87,
"avg_line_length": 29.454545454545453,
"alnum_prop": 0.6512345679012346,
"repo_name": "n2o/dpb",
"id": "464948fd7acd3368096c99301521845c3b3810f7",
"size": "324",
"bin... |
"""An abstract for a collection of key_range.KeyRange objects."""
from google.appengine.ext import key_range
from mapreduce import namespace_range
__all__ = [
"KeyRangesFactory",
"KeyRanges"]
# pylint: disable=g-bad-name
class KeyRangesFactory(object):
"""Factory for KeyRanges."""
@classmethod
de... | {
"content_hash": "b971d9528c93e552ff605eebdebf8d6f",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 80,
"avg_line_length": 24.323529411764707,
"alnum_prop": 0.6336154776299879,
"repo_name": "VirusTotal/appengine-mapreduce",
"id": "819c2bb9f222dadc8a2a08765a6de3c58ecd5095",... |
import sys
import json
import urllib2
import argparse
from operator import itemgetter
from prettytable import PrettyTable
AWE_URL = 'https://awe.mg-rast.org'
MGP = {
'mgrast-prod-4.0.3': [
'qc_stats',
'adapter trim',
'preprocess',
'dereplication',
'screen',
'rna dete... | {
"content_hash": "a1e79faa22c480a3f32561c172c0ad7d",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 123,
"avg_line_length": 33.98571428571429,
"alnum_prop": 0.5182849936948297,
"repo_name": "MG-RAST/MG-RAST",
"id": "7bdf87912230e315fb0485edeb08ae673485dd40",
"size": "716... |
from io import BytesIO
import json, base64
from .command import download
import logging
LOG = logging.getLogger(__name__)
# json.dumps and json.loads expect ascii unless the json was explicitly encoded as utf8,
# which we don't do anywhere in builder.
# <bytes>.decode and <string>.encode() both default to UTF-8
# so ... | {
"content_hash": "bd32143ee8d047951a28493b7f32ed59",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 88,
"avg_line_length": 38.32142857142857,
"alnum_prop": 0.7315936626281454,
"repo_name": "elifesciences/builder",
"id": "937983a5c4440cb2fb489005937c6d9e08cc701d",
"size": ... |
"""Metric losses base class."""
from typing import Any, Callable, Dict, Optional
import tensorflow as tf
from tensorflow_similarity.types import FloatTensor
from tensorflow_similarity.utils import is_tensor_or_variable
class MetricLoss(tf.keras.losses.Loss):
"""Wraps a loss function in the `Loss` class."""
... | {
"content_hash": "11b0b5807676472688a60c72d20219b2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 118,
"avg_line_length": 34.03636363636364,
"alnum_prop": 0.5913461538461539,
"repo_name": "tensorflow/similarity",
"id": "369cf71db9201c1bd7723420fe01ec98f7e4f93a",
"size":... |
from . import RequestOptions
class Pager(object):
"""
Generator that takes an endpoint with `.get` and lazily loads items from Server.
Supports all `RequestOptions` including starting on any page.
"""
def __init__(self, endpoint, request_opts=None):
self._endpoint = endpoint.get
s... | {
"content_hash": "18736a21cc5252f2050c2768723b42ee",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 100,
"avg_line_length": 38.93023255813954,
"alnum_prop": 0.6248506571087217,
"repo_name": "Talvalin/server-client-python",
"id": "eaad398afb68a32f0938b409af3b308798e720d7",
... |
import pygraphviz as pgv
import wx
class GraphImgPanel(wx.Panel):
def __init__(self, parent, size):
wx.Panel.__init__(self, parent = parent, size = size)
self.size = size
rootSizer = wx.BoxSizer(wx.HORIZONTAL)
verticalSizer = wx.BoxSizer(wx.VERTICAL)
rootSizer.AddStretchSpa... | {
"content_hash": "67b48002ab5331efa3e9a67df0812336",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 123,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.6549165120593692,
"repo_name": "DarthThanatos/citySimNG",
"id": "b9b194fff643127ba556848895d230f2775994d0",
"siz... |
from twisted.internet import protocol, threads, defer
from protocol import ProtobufProtocol, gateway_pb2, common_pb2, dump
from logger import logger
from user import User
from hero import Hero
import random
global instances
class Gateway(ProtobufProtocol):
_checksum = 0
_version_checked = False
_user = None... | {
"content_hash": "82b53e742e4154082bfa905e4adaf2fe",
"timestamp": "",
"source": "github",
"line_count": 1011,
"max_line_length": 100,
"avg_line_length": 26.512363996043522,
"alnum_prop": 0.6797492911505746,
"repo_name": "zzragida/PythonExamples",
"id": "107706a9e05b3e55b268754723c65a9c93f242ed",
"s... |
"""
Fiona is OGR's neat, nimble, no-nonsense API.
Fiona provides a minimal, uncomplicated Python interface to the open
source GIS community's most trusted geodata access library and
integrates readily with other Python GIS packages such as pyproj, Rtree
and Shapely.
How minimal? Fiona can read features as mappings fr... | {
"content_hash": "d8536feb834173402bcee0ad03f48012",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 73,
"avg_line_length": 34.567796610169495,
"alnum_prop": 0.6211081147340034,
"repo_name": "johanvdw/Fiona",
"id": "2bd255273f7c78743b197276ef2f4f9e0aae3c1b",
"size": "8183... |
from datetime import date, timedelta, datetime
from dateutil import rrule
def week_start_date(year, week):
"""
Taken from http://stackoverflow.com/a/1287862/1064619
"""
d = date(year, 1, 1)
delta_days = d.isoweekday() - 1
delta_weeks = week
if year == d.isocalendar()[0]:
delta_week... | {
"content_hash": "e49e35f5e9662f11cef4aa36e1c7ab80",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 135,
"avg_line_length": 31.1875,
"alnum_prop": 0.5861723446893787,
"repo_name": "worldofchris/jlf",
"id": "0a6139fe83b7881a329b490e5fc8902dd88c437b",
"size": "998",
"bina... |
from kao_decorators import lazy_property
from importlib import import_module
class KaoModule:
""" Represents a Python module """
def __init__(self, name):
""" Initialize the module with the name of the module it represents """
self.name = name
@property
def fi... | {
"content_hash": "8d6093f3a7a116423af750cee09a1787",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 32.65,
"alnum_prop": 0.5620214395099541,
"repo_name": "cloew/KaoModules",
"id": "5a9cb8b6bd0a21d364c0fd63e3f5349189728187",
"size": "1306",
"binary... |
from __future__ import with_statement
import os
import textwrap
from . import D2to1TestCase
from .util import open_config
class TestHooks(D2to1TestCase):
def setup(self):
super(TestHooks, self).setup()
with open_config(os.path.join(self.package_dir, 'setup.cfg')) as cfg:
cfg.set('glo... | {
"content_hash": "f6b45ceaf7f6b3360f0af6658e4af130",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 95,
"avg_line_length": 34.21153846153846,
"alnum_prop": 0.599213041034289,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "047e0b90942dba6126ae9239f85a5d8545024e64",... |
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
import impala._thrift_gen.beeswax.BeeswaxService
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fa... | {
"content_hash": "83f3edc10ce27c3eb1d368eb0b956b8b",
"timestamp": "",
"source": "github",
"line_count": 1279,
"max_line_length": 188,
"avg_line_length": 32.471462079749806,
"alnum_prop": 0.6554140280754136,
"repo_name": "laserson/impyla",
"id": "0bd319a92484675345d5f3d2ff4936aef0fcef42",
"size": "4... |
"""
Tests for PDC client configuration.
"""
import os
try:
# Python 2.6 compatibility
import unittest2 as unittest
except ImportError:
import unittest
from pdc_client.config import (
ServerConfigManager,
ServerConfigMissingUrlError,
ServerConfigNotFoundError,
ServerConfigConflictError,
)
... | {
"content_hash": "f8790433c979f306114a73b37a89d71c",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 91,
"avg_line_length": 34.26486486486486,
"alnum_prop": 0.6329073986433191,
"repo_name": "product-definition-center/pdc-client",
"id": "5ba22212afd26e6309030692a452fcbfcad3f... |
"""Mesh utils."""
# pylint: disable=missing-function-docstring
# pylint: disable=unused-variable
# pylint: disable=unused-argument
# pylint: disable=missing-class-docstring
from matplotlib import cm
from psbody.mesh import Mesh
import trimesh
# colormap = cm.get_cmap("plasma")
def convert_points_to_mesh(points,
... | {
"content_hash": "3d8c20b8026c693abea4b68f4ac099fb",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 27.56756756756757,
"alnum_prop": 0.653921568627451,
"repo_name": "google-research/google-research",
"id": "a958defb6827e1b0f90a8a785881f623ea3c5c0a",
... |
import unittest
import turkey_vulture
import data
import facebook
import re
# TODO: Add test for big update
class MockGraphAPI(facebook.GraphAPI):
def __init__(self):
facebook.GraphAPI.__init__(self, "access_token", 60)
self._thread_order = {}
self.use_default_order()
self._api_ver... | {
"content_hash": "a5be15e2f4a8df945d49a0ecee93f722",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 156,
"avg_line_length": 35.537142857142854,
"alnum_prop": 0.6579835986493006,
"repo_name": "GTmmiller/TurkeyVulture",
"id": "7013c453b1bc0590d33d39d7e48fd167daadc5ff",
"si... |
''' Utility functions for algebra etc '''
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import numpy.linalg as npl
# epsilon for testing whether a number is close to zero
_EPS = np.finfo(float).eps * 4.0
# axis sequences for Euler angles
_NEXT_AXIS = [1, 2, 0, 1]
# ... | {
"content_hash": "7b71b8419448c04856ee2f9e45632d8f",
"timestamp": "",
"source": "github",
"line_count": 898,
"max_line_length": 121,
"avg_line_length": 29.41314031180401,
"alnum_prop": 0.5653276795517359,
"repo_name": "beni55/dipy",
"id": "b7563cc477d590568fa54cda802ef2b597acfb53",
"size": "26413",... |
'''
This library defines methods to work with the midi file
'''
from logbook import Logger
import struct
log = Logger('snail')
DEFAULT_MIDI_HEADER_LEN = 14
def parse_file_header(infile):
'''
:param infile: Receives a file like object; parses and returns parts of the midi header
returns:
header... | {
"content_hash": "e2b27ea8b0128b5ad4a4d73edf7d1b46",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 105,
"avg_line_length": 36.13084112149533,
"alnum_prop": 0.6259699948266942,
"repo_name": "sjzabel/snail",
"id": "2468f35077c8a7ac5c1f610aa5cb8b4770554b23",
"size": "3866"... |
from hwt.interfaces.utils import addClkRstn
from hwt.synthesizer.param import Param
from hwtHls.hlsStreamProc.streamProc import HlsStreamProc
from hwtLib.examples.statements.ifStm import SimpleIfStatement
class SimpleIfStatementHls(SimpleIfStatement):
def _config(self):
self.CLK_FREQ = Param(int(100e6))
... | {
"content_hash": "3c25199fc51fcfe99f2656db43a6dddf",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 26.893617021276597,
"alnum_prop": 0.5522151898734177,
"repo_name": "Nic30/hwtHls",
"id": "90e5fde708adbeb6098de2b2e0bead2f95875b6a",
"size": "1312",
... |
import itertools
import random
import string
import uuid
from debtcollector import removals
import netaddr
from oslo_utils import netutils
from oslo_utils import uuidutils
import six.moves
def rand_uuid():
"""Generate a random UUID string
:return: a random UUID (e.g. '1dc12c7d-60eb-4b61-a7a2-17cf210155b6')
... | {
"content_hash": "a15c9540ce974828bed4c175655635ab",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 78,
"avg_line_length": 31.185929648241206,
"alnum_prop": 0.6342249436029649,
"repo_name": "vedujoshi/tempest",
"id": "a0941ef50b09db16f06c56b5f2ead4c0ada2ed60",
"size": "6... |
from sklearn.svm import LinearSVC, SVC
from sklearn.cross_validation import cross_val_score
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.cross_validation import train_test_split
from sklearn import preprocessing
from sklearn import feature_selection
import warnings
import json
import... | {
"content_hash": "9f6706177cf86a9be9b588ee7ffdff3c",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 109,
"avg_line_length": 28.038961038961038,
"alnum_prop": 0.6850393700787402,
"repo_name": "IoT-Expedition/Edge-Analytics",
"id": "3eda3135cb7c7efc87b237f6c0e8da19d349dcd5",... |
from setuptools import find_packages, setup
from channels_api import __version__
setup(
name='channels_api',
version=__version__,
url='https://github.com/linuxlewis/channels-api',
author='Sam Bolgert',
author_email='sbolgert@gmail.com',
description="Helps build a RESTful API on top of WebSocket... | {
"content_hash": "f968d3984e27389b6b549464ab98702d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 81,
"avg_line_length": 30.96153846153846,
"alnum_prop": 0.6211180124223602,
"repo_name": "linuxlewis/channels-api",
"id": "4c7148edc36152fecf84b528fae7f5f3437f8b1f",
"size"... |
from __future__ import absolute_import
import distutils.util
try:
from importlib.machinery import EXTENSION_SUFFIXES
except ImportError: # pragma: no cover
import imp
EXTENSION_SUFFIXES = [x[0] for x in imp.get_suffixes()]
del imp
import logging
import os
import platform
import re
import struct
impo... | {
"content_hash": "dc8f05d87ea838eedb3bba3f240cdd67",
"timestamp": "",
"source": "github",
"line_count": 726,
"max_line_length": 111,
"avg_line_length": 32.133608815426996,
"alnum_prop": 0.6074842470744567,
"repo_name": "kenxwagner/PythonPlay",
"id": "60a69d8f943667d32d9012e3d6219e445ffa6188",
"size... |
from typing import Optional
from src.settings import Colors
def league_color(league: str) -> Optional[Colors]:
if league in [
"1 HNL (Croatia)",
"A Grupa (Bulgaria)",
"A Lyga (Lithuania)",
"Adeccoligaen (Norway)",
"A-League (Australia)",
"Allsvenskan (Sweden)",
... | {
"content_hash": "7a44e6c584977703dd6e4f91e5d7ae23",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 50,
"avg_line_length": 30.92391304347826,
"alnum_prop": 0.5332161687170475,
"repo_name": "vapkarian/soccer-analyzer",
"id": "eb60760ebe18e61c041cc3b30d0fdb3d28c1e4ae",
"siz... |
"""Tests for record_input_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.python.framework.errors_impl import NotFoundError
from tensorflow.python.lib.io import tf_record
from tensorflow.python.ops import data_flow_ops
from... | {
"content_hash": "f5cd3902df85636565e01d1e6f89d074",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 32.462025316455694,
"alnum_prop": 0.6145447455644375,
"repo_name": "hsaputra/tensorflow",
"id": "0945ed24bf9ac36c508d5da5f66bcc1a3e034083",
"size": ... |
from functools import wraps
from flask import Blueprint, jsonify, session, request, make_response
from app.views.api import api
from werkzeug.exceptions import BadRequest
@api.route('/')
def api_default():
return jsonify({
"Response": "No method requested"
})
# http://flask.pocoo.org/docs/0.10/patte... | {
"content_hash": "03762a2f21107001c38d34ebb527546e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 74,
"avg_line_length": 30.4,
"alnum_prop": 0.5216165413533834,
"repo_name": "krrg/gnomon",
"id": "c8c5da3fb44dec007962799b87883aad91484ded",
"size": "1064",
"binary": fal... |
"""Tests for the gridfs package.
"""
import datetime
import threading
import time
import gridfs
from bson.binary import Binary
from bson.py3compat import StringIO, string_type
from gridfs.errors import NoFile, CorruptGridFile
from pymongo.errors import (ConfigurationError,
ConnectionFailur... | {
"content_hash": "cb0fe4a7c15c4cbcabdaa2cc7c1dbfea",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 77,
"avg_line_length": 37.432367149758456,
"alnum_prop": 0.5702394011744208,
"repo_name": "develf/mongo-python-driver",
"id": "42faa1aacee18b64b9f57db272d002a3e7efd8fc",
"... |
import sys, os
# At the top.
import sphinx_bootstrap_theme
# 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.insert(0, o... | {
"content_hash": "62f20c6ba802eccf8fd581ae805c9932",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 80,
"avg_line_length": 32.06802721088435,
"alnum_prop": 0.6813746287653797,
"repo_name": "OpenGeoscience/vgl",
"id": "4f8e45a98fe53afb5f5029fd6e8d9cf7d20e0a2d",
"size": "9... |
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import pandas as pd
import argparse
from os import path
parser = argparse.ArgumentParser(description='Plot data from output of the black hole simulation.')
parser.add_argument('--index', type=int, default=1,
help='Index to plot (d... | {
"content_hash": "71381c45fa35aa800068583f324a64ff",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 158,
"avg_line_length": 44.49180327868852,
"alnum_prop": 0.5700073691967575,
"repo_name": "M2-AAIS/BAD",
"id": "a7e0ffc427e1c7deaceaeb5e7de0d1ca22c4df3c",
"size": "2768",
... |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdip...@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Attention: Requires Chrome or Safari. For IE of Firefox you need https://github.com/gimite/web-socket-js
1) install tornado (requires Tornado 3.0 or later)... | {
"content_hash": "c27eec7241d813d61348ff5ae2b01e60",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 112,
"avg_line_length": 37.80753138075314,
"alnum_prop": 0.6134351482957061,
"repo_name": "xiang12835/python_web",
"id": "962e42a25e7b23686f0a3306ca47f5fc78bc2c9c",
"size"... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | {
"content_hash": "d65409d4472904bca1c93984dbdbe49e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 118,
"avg_line_length": 30.846153846153847,
"alnum_prop": 0.6221945137157108,
"repo_name": "AtenrevCode/scChat",
"id": "b5b72cb6b1421104033dbc98e53552b80151fd0d",
"size": "... |
import numpy as np
from opensfm import features
from opensfm.test import data_generation
def test_dataset_load_features_sift(tmpdir) -> None:
data = data_generation.create_berlin_test_folder(tmpdir)
assert len(data.images()) == 3
data.config["feature_type"] = "SIFT"
image = data.images()[0]
poi... | {
"content_hash": "c29ae3661e9b86a4316679d036d2fcee",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6912013536379019,
"repo_name": "mapillary/OpenSfM",
"id": "02202e45d0d09748b26824826a8a0cfb74ec87b6",
"size": "11... |
import os
import sys
import unittest
from django.conf import settings
from htmlmin.middleware import HtmlMinifyMiddleware, MarkRequestMiddleware
from htmlmin.tests import TESTS_DIR
from htmlmin.tests.mocks import (RequestBareMock, RequestMock, ResponseMock,
ResponseWithCommentMock)
c... | {
"content_hash": "95134a8f191370d5e63bfab930e73577",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 77,
"avg_line_length": 37.859223300970875,
"alnum_prop": 0.6453391460443647,
"repo_name": "cobrateam/django-htmlmin",
"id": "38aa8a1b8bc77ce359f6f59a973c7889d087f9f9",
"si... |
import json
import re
from os import path, getcwd
from random import randint
from typing import Union
from discord import User, Message, Embed, Server, Game, Permissions, Channel, ChannelType, HTTPException, Forbidden, InvalidArgument, NotFound
from discord.ext.commands import Bot, Context, check
from bot.config impo... | {
"content_hash": "b4ad1bc961746c53acff9047072e6f3c",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 142,
"avg_line_length": 34.91573033707865,
"alnum_prop": 0.6781442746044516,
"repo_name": "HellPie/discord-reply-bot",
"id": "e0f39efb3a6455df9a9623cda01dbc81fd70aae5",
"s... |
import os
import sys
from django.core.management import call_command
# Main entrypoint for barsystem-installer executable
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'barsystem.local_settings')
import warnings
warnings.filterwarni... | {
"content_hash": "c66b3c5d3739bec5d276c5665b1b8ebf",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 23.94736842105263,
"alnum_prop": 0.701098901098901,
"repo_name": "TkkrLab/barsystem",
"id": "eda16db54ea18ab0b3d376fe55bef45e3ad42755",
"size": "455"... |
from .client import ServiceMonitoringServiceClient
from .async_client import ServiceMonitoringServiceAsyncClient
__all__ = (
"ServiceMonitoringServiceClient",
"ServiceMonitoringServiceAsyncClient",
)
| {
"content_hash": "ca85a8b623fac05321ea9ae3dd0b9cf3",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 29.857142857142858,
"alnum_prop": 0.8133971291866029,
"repo_name": "googleapis/python-monitoring",
"id": "775fda5cc28cc2e994595987125f18f036c54001",
"... |
"""Custom TestCase and helpers for connectmessages tests."""
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.messages.storage.fallback import FallbackStorage
from django.test import RequestFactory
from django.utils.timezone import ... | {
"content_hash": "0a52768bc259786935c675a232468217",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 78,
"avg_line_length": 36.24528301886792,
"alnum_prop": 0.6387298282144717,
"repo_name": "lpatmo/actionify_the_news",
"id": "4cd4b22554cedb6c5b7c5dd2bcc48a2fe19eb545",
"si... |
"""gcloud dns record-sets changes describe command."""
from googlecloudsdk.api_lib.dns import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import resolvers
class Describe(base.DescribeCommand):
"""View the details of a change.
This command displays the details of the specified change.
... | {
"content_hash": "36f8cd50e7416e635596fe2ebd2d5990",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 28.595238095238095,
"alnum_prop": 0.6519567027477102,
"repo_name": "KaranToor/MA450",
"id": "f6d9b0af6f8be36f482bd46935fb7d7e5c8436a9",
"size": "1797... |
from __future__ import print_function, absolute_import
import itertools
import numpy as np
import numba.unittest_support as unittest
from numba.compiler import compile_isolated, Flags
from numba import types, typeof, njit
from numba import lowering
from .support import TestCase
def return_double_or_none(x):
if... | {
"content_hash": "baeca7637e5b55887b01caed34a86c90",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 71,
"avg_line_length": 26.44,
"alnum_prop": 0.5505126912086065,
"repo_name": "stefanseefeld/numba",
"id": "314d8829f2c92452647271b1fe5bed8cd2fd7833",
"size": "5949",
"bi... |
from openelex.tests.mongo_test_case import MongoTestCase
from openelex.models import RawResult
from openelex.us.md.load import MDLoader2008Special
class TestMDLoader2008Special(MongoTestCase):
def setUp(self):
super(TestMDLoader2008Special, self).setUp()
self.loader = MDLoader2008Special()
... | {
"content_hash": "e87fcd23020d346f7ba06c0f95f36341",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 39.282051282051285,
"alnum_prop": 0.6377284595300261,
"repo_name": "cathydeng/openelections-core",
"id": "90a37a5fde63be6889def81b3b158f6995d46228",
... |
from distutils.core import setup
setup(name='rhyme',
version='0.1',
description='A rhyming library',
author='Ian Overgard',
author_email='ian.overgard@gmail.com',
url='http://github.com/fathat/pyrhyme',
py_modules=['rhyme'],
data_files=[('data', ['data/rhyme.db'])]
) | {
"content_hash": "7748026ea411f2de5b20007d6ec31465",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 46,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6044303797468354,
"repo_name": "fathat/pyrhyme",
"id": "d8afe0b5d0f6ab7f89918cd8480ea69bf89f9666",
"size": "339",... |
import json
import yaml
from .patched import Api
from flask import Blueprint, make_response, current_app
from datatypes import ns
api_blueprint = Blueprint('api', __name__)
@api_blueprint.route('/swagger.yml')
def swagger():
resp = make_response(yaml.dump(yaml.load(json.dumps(current_app.api.__schema__)), defau... | {
"content_hash": "8eb71c9fbefa84e2077079394807f355",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 112,
"avg_line_length": 28.097560975609756,
"alnum_prop": 0.6024305555555556,
"repo_name": "hitakaken/ifplus",
"id": "537befeb3a0c4d7a1d8c007f126ceab5cc4609a1",
"size": "11... |
import abc
from neutron_lib.api import validators
from neutron_lib import exceptions
import six
import webob.exc
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.api.v2 import base
from neutron.api.v2 import resource as api_resource
from neutron import ... | {
"content_hash": "bbd8544f303be5aeaa8c8e38cbe8af0a",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 79,
"avg_line_length": 31.243523316062177,
"alnum_prop": 0.6233830845771144,
"repo_name": "igor-toga/local-snat",
"id": "a09dfa97796de5a08b42c79cd388c9fa608e2e99",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('videos', '0001_initial'),
]
operations = [
migrations.AddField(
... | {
"content_hash": "9865b76b1da593977df0070e70338657",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 123,
"avg_line_length": 25.75,
"alnum_prop": 0.6194174757281553,
"repo_name": "rouxcode/django-cms-plugins",
"id": "89f30daca5dbdb2eb010ccd93bc12550003435d6",
"size": "588"... |
"""Tests for db.task layer."""
import datetime as dt
import json
import ddt
import jsonschema
import mock
from rally.common import objects
from rally import consts
from rally import exceptions
from tests.unit import test
@ddt.ddt
class TaskTestCase(test.TestCase):
def setUp(self):
super(TaskTestCase, s... | {
"content_hash": "8d51839f156aae7e581799fd7b214fb1",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 76,
"avg_line_length": 40.9171974522293,
"alnum_prop": 0.5849937733499377,
"repo_name": "vganapath/rally",
"id": "884b5a670304c1272828457f3e93d3baae96cc19",
"size": "13478... |
"""A simple web crawler -- classes implementing crawling logic."""
import asyncio
import cgi
from http.client import BadStatusLine
import logging
import re
import time
import urllib.parse
logger = logging.getLogger(__name__)
def unescape(s):
"""The inverse of cgi.escape()."""
s = s.replace('"', '"').re... | {
"content_hash": "c1ddc97cc6ddd7b72ffb3eccaa31c0bd",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 79,
"avg_line_length": 36.64670658682635,
"alnum_prop": 0.5557734204793028,
"repo_name": "mikar/60-days-of-python",
"id": "9bc735d57bccc39530a6b5c7f8e950086d3ef0e0",
"size... |
"""Fichier contenant le type orbe."""
from bases.objet.attribut import Attribut
from .base import BaseType
class Orbe(BaseType):
"""Type d'objet: orbe.
"""
nom_type = "orbe"
def __init__(self, cle=""):
"""Constructeur de l'objet"""
BaseType.__init__(self, cle)
# Attributs ... | {
"content_hash": "e2353fe19dac64bae74fbf95e088a2f4",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 67,
"avg_line_length": 27.675,
"alnum_prop": 0.5438121047877146,
"repo_name": "vlegoff/tsunami",
"id": "9460c3b0594ff006000c626cab6f633afec96415",
"size": "2680",
"binary... |
INITIAL_FILE_RENAME_INFORMATION = _FILE_RENAME_INFORMATION
class _FILE_RENAME_INFORMATION(INITIAL_FILE_RENAME_INFORMATION):
@property
def filename(self):
filename_addr = ctypes.addressof(self) + type(self).FileName.offset
if getattr(self, "_target", None) is not None: #remote ctypes :D -> TRICK... | {
"content_hash": "00d472c7668ad5461696cc2cd5cd60eb",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 94,
"avg_line_length": 52.36363636363637,
"alnum_prop": 0.6788194444444444,
"repo_name": "hakril/PythonForWindows",
"id": "4402d6908974fcacd0012e84b75cc0938f315048",
"size"... |
import datetime
import uuid
from oslo.config import cfg
from nova.api.openstack import compute
from nova.api.openstack.compute import plugins
from nova.api.openstack.compute.plugins.v3 import servers
from nova.compute import api as compute_api
from nova.compute import flavors
from nova import db
import nova.db.api
fr... | {
"content_hash": "ae17697e17824eb0e9f79ca228f2b20c",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 77,
"avg_line_length": 36.88655462184874,
"alnum_prop": 0.5776284314842237,
"repo_name": "OpenAcademy-OpenStack/nova-scheduler",
"id": "565fe38b4c68b5d8c400263a95818835429d6... |
import logging
import random
import time
import asyncio
import pathlib
import importlib
import collections
import discord
import aiohttp
import uvloop
from discord.ext import commands
import joseconfig as config
from ext.common import SayException
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
log = logg... | {
"content_hash": "602a11bb27bc142ebed6f565e4dfe1f5",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 79,
"avg_line_length": 29.060931899641577,
"alnum_prop": 0.5786877158362111,
"repo_name": "lnmds/jose",
"id": "1023f11dc7281fc571e70d01643c3ea9ae8708bf",
"size": "8115",
... |
from apps.common.hasher import get_hasher
from django.db import models
import time
class EditMixin(models.Model):
"""
Abstract class for use in models
"""
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
class Meta:
abstract = True... | {
"content_hash": "2569f682cd98ea68e5523c9ba1c4b851",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 26.27906976744186,
"alnum_prop": 0.6495575221238938,
"repo_name": "RonquilloAeon/django-golden-image",
"id": "ea9fd2ff0bfbe3a958b01b409ebe7fe724aa88b2"... |
import roslib
roslib.load_manifest('smart_arm_controller')
import rospy
from std_msgs.msg import Float64
from numpy import matrix, array
import numpy as np
import sys
import sensor_msgs.msg
from sensor_msgs.msg import JointState
from dynamixel_msgs.msg import JointState
joint_names = ('shoulder_pitch_controller',
'elb... | {
"content_hash": "f9cde283790028087c18ddc48f73b3cc",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 99,
"avg_line_length": 37.52980132450331,
"alnum_prop": 0.629610022939827,
"repo_name": "sigproc/robotic_surgery",
"id": "39b421efdcb7abc672923da0df3523dea423b141",
"size"... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from src.utils.utils import to_str
from src.utils.dbserialize import to_pickle
try:
import cPickle as pickle
except ImportError:
import pickle
CTYP... | {
"content_hash": "21e5ab6a3024491c4b66d6c18ef7297e",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 187,
"avg_line_length": 46.630630630630634,
"alnum_prop": 0.5660258887171561,
"repo_name": "TaliesinSkye/evennia",
"id": "343bd030a212a888dbc122e6830ad3874fd59caa",
"size"... |
from tornado import gen
import rethinkdb as r
from datetime import datetime, timedelta
from ..config import CONFIG
from .utils import dump_cursor
from .connection import connection
@gen.coroutine
def get_reservation_for_user(id):
conn = yield connection()
result = yield r.table('reservations').\
filt... | {
"content_hash": "3836c2cfb5e163b938eb49aa7f365162",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 71,
"avg_line_length": 28.301204819277107,
"alnum_prop": 0.6564495530012772,
"repo_name": "wannabeCitizen/quantifiedSelf",
"id": "61a46ad4147e9eb7423a680b1401a32c1a501b76",
... |
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
class MyUserManager(BaseUserManager):
def create_user(self, email, is_shop_owner, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
... | {
"content_hash": "5f83526ee6efa02e920d6ec9bc296c27",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 67,
"avg_line_length": 26.58974358974359,
"alnum_prop": 0.5853423336547734,
"repo_name": "VikasSherawat/OrderFood",
"id": "975e126bce8ab963bb690a11a2cdd69751c7586e",
"size"... |
"""List summary info for the test files in the charset directory"""
# Copyright (c) 2008-2012 Darcy Mason
# This file is part of pydicom, relased under an MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
import logging
logging.basicConfig(... | {
"content_hash": "f901afe4004726e0f077a9237b85989b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 34.13513513513514,
"alnum_prop": 0.611243072050673,
"repo_name": "njvack/yadda",
"id": "f32cb7cb256e467a529b3717c04ef0990450674c",
"size": "1277",
... |
"""
Generate grid of hyperparameters
"""
from sys import stdout
from copy import deepcopy
from yaml import dump
base_hyperparameters = {
##########################################
# ENSEMBLE SIZE
##########################################
"n_models": 4,
##########################################
... | {
"content_hash": "85e42c244aba3252d818a20f34dcee81",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 92,
"avg_line_length": 34.93181818181818,
"alnum_prop": 0.43103448275862066,
"repo_name": "hammerlab/mhcflurry",
"id": "5b15e104d4ce6ef155cc03bff33a923d6c5b27e1",
"size": "... |
"""distutils.command.build_clib
Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module."""
# This module should be kept compatible with Python 1.5.2.
__revision__ = "$Id: build_clib.py,v 1.27 2002/11/19 13:12:28 akuchling ... | {
"content_hash": "6b10abc5b8c11a251b7f237ed70f11e2",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 78,
"avg_line_length": 36.42016806722689,
"alnum_prop": 0.561259806183664,
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"id": "66dcdf111fa4091d97c151e7d15e15a865c62208",
... |
"""
Created on 2015-05-22
@author: lujin
"""
from django import template
register = template.Library()
def trans_underline(obj, key):
try:
return obj[key]
except:
return ""
register.filter(trans_underline)
| {
"content_hash": "cced4a9752c88e0f0008e67c46beb582",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 32,
"avg_line_length": 13.823529411764707,
"alnum_prop": 0.6510638297872341,
"repo_name": "myangeline/rorobot",
"id": "1913cd95fb5fc970999e7405c999835ab56314a2",
"size": "2... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('muse_api', '0005_remove_document_path'),
]
operations = [
migrations.AlterField(
model_name='binder',
... | {
"content_hash": "efa1f6f266dab2fea19d0f728e074e70",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 159,
"avg_line_length": 33.208333333333336,
"alnum_prop": 0.6386449184441656,
"repo_name": "ltouroumov/muse-writer",
"id": "585bf500acec294c6b3ab0c25be316e86bb53e4e",
"size... |
import dataset
import time
class Flight(object):
db = dataset.connect('sqlite:///db_flight')
table = db['tb_flight']
__necessary_fields__ = ['from_airport', 'to_airport', 'from_city',
'to_city', 'from_time', 'to_time', 'website',
'price', 'flight_da... | {
"content_hash": "410e05f03670468cc65be6ad73b89826",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 34.36538461538461,
"alnum_prop": 0.514829322887521,
"repo_name": "daijia/fetch-flight",
"id": "52118a4d8deb72db6469d3494e38f27248632267",
"size": "18... |
"""
Square digit chains
Problem 92
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before.
For example,
44 → 32 → 13 → 10 → 1 → 1
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
Therefore any chain that arrives at 1 or 89 will become ... | {
"content_hash": "662883a021685f23c3aba20221d05fa4",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 167,
"avg_line_length": 25.61111111111111,
"alnum_prop": 0.5589298626174982,
"repo_name": "DestructHub/ProjectEuler",
"id": "041c3485ad6fc03573320630cb433c902342ffe7",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('officehours', '0005_auto_20170209_2306'),
]
operations = [
migrations.AlterField(
model_name='course',
name='start_time',
... | {
"content_hash": "6002c49c0e20af0fab95e24c3f8d748f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 21.88888888888889,
"alnum_prop": 0.5989847715736041,
"repo_name": "izzyalonso/tndata_backend",
"id": "94b7143090b3b0c3d929dd675d44b84f125b8390",
"siz... |
import os
from setuptools import setup
try:
here = os.path.dirname(os.path.abspath(__file__))
description = file(os.path.join(here, 'README.md')).read()
except IOError:
description = None
PACKAGE_VERSION = '1.4'
deps = ['mozinfo == 0.4',
'mozfile'
]
setup(name='mozInstall',
version=... | {
"content_hash": "69cd4fe59a28c733ebb05a54ad0fa32b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 34.6,
"alnum_prop": 0.5953757225433526,
"repo_name": "sergecodd/FireFox-OS",
"id": "13fa8c5b1670b67589a14001832bf09e537e5e7e",
"size": "1757",
"bin... |
from __future__ import unicode_literals
import six
import iso639
from collections import defaultdict
from dash.orgs.views import OrgPermsMixin, OrgObjPermsMixin
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.utils.timesince import ti... | {
"content_hash": "4f260caf6f63ee510bd1948c9359a51f",
"timestamp": "",
"source": "github",
"line_count": 688,
"max_line_length": 119,
"avg_line_length": 37.1656976744186,
"alnum_prop": 0.5832225263981228,
"repo_name": "xkmato/casepro",
"id": "bf3a8beb9d19d42965b24d0feccf1ff6023e46f6",
"size": "25570... |
from panda3d.core import NodePath
from toontown.toonbase import ToontownIntervals
from toontown.toonbase.ToontownTimer import ToontownTimer
from CogdoFlyingGameGuis import CogdoFlyingFuelGui, CogdoFlyingProgressGui
from CogdoGameMessageDisplay import CogdoGameMessageDisplay
from CogdoMemoGui import CogdoMemoGui
i... | {
"content_hash": "82ee2f29fc9dac8cb863828c4a6b6e55",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 111,
"avg_line_length": 35.569060773480665,
"alnum_prop": 0.6599875737806772,
"repo_name": "DedMemez/ODS-August-2017",
"id": "089f5cebd9c22ed383755f64dd70799d6917f128",
"s... |
#!/usr/common/bin/python
# apiutil.py
#
# This file defines a bunch of utility functions for OpenGL API code
# generation.
import sys, string, re
#======================================================================
def CopyrightC( ):
print """
"""
def CopyrightDef( ):
print """; Copyright (c) 2001, Stanford... | {
"content_hash": "66e9fef1dde895ff03e95ebe978460b3",
"timestamp": "",
"source": "github",
"line_count": 777,
"max_line_length": 109,
"avg_line_length": 24.207207207207208,
"alnum_prop": 0.6485724918921792,
"repo_name": "egraba/vbox_openbsd",
"id": "bce38f1886961e4c60a8a97408fecbc39cd5597a",
"size":... |
from flask import g
from backend.app import app, db
from backend.routes import auth_required, dump_with_schema, load_with_schema
from backend.schema import UserSchema
@app.route('/user')
@auth_required
@dump_with_schema(UserSchema)
def get_user():
return g.current_user
@app.route('/user', methods=['PATCH'])
@a... | {
"content_hash": "921e24d9509e7791d3f2f812cc9757e2",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 20.62962962962963,
"alnum_prop": 0.7163375224416517,
"repo_name": "ianunruh/flask-api-skeleton",
"id": "20c21af3b7c7c8b3bd5123edf6356cfeea36c447",
"s... |
import torch
import torch.nn.functional as function
import torch.optim.optimizer as optim
import torch.nn as nn
class AlexNet(nn.Module):
def __init__(self, num_classes = 10):
super(AlexNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=64, kernel_size= 11, stride=4, padding = ... | {
"content_hash": "4bbff2b44c510b23d4f1e008d5957144",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 102,
"avg_line_length": 50.26470588235294,
"alnum_prop": 0.6454066705675834,
"repo_name": "yt4766269/pytorch_zoo",
"id": "f664f3f87570fa5317152b70f0e261cf60d63c1e",
"size":... |
"""
Django settings for click2pass project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
from secret_settings import *
# Build paths inside the project like th... | {
"content_hash": "0e72961fdc612b9a6275f9c56345ab60",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 71,
"avg_line_length": 22.60185185185185,
"alnum_prop": 0.6759524784924211,
"repo_name": "iwagaki/click2pass",
"id": "6068d7a1bef76d43817bd2210a6f24976642e98f",
"size": "2... |
from __future__ import absolute_import
from sentry.models import ProjectRedirect
from sentry.testutils import TestCase
class ProjectRedirectTest(TestCase):
def test_record(self):
org = self.create_organization()
project = self.create_project(organization=org)
ProjectRedirect.record(projec... | {
"content_hash": "eb25f19356643f0ba1a2e39b8ce7396e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 98,
"avg_line_length": 36.458333333333336,
"alnum_prop": 0.7062857142857143,
"repo_name": "beeftornado/sentry",
"id": "fee740dea91c79fae01dae582da44c0943d59f0d",
"size": "9... |
"""
A PTransform that provides an unbounded, streaming source of empty byte arrays.
This can only be used with the flink runner.
"""
# pytype: skip-file
from __future__ import absolute_import
import json
from typing import Any
from typing import Dict
from apache_beam import PTransform
from apache_beam import Window... | {
"content_hash": "2e4f248abf5254ea749c093a60887074",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 31.4375,
"alnum_prop": 0.7261431411530815,
"repo_name": "iemejia/incubator-beam",
"id": "0dac8512fea22ac2993eaf64af068637f53f8cc0",
"size": "2797",
... |
import a10_neutron_lbaas.tests.unit.test_base as test_base
class UnitTestBase(test_base.UnitTestBase):
def __init__(self, *args):
super(UnitTestBase, self).__init__(*args)
self.version = 'v2'
def print_mocks(self):
super(UnitTestBase, self).print_mocks()
print("NEUTRON ", sel... | {
"content_hash": "6e991319917cecee08f4036cb605d772",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.6482558139534884,
"repo_name": "dougwig/a10-neutron-lbaas",
"id": "556ab9abbb0b404ccb689704713d3eb521353ccd",
"si... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "d2eb7c491e23681ddf18c03a047bf5b9",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 106,
"avg_line_length": 33.526315789473685,
"alnum_prop": 0.7616431187859759,
"repo_name": "radicalbit/ambari",
"id": "1d000bfbf900e422e5eb4798ab728c0744bb898a",
"size": "... |
'''Process G6 JSON files into elasticsearch
This version reads G6 JSON from disk or DM API.
Usage:
process-g6-into-elastic-search.py <es_endpoint> <dir_or_endpoint> [<token>]
Arguments:
es_endpoint Full ES index URL
dir_or_endpoint Directory path to import or an API URL if token is given
token ... | {
"content_hash": "a8e029629ec82f3dd0147f632bc2c446",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 28.144444444444446,
"alnum_prop": 0.6123174101855507,
"repo_name": "RichardKnop/digitalmarketplace-search-api",
"id": "6fcc100b4a478ac6eaad15e0c6137cb7... |
"""
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
specifications from styles.xml in STYLE_FILE.odt.
"""
#
# Author: Michael Schutte <michi@uiae.at>
from lxml import etree
import sys
import zipfile
from tempfile import mkstemp
import shutil
import os
NAMESPACES = {
"style": "urn:oasi... | {
"content_hash": "b8b5081826b594c01ccee1efe147838d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 24.672131147540984,
"alnum_prop": 0.6132890365448505,
"repo_name": "Titulacion-Sistemas/PythonTitulacion-EV",
"id": "30520fdf285fb9497590ad9f51a40deef7... |
BROWSER = 'chrome'
START_URL = 'https://webtools-test.kent.ac.uk/site-editor'
SITE_EDITOR_USER = ''
SITE_EDITOR_PASSWORD = ''
DEFAULT_SITE_ID = 1 | {
"content_hash": "5fa2b26d92ee53dcbced31c774344eae",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 18.5,
"alnum_prop": 0.6891891891891891,
"repo_name": "unikent/astro",
"id": "d4ca7e736d78fe7cc9011130d974cc1d04d7b5c1",
"size": "148",
"binary": fal... |
import rospy
from std_msgs.msg import String
from ihmc_msgs.msg import ChestOrientationPacketMessage
import lcm
from bot_core.pose_t import pose_t
lc = lcm.LCM()
def callback(m):
rospy.loginfo(rospy.get_caller_id() + "I heard %f", m.orientation.x)
#rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data... | {
"content_hash": "aee3ae5620dec534d3dfd37e1ed726a3",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 108,
"avg_line_length": 30.405405405405407,
"alnum_prop": 0.6871111111111111,
"repo_name": "openhumanoids/oh-distro",
"id": "8da3482c28ef951e67978d9991686043fb5b06fc",
"siz... |
from __future__ import unicode_literals
import os
import platform
import shutil
import six
import tempfile
import unittest
import fs
from fs.osfs import OSFS
if platform.system() != "Windows":
@unittest.skipIf(platform.system() == "Darwin", "Bad unicode not possible on OSX")
class TestEncoding(unittest.Test... | {
"content_hash": "3e5e3a93efa4035281896755cc0fe2f2",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 86,
"avg_line_length": 37.73684210526316,
"alnum_prop": 0.5801952580195258,
"repo_name": "PyFilesystem/pyfilesystem2",
"id": "6791e39682cf78f76dac0149bd34cc55b6ece3e3",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.