code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
from __future__ import print_function
import sys
import time
import logging
import tornado
import katcp
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
stdout_handle = logging.StreamHandler(sys.stdout)
stdout_handle.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctim... | martinslabber/katcp_utils | katcp_ping_tester/ping_server.py | Python | mit | 2,370 |
from .. import util
from .compiler import Visitable
# these are back-assigned by cypher_types.
BOOLEANTYPE = None
INTEGERTYPE = None
NULLTYPE = None
STRINGTYPE = None
class PropType(Visitable):
"""Base property type class"""
def bind_processor(self):
"""Return a function to convert a Python value i... | theY4Kman/neoalchemy | neoalchemy/cypher/type_api.py | Python | mit | 3,212 |
"""
WSGI config for tele_giphy project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
# Standard Library
import os
# Django
from django.core.wsgi import get_wsgi_application
os.... | JessicaNgo/TeleGiphy | tele_giphy/tele_giphy/wsgi.py | Python | mit | 426 |
#!/usr/bin/env python3
''' Adjust timestamps in MCF files (https://www.moviecontentfilter.com/specification) for new releases
'''
import sys
import mcf
class VideoSegment():
def __init__(self, start, end):
self.start = start
self.end = end
def main():
if len(sys.argv) < 3:
sys.exi... | bmaupin/junkpile | python/video-tools/mcf/adjust-mcf-new-release.py | Python | mit | 1,566 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('easyPoS', '0007_auto_20141209_2237'),
]
operations = [
migrations.AlterField(
model_name='arrhe'... | simonpessemesse/seguinus | easyPoS/migrations/0008_auto_20141209_2237.py | Python | gpl-2.0 | 868 |
#!/usr/bin/env python
'''
pyNLPQL - A Python pyOpt interface to NLPQL.
Copyright (c) 2008-2014 by pyOpt Developers
All rights reserved.
Revision: 1.5 $Date: 21/06/2010 21:00$
Tested on:
---------
Linux with g77
Linux with gfortran
Linux with pathf95
Win32 with g77
Mac with g95
Developers:
-----------
- Dr. Ruben... | svn2github/pyopt | pyOpt/pyNLPQL/pyNLPQL.py | Python | gpl-3.0 | 17,781 |
from flask_user import UserMixin
from hortiradar.website import db
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
# User authentication information
username = db.Column(db.String(50), nullable=False, unique=True)
password = db.Column(db.String(255), nullable=False, ser... | mctenthij/hortiradar | hortiradar/website/models.py | Python | apache-2.0 | 1,248 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
# overloading pickle to have it find the PackedDBobj in this module
import pickle
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
renametable = {
... | TaliesinSkye/evennia | src/objects/migrations/0002_auto__del_field_objattribute_db_mode.py | Python | bsd-3-clause | 9,805 |
"""Module for implementations of the MetadataExtractor interface."""
from __future__ import absolute_import, unicode_literals
from rdflib.term import Literal
from rdflib.term import URIRef
from gutenberg._domain_model.types import rdf_bind_to_string
from gutenberg._domain_model.vocabulary import DCTERMS
from gutenb... | hugovk/Gutenberg | gutenberg/query/extractors.py | Python | apache-2.0 | 3,761 |
"""
byceps.services.board.models.posting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime
from ....blueprints.board.authorization import (
BoardPermission,
BoardPostingPermission,
)
from ....data... | m-ober/byceps | byceps/services/board/models/posting.py | Python | bsd-3-clause | 4,336 |
from django.conf.urls import patterns, url, include
from tastypie.api import Api
from usersvumigo.api import VumiGoUserResource, QuizResponseResource
api_resources = Api(api_name='v1')
api_resources.register(VumiGoUserResource())
api_resources.register(QuizResponseResource())
# Setting the urlpatterns to hook into t... | westerncapelabs/django-grs-gatewaycms | usersvumigo/urls.py | Python | mit | 408 |
import os
import re
import sys
import subprocess
import argparse
from testVDRParser import TestVDRParser
from trainVDRParser import TrainVDRParser
from RCNNObjectExtractor import RCNNObjectExtractor
import aux
from vdrDescription import GenerateDescriptions
class cd:
"""Context manager for changing the current wo... | elliottd/vdrparser | selfPredict.py | Python | apache-2.0 | 8,567 |
"""
For calendar module.
"""
from pax.content import ContentImage
from dateutil import parser
class EventImage(object):
"""
Local wrapper for event data.
"""
def __init__(self,data):
self.content = ContentImage(data['content'])
self.calendar = data['calendar']
self.event_type = ... | Axilent/Djax | pax/calendar.py | Python | bsd-3-clause | 10,431 |
# Types are hashable
print(hash(type) != 0)
print(hash(int) != 0)
print(hash(list) != 0)
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
d = {}
d[int] = float
| aitjcize/micropython | tests/basics/types2.py | Python | mit | 188 |
from __future__ import absolute_import, unicode_literals
import io
import os
import sys
from collections import defaultdict
from functools import partial
from distutils.errors import DistutilsOptionError, DistutilsFileError
from setuptools.py26compat import import_module
from setuptools.extern.six import string_types
... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/setuptools/config.py | Python | gpl-3.0 | 16,317 |
"""
2016-06-28
Mag calibration using fitted u from APASS catalog
limit middle part of match, and draw mag difference
"""
import os
import sys
import MySQLdb
def bok_one(filename):
""" Generate reduce command and call IDL. """
part = filename.split("/")
run = part[5]
mjd = part[6]
flt... | RapidLzj/201603 | pass2_mag_again.py | Python | apache-2.0 | 1,674 |
import logging
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from .. import *
from madewithwagtail.settings import APPLICATION_VERSION, PROJECT, ENVIRONMENT
SENTRY_RELEASE = APPLICATION_VERSION
SENTRY_ENVIRONMENT = ENVIRO... | springload/madewithwagtail | madewithwagtail/settings/grains/sentry.py | Python | mit | 1,094 |
from __future__ import absolute_import # For 'redis'
import redis
from ..job import Job
from .. import app_settings
class RedisBackend(object):
def __init__(self):
self.client = redis.Redis(
host=app_settings.REDIS_HOST,
port=app_settings.REDIS_PORT,
)
def enqueue(sel... | lamby/django-lightweight-queue | django_lightweight_queue/backends/redis.py | Python | bsd-3-clause | 854 |
'''
Analysis plugin for supporting WorkspaceEmulators during analysis pass.
Finds and connects Switch Cases, most specifically from Microsoft.
'''
import envi
import envi.archs.i386 as e_i386
import vivisect
import vivisect.analysis.generic.codeblocks as vagc
def analyzeJmp(amod, emu, op, starteip):
'''
Top ... | imjonsnooow/vivisect | vivisect/analysis/generic/switchcase.py | Python | apache-2.0 | 5,920 |
#!/usr/bin/env python
"""
Contains the Momentum class definition
Momentum - a class that represents a physical momentum
"""
import math
class Momentum(object):
"""
A class that represents a physical momentum
Attributes:
px (float): x-component of the momentum
py (float): y-component of the momentum
pz... | semkiv/heppy_fcc | utility/Momentum.py | Python | gpl-3.0 | 1,976 |
# -*- coding: utf-8 -*-
"""Testing of class Bash."""
# pylint: disable=no-self-use, invalid-name, too-many-public-methods
import os
import unittest
from mock import patch
from hamcrest import assert_that, equal_to, matches_regexp
from spline.components.bash import Bash
from spline.components.config import ShellConfig
... | Nachtfeuer/pipeline | tests/components/test_bash.py | Python | mit | 7,362 |
from django.contrib import admin
from wafer.pages.models import File, Page
from wafer.compare.admin import CompareVersionAdmin, DateModifiedFilter
class PageAdmin(CompareVersionAdmin):
prepopulated_fields = {"slug": ("name",)}
list_display = ('name', 'slug', 'get_absolute_url',
'include_... | CTPUG/wafer | wafer/pages/admin.py | Python | isc | 551 |
# -*- coding: utf-8 -*-
"""
Predefined units of measure. Kilogramme has been replaced with gramme to make implementation easier
('kg' unit is still derivable using the prefix library)
The following units are also derivable:
(these commute)
Ampere * Volt -> Watt
Ohm * Ampere -> Volt
second * Ampere -> Coulomb
Wat... | gabbpuy/PyQuantity | quantity/unit/units.py | Python | bsd-2-clause | 5,773 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
from .utils import BaseModelLinkedToAssociation
__all__ = [ "Country", "AddressType", "PhoneType", "PhoneKind", "EmailType",
"WebsiteType", "RelationshipType", "Rev... | kunitoki/nublas | nublas/db/models/types.py | Python | mit | 9,600 |
import _plotly_utils.basevalidators
class CustomdataValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="customdata", parent_name="splom", **kwargs):
super(CustomdataValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/splom/_customdata.py | Python | mit | 406 |
# -*- Mode: Python; test-case-name: morituri.test.test_common_gstreamer -*-
# vi:si:et:sw=4:sts=4:ts=4
# Morituri - for those about to RIP
# Copyright (C) 2009 Thomas Vander Stichele
# This file is part of morituri.
#
# morituri is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | thomasvs/morituri | morituri/common/gstreamer.py | Python | gpl-3.0 | 2,652 |
from pyspark import SparkContext, SparkConf
from random import random
conf = SparkConf()
conf.setAppName("deep test").setMaster("spark://192.168.1.14:7077")#.setExecutorEnv("CLASSPATH", path)
conf.set("spark.scheduler.mode", "FAIR")
conf.set("spark.cores.max",44)
conf.set("spark.executor.memory",'5g')
#conf.set("spark... | gzc/isystem | bigdata/spark/sparktest/pi.py | Python | mit | 660 |
"""A module containing convenient methods for general machine learning"""
from __future__ import print_function
from builtins import object
__author__ = 'wittawat'
import autograd.numpy as np
import time
class ContextTimer(object):
"""
A class used to time an executation of a code snippet.
Use it with w... | wittawatj/interpretable-test | freqopttest/util.py | Python | mit | 5,510 |
#!/usr/bin/python
"""<title>a simple tile editor for pygame</title>
<pre>
usage: tileedit tiles.tga [tile_w] [tile_h]
windows: python tileedit tiles.tga [tile_w] [tile_h]
options:
-h, --help show this help message and exit
--sw=SCREEN_W screen width (app)
--sh=SCREEN_H screen height (... | PerroTron/HostilPlanet | tileedit.py | Python | gpl-2.0 | 35,824 |
from __future__ import print_function
import numpy
from numpy.testing import assert_equal, assert_almost_equal
from nose.tools import raises
from tsutils import eq_
from railgun import SimObject, relpath
LIST_IDX = list('ijklmnopqrstuvwxyz')
def get_str_get_array(cdt, dim):
"""
Get c-function declaration '... | tkf/railgun | tests/arrayaccess.py | Python | mit | 7,777 |
#!/usr/bin/env python
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import os
import sys
import subprocess
import imp
protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog =... | MSFTOSSMgmt/WPSDSCLinux | Providers/Scripts/3.x/Scripts/nxMySqlUser.py | Python | mit | 7,628 |
from kamo import Template
template = Template("""
%for x in range(1, N):
%if x % 15 == 0:
"fizzbuzz"
%elif x % 3 == 0:
"fizz"
%elif x % 5 == 0:
"buzz"
%else:
${x}
%endif
%endfor
""")
print(template.render(N=100))
| podhmo/kamo | demo/fizzbuzz.py | Python | mit | 224 |
try:
from collections import OrderedDict
except:
from sleekxmpp.thirdparty.ordereddict import OrderedDict
from sleekxmpp.thirdparty import suelta
from sleekxmpp.thirdparty.mini_dateutil import tzutc, tzoffset, parse_iso
| TheGurke/Progenitus | sleekxmpp/thirdparty/__init__.py | Python | gpl-3.0 | 229 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_setup, docte... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/sale_stock_quantity/tests/test_sale_stock_quantity.py | Python | gpl-3.0 | 848 |
#!/usr/bin/python
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holdin... | qtproject/pyside-pyside | tests/QtWidgets/virtual_pure_override_test.py | Python | lgpl-2.1 | 2,494 |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
import shutil
from stone.ir import (
is_list_type,
is_map_type,
is_nullable_type,
is_numeric_type,
is_string_type,
is_struct_type,
is_timestamp_type,
is_union_type,
is_user_defi... | posita/stone | stone/backends/obj_c_types.py | Python | mit | 69,747 |
import sys
from ood.controllers.simple import SimpleServerController
from ood.state import State, StateMachine as StateMachineBase
class Archived(State):
name = 'archived'
class Starting(State):
name = 'starting'
timeout = 10
def on_timeout(self):
if self.machine.controller.mcc.port_open()... | markrcote/ood | ood/states/simple.py | Python | mit | 1,217 |
from flask import request
from werkzeug.exceptions import abort
from app.main import main
from app.mapping import get_mapping
from app.main.services.process_request_json import convert_request_json_into_index_json, check_json_from_request
from app.main.services.response_formatters import api_response
from app.main.ser... | alphagov/digitalmarketplace-search-api | app/main/views/update.py | Python | mit | 1,393 |
"""
Base class for FFC unit tests.
"""
from functools import wraps
from unittest import TestCase
from numpy import arange, prod
from numpy.random import randn, seed as random_seed
from pandas import date_range, Int64Index, DataFrame
from six import iteritems
from zipline.finance.trading import TradingEnvironment
from... | michaeljohnbennett/zipline | tests/modelling/base.py | Python | apache-2.0 | 3,451 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2014, GEM Foundation
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | vup1120/oq-risklib | openquake/commonlib/calculators/scenario_risk.py | Python | agpl-3.0 | 4,660 |
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | fabio-otsuka/invesalius3 | invesalius/data/mask.py | Python | gpl-2.0 | 14,213 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID... | megcunningham/django-diesel | megs_project/contrib/sites/migrations/0002_set_site_domain_and_name.py | Python | bsd-3-clause | 944 |
# yellowbrick.cluster.silhouette
# Implements visualizers using the silhouette metric for cluster evaluation.
#
# Author: Benjamin Bengfort
# Author: Rebecca Bilbro
# Created: Mon Mar 27 10:09:24 2017 -0400
#
# Copyright (C) 2017 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: silhouett... | DistrictDataLabs/yellowbrick | yellowbrick/cluster/silhouette.py | Python | apache-2.0 | 12,564 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... | pllim/astropy | docs/conf.py | Python | bsd-3-clause | 17,986 |
#
# Seagull photo gallery app
# Copyright (C) 2016 Hajime Yamasaki Vukelic
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# ver... | foxbunny/seagull | seagull/gallery/__init__.py | Python | gpl-3.0 | 571 |
import math
from screenlets.options import ColorOption, IntOption
fft = True
cc = ( 0.09, 0.57, 0.81, 0.8 )
cc_peak = ( 1.0, 1.0, 1.0, 0.65 )
n_circle_bars = 16
radius = 5
inner_radius = 10
arc_width = 2
arc_spacing = 3
inner_circle_bar = 1
def load_theme( screenlet ):
screenlet.resize( (radius + arc_spacing) *... | kb3dow/dotfiles | conky/ConkyBar/Impulse/Themes/circle lcd2/__init__.py | Python | gpl-3.0 | 2,761 |
HOST = "wfSciwoncGW:enw1989@172.31.25.253:27001,172.31.25.251:27001,172.31.2.76:27001/?authSource=admin"
PORT = ""
USER = ""
PASSWORD = ""
DATABASE = "googlew"
READ_PREFERENCE = "secondary"
WRITE_CONCERN = "majority"
COLLECTION_INPUT = "task_events"
COLLECTION_OUTPUT = "task_events_info"
PREFIX_COLUMN = "g_"
ATTRIBUTE... | elainenaomi/sciwonc-dataflow-examples | dissertation2017/Experiment 1B/instances/8_2_workflow_full_10files_secondary_wmj_1sh_3rs_with_annot_with_proj_3s/taskevent_0/ConfigDB_TaskEvent_0.py | Python | gpl-3.0 | 561 |
# encoding: UTF-8
# Copyright 2016 Google.com
#
# 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 law or agreed to... | KingLu/FuXi | predict_mnist_1.0_softmax.py | Python | mit | 3,428 |
#!/usr/bin/env python2
from dbutil import *
def createTables():
""" Populate the array with names of sql DDL files """
for sqlFileName in ["Address.sql", "Electricity.sql", "CodeViolationsReport.sql",
"FireRescueEMSResponse.sql", "NaturalGasReport.sql",
"WaterRe... | aabmass/CIS4301-Project-GUL | backend/loaddb/createtables.py | Python | mit | 534 |
# Copyright 2013-2016 DataStax, Inc.
#
# 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 law or agreed to in writi... | kishkaru/python-driver | tests/integration/standard/test_cluster.py | Python | apache-2.0 | 31,945 |
# -*- coding: UTF-8 -*-
import pytest
import time
from pytest_testrail.plugin import testrail, pytestrail
@testrail('C344', 'C366')
def test_func1():
time.sleep(0.5)
@testrail('C345')
def test_func2():
time.sleep(1.6)
pytest.fail()
@testrail('C99999')
def test_func3():
time.sleep(0.5)
@pytestrail.c... | allankilpatrick/pytest-testrail | tests/livetest/livetest.py | Python | mit | 434 |
import socket
addr=('0.0.0.0',31483)
sockfd=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sockfd.bind(addr)
recv_num=0
while True:
recv_data,peer_addr=sockfd.recvfrom(10000)
if not recv_data:
print peer_addr,'exit'
break
recv_num+=1
print peer_addr,'send------------------------------------------------>',recv_... | focusexplorer/focusexplorer.github.io | z_lib/monitor.py | Python | lgpl-3.0 | 355 |
import types
import asyncio
import redis
from asyncio.log import logger
from asyncio.selector_events import _SelectorSocketTransport
def _make_pubsub_socket_transport(self, sock, protocol, waiter=None, *,
extra=None, server=None):
return _PubsubSelectorSocketTransport(self, soc... | sdgdsffdsfff/fishpond | main.py | Python | gpl-2.0 | 2,046 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2017-8-30
@author: generated by @lolobosse script
'''
LOCALE = [
["just now", "right now"],
["%ss ago", "in %ss"],
["1m ago", "in 1m"],
["%sm ago", "in %sm"],
["1h ago", "in 1h"],
["%sh ago", "in %sh"],
["1d ago", "in 1d"],
["... | Vagab0nd/SiCKRAGE | lib3/timeago/locales/en_short.py | Python | gpl-3.0 | 514 |
from fukei.utils import import_class
__streams = {
'default': lambda: (import_class('fukei.upstream.remote.RemoteUpstream'),
import_class('tornado.iostream.IOStream')),
'local': lambda: (import_class('fukei.upstream.local.LocalUpstream'),
import_class('tornado.io... | princemaple/Fukei | fukei/upstream/__init__.py | Python | mit | 558 |
# -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from django.core import checks
from django.db.models import BinaryField, TextField
class SizedBinaryField(BinaryField):
def __init__(self, *args, **kwargs):
self.size_class = kwargs.pop('size... | nickmeharry/django-mysql | django_mysql/models/fields/sizes.py | Python | bsd-3-clause | 3,022 |
from __future__ import absolute_import
import json
import logging
from pip._vendor import six
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.exceptions import CommandError
from pip._internal.in... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_internal/commands/list.py | Python | gpl-3.0 | 11,312 |
#-*- coding: utf-8 -*-
import os
import yaml
from polaris_common import topology
from polaris_pdns import config
from polaris_pdns.core.polaris import Polaris
__all__ = [ 'main', 'load_configuration' ]
def main():
"""Config must be loaded prior to calling this."""
Polaris().run()
def load_configurat... | polaris-gslb/polaris-core | polaris_pdns/__init__.py | Python | bsd-3-clause | 1,665 |
from chainer.link_hooks.spectral_normalization import SpectralNormalization # NOQA
from chainer.link_hooks.timer import TimerHook # NOQA
| tkerola/chainer | chainer/link_hooks/__init__.py | Python | mit | 139 |
# Copyright (C) 2010, Red Hat, Inc.
# Written by Darryl L. Pierce
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# ... | taget/node | server/ovirtserver/tests/models/__init__.py | Python | gpl-2.0 | 2,184 |
import sublime, sublime_plugin, webbrowser
try:
from .github import *
except ValueError:
from github import *
class GithubPullsCommand(GithubWindowCommand):
@with_repo
def run(self, repo):
webbrowser.open_new_tab(repo.pulls_url())
| robotwholearned/dotfilesCustom | Sublime Text 2/Packages/Github Tools/github_pulls.py | Python | mit | 257 |
# Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
#
# 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 a... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/ssd/implementations/pytorch/train.py | Python | apache-2.0 | 17,415 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# /usr/bin/net-agent
#
# Copyright 2007-2012 Intel Corporation
# Copyright 2014 Sam Nazarko <email@samnazarko.co.uk>
import gobject
import dbus
import dbus.service
import dbus.mainloop.glib
import sys
class Canceled(dbus.DBusException):
_dbus_error_name = "net.connm... | srmo/osmc | package/mediacenter-addon-osmc/src/script.module.osmcsetting.networking/resources/lib/osmc_wireless_agent.py | Python | gpl-2.0 | 6,555 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/core/fmap_range.py | Python | bsd-3-clause | 10,737 |
from itertools import imap
def indent_text(text, indent):
return reduce(lambda line1,line2: '%s\n%s' % (line1, line2),
imap(lambda line: (' ' * 4 * indent) + line,
text.splitlines())) | levilucio/SyVOLT | util/misc.py | Python | mit | 233 |
import datetime
from django.db import models
from django.contrib.auth.models import User
class Box(models.Model):
label = models.CharField(max_length=100, db_index=True)
content = models.TextField()
created_by = models.ForeignKey(User, related_name="boxes")
last_updated_by = models.Foreign... | paltman/django-boxes | boxes/models.py | Python | bsd-3-clause | 477 |
import sys
import errno
import json
import os
from argparse import ArgumentParser
sys.path.insert(1, 'py-bindings')
from squad import SQUADConverter
def get_samples(test_file, vocab_file, output_dir):
print("Test file:", test_file)
print("Vocab file:", vocab_file)
print("Output dir:", output_dir)
max_s... | mlperf/inference_results_v0.7 | closed/Intel/code/resnet/resnet-ov/py-bindings/convert.py | Python | apache-2.0 | 2,497 |
import numpy as np
import struct
from datetime import datetime
import sys
from os import system
# from IPython import embed
def unpack_bytes(pd0_bytes, data_format_tuples, offset, verbose=False):
data = {}
for fmt in data_format_tuples:
try:
struct_offset = offset+fmt[2]
size =... | USF-COT/trdi_adcp_readers | trdi_adcp_readers/pd0/pd0_parser_sentinelV.py | Python | mit | 21,247 |
from app.views.api import api
from flask import jsonify
@api.route("/export")
def api_export_all():
from views.api.organizations import api_organizations_list
from views.api.timesheets import api_timesheet_list
organizations = api_organizations_list().get_data(as_text=True)
timesheets = api_timeshe... | krrg/gnomon | app/views/api/export.py | Python | apache-2.0 | 453 |
#!/usr/bin/env python3
"""
s2_pi.py
Copyright (c) 2016-2018 Alan Yorinks All right reserved.
Python Banyan is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any la... | MrYsLab/s2-pi | s2_pi/s2_pi.py | Python | agpl-3.0 | 5,512 |
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
from collections import namedtuple
import collections as abc
from funcsigs import signature
from funcsigs im... | huntzhan/magic-constraints | magic_constraints/constraint.py | Python | mit | 9,002 |
from werkzeug.exceptions import BadRequest
import pytest
from funnel.utils import (
abort_null,
extract_twitter_handle,
format_twitter_handle,
make_redirect_url,
mask_email,
split_name,
)
def test_make_redirect_url():
# scenario 1: straight forward splitting
result = make_redirect_ur... | hasgeek/funnel | tests/unit/test_utils.py | Python | agpl-3.0 | 1,800 |
import json
from google.cloud import datastore
# from google.appengine.ext.db import GqlQuery
import cloudstorage
import mypubsub
import utility
class Capitals:
def __init__(self):
self.ds = datastore.Client(project=utility.project_id())
self.kind = "newworld"
def publish_capital(self, ci... | DSankpal/wed-thurs-fri | world.py | Python | mit | 4,567 |
#!/usr/bin/python3
import numpy as np
import cv2
from collections import deque
from obstacle_detector.distance_calculator import spline_dist
from obstacle_detector.perspective import inv_persp_new
from obstacle_detector.perspective import regress_perspecive
from obstacle_detector.depth_mapper import calculate_depth... | Sid1057/obstacle_detector | depth_test.py | Python | mit | 3,465 |
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
# Copyright (c) 2017 Dell Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versio... | wrouesnel/ansible | lib/ansible/modules/network/dellos10/dellos10_command.py | Python | gpl-3.0 | 7,295 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py | Python | mit | 10,707 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | XeCycle/indico | indico/core/signals/core.py | Python | gpl-3.0 | 3,307 |
#!/usr/bin/env python
import argparse
import ConfigParser
import sys
import os
import multiprocessing
import itertools
import copy
import subprocess
from pprint import pprint
from benchmark.benchmarker import Benchmarker
from setup.linux.unbuffered import Unbuffered
from setup.linux import setup_util
from ast import l... | PermeAgility/FrameworkBenchmarks | toolset/run-tests.py | Python | bsd-3-clause | 11,680 |
"""
Author: nathanntg
Dependency: numpy
"""
from trainer import Trainer
from paralleltrainer import ParallelTrainer
__author__ = 'nathanntg'
| nathanntg/lin-train | lintrain/__init__.py | Python | mit | 143 |
# setup_win.py
from distutils.core import setup
import py2exe
options = {"py2exe": {
"compressed": 1,
"optimize": 2,
"bundle_files": 1
}}
setup(windows=["main.py"], options=options, zipfile=None)
| BruceZhang1993/imotion-client | setup_win.py | Python | gpl-3.0 | 212 |
"""
This module contains an interface to the Force Fields available in the
OpenBabel library ( http://openbabel.org/ ).
The OpenBabel Python interface is described in
O'Boyle et al., Chem. Cent. J., 2, 5 (2008), doi:10.1186/1752-153X-2-5
Copyright (C) 2010 Troels Kofoed Jacobsen
Code released under GPLv2 (or later).... | tkjacobsen/obcalc | obcalc/__init__.py | Python | gpl-2.0 | 5,701 |
#!/usr/bin/env python3
import udt
import socket
import time
s = udt.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
s.connect(("localhost", 5555))
print("Sending...")
s.send(b"Hello", 0)
buf = s.recv(1024, 0)
print(repr(buf))
| lilydjwg/udt_py | test_client.py | Python | bsd-3-clause | 227 |
#!/usr/bin/env python3
"""websocket cmd client for wssrv.py example."""
import argparse
import asyncio
import signal
import sys
import aiohttp
async def start_client(loop, url):
name = input('Please enter your name: ')
# input reader
def stdin_callback():
line = sys.stdin.buffer.readline().decod... | arthurdarcet/aiohttp | examples/client_ws.py | Python | apache-2.0 | 2,109 |
########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# 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... | funkyHat/cloudify-gcp-plugin | system_tests/local/__init__.py | Python | apache-2.0 | 3,662 |
from __future__ import unicode_literals, absolute_import
import datetime
import pytest
import mock
from django_dynamic_fixture import G
from django.core.urlresolvers import reverse
from django.test import TestCase
from contacts.tests.factories import UserFactory
from logframe.models import (
Activity,
Indica... | aptivate/alfie | django/website/export/tests/test_export_views.py | Python | agpl-3.0 | 13,939 |
from django.test import TestCase
from django.test.client import Client
from team.models import Metric
class ImportMetricsTest(TestCase):
def test_load_correct_csv(self):
"""
Test the load of a correct formated csv
"""
c = Client()
with open('metrics_example-corrected.csv') as fp:
re... | thinmanj/Demo | team/tests.py | Python | gpl-2.0 | 1,762 |
# Copyright 2014 Google Inc.
# 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 law or agreed to in writing, sof... | google/bocado | src/bocado/output.py | Python | apache-2.0 | 8,583 |
"""CMS apphook for the django-outlets app."""
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from . import menu
class OutletsApphook(CMSApp):
name = _("Outlets Apphook")
urls = ["outlets.urls"]
menus = [menu.OutletsMenu]
... | bitmazk/cmsplugin-django-outlets | cmsplugin_outlets/cms_app.py | Python | mit | 360 |
from distutils.core import setup
import os
import re
from setuptools import find_packages
READMEFILE = "README.md"
VERSIONFILE = os.path.join("pymercury", "__init__.py")
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
def get_version():
verstrline = open(VERSIONFILE, "rt").read()
mo = re.search(VSRE, verstrlin... | akupara/pymercury | setup.py | Python | mit | 1,532 |
import sys
def find_max_crossing_subarray(A, low, mid, high):
left_sum = -sys.maxint
sum = 0
i = mid
max_left = mid
while i >= low:
sum += A[i]
if sum > left_sum:
max_left = i
left_sum = sum
i -= 1
right_sum = -sys.maxint
sum = 0
i = mid + 1
max_right = mid + 1
while i <= high:
sum += A[i]
i... | hexinatgithub/CLRS | Chapter4/maximum-subarray.py | Python | mit | 1,207 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... | dnmellen/pycolorterm | docs/conf.py | Python | bsd-3-clause | 8,430 |
# This file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... | d7415/merlin | Hooks/user/forcepref.py | Python | gpl-2.0 | 6,556 |
"""
WSGI config for Shareabouts Textizen adapter.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
# Import the project app to initialize the settings and view definitions
import app
... | openplans/shareabouts-textizen-adapter | wsgi.py | Python | gpl-3.0 | 566 |
# orm/attributes.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Defines instrumentation for class attributes and their interaction
with instan... | sqlalchemy/sqlalchemy | lib/sqlalchemy/orm/attributes.py | Python | mit | 73,547 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import BasePage
class FirefoxWhatsNew75Page(BasePage):
... | ericawright/bedrock | tests/pages/firefox/whatsnew/whatsnew_75.py | Python | mpl-2.0 | 1,408 |
__author__ = 'Guorong Xu<g1xu@ucsd.edu>'
import re
def parse(hairpin_file, output_file):
print "system is processing " + hairpin_file
filewriter = open(output_file, "w")
with open(hairpin_file, 'r+') as f:
printable = False
lines = f.readlines()
for line in lines:
if ... | ucsd-ccbb/jupyter-genomics | src/awsCluster/miRNASeq/HairpinParser.py | Python | mit | 814 |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 08:18:04 2016
@author: npop
The project holds all the information about the project
And imposes the project structure
Time Data - any time data
Spec Data - this is the fourier data
Stat Data - statistic data
TF Data - transfer functions
Cal Data - the path to the cali... | nss350/magPy | core/project.py | Python | apache-2.0 | 14,763 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011, Martín Raúl Villalba
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the So... | mvillalba/codinghyde.ant | src/codinghyde/ant/tests/driver_tests.py | Python | mit | 3,012 |
#!/usr/bin/env python3
import unittest
from pymatrix import *
a = matrix('''
1 2 4
1 3 6
-1 0 1
''')
b = matrix('''
2 1 3
0 -1 1
1 2 0
''')
c = matrix('''
1
2
3
''')
d = matrix('''
2 0 0
0 2 0
0 0 2
''')
a_transpose = matrix('''
1 1 -1
2 3 0
4 6 1
''')
a_cofactors = matrix('''
3 -7 3
-2 5 -2
0 -2 1
''')
a_inver... | Ismael-VC/pymatrix | test_pymatrix.py | Python | unlicense | 6,411 |
from django import forms
from django.forms import BaseModelFormSet
from django.forms.formsets import DELETION_FIELD_NAME
from django.forms.models import modelformset_factory
from django.template.loader import render_to_string
from django.core.validators import FileExtensionValidator
from ct.models import Course, Unit... | cjlee112/socraticqs2 | mysite/ctms/forms.py | Python | apache-2.0 | 8,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.