text stringlengths 4 1.02M | meta dict |
|---|---|
import sqlite3
class db():
'''
Maneja las conexiones con la base de datos.
'''
def __init__(self,db_path):
'''
Crea la conexión con la base de datos.
'''
self.cnx=sqlite3.connect(db_path)
self.cur=self.cnx.cursor()
def consultaSimp(self,sql):
'''
Consulta de datos simple
'''
self.cur.execute(s... | {
"content_hash": "e2cae3e09967fb27cb142c09c81ff0e1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 44,
"avg_line_length": 18.4,
"alnum_prop": 0.6508152173913043,
"repo_name": "seertha/WSN_XBee",
"id": "467868d1e91478b97b8611e8c653056d02233891",
"size": "788",
"binary":... |
import sys
sys.path = ['../../'] + sys.path # Prepend
from codejam import CodeJam, parsers
from codejam.helpers import memoize
import unittest
from itertools import repeat
# Python 3 difference
try:
import io
io.StringIO('not unicode')
StringIO = io.StringIO
except:
from StringIO import StringIO
def pickleab... | {
"content_hash": "07597fe0fe8094bad09fd9e75e69df92",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 105,
"avg_line_length": 27.730337078651687,
"alnum_prop": 0.5923824959481362,
"repo_name": "yanatan16/pycodejam",
"id": "f4eae69d18c754d6e0f939cc80f4a5ab32792e78",
"size":... |
from base64 import decodestring
import os
import re
# System libary imports.
from IPython.external.qt import QtCore, QtGui
# Local imports
from IPython.utils.traitlets import Bool
from IPython.qt.svg import save_svg, svg_to_clipboard, svg_to_image
from ipython_widget import IPythonWidget
class RichIPythonWidget(IPy... | {
"content_hash": "a9522acf1d33aab4e957ea7ad100c0ad",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 98,
"avg_line_length": 43.50301204819277,
"alnum_prop": 0.5363844076715364,
"repo_name": "noslenfa/tdjangorest",
"id": "302c6c6911335531a699ebb042eed9d7fac7e66b",
"size": ... |
from django.utils.encoding import force_text
from unittest import mock
from olympia import amo
from olympia.addons.models import Addon, AddonReviewerFlags
from olympia.amo.tests import (
TestCase, addon_factory, file_factory, version_factory)
from olympia.reviewers.forms import ReviewForm
from olympia.reviewers.m... | {
"content_hash": "eb66ca21c42386c49c596bc2ff7a2130",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 79,
"avg_line_length": 43.60112359550562,
"alnum_prop": 0.6446334235278959,
"repo_name": "psiinon/addons-server",
"id": "9b636353660291a0e13152b474055c518960c34e",
"size":... |
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("checkout", "0038_merge_20210903_1048"),
("product", "0153_merge_20211006_0910"),
("warehouse", "0018_auto_20210323_2116"),
]
operations = [
... | {
"content_hash": "eb04f489909f750b2f181f022c6ee67d",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 83,
"avg_line_length": 33.95,
"alnum_prop": 0.4521354933726068,
"repo_name": "mociepka/saleor",
"id": "89fe2d54d5ddd02defc8cc210e22ac092f9f58e4",
"size": "2086",
"binary"... |
import ddt
from neutronclient.common import exceptions
from oslo_serialization import jsonutils
from kuryr import app
from kuryr.tests.unit import base
from kuryr import utils
@ddt.ddt
class TestIpamRequestPoolFailures(base.TestKuryrFailures):
"""Unit tests for testing request pool failures.
This test cover... | {
"content_hash": "91e29f9694b8a52284f2bb28693ee495",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 86,
"avg_line_length": 36.792682926829265,
"alnum_prop": 0.6324163075903215,
"repo_name": "midonet/kuryr",
"id": "053416852725193abdd5792cbfbaa2eb649ab0aa",
"size": "3563",... |
from sys import argv
script, first, second, third = argv
# script is the name of the file, its value is a priori
print "The script is called:", script
# you must run this code in bash with three space seperated variables in order to succeed
print "Your first variable is:", first
print "Your second variable is:", s... | {
"content_hash": "de160de42be285c9c3cc3795027ce680",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 27.923076923076923,
"alnum_prop": 0.7493112947658402,
"repo_name": "FlippantSol/CIS-121",
"id": "56ee6368f8d18f6117709b51bd41b4e7ac63f283",
"size": "... |
from ghidra.app.util.datatype import DataTypeSelectionDialog
from ghidra.framework.plugintool import PluginTool
from ghidra.program.model.data import DataType
from ghidra.program.model.data import DataTypeManager
from ghidra.util.data.DataTypeParser import AllowedDataTypes
tool = state.getTool()
dtm = currentProgram... | {
"content_hash": "60154ad16a31f54ad944de6ec034c383",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 87,
"avg_line_length": 41.857142857142854,
"alnum_prop": 0.8293515358361775,
"repo_name": "NationalSecurityAgency/ghidra",
"id": "be36f8fdf996775e8e730d5a3113ea296e12cf61",
... |
import logging; logger = logging.getLogger("morse." + __name__)
import morse.core.robot
class SubmarineClass(morse.core.robot.MorseRobotClass):
""" Class definition for the Submarine.
Sub class of Morse_Object. """
def __init__(self, obj, parent=None):
""" Constructor method.
Rece... | {
"content_hash": "ba211b288d67ac8f1cc5f11588f4b87b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 36.22727272727273,
"alnum_prop": 0.6348808030112923,
"repo_name": "Arkapravo/morse-0.6",
"id": "5baba4a2d9528e9bf4428114aa5d8e4b28badc88",
"size": "7... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import shutil
from collections import defaultdict
from pathspec import PathSpec
from pathspec.gitignore import GitIgnorePattern
from twitter.... | {
"content_hash": "023c9d2a74917de0190d18e2903fcad7",
"timestamp": "",
"source": "github",
"line_count": 707,
"max_line_length": 111,
"avg_line_length": 44.205091937765204,
"alnum_prop": 0.6671999488049147,
"repo_name": "dbentley/pants",
"id": "14f1fa2cfaf1a6d0ee1e3d11d3a7c334133de43b",
"size": "314... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserSocialAuth'
db.create_table(u'social_auth_usersocialauth', (
(u'id', self.gf('django.db.models.field... | {
"content_hash": "44f92a05f724f61f72fd22ae8a8d9498",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 136,
"avg_line_length": 56.03669724770642,
"alnum_prop": 0.5857891290111329,
"repo_name": "oinopion/pipeye",
"id": "55cb77355ae73b27a60abcf7eb919fb19bb6ca3c",
"size": "613... |
from datetime import datetime
from rx.core import Observable, AnonymousObservable
from rx.disposables import CompositeDisposable, SingleAssignmentDisposable, \
SerialDisposable
from rx.concurrency import timeout_scheduler
from rx.internal import extensionmethod
@extensionmethod(Observable)
def timeout(self, duet... | {
"content_hash": "90d2c8c2ce7710a4baec4ea872e8b877",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 34.83673469387755,
"alnum_prop": 0.6303456356180434,
"repo_name": "Sprytile/Sprytile",
"id": "77dda3c432b7b9e5bf003e781cdd035e706d94ff",
"size": "341... |
import os
import re
import demistomock as demisto # noqa: F401
import requests
from CommonServerPython import * # noqa: F401
from requests.auth import HTTPBasicAuth
VERSION = "v1.0.1"
USER_AGENT = "ReversingLabs XSOAR TitaniumCloud {version}".format(version=VERSION)
HEADERS = {
"User-Agent": USER_AGENT
}
BASE_... | {
"content_hash": "593cbb0b4928bf904dacc12f013fe43d",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 116,
"avg_line_length": 35.452471482889734,
"alnum_prop": 0.5306735306735306,
"repo_name": "VirusTotal/content",
"id": "738cbd7269ddb5dadc7dbc566b1669393dfec22f",
"size": ... |
from django.conf.urls import url
from signprot import views
urlpatterns = [
url(r'^$', views.BrowseSelection.as_view(), name='index'),
url(r'^statistics', views.GProtein, name='gprotein'),
url(r'^ginterface/(?P<protein>[^/]*?)/$', views.Ginterface, name='render'),
url(r'^ginterface[/]?$', views.TargetSelec... | {
"content_hash": "2199594707c33cc4629b20386a1e355a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 109,
"avg_line_length": 55.3125,
"alnum_prop": 0.6463276836158192,
"repo_name": "fosfataza/protwis",
"id": "d271c40cc7130279dfbbb90e38a1113fa9b351d2",
"size": "885",
"bin... |
import unittest
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, record_only
class TestMonitorPrivateLinkScope(ScenarioTest):
def __init__(self, method_name, config_file=None, recording_dir=None, recording_name=None, recording_processors=None,
replay_processors=None, recording_... | {
"content_hash": "2dcb835cbc06d21036fcd1e235c44937",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 157,
"avg_line_length": 56.23255813953488,
"alnum_prop": 0.6268265784394816,
"repo_name": "yugangw-msft/azure-cli",
"id": "d29fe0e52d0166039c5b06d2d0bd86202216492c",
"size... |
"""This example updates an ad group.
To get ad groups, run get_ad_groups.py.
"""
import argparse
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
from google.api_core import protobuf_helpers
# [START update_ad_group]
def main(client, cus... | {
"content_hash": "086c79d7e761dd062caf70d7a5874695",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 31.325842696629213,
"alnum_prop": 0.6244619799139168,
"repo_name": "googleads/google-ads-python",
"id": "8c92ab7a64a1192505698bff516f13e3702c2db0",
"... |
import StringIO
import logging
import mock
from twisted.internet import defer
from twisted.trial import unittest
from lbrynet.core import log_support
class TestLogger(unittest.TestCase):
def raiseError(self):
raise Exception('terrible things happened')
def triggerErrback(self, callback=None):
... | {
"content_hash": "46b1691d20599d69209725f6e92a83eb",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 93,
"avg_line_length": 35.270833333333336,
"alnum_prop": 0.6639102185469581,
"repo_name": "zestyr/lbry",
"id": "cf7bdfc27ffbcfc65b04fcbc3a9d70c0a38318f9",
"size": "1693",
... |
"""Common test lib."""
import textwrap
import sys
from contextlib import contextmanager
from pymdown import compat
@contextmanager
def capture(command, *args, **kwargs):
"""
Capture the stdout temporarily in test environment.
Takes a command to execute, and during its execution,
we will redirect stdo... | {
"content_hash": "5863721fd206a0ba78135f513400fc62",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 57,
"avg_line_length": 22.14814814814815,
"alnum_prop": 0.68561872909699,
"repo_name": "facelessuser/PyMdown",
"id": "e90114e215cf1d91fbb6b2b2a0f38fd27a8bcd34",
"size": "59... |
"""
Support for IP Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.generic/
"""
import asyncio
import logging
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPDigestAuth
import voluptuous as vol
from home... | {
"content_hash": "2f62aa836ec76a0a61442ea7da9d7fdc",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 78,
"avg_line_length": 38.02097902097902,
"alnum_prop": 0.632701857642082,
"repo_name": "nugget/home-assistant",
"id": "ae7e849c234d1e5890d0ef4b0543eff8a30f8c27",
"size": ... |
from django.template import Library, Template, TemplateSyntaxError, Node, Variable
from courant.core.news.models import *
from courant.core.utils.text import split_contents
from datetime import timedelta, datetime
register = Library()
class WeeksIssuesNode(Node):
def __init__(self, issue, varname):
self... | {
"content_hash": "03ca0b4fda73632b528b413dd13ae45f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 90,
"avg_line_length": 34.906976744186046,
"alnum_prop": 0.5829447035309794,
"repo_name": "maxcutler/Courant-News",
"id": "046190add5886ce9078b50c6bf81cf109d22a8ba",
"size"... |
import hashlib
import logging
import os
import sys
from collections import namedtuple
from .posix import get_drive_list as get_drive_list_posix
from .windows import get_drive_list as get_drive_list_windows
logger = logging.getLogger(__name__)
# The name of the folder we export data and content to, and what we look f... | {
"content_hash": "3313984de1d732161d934ee7414759c7",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 109,
"avg_line_length": 26.613333333333333,
"alnum_prop": 0.6177354709418837,
"repo_name": "jonboiser/kolibri",
"id": "fcc1f07147f2179029c992d5100cab2d10f4bab1",
"size": "1... |
"""
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# Giorgio Patrini
# License: BSD 3 clause
import warnings
import numpy as np
from s... | {
"content_hash": "3d669afc3e00bf69d34c265f0da7412c",
"timestamp": "",
"source": "github",
"line_count": 1092,
"max_line_length": 85,
"avg_line_length": 34.07142857142857,
"alnum_prop": 0.6199537708971671,
"repo_name": "ivannz/scikit-learn",
"id": "bc4e18e7d55e3ed6b70dfd223be0925ffcaa3d0f",
"size": ... |
import io
import sys
import unittest
from mwel import ErrorLogger, toxml, fromxml
from . import TempFilesMixin
class TestErrorLogger(unittest.TestCase):
def test_basic(self):
el = ErrorLogger()
expected_output = '''\
negative lineno, no colno
zero lineno, no colno
positive lineno, negative coln... | {
"content_hash": "ce96b6c7682960f526f5bec29c6cda9a",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 142,
"avg_line_length": 30.96303501945525,
"alnum_prop": 0.5932139491046183,
"repo_name": "mworks/mworks",
"id": "de11b47c561aec5a88f375e6f259afadcd4b2619",
"size": "15940... |
def set_app_resource_ownership(app_uid, app_name, app_api_version, resource):
""" Set the app as owner of the resource"""
set_resource_ownership(app_uid, app_name, app_api_version, "Application",
resource)
def set_service_account_resource_ownership(account_uid, account_name, resource):
... | {
"content_hash": "fa112d0e8634511f60dbad8949e3f401",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 37.163636363636364,
"alnum_prop": 0.6746575342465754,
"repo_name": "GoogleCloudPlatform/marketplace-k8s-app-tools",
"id": "3371dfafff73fdcdf9b9f86b9351... |
"""Tests for python.tpu.feature_column."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from absl.testing import parameterized
from tensorflow.python.client import session
from tensorflow.python.feature_column import feature_column_lib as f... | {
"content_hash": "1083e1ba309967ea0ad723066d6e47cf",
"timestamp": "",
"source": "github",
"line_count": 715,
"max_line_length": 80,
"avg_line_length": 39.38461538461539,
"alnum_prop": 0.6354048295454545,
"repo_name": "aldian/tensorflow",
"id": "93f65d6e1c4bec623c3a8e9d4b5b81311b2b36d5",
"size": "28... |
from django.test import TestCase
from django.template import Context, Template
from django.template.loader import get_template
from taggit_templatetags.tests.models import AlphaModel, BetaModel
from taggit.tests.tests import BaseTaggingTest
from taggit_templatetags.templatetags.taggit_extras import get_weight_fun
cl... | {
"content_hash": "4ec6604db56768ef350255ff997da106",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 102,
"avg_line_length": 38.291666666666664,
"alnum_prop": 0.5763511062749366,
"repo_name": "feuervogel/django-taggit-templatetags",
"id": "011828d3c8f41aae6ab0fb31314a68719b... |
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# typing library was introduced as a core module in version 3.5.0
requires = ["dirlistproc", "jsonasobj", "pyjxslt", "PyLD", "rdflib", "yadict-compare"]
if sys.version_info < (3, 5):
requires.append("typing")
... | {
"content_hash": "a8240c00960b3ecf4ca7515e9e368ca8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 33.142857142857146,
"alnum_prop": 0.6724137931034483,
"repo_name": "crDDI/dbgap",
"id": "41848bcccd45a6bbcc48dddc463949c9ceb2dde9",
"size": "929",
... |
from __future__ import absolute_import, print_function
import os
import datetime
import numpy as np
from sunpy.util.cond_dispatch import ConditionalDispatch
from sunpy.spectra.spectrogram import LinearTimeSpectrogram, REFERENCE, get_day
__all__ = ['SWavesSpectrogram']
class SWavesSpectrogram(LinearTimeSpectrogram... | {
"content_hash": "4c89b0d143551543d42fd52b328c7f30",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 83,
"avg_line_length": 33.023529411764706,
"alnum_prop": 0.6152475952974706,
"repo_name": "Alex-Ian-Hamilton/sunpy",
"id": "8957138268fb89b8be30888947a79f7806536dfd",
"size... |
"""
This module holds controller components of
a typical glim app.
"""
class Controller(object):
"""
The controller component is responsible for handling requests
and returning appropriate response to the requests.
Attributes
----------
request (bottle.request): Thread safe bottle request ob... | {
"content_hash": "01ec8a9a224d5339af8c2cc4895ec1d0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 68,
"avg_line_length": 28.27777777777778,
"alnum_prop": 0.6797642436149313,
"repo_name": "aacanakin/glim",
"id": "d6ce911b42f9dc2bd34b2d6d39261b26acfa0272",
"size": "509",
... |
"""
sentry.coreapi
~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# TODO: We should make the API a class, and UDP/HTTP just inherit from it
# This will make it so we can more easily control logging with various
# m... | {
"content_hash": "796b4fc786ec3834b8522154e3658806",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 97,
"avg_line_length": 32.97948717948718,
"alnum_prop": 0.5897994091121131,
"repo_name": "SilentCircle/sentry",
"id": "99bd1bf8c5f6aecab69199ef74a5c47ca53c9437",
"size": "... |
import numpy as np
import scipy as sp
import scipy.linalg as LA
from .covar_base import Covariance
from limix.hcache import cached
import pdb
import logging as LG
class FreeFormCov(Covariance):
"""
General semi-definite positive matrix with no contraints.
A free-form covariance matrix of dimension d has 1... | {
"content_hash": "f95ef7b676e618a0d33d3ccfb8a671eb",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 98,
"avg_line_length": 30,
"alnum_prop": 0.5022123893805309,
"repo_name": "PMBio/limix",
"id": "cfc98a750f23c935680d9cf10cda64e2874a865c",
"size": "6780",
"binary": fals... |
#!/usr/bin/env python2.7
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | {
"content_hash": "c33baff49a7a181ab3beda5125c71f33",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 146,
"avg_line_length": 36.66829268292683,
"alnum_prop": 0.6164693361713449,
"repo_name": "kumaralokgithub/grpc",
"id": "8359734c8484d78659d4487a3e692783997f3a3f",
"size":... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line
# Allow starting the app without installing the module.
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath... | {
"content_hash": "7c3845669a43b49e2bdc1a4f479ad089",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 84,
"avg_line_length": 28.846153846153847,
"alnum_prop": 0.7066666666666667,
"repo_name": "PetrDlouhy/django-su",
"id": "0977c7ebc4dc21bde1aa92ac1f8a5fa6032324d8",
"size": ... |
from test import get_client_credentials_session, cassette
def test_should_page_through_search_results():
session = get_client_credentials_session()
with cassette('fixtures/resources/catalog/list_search/page_through_search_results.yaml'):
first_page = session.catalog.search('mapreduce').list(page_size... | {
"content_hash": "a0ed085210452f69827459facf84f682",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 106,
"avg_line_length": 39.542857142857144,
"alnum_prop": 0.6907514450867052,
"repo_name": "lucidbard/mendeley-python-sdk",
"id": "2965ae489f3fa989bf20b6e3d5a5dafe494f4737",
... |
import sys, time
import pytest
def test_we_can_import_module():
pytest.importorskip('timelimit')
def test_context_manager_exists():
timelimit = pytest.importorskip('timelimit')
timelimit.timelimit
def test_context_manager_can_be_used():
timelimit = pytest.importorskip('timelimit')
with timelimit.... | {
"content_hash": "f676397942172c2f6cd97bfc581b006f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 25.853658536585368,
"alnum_prop": 0.6575471698113208,
"repo_name": "INM-6/Python-Module-of-the-Week",
"id": "6d4c49878e3994edd0c7de98ef5439d579da7072",... |
from __future__ import print_function
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import json
import os
import sys
import re
import requests
import multipart
import string
class MZBenchAPIException(Exception):
pass
def start(host, script_file, script_content,... | {
"content_hash": "6368a9ae7e972e21e9f1535b578abca4",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 193,
"avg_line_length": 33.943866943866944,
"alnum_prop": 0.628100692105102,
"repo_name": "machinezone/mzbench",
"id": "3ad7ebc2de6d10f30a37072626f4d67d48a006bf",
"size": ... |
class RelationshipType:
"""
Stores components of a relationship type:
inUse: Whether relationship type is in use
type_block_id: ID of the block that stores string name of our type
Along with the index where the relationship type is stored
"""
def __init__(self, index=0, in_use=True,... | {
"content_hash": "a051874a001a02f50a26570bda21e2e9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 76,
"avg_line_length": 31.646153846153847,
"alnum_prop": 0.5775401069518716,
"repo_name": "PHB-CS123/graphene",
"id": "547ba33fd59b000fd0d696d79d16fb92a9082016",
"size": "2... |
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 'Indicator.identifier'
db.add_column(u'survey_indicator', 'identifier',
self.gf('django.db.mode... | {
"content_hash": "fc52fd8a4e0fe537dd3b57a0b27910b6",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 179,
"avg_line_length": 85.26839826839827,
"alnum_prop": 0.5666345128699802,
"repo_name": "antsmc2/mics",
"id": "44b8ae5becfbb800490799271c0607eb3daf5bdb",
"size": "19721"... |
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:45
:Licence MIT
Part of grammpy
"""
from .representation import *
| {
"content_hash": "99a491e9e5726ed05398e0b44edca56e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 29,
"avg_line_length": 13.222222222222221,
"alnum_prop": 0.7226890756302521,
"repo_name": "PatrikValkovic/grammpy",
"id": "8904a2b59a840caf9f17cf3c3e300cd401fa5586",
"size":... |
""":mod:`sqlalchemy_imageattach` --- SQLAlchemy-ImageAttach
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This package provides a simple way to attach images to the other
object-relationally mapped entities and store these into the physically
agnostic backend storages.
For example, you can simply store ... | {
"content_hash": "5c9e255534a383cad98646f3d2e89947",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 44.23076923076923,
"alnum_prop": 0.7217391304347827,
"repo_name": "youknowone/sqlalchemy-imageattach",
"id": "fec1256977fea4a3dd23369e280ecb7a5432ffcb"... |
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 337600
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([
"88.208.34.101"
])
import re
import sys
import dns.resolver
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3}... | {
"content_hash": "f98be9396d1d145bdab09161cb31decb",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 186,
"avg_line_length": 31.256880733944953,
"alnum_prop": 0.5705899618432638,
"repo_name": "tropa/axecoin",
"id": "f1d9e368c61c8b77036d0b9cc88fe3eaa07c28f3",
"size": "3480... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Song',
fields=[
('id', models.AutoField(auto_create... | {
"content_hash": "2e714c129a94aaf111aac6298ec86228",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 24.545454545454547,
"alnum_prop": 0.5592592592592592,
"repo_name": "Lightshadow244/OwnMusicWeb",
"id": "e896c11782f0107fb83cdc657104b92b8d154080",
"... |
from engine.event import *
from engine.action import *
from engine.code import *
from engine.player import *
from engine.round import *
from engine.team import *
import configparser
from flask import Flask, json, jsonify, make_response, session, render_template, request, send_file
import json
import os
import psycopg2... | {
"content_hash": "1a960525384024a74059aa353288868b",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 164,
"avg_line_length": 32.01197604790419,
"alnum_prop": 0.5712682379349046,
"repo_name": "mahfiaz/spotter_irl",
"id": "ef20aae862196bf22c4b066c53c4cabead7db1fe",
"size": ... |
import Image
from ImageDraw import Draw
import random
from vision.annotations import *
class Geppetto(object):
"""
Facilitates making toy tracking data. Geppetto manages the toys and renders the
frames to produce the actual data.
"""
def __init__(self, size = (720, 480), background = (255, 255, 255... | {
"content_hash": "9d81f7038a0272accd3804917dd65e70",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 125,
"avg_line_length": 31.060606060606062,
"alnum_prop": 0.5580487804878049,
"repo_name": "weiliu89/pyvision",
"id": "76b6f2bff938e9d34b8f6b131573cb01b24e34eb",
"size": "... |
import os
import json
import codecs
from PIL import Image
from io import BytesIO
import numpy as np
class Hexagram(object):
"""
Generate and write a hexagram to PNG
Input is an iterable of six binary digits or booleans;
1 / True is a solid line,
0 / False is a broken line
Write to hexagram_out... | {
"content_hash": "63991729312a5353456952a84d838d2d",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 114,
"avg_line_length": 35.054545454545455,
"alnum_prop": 0.5567946058091287,
"repo_name": "urschrei/hexagrams",
"id": "6b6020e64b0370459a4c1974ff1ba0d6cc2b690e",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0029_auto_20170226_0745'),
]
operations = [
migrations.RenameField(
model_name='surveytype',
old_name='descript... | {
"content_hash": "52b58e54f16a8c87eeec3361d64cbbcc",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 159,
"avg_line_length": 31.029411764705884,
"alnum_prop": 0.5867298578199052,
"repo_name": "Code4SA/umibukela",
"id": "25238183ba590a97270fd473cda7f2b0a03e0e3b",
"size": "1... |
class Database:
def __init__(self):
pass
def save_target(self, target_system_id, target_system_data):
""" saves the data of an OEDA target system with the provided id """
pass
def get_target(self, target_system_id):
""" returns the configuration of an OEDA target system ""... | {
"content_hash": "a8210b04ac9d1e47f44976c809360087",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 152,
"avg_line_length": 33.41095890410959,
"alnum_prop": 0.6396063960639606,
"repo_name": "Starofall/OEDA",
"id": "82a1e15039a3bbbf3e37eef3688b2881c59bb357",
"size": "2544"... |
"""Tests for linear.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.python.feature_column import feature_column
from tensorflow.python.feature_column import feature_column_v2
from tensorflow.... | {
"content_hash": "e23ce7e87480730a97540acdf29d3e94",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 83,
"avg_line_length": 37.578347578347575,
"alnum_prop": 0.7078089461713419,
"repo_name": "tensorflow/estimator",
"id": "4e8184a54f4f821f0372c0898618761917ffc80f",
"size":... |
from __future__ import absolute_import
import errno
import warnings
import hmac
from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256
from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning
SSLContext = None
HAS_SNI = False
IS_PYOPENSSL = False
# Maps the length of a d... | {
"content_hash": "322e96a500830f47c73ae5b0f87e2976",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 93,
"avg_line_length": 35.9080118694362,
"alnum_prop": 0.6346582927030824,
"repo_name": "typemytype/Mechanic",
"id": "9bad178573218fd21cf8619198f103e2f034d8cc",
"size": "1... |
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("advicer", "0012_auto_20151124_1541")]
operations = [
migrations.AlterField(
model_name="advice",
name="grant_on",
field=models.DateTimeFi... | {
"content_hash": "1e41bf553e5d9506078237b3e059dd5a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 25.352941176470587,
"alnum_prop": 0.5986078886310905,
"repo_name": "rwakulszowa/poradnia",
"id": "dca31f96eb8ab689848a42299485bdb76097b8ba",
"size": ... |
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section, print_h2
from rx.internal import extensionmethod
from rx import Observable, AnonymousObservable, Observer
from rx.sub... | {
"content_hash": "4b53c72782db9a9ef9b64702911356b3",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 77,
"avg_line_length": 27.863013698630137,
"alnum_prop": 0.6081612586037365,
"repo_name": "christabor/MoAL",
"id": "84cd8539024319dd85c03b8ca48563007bee1bb1",
"size": "409... |
from collections import OrderedDict
import os
import re
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import re... | {
"content_hash": "160f997da18dc89ef80f9357d36addf0",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 145,
"avg_line_length": 40.58346333853354,
"alnum_prop": 0.6227416006765588,
"repo_name": "googleapis/python-retail",
"id": "cfed14db070e904b87a7374cc6a888537f22c1a7",
"si... |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineRespon... | {
"content_hash": "7aa0e17c4b5626fc6643f3508409c3b0",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 243,
"avg_line_length": 41.63537906137184,
"alnum_prop": 0.6394693488251105,
"repo_name": "Azure/azure-sdk-for-python",
"id": "70e06d467b99b8817d121953429bca1e396cff45",
"... |
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA).
"""
# Author: Lars Buitinck
# Olivier Grisel <olivier.grisel@ensta.org>
# Michael Becker <mike@beckerfuffle.com>
# License: 3-clause BSD.
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import svds
from ..... | {
"content_hash": "d133502e8b6b93e368c2f3992afed622",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 78,
"avg_line_length": 36.419213973799124,
"alnum_prop": 0.6173860911270983,
"repo_name": "BiaDarkia/scikit-learn",
"id": "049c165baea200b131eafe9ec6abaa17e0cc9adf",
"size... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | {
"content_hash": "209757977058bc7a768d9962cb880a63",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 125,
"avg_line_length": 30.443946188340806,
"alnum_prop": 0.6892031226984828,
"repo_name": "dezinezync/TiColorArt",
"id": "b8db8c951089172f5a6e3dc4604bba7320f9c8cf",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Custom... | {
"content_hash": "9f4c819dae1a35a156c59e01fdbb3e9f",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 289,
"avg_line_length": 68.64102564102564,
"alnum_prop": 0.6417631677250654,
"repo_name": "Larhard/Elgassia",
"id": "bb1460e6b247a75589d5c4be94120e9431fda77d",
"size": "270... |
import numpy as np
import cgen as c
from sympy import And, Or, Max
from devito.data import FULL
from devito.ir import (DummyEq, Conditional, Dereference, Expression, ExpressionBundle,
List, ParallelTree, Prodder, FindSymbols, FindNodes, Return,
VECTORIZED, Transformer, IsP... | {
"content_hash": "e673b34575559dfe350b28b5fe8ad625",
"timestamp": "",
"source": "github",
"line_count": 554,
"max_line_length": 90,
"avg_line_length": 37.6028880866426,
"alnum_prop": 0.5795410906298003,
"repo_name": "opesci/devito",
"id": "afad4ea3a1826d3a763169d72354c378212231bb",
"size": "20832",... |
"""
Log Server
"""
import sys
from time import gmtime, strftime
from enum import Enum
from core.observer import Observer
from core.base_component import BaseComponent
class LogLevel(Enum):
""""
Enumeration for setting a log level
"""
INFO = '\033[0m'
DEBUG = '\033[0;37m'
SUCCESS = '\033[92m'
... | {
"content_hash": "e6b98ddc048715f8673b265f75610d6f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 87,
"avg_line_length": 28.186046511627907,
"alnum_prop": 0.5412541254125413,
"repo_name": "thomaskuestner/MRIQA",
"id": "ccf26aea986ae3148448348cba754321528ee5a9",
"size": ... |
from django.contrib import admin
from .models import AreaTagModel
class MapAreaInlineAdmin(admin.TabularInline):
model = AreaTagModel
fk_name = 'mapa'
| {
"content_hash": "b9c5060110311b830ebf576a86d71326",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 23,
"alnum_prop": 0.7701863354037267,
"repo_name": "tourlines/cmsplugin-html",
"id": "a8ea0312eaadcf24dfcff16006e33f74261c8723",
"size": "177",
"bin... |
"""Check that it's not possible to start a second auroracoind instance using the same datadir or wallet."""
import os
from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_node import ErrorMatch
class FilelockTest(BitcoinTestFramework):
def set_test_params(self):
self.set... | {
"content_hash": "deec91ee00347202f1eac0022028ab0e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 177,
"avg_line_length": 50.8125,
"alnum_prop": 0.6845018450184502,
"repo_name": "aurarad/auroracoin",
"id": "ba57298b3e7626ae5e0656d1df6f55451a3544db",
"size": "1882",
"b... |
"""This file contains the Spotlight Volume Configuration plist in Plaso."""
from plaso.events import plist_event
from plaso.parsers.plist_plugins import interface
__author__ = 'Joaquin Moreno Garijo (Joaquin.MorenoGarijo.2013@live.rhul.ac.uk)'
class SpotlightVolumePlugin(interface.PlistPlugin):
"""Basic plugin t... | {
"content_hash": "e9d400a91ca6d7b1e41034270374862f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 33,
"alnum_prop": 0.7116324535679375,
"repo_name": "iwm911/plaso",
"id": "29f501066df4a40fcfd5697ae9f39c76a7ef2601",
"size": "1721",
"binary": fals... |
import random
import re
from sopel.module import commands, example
#Matches: <@+nickNames123>
_NICKNAME = '(<[^\s]+>)'
@commands('quote')
def quote(bot, trigger):
quotes = bot.mongodb.quotes
input = trigger.group(2) if trigger.group(2) else ''
quotable = re.findall(_NICKNAME, input)
if quotable:
... | {
"content_hash": "31c7fb920e6e1008cb74c6147b3c69d7",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 75,
"avg_line_length": 26.426666666666666,
"alnum_prop": 0.5817356205852674,
"repo_name": "jimj/sopelmodules",
"id": "37de50b9a91da397eadf34e48fdb6b9fc5219947",
"size": "19... |
import os
import sys
import traceback
from zipfile import ZipFile
# Magic python path, based on http://djangosnippets.org/snippets/281/
from os.path import abspath, dirname, join
parentdir = dirname(dirname(abspath(__file__)))
# Insert our parent directory (the one containing the folder metashare/):
sys.path.insert(1,... | {
"content_hash": "ac3e4d5ae45717b4a94f711e931a6d4c",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 41.447916666666664,
"alnum_prop": 0.6142246795677306,
"repo_name": "zeehio/META-SHARE",
"id": "745f9c15a64c380b7d429546298f430c73bcae22",
"size": "40... |
from codecs import open
from ohoh import build_parser, DEFAULT_HOST, DEFAULT_PORT
from os import path
import os
import pytest
import sys
import time
@pytest.fixture
def parser():
return build_parser()
@pytest.fixture
def modfile(request, tmpdir):
def uninstall():
sys.path.remove(tmpdir.strpath)
s... | {
"content_hash": "cc38afa18fc926a2dd1e58ce973c2377",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 81,
"avg_line_length": 31.076271186440678,
"alnum_prop": 0.6523043359694574,
"repo_name": "te-je/ohoh",
"id": "2ac2f2c7138d46cab1a9b43042ce9e5dad55ab02",
"size": "3667",
... |
"""
Openflow tests on an l2 table
"""
import sys
import os
import time
import logging
from oftest import config
import oftest.base_tests as base_tests
import ofp
from oftest.testutils import *
from oftest.parse import parse_mac
import openflow_base_tests
sys.path.append(os.path.join(sys.path[0], '..', '..', '..', ... | {
"content_hash": "c95c2b1e8c089d5a249427e248cc76be",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 105,
"avg_line_length": 33.34653465346535,
"alnum_prop": 0.5716745843230404,
"repo_name": "pierce-m/p4factory",
"id": "6658bef1241bec2a23ccc1262bf1393ae855e4dc",
"size": "... |
"""
Email sharing of add-ons and collections with various services.
"""
from tower import ugettext_lazy as _, ungettext as ngettext
# string replacements in URLs are: url, title, description
class ServiceBase(object):
"""Base class for sharing services."""
@staticmethod
def count_term(count):
"""... | {
"content_hash": "3879671af7cfc79a7bb3aea249c0707c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 74,
"avg_line_length": 30.93243243243243,
"alnum_prop": 0.6443861948449104,
"repo_name": "jbalogh/zamboni",
"id": "e0239b48542646efae0a9be1f32fd4e9dc2f9014",
"size": "2289"... |
import time
import unittest
import config
import node
PANID_INIT = 0xface
COMMISSIONER = 1
LEADER = 2
ROUTER = 3
LEADER_ACTIVE_TIMESTAMP = 10
ROUTER_ACTIVE_TIMESTAMP = 20
ROUTER_PENDING_TIMESTAMP = 30
ROUTER_PENDING_ACTIVE_TIMESTAMP = 25
COMMISSIONER_PENDING_CHANNEL = 20
COMMISSIONER_PENDING_PANID = 0xafce
class ... | {
"content_hash": "54071af2ead476cb315d77677e217acc",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 105,
"avg_line_length": 38.91588785046729,
"alnum_prop": 0.6332853025936599,
"repo_name": "georgecpr/openthread",
"id": "b15c63c35425910471b1abd74f0f9a6d63d54608",
"size":... |
import logging
import StringIO
from webkitpy.common.system import outputcapture
from webkitpy.layout_tests.views.metered_stream import MeteredStream
_log = logging.getLogger(__name__)
class Printer(object):
def __init__(self, stream, options=None):
self.stream = stream
self.meter = None
... | {
"content_hash": "0c1ffeb466c51eb5776a067dd2d3a3a7",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 111,
"avg_line_length": 36.54545454545455,
"alnum_prop": 0.5931281094527363,
"repo_name": "leighpauls/k2cro4",
"id": "0ec3035b364eaa56afe1c2692d86a70bb42dd171",
"size": "7... |
"""Basic examples for building pandas objects using the Data Commons Pandas API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datacommons_pandas as dcpd
def build_time_series_example():
print("""
# Build a pd.Series of time series for one ... | {
"content_hash": "3c6936f814a77d4e20c718eeb6f9f5ff",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 96,
"avg_line_length": 33.693548387096776,
"alnum_prop": 0.6213499281953088,
"repo_name": "datacommonsorg/api-python",
"id": "ea09ea1e68ec38839fe6de14dfae267fb256806f",
"s... |
import datetime
from django.contrib.auth.models import User
from django.db import models
from tastypie.utils import now, aware_datetime
class Note(models.Model):
author = models.ForeignKey(User, blank=True, null=True)
title = models.CharField(max_length=100)
slug = models.SlugField()
content = models... | {
"content_hash": "5528b95f1a54291379099d21e89ad028",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 59,
"avg_line_length": 28.03125,
"alnum_prop": 0.6677814938684504,
"repo_name": "strets123/django-tastypie-tweaks",
"id": "1fe679e4e09ae0c41f052b51f57077604a883e03",
"size"... |
import sys
from os.path import join, dirname
from absl import app
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
sys.path.append('../')
import datasets
from util import io as ioutil
def main(_):
config_ini = join(dirname(__file__), '..', 'config', 'dragon_specular.ini')
config = ioutil.read_c... | {
"content_hash": "c68d8d06312b503c8a2d1732ac96898c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 25.515151515151516,
"alnum_prop": 0.668646080760095,
"repo_name": "google/neural-light-transport",
"id": "7eab2e9233141229915ea54e3a9ad3980ec8ae2f",
... |
"""
URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based view... | {
"content_hash": "1a03b04bcda251ef35d6b917ebedd6a9",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 35.58064516129032,
"alnum_prop": 0.6672710788757933,
"repo_name": "Flyingfox646/flyingfox",
"id": "393867aad96c8901a95d14916e1d05eafacef1d1",
"size":... |
"""Base classes for our unit tests.
Allows overriding of flags for use of fakes, and some black magic for
inline callbacks.
"""
import functools
import unittest
import uuid
import mox
import nose.plugins.skip
from oslo.config import cfg
import stubout
from cinder import flags
from cinder.openstack.common import lo... | {
"content_hash": "8df4b38515dd0450e1baefc1b2af3a2b",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 79,
"avg_line_length": 33.059925093632955,
"alnum_prop": 0.5521694800045316,
"repo_name": "tomasdubec/openstack-cinder",
"id": "967eadca37d7e3af03bcfd6ac0827d3e81d9b9e8",
... |
from unittest import TestCase
import msal
from office365.graph_client import GraphClient
from tests import load_settings
def acquire_token_by_username_password():
settings = load_settings()
authority_url = 'https://login.microsoftonline.com/{0}'.format(settings.get('default', 'tenant'))
app = msal.Publi... | {
"content_hash": "7571baab845d6bcca958faeff84931a0",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 106,
"avg_line_length": 38.84615384615385,
"alnum_prop": 0.6646864686468646,
"repo_name": "vgrem/Office365-REST-Python-Client",
"id": "c8da5513d71f78f1b0cbe1692172ffb21a62b78... |
import datetime
import glob
import logging
import math
import os
import re
import time
import warnings
from typing import Optional, Union, List, Dict, Tuple, Any, Type
import torch
from torch.cuda import amp
from torch.nn.utils import clip_grad_norm_
import torch.distributed as dist
from torch.cuda.amp.grad_scaler imp... | {
"content_hash": "c14451f40dbed0980b064fd32372a7f6",
"timestamp": "",
"source": "github",
"line_count": 1244,
"max_line_length": 113,
"avg_line_length": 46.72106109324759,
"alnum_prop": 0.599679977976979,
"repo_name": "allenai/allennlp",
"id": "cfabbc3237f6097afb8fa1f1cb25f906a47fa30c",
"size": "58... |
from flask_restful import Resource, reqparse, fields, marshal_with
from dateutil import parser
from sqlalchemy import desc
from flask_jwt_extended import jwt_required
from .revisions import revision_fields
from ... import db
from ...models import Revision, Futuremark3DMarkResult
futuremark3dmarkresult_fields = {
... | {
"content_hash": "005c1772c00ac5cc82d2a2210037e10d",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 77,
"avg_line_length": 43.20261437908497,
"alnum_prop": 0.594553706505295,
"repo_name": "rivalrockets/rivalrockets-api",
"id": "84787a92b1daa847561e2825cb204a8dc1d4387c",
... |
'''
Parsing
'''
from __future__ import absolute_import
##
# Import Modules
#
import os.path
import re
from Library.StringUtils import RaiseParserError
from Library.StringUtils import GetSplitValueList
from Library.StringUtils import CheckFileType
from Library.StringUtils import CheckFileExist
from Li... | {
"content_hash": "463424d248e7e0db168308f23284215a",
"timestamp": "",
"source": "github",
"line_count": 1007,
"max_line_length": 120,
"avg_line_length": 39.15690168818272,
"alnum_prop": 0.5742182546727195,
"repo_name": "MattDevo/edk2",
"id": "81729d6cdbf7b3a2c43e6bfaf6072117e128296d",
"size": "4005... |
from msrest.paging import Paged
class LoadBalancerPaged(Paged):
"""
A paging container for iterating over a list of :class:`LoadBalancer <azure.mgmt.network.v2016_12_01.models.LoadBalancer>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page':... | {
"content_hash": "b7e93fad753d489616f2705a17e3f066",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 133,
"avg_line_length": 29.875,
"alnum_prop": 0.6129707112970711,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "df9453cdfabf53f931d6c1209068050b4d714e96",
"size": ... |
"""Support for the worldtides.info API."""
from __future__ import annotations
from datetime import timedelta
import logging
import time
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_A... | {
"content_hash": "06d62725c8dfc2291fdbe2a85874f07b",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 84,
"avg_line_length": 33.62595419847328,
"alnum_prop": 0.6086265607264473,
"repo_name": "GenericStudent/home-assistant",
"id": "533328490c84fff786b414fab5259bf1e1d57caf",
... |
import logging
from ask_amy.core.object_dictionary import ObjectDictionary
from ask_amy.core.directive import AudioPlayer
logger = logging.getLogger()
class Reply(ObjectDictionary):
def __init__(self, card_dict=None):
super().__init__(card_dict)
@classmethod
def constr(cls, response, session_at... | {
"content_hash": "d5bed67ad85d84de495a6e275a3df6ff",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 104,
"avg_line_length": 37.93014705882353,
"alnum_prop": 0.567994572065523,
"repo_name": "dphiggs01/ask_amy",
"id": "29c19c6a414691a1bda775f60e4f924148138d7e",
"size": "10... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lizard_auth_client', '0006_auto_20181115_1313'),
]
operations = [
migrations.AlterModelOptions(
name='organisation',
options... | {
"content_hash": "15680f62e3f1778356c45124a8e4aabe",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 58,
"avg_line_length": 21.294117647058822,
"alnum_prop": 0.6022099447513812,
"repo_name": "lizardsystem/lizard-auth-client",
"id": "53c9a4f9560bb222a902cf24d3be042b2c8149ef",... |
from django.apps import AppConfig
class 檢查工具Config(AppConfig):
name = '檢查工具'
def ready(self):
# registering signals
from 檢查工具 import signals
signals
| {
"content_hash": "e781d597febfacb9f2ea6f7e0327b925",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 33,
"avg_line_length": 18.4,
"alnum_prop": 0.6467391304347826,
"repo_name": "i3thuan5/gi2_liau7_khoo3",
"id": "ffa57f8e50d55f5777d983d40443bd6980026f6c",
"size": "208",
"... |
"""
Django settings for deckbuilder project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import o... | {
"content_hash": "6c224a78c10d499d5216aeaf0f1ca61d",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 91,
"avg_line_length": 25.689922480620154,
"alnum_prop": 0.6864815932407966,
"repo_name": "vokal/deckbuilder-api",
"id": "1b2640defffe25e1f3d7a9a50be92e71141bdf67",
"size"... |
import json
import struct
import time
from calendar import timegm
from binascii import hexlify, unhexlify
from .objecttypes import object_type
from .utils import unicodify
timeformat = "%Y-%m-%dT%H:%M:%S%Z"
def varint(n):
""" Varint encoding
"""
data = b""
while n >= 0x80:
data += bytes([(n &... | {
"content_hash": "c94c9568a5315429baf25af97803d0ab",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 88,
"avg_line_length": 22.533642691415313,
"alnum_prop": 0.5270799011532126,
"repo_name": "xeroc/python-graphenelib",
"id": "d19d7264453db463ef0bc64bf6b2213ada8993d1",
"si... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os.path
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from pandas.util.testing import assert_frame_equal
import itertools
import py... | {
"content_hash": "277aa92c60faef61709b86139d44c239",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 97,
"avg_line_length": 38.677290836653384,
"alnum_prop": 0.5636588380716935,
"repo_name": "kcompher/FreeDiscovUI",
"id": "187ea2ee280b9ff3928a8202d5619a18d72d9c56",
"size"... |
import sys
import M2Crypto
def extract_DN(fname):
"""
Extract a Distinguished Name from an X.509 proxy.
@type fname: string
@param fname: Filename containing the X.509 proxy
"""
fd = open(fname,"r")
try:
data = fd.read()
finally:
fd.close()
while 1:
try:
... | {
"content_hash": "0411190e64e94cdea3b7f07d82d55b70",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 65,
"avg_line_length": 24.314285714285713,
"alnum_prop": 0.5299647473560517,
"repo_name": "holzman/glideinwms-old",
"id": "243131bd4bd5c1dfc4db15f9b978b0ccdee06977",
"size"... |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, 'surface.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| {
"content_hash": "8cd5dd898a94ace68df36df81cdb64b5",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 70,
"avg_line_length": 40.42857142857143,
"alnum_prop": 0.5830388692579506,
"repo_name": "JRock007/boxxy",
"id": "51db70bfe47a20bc3de513bc91007108d775b724",
"size": "283",
... |
"""This code example gets all proposal line items.
To create proposal line items, run create_proposal_line_items.py.
"""
# Import appropriate modules from the client library.
from googleads import dfp
def main(client):
# Initialize appropriate service.
proposal_line_item_service = client.GetService(
'Pro... | {
"content_hash": "3ac8faee2cfe95f515d0ec923f1bfcba",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 32.73170731707317,
"alnum_prop": 0.650521609538003,
"repo_name": "wubr2000/googleads-python-lib",
"id": "dbfe9db9da7382c1a43fd6f74eb02738086a6498",
"... |
from oslo_log import log as logging
from congress.api import api_utils
from congress.api import webservice
from congress.dse import deepsix
from congress.managers import datasource as datasource_manager
LOG = logging.getLogger(__name__)
def d6service(name, keys, inbox, datapath, args):
return SchemaModel(name, ... | {
"content_hash": "d7fa3097603b4d68a4e5188e5dd06a9a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 38.14754098360656,
"alnum_prop": 0.587881392350666,
"repo_name": "ekcs/congress",
"id": "ddde96eec88abca6a289efae35bb040a95ea2f70",
"size": "2959",
... |
"""
Pages in Django can are served up with custom HTTP headers containing useful
information about those pages -- namely, the content type and object ID.
This module contains utility functions for retrieving and doing interesting
things with these special "X-Headers" (so called because the HTTP spec demands
that custo... | {
"content_hash": "1dc1fdf30d5215b7f941157b882ce2dc",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 81,
"avg_line_length": 46.04545454545455,
"alnum_prop": 0.7255676209279368,
"repo_name": "tungvx/deploy",
"id": "98d2586b75c72bb13e30131f4e912f3490045bfc",
"size": "1013",
... |
from operator import attrgetter
from mkt.search.indexers import BaseIndexer
from mkt.translations.models import attach_trans_dict
class WebsiteIndexer(BaseIndexer):
translated_fields = ('description', 'name', 'short_name', 'title')
fields_with_language_analyzers = ('description', 'name', 'short_name')
hi... | {
"content_hash": "273f536b36a82a07141e79922671f953",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 40.07142857142857,
"alnum_prop": 0.5201426024955437,
"repo_name": "eviljeff/zamboni",
"id": "0a6d77d641c7d2e090a6581dc989a073b5d611d0",
"size": "561... |
import asyncio
import re
from unittest import mock
from kafka.protocol.group import (
JoinGroupRequest_v0 as JoinGroupRequest,
SyncGroupResponse_v0 as SyncGroupResponse,
LeaveGroupRequest_v0 as LeaveGroupRequest,
HeartbeatRequest_v0 as HeartbeatRequest,
)
from kafka.protocol.commit import (
OffsetC... | {
"content_hash": "c6152e363921e2eea5732fc03d11fd57",
"timestamp": "",
"source": "github",
"line_count": 1463,
"max_line_length": 85,
"avg_line_length": 39.866712235133285,
"alnum_prop": 0.6271238748392628,
"repo_name": "aio-libs/aiokafka",
"id": "f8ebb6c0c0cc7b062ea041c35f5a2ea031441b69",
"size": "... |
"""
S3 TOKEN MIDDLEWARE
This WSGI component:
* Get a request from the swift3 middleware with an S3 Authorization
access key.
* Validate s3 token in Keystone.
* Transform the account name to AUTH_%(tenant_name).
"""
import httplib
import webob
from keystone.openstack.common import jsonutils
from swift.common imp... | {
"content_hash": "f14c183fc036653265fc258095950352",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 77,
"avg_line_length": 40.19072164948454,
"alnum_prop": 0.5689367705527767,
"repo_name": "weiyuanke/mykeystone",
"id": "7cf2e3944dffc08438115616b103505f6e994c50",
"size": ... |
#!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py --ipython
$ python runtests.py --python somescript.py
$ python... | {
"content_hash": "e5851c498ab1ceab092ff823aad700fc",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 103,
"avg_line_length": 35.22875816993464,
"alnum_prop": 0.5395176252319109,
"repo_name": "bccp/bananaplots",
"id": "769d333c12ea8c5d4c26b58cf1cacfa4a9cd8bfc",
"size": "16... |
import cv2
import numpy as np
import timeit
import logging
import os
import cPickle as pickle
from scipy import ndimage
import fli
import gzip
import scipy.ndimage.interpolation as scipint
from os import listdir
from os import remove
from os.path import isfile, join
path = '../data/custom/'
def shuffle_in_unison(a, b... | {
"content_hash": "ab6a8f8bb51708cb01c11c7f30f2a982",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 94,
"avg_line_length": 35.97196261682243,
"alnum_prop": 0.6349701221096389,
"repo_name": "laputian/dml",
"id": "752170db334bae3d5f5bf2ed337f9d1a5c4184fa",
"size": "3849",
... |
import os
import uuid
from keystone.tests import unit as tests
from keystone.tests.unit import default_fixtures
from keystone.tests.unit.ksfixtures import database
from keystone.tests.unit import test_backend
DEFAULT_CATALOG_TEMPLATES = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'default_catalo... | {
"content_hash": "56a5cf6b24a8d3a35ce272cf8bc0e6c5",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 79,
"avg_line_length": 39.5,
"alnum_prop": 0.5463217758209503,
"repo_name": "yanheven/keystone",
"id": "89e72992b3a601cfdceccd63e17ec4f3680e7974",
"size": "6037",
"binar... |
"""Custom convolutional neural network layers in model_zoo."""
__all__ = ['DeformableConvolution', 'ModulatedDeformableConvolution']
from .... import symbol
from ...block import HybridBlock
from ....base import numeric_types
from ...nn import Activation
class DeformableConvolution(HybridBlock):
"""2-D Deformable... | {
"content_hash": "4b2eeefe62012fedeac4066de6cfed9f",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 119,
"avg_line_length": 52.338582677165356,
"alnum_prop": 0.5794092573090618,
"repo_name": "larroy/mxnet",
"id": "c4924c130a28dbdc9672bb5492f3be341392c159",
"size": "20779... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ast
import os
import random
import subprocess
import sys
try:
import argparse
except ImportError:
print("Cannot import argparse.")
exit(1)
# Import t... | {
"content_hash": "d6d11f508e240d4161ba4115c601441a",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 79,
"avg_line_length": 30.652482269503547,
"alnum_prop": 0.5853771402128645,
"repo_name": "jedi22/osquery",
"id": "bf5fe0b2d199b4f9ef8082baca88332b3bdfab5a",
"size": "4714... |
"""Views."""
from __future__ import unicode_literals
import operator
import nm_helper
import cdb_helper
import netspot_settings
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from .lib.spotmax import netspot
@login_required
def netmagis(request):
"""NetMagis landin... | {
"content_hash": "396f201a46c805c30f29e0d99ca053ea",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 95,
"avg_line_length": 30.983606557377048,
"alnum_prop": 0.5314814814814814,
"repo_name": "MaxIV-KitsControls/netspot",
"id": "b9d670c0125f43290ae152fa288e91817f6cd64b",
"... |
import _plotly_utils.basevalidators
class SymbolsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="symbolsrc", parent_name="scattergeo.marker", **kwargs
):
super(SymbolsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | {
"content_hash": "bbebebb8081cbd628572bc13820f7645",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 32.61538461538461,
"alnum_prop": 0.6108490566037735,
"repo_name": "plotly/plotly.py",
"id": "e3c73ef93b3f6b100146d96c0fdad0ec44fb5990",
"size": "424"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.