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 |
|---|---|---|---|---|---|
# Copyright 2012-2017, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
:class:`~test.task.Task` that can be ran with :func:`~test.task.run_tasks` to initialize our tests. tasks are...
::
Initialization Tasks
|- STEM_VERSION - checks our version of stem
|- TOR_VERSION - checks our... | patrickod/stem | test/task.py | Python | lgpl-3.0 | 9,464 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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 version.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xhtml/UriType.py | Python | gpl-3.0 | 865 |
import os
import LCEngine4 as LCEngine
from PyQt4 import QtGui, QtCore
from Code import Books
from Code import ControlPosicion
from Code import Partida
from Code import DBgames
from Code.QT import Colocacion
from Code.QT import Controles
from Code.QT import Iconos
from Code.QT import QTVarios
from Code.QT import Col... | lukasmonk/lucaschess | Code/QT/POLAnalisis.py | Python | gpl-2.0 | 21,503 |
"""Django module for the OS2datascanner project."""
| os2webscanner/os2webscanner | django-os2webscanner/os2webscanner/__init__.py | Python | mpl-2.0 | 53 |
from nose.tools import ok_, eq_
from crashstats.symbols import utils
from crashstats.base.tests.testbase import TestCase
from .base import (
ZIP_FILE,
TAR_FILE,
TGZ_FILE,
TARGZ_FILE
)
class TestUtils(TestCase):
def test_preview_zip(self):
with open(ZIP_FILE) as f:
result = u... | bsmedberg/socorro | webapp-django/crashstats/symbols/tests/test_utils.py | Python | mpl-2.0 | 1,780 |
#!/bin/env python
# Copyright 2015 Brno University of Technology (author: Karel Vesely)
# Apache 2.0
import sys,operator
# Append Levenshtein alignment of 'hypothesis' and 'reference' into 'CTM':
# (i.e. the output of 'align-text' post-processed by 'wer_per_utt_details.pl')
# The tags in the appended column are:
#... | StevenLOL/aicyber_semeval_2016_ivector | System_2/steps/conf/append_eval_to_ctm.py | Python | gpl-3.0 | 1,989 |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | ShangtongZhang/DeepRL | deep_rl/agent/BaseAgent.py | Python | mit | 5,970 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | ubuntu-core/snapcraft | snapcraft/internal/elf.py | Python | gpl-3.0 | 27,232 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VmFailedToRebootGuestEvent(vim, *args, **kwargs):
'''This event records a failure to ... | xuru/pyvisdk | pyvisdk/do/vm_failed_to_reboot_guest_event.py | Python | mit | 1,202 |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
from sqlalchemy import engine_from_config
import tictactoe.lib.app_globals as app_globals
import tictactoe.lib.helpers
from tictactoe.config.... | Pewpewarrows/reddit-tic-tac-toe | tictactoe/tictactoe/config/environment.py | Python | mit | 1,928 |
'''
This little script can be used to generate an
SQLite3 database from Rachel's GF output.
The script will make a table out from each ascii
output file. The halo_id and gal_id columns of
each table are indexed for faster table joining.
Each index is names as table_id, albeit there
should be no need to know the name ... | sniemi/SamPy | sandbox/bolshoi/sqlite_sams.py | Python | bsd-2-clause | 4,582 |
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# urllibcompat.py - adapters to ease using urllib2 on Py2 and urllib on Py3
#
# Copyright 2017 Google, Inc.
#
# This software may be used and... | facebookexperimental/eden | eden/scm/edenscm/mercurial/urllibcompat.py | Python | gpl-2.0 | 5,254 |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'env',
'recipe_engine/path',
]
| endlessm/chromium-browser | third_party/skia/infra/bots/recipe_modules/git/__init__.py | Python | bsd-3-clause | 209 |
#!/usr/bin/env python3
import logging
import warnings
try:
import httplib
except ImportError:
import http.client
warnings.filterwarnings("ignore")
# Hijack the HTTP lib logger message and Log only once
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.CRITICAL)
reques... | openbmc/openbmc-test-automation | lib/disable_warning_urllib.py | Python | apache-2.0 | 416 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-06 09:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("gallery", "0012_auto_20180619_1106")]
operations = [migrations.RemoveField(model_name="image", name="phash")]
| manti-by/M2-Blog-Engine | manti_by/apps/gallery/migrations/0013_remove_image_phash.py | Python | bsd-3-clause | 286 |
"""Create Celery app instances used for testing."""
from __future__ import absolute_import, unicode_literals
import weakref
from contextlib import contextmanager
from copy import deepcopy
from kombu.utils.imports import symbol_by_name
from celery import Celery, _state
#: Contains the default configuration values fo... | cloudera/hue | desktop/core/ext-py/celery-4.2.1/celery/contrib/testing/app.py | Python | apache-2.0 | 2,906 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
The main test runner script.
Usage: ::
python run_tests.py
Skip slow tests: ::
python run_tests.py fast
'''
from __future__ import unicode_literals
import nose
import sys
from textblob_fr.compat import PY2, PY26
def main():
args = get_argv()
succes... | sloria/textblob-fr | run_tests.py | Python | mit | 1,067 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | xrg/openerp-server | bin/service/web_services.py | Python | agpl-3.0 | 41,970 |
"""
timedflock
==========
`timedflock` module provides a file lock class `TimedFileLock` on Unix-like
platforms which uses `fcntl.flock` at its core and supports timeout.
`TimedFileLock` does not poll the file lock to support timeout. Instead, it
spawns a child process to do `fcntl.flock`. Because of this, the main p... | rkyoto/timedflock | timedflock2.py | Python | apache-2.0 | 5,273 |
'''
Image
=====
The :class:`Image` widget is used to display an image::
wimg = Image(source='mylogo.png')
Asynchronous Loading
--------------------
To load an image asynchronously (for example from an external webserver), use
the :class:`AsyncImage` subclass::
aimg = AsyncImage(source='http://mywebsite.com... | happy56/kivy | kivy/uix/image.py | Python | lgpl-3.0 | 9,715 |
#!/usr/bin/env python
from geophys2netcdf._geophys2netcdf import Geophys2NetCDF
#=========================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitt... | alex-ip/geophys2netcdf | geophys2netcdf/__main__.py | Python | apache-2.0 | 3,071 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
except ImportError:
# Python on Solaris ... | OneBitSoftware/jwtSample | src/Spa/env1/Lib/site-packages/gunicorn/util.py | Python | mit | 12,319 |
__author__ = "Christian Kongsgaard"
__license__ = "MIT"
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import os
import datetime
import time
import shutil
import typing
from mongoengine import Q
# RiBuild Modules:
from del... | thp44/delphin_6_automation | delphin_6_automation/database_interactions/simulation_interactions.py | Python | mit | 9,558 |
def decoded_len(s):
chars = 0
# 0: not in an escape sequence
# 1: just saw a \
# 2: in a hex sequence (just saw \x)
# 3: passed the first of 2 hex chars (just saw \xd for some digit d)
state = 0
for c in s[1:-1]: # assume all strings are quoted
if state == 0 and c == "\\":
... | aarestad/advent-of-code-2015 | 2015/8.py | Python | gpl-3.0 | 1,509 |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. 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 b... | falbassini/googleads-dfa-reporting-samples | python/v2.1/download_floodlight_tag.py | Python | apache-2.0 | 1,952 |
# -*- coding: utf-8 -*-
# Copyright 2017 Stein & Gabelgaard ApS
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models, SUPERUSER_ID, _
import logging
_logger = logging.getLogger(__name__)
class CamposEventParticipant(models.Model):
_inherit = 'campos.event.part... | sl2017/campos | campos_fee/models/campos_event_participant.py | Python | agpl-3.0 | 12,468 |
#
# Configuration/Defaults file for SConscript.
# This is Python file.
# Store frequently used command-line variables in this file rather than
# suppying them to scons at each invocation.
#build_mode = 'rel'
use_plat = 1
| semihc/gsl | SConsCfg.py | Python | gpl-2.0 | 222 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, incl... | aubreyrjones/libesp | scons_local/scons-local-2.3.0/SCons/Options/BoolOption.py | Python | mit | 2,015 |
from __future__ import print_function
import unittest2
from lldbsuite.test.decorators import *
from lldbsuite.test.concurrent_base import ConcurrentEventsBase
from lldbsuite.test.lldbtest import TestBase
@skipIfWindows
class ConcurrentTwoWatchpointsOneDelayBreakpoint(ConcurrentEventsBase):
mydir = ConcurrentEv... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py | Python | apache-2.0 | 846 |
# -*- coding: utf-8 -*-
#
# Eryri documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 14 09:53:41 2014.
#
# 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
# autogenerated file.
#
# All... | nepteam/documentation | docs/source/conf.py | Python | mit | 10,696 |
import os
from setuptools import setup
PACKAGE_VERSION = '0.2.0'
PACKAGE_NAME = 'django-couchdb-cache'
EXAMPLES_TARGET_DIR = 'share/{}/'.format(PACKAGE_NAME)
EXAMPLES_LOCAL_DIR = 'examples'
def get_data_files():
data_files = [(os.path.join(EXAMPLES_TARGET_DIR, root), [os.path.join(root, f) for f in files]) for ... | shuttlecloud/django-couchdb-cache | setup.py | Python | gpl-3.0 | 1,196 |
"""
Django settings for training project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... | aberon10/training | training/training/settings.py | Python | mit | 3,221 |
"""Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: Simplified BSD
import os
from os.path import join, exists
import re
import numpy as np
import scipy as sp
from scipy import io
from shutil import copyfileobj
import urllib2
from .base import get_data_home, Bunch
MLDATA_BASE_... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sklearn/datasets/mldata.py | Python | agpl-3.0 | 6,651 |
from django import template
register = template.Library()
@register.filter
def make_id(name):
return "-".join(name.split())
@register.filter
def block_param_title(dict):
return list(dict.keys())[0].title()
@register.filter
def block_param_id(dict):
return "-".join(list(dict.keys())[0].split())
| OpenSourcePolicyCenter/PolicyBrain | webapp/apps/taxbrain/templatetags/strings.py | Python | mit | 314 |
import pytest
import rpmlint.spellcheck
@pytest.mark.skipif(not rpmlint.spellcheck.ENCHANT, reason='Missing enchant bindings')
def test_spelldict(capsys):
"""
Check we can init dictionary spellchecker
"""
spell = rpmlint.spellcheck.Spellcheck()
spell._init_checker()
out, err = capsys.readouter... | matwey/rpmlint | test/test_spellchecking.py | Python | gpl-2.0 | 2,542 |
import time
print('')
| xNUTs/PTVS | Python/Tests/TestData/DebuggerProject/DebugReplTest5.py | Python | apache-2.0 | 26 |
"""
Tests for middleware for comprehensive themes.
"""
from __future__ import absolute_import
from django.contrib.messages.middleware import MessageMiddleware
from django.contrib.sites.models import Site
from django.test import RequestFactory, TestCase, override_settings
from openedx.core.djangoapps.theming.midd... | ESOedX/edx-platform | openedx/core/djangoapps/theming/tests/test_middleware.py | Python | agpl-3.0 | 3,897 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... | agry/NGECore2 | scripts/mobiles/generic/faction/imperial/imp_corporal_16.py | Python | lgpl-3.0 | 1,426 |
# -*- coding: utf-8 -*-
"""
logbook.base
~~~~~~~~~~~~
Base implementation for logbook.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
try:
import thread
except ImportError:
# for python 3.1,3.2
import _thread ... | Rafiot/logbook | logbook/base.py | Python | bsd-3-clause | 35,527 |
from __future__ import unicode_literals
import datetime
import warnings
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
A... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py | Python | gpl-3.0 | 17,797 |
# Copyright (C) 2014 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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.
#
# This... | mushorg/conpot | conpot/protocols/kamstrup_meter/command_responder.py | Python | gpl-2.0 | 2,610 |
#
# This file defines global variables that will always be
# available in a view context without having to repeatedly
# include it. For this to work, this file is included in
# the settings file, in the TEMPLATE_CONTEXT_PROCESSORS
# tuple.
#
from django.conf import settings
from evennia.utils.utils import get_evennia_... | shollen/evennia | evennia/web/utils/general_context.py | Python | bsd-3-clause | 1,680 |
#!/usr/bin/env python
import os
import sys
def whereis_python():
import json
print('sys.path =', json.dumps(sys.path, indent=4))
print(sys.executable)
if __name__ == "__main__":
#whereis_python() # debug
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maio.settings")
try:
from django... | jonmsawyer/maio | manage.py | Python | mit | 954 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-10 12:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | dhavalmanjaria/dma-student-information-system | study_material/migrations/0003_studymaterial_user.py | Python | gpl-2.0 | 665 |
'''
@author: Victor Barrera
Description: This scripts makes use of the siq module to obtain the methylation value for each CpG island region.
'''
import sys
import pysam
import re
from siq import *
# Obtain the CpG island sequence file,
# the sam-file and the minimum read filter
cpgi_sec_path=sys.argv[1]
sam_path=sys... | vbarrera/thesis | Genomic_Evaluation_of_individual_CpG_Methylation/Python/CpGMethStatus.py | Python | gpl-2.0 | 1,440 |
from __future__ import absolute_import, print_function
from pony.py23compat import PY2, imap, basestring, unicode
import re, os.path, sys, inspect, types, warnings
from datetime import datetime
from itertools import count as _count
from inspect import isfunction
from time import strptime
from collections imp... | Ahmad31/Web_Flask_Cassandra | flask/lib/python2.7/site-packages/pony/utils/utils.py | Python | apache-2.0 | 12,252 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progr... | rhyolight/nupic.core | bindings/py/setup.py | Python | agpl-3.0 | 7,451 |
import unittest, random, sys, time, os
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e
def write_syn_dataset(csvPathname, rowCount, SEED):
# 8 random generatators, 1 per column
r1 = random.Random(SEED)
r2 = random.Random(SEED)
r3 = ... | janezhango/BigDataMachineLearning | py/testdir_multi_jvm_fvec/test_exec2_dkv.py | Python | apache-2.0 | 2,933 |
from hypergan.gans.standard_gan import StandardGAN
from hypergan.gan_component import GANComponent
def gan_factory(*args, **kw_args):
if 'config' in kw_args:
config = kw_args['config']
elif len(args) > 0:
config = args[0]
else:
config = None
if config and 'class' in config:
... | 255BITS/HyperGAN | hypergan/gan.py | Python | mit | 473 |
#!/usr/bin/env python3
"""
Created on 23 Jun 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
(cat /home/pi/SCS/pipes/display_pipe &) | ./display.py -v
"""
import sys
from scs_core.data.datetime import LocalizedDatetime
from scs_core.sync.interval_timer import IntervalTimer
# ---------------------... | south-coast-science/scs_dev | tests/display/display_pipe_test.py | Python | mit | 916 |
# See screenshots here: https://github.com/dmroeder/pylogix/issues/156
# This example allows reading either a single tag or multiple tags separated by semicolon (';').
# Single tag example: CT_2D_DINTArray[0,0] or CT_STRING or CT_BOOLArray[252].
# Multi tag example: CT_DINT; CT_REAL; CT_3D_DINTArray[0,3,1].
# I... | dmroeder/pylogix | examples/81_simple_gui.py | Python | apache-2.0 | 32,706 |
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
warnings.warn("Module `scrapy.contrib.throttle` is deprecated, "
"use `scrapy.extensions.throttle` instead",
ScrapyDeprecationWarning, stacklevel=2)
from scrapy.extensions.throttle import *
| bdh1011/wau | venv/lib/python2.7/site-packages/scrapy/contrib/throttle.py | Python | mit | 290 |
# Copyright 2020 Google LLC. 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 applicable law or a... | tensorflow/cloud | src/python/tensorflow_cloud/core/tests/unit/preprocess_test.py | Python | apache-2.0 | 9,116 |
# -*- test-case-name: twisted.test.test_persisted -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Utility classes for dealing with circular references.
"""
import types
from twisted.python import log, reflect
class NotKnown:
def __init__(self):
self.de... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/persisted/crefutil.py | Python | bsd-3-clause | 4,659 |
# name=Monitoring plots
# displayinmenu=true
# displaytouser=true
# displayinselector=true
from monitoring import plot
import toolbox as tb
from voluptuous import Schema, All, Any, Range, Datetime, Required, Optional, Lower
class PlotTool(tb.Tool):
defaultColours = [
[166, 206, 227],
[ 31, 120, 1... | jprine/monitoring-module | src/monitoring_plots.py | Python | mit | 2,046 |
import tkinter as tk
import tkinter.ttk
# adapted from http://tkinter.unpythonic.net/wiki/VerticalScrolledFrame
class VerticalScrolledFrame(tk.Frame):
"""A pure Tkinter scrollable frame that actually works!
* Use the 'interior' attribute to place widgets inside the scrollable frame
* Construct and p... | JonathanTaquet/Oe2sSLE | VerticalScrolledFrame.py | Python | gpl-2.0 | 2,525 |
import unittest
import time
from datetime import datetime
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission, Follow
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
... | russomi/flasky-appengine | tests/test_user_model.py | Python | mit | 6,921 |
from pywps.app.Service import Service
def make_app(processes=None, cfgfiles=None):
app = Service(processes=processes, cfgfiles=cfgfiles)
return app
| bird-house/PyWPS | pywps/application.py | Python | mit | 158 |
from __future__ import unicode_literals
from django.contrib.auth.models import Permission, User
from django.utils import six
from djblets.avatars.services.gravatar import GravatarService
from djblets.testing.decorators import add_fixtures
from djblets.webapi.testing.decorators import webapi_test_template
from kgb impo... | brennie/reviewboard | reviewboard/webapi/tests/test_user.py | Python | mit | 14,393 |
import os
import re
from setuptools import find_packages, setup
def get_version(package):
"""
Return package version as listed in `__version__` in `version.py`.
"""
init_py = open(os.path.join(package, 'version.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
... | kumar303/docker-utils | setup.py | Python | apache-2.0 | 798 |
# Copyright 2013 IBM Corp.
#
# 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 t... | ntymtsiv/tempest | tempest/api/compute/v3/admin/test_hosts.py | Python | apache-2.0 | 3,304 |
#!/usr/bin/python3
# Copyright 2019 by Jeff Woods
#
# 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 applic... | jcwoods/datagen | datagen/entitygenerator.py | Python | apache-2.0 | 9,231 |
"""
Django settings for drf_bench project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | xordoquy/django-rest-framework-benchmark | drf_bench/settings.py | Python | mit | 2,632 |
# pylint: disable=E1101
import time
import itertools as it
import numpy as np
from bl.core.io import MessageStreamWriter
import bl.core.gt.messages.SnpCall as SnpCall
import bl.vl.utils as vlu
from kb_object_creator import KBObjectCreator
from bl.vl.kb.drivers.omero.proxy_core import convert_from_numpy
from bl.vl.k... | crs4/omero.biobank | test/genotype/common.py | Python | gpl-2.0 | 5,300 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
no_cache = True
def get_context():
from portal.utils import get_transaction_context
context = get_transact... | saurabh6790/test-med-app | selling/doctype/sales_order/templates/pages/order.py | Python | agpl-3.0 | 1,086 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Python -*-
"""
@file WiiRemoteTest.py
@brief Test Component
@date $Date$
"""
import sys
import time
sys.path.append(".")
# Import RTM module
import RTC
import OpenRTM_aist
import os
def cls():
os.system(['clear','cls'][os.name == 'nt'])
# Import Service ... | sugarsweetrobotics/WiiRemoteTest | WiiRemoteTest.py | Python | gpl-3.0 | 8,534 |
#!/usr/bin/env python3
import argparse
import sys
import numpy as np
#from translate.evaluation import corpus_bleu, corpus_ter
parser = argparse.ArgumentParser()
# parser.add_argument('source1')
# parser.add_argument('source2')
# parser.add_argument('target')
#
# parser.add_argument('--bleu', action='store_true')
# p... | eske/seq2seq | scripts/post_editing/to-sgm.py | Python | apache-2.0 | 1,133 |
"""Unit test for trace websocket API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import jsonschema
import mock
from treadmill.trace.app import events
from treadmill.websocket.api import trac... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/websocket/api/trace_test.py | Python | apache-2.0 | 3,800 |
import time
import uuid
from datetime import timedelta
from golem.core.keysauth import EllipticalKeysAuth
from mock import Mock, patch
from golem.core.common import get_current_time, timeout_to_deadline
from golem.network.p2p.node import Node
from golem.task.taskbase import Task, TaskHeader, ComputeTaskDef, TaskEvent... | imapp-pl/golem | tests/golem/task/test_taskmanager.py | Python | gpl-3.0 | 24,910 |
# This is a copy of the Python logging.config.dictconfig module,
# reproduced with permission. It is provided here for backwards
# compatibility for Python versions prior to 2.7.
#
# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# docu... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/utils/dictconfig.py | Python | bsd-3-clause | 22,939 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | fengbeihong/tempest_automate_ironic | tempest/manager.py | Python | apache-2.0 | 2,949 |
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.conf import settings
def my_render(request, template, context={}):
context.update(csrf(request))
context['STATIC_URL'] = settings.STATIC_URL
context['flash'] = request.get_flash()
context['user'... | MERegistro/meregistro | meregistro/shortcuts.py | Python | bsd-3-clause | 533 |
def hash_index_terms(filepath):
index_terms = {}
with open(filepath) as index_dict:
while True:
pos = index_dict.tell()
try:
term, docs = index_dict.readline().split(' ')
except ValueError: # nothing left to split: EOF
break
... | moritzschaefer/the-search-engine | tsg/ranker/hasher.py | Python | mit | 453 |
# -*- coding: utf-8 -*-
# MouseTrap
#
# Copyright 2009 Flavio Percoco Premoli
#
# This file is part of mouseTrap.
#
# MouseTrap is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License v2 as published
# by the Free Software Foundation.
#
# mouseTrap is distributed ... | lhotchkiss/mousetrap | src/mousetrap/app/main.py | Python | gpl-2.0 | 7,724 |
# Copyright 2016 The TensorFlow Authors. 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 applicable ... | fisheess/modular_SSD_tensorflow | nets/vgg.py | Python | mit | 17,014 |
# Copyright 2019 The TensorFlow Authors. 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 applica... | karllessard/tensorflow | tensorflow/python/keras/distribute/custom_training_loop_optimizer_test.py | Python | apache-2.0 | 4,404 |
#!/usr/bin/env python
#
# SessionStorage.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... | buffer/thug | thug/DOM/SessionStorage.py | Python | gpl-2.0 | 756 |
"""Physical constants."""
import numpy as np
k_B = 1.380649e-16
"""Exact value of the Boltzmann constant in cgs units."""
h = 6.62607015e-27
"""Exact value of Planck's constant in cgs units."""
c_light = 2.99792458e10
"""Exact value of the speed of light in cgs units."""
sigma_SB = 2.*np.pi**5*k_B**4/(15.*h**3*c_li... | warrickball/tomso | tomso/constants.py | Python | mit | 1,473 |
# -*- coding: utf-8 -*-
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 'GeoSemanticsSpecification.geocode_address'
db.add_column('semanticizer_geosemanticsspecifica... | citizennerd/VivaCity | semanticizer/migrations/0005_auto__add_field_geosemanticsspecification_geocode_address.py | Python | mit | 6,563 |
import distutils.sysconfig
import getopt
import glob
import os
import platform
import shutil
import subprocess
import stat
import sys
sys.path.append(os.path.join("..", "ScintillaEdit"))
import WidgetGen
scintillaDirectory = "../.."
scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts")... | dmpas/e8-scintilla-patch | qt/ScintillaEditPy/sepbuild.py | Python | lgpl-3.0 | 11,490 |
from openerp import api, models, fields, SUPERUSER_ID
class product_template(models.Model):
_name = 'product.template'
_inherit = ['product.template', 'website_seo_url']
seo_url = fields.Char('SEO URL', translate=True, index=True)
| bmya/website-addons | website_seo_url_product/models.py | Python | lgpl-3.0 | 246 |
from __future__ import absolute_import
"""Midi processing for segmented midi taggers.
"""
"""
============================== License ========================================
Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding
This file is part of The Jazz Parser.
The Jazz Parser is free s... | markgw/jazzparser | src/jazzparser/taggers/segmidi/midi.py | Python | gpl-3.0 | 3,221 |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'queue_overview_form.ui'
##
## Created by: Qt User Interface Compiler version 5.15.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
######... | hasielhassan/AgnosticQueue | python/ui/queue_overview_form.py | Python | mit | 2,703 |
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from rest_framework import routers
from . import views
from linky import settings
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'links', views.LinkViewSet, base_name='links')
... | sbdchd/linky | backend/core/urls.py | Python | bsd-2-clause | 647 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 So... | Alignak-monitoring-contrib/alignak-module-nsca | test/alignak_test.py | Python | agpl-3.0 | 77,995 |
"""Argument definitions for model training code in `trainer.model`."""
import argparse
from trainer import model
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--batch_size",
help="Batch size for training steps",
type=int,
default=32,
)... | GoogleCloudPlatform/asl-ml-immersion | notebooks/building_production_ml_systems/solutions/taxifare/trainer/task.py | Python | apache-2.0 | 1,800 |
from data import *
# white
pvals = {
PAWN: 100,\
BISHOP: 300,\
KNIGHT: 300,\
ROOK: 500,\
QUEEN: 900,\
-PAWN: -100,\
-BISHOP: -300,\
-KNIGHT: -300,\
-ROOK: -500,\
-QUEEN: -900,\
KING: 10000,\
-KING: -10000,\
EMPTY: 0,\
}
def value(state):
return state.som * su... | edrex/minichess | minichess/eval.py | Python | gpl-2.0 | 605 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
from gevent.pywsgi import WSGIServer
import re
from urllib import unquote
import logging
static_setting = {
'templates': r'templates'
}
from HTTPerror import HTTP404Error, HTTP403Error, HTTP502Error, HTTP302Error
clas... | salamer/jolla | jolla/server.py | Python | apache-2.0 | 8,875 |
from django.test import TestCase
# Create your tests here.
from django.test import TestCase
from django.utils import timezone
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from principal.models import Proyecto
from principal.models import Rol
from principal.models import Permiso
f... | SantiagoValdez/hpm | src/hpm/app_proyecto/tests.py | Python | gpl-2.0 | 2,905 |
#
# Copyright (C) 2015 Prevas A/S
#
# This file is part of dctrl, an embedded device control framework
#
# dctrl is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at... | DeviceTestFramework/dctrl | dctrl/expect/serpexpect.py | Python | gpl-2.0 | 3,807 |
#!/usr/bin/python
# This script reads through a enotype likelihood file and the respective mean genotype likelihood file. It writes a nexus file for all individuals and the given genotypesi, with '0' for ref homozygote, '1' for heterozygote, and '2' for alt homozygote.
# Usage: ~/vcf2nex012.py pubRetStriUG_unlnkd.gl ... | schimar/hts_tools | vcf2nex012.py | Python | gpl-2.0 | 1,837 |
# -*- coding: utf-8 -*-
# Copyright 2016 Open Net Sàrl
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_import
| CompassionCH/l10n-switzerland | l10n_ch_import_cresus/tests/__init__.py | Python | agpl-3.0 | 147 |
from unittest import TestCase
import warnings
from pyml import *
class FullPageTests(TestCase):
def test_full_page(self):
"""Should be able to render a complex page."""
output = html(lang='en')(
head(
title('Test Page'),
),
body(
... | tsmall/pyml | pyml/test/test_elements.py | Python | gpl-3.0 | 3,842 |
from tornado.ioloop import IOLoop
from tornado.tcpserver import TCPServer
class StreamHandler:
def __init__(self, stream):
self._stream = stream
stream.set_nodelay(True)
self._stream.read_until(b'\n', self._handle_read)
def _handle_read(self, data):
self._stream.write(data)
... | MagicStack/vmbench | servers/torecho_readline.py | Python | mit | 641 |
# -*- coding: utf-8 -*-
#
# Copyright © 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should h... | beav/katello | cli/src/katello/client/api/environment.py | Python | gpl-2.0 | 2,564 |
#!/usr/bin/env python
import argparse
import jinja2
import logging
import os
import sys
import traceback
LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFo... | tendrilinc/marathon-autoscaler | scripts/render_template.py | Python | apache-2.0 | 2,090 |
import inspect
from contextlib import contextmanager
from itertools import chain
from django.conf import settings
from django.utils.decorators import method_decorator
from django.utils.termcolors import colorize
from sekizai.helpers import validate_template
from cms import constants
from cms.models import AliasPlugin... | rsalmaso/django-cms | cms/utils/check.py | Python | bsd-3-clause | 17,000 |
# Conjuntos
# Conjuntos dos numeros naturais
def naturais_sem_zero():
n = 1
print("Conjuntos do N*(Naturais sem Zero)")
while(n < 15):
print(n)
n = n + 1
#--------------------------------------------
# Conjuntos dos numeros naturais
def naturais_com_zero():
n = 0
print("Conjuntos do N(Naturais com Zer... | joaopaulojpsp/python_matematica | Conjuntos/naturaiz.py | Python | apache-2.0 | 528 |
"""
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: "PAHNAPLSIIGYIR"
Write the code that will take a string and make this conver... | yingcuhk/LeetCode | Algorithms/#6 ZigZag Conversion/PythonCode.py | Python | mit | 1,350 |
# from scrapy.spider import Spider
# from scrapy.selector import Selector
# from scrapy_laserprinter_usage_page.items import ScrapyLaserprinterUsagePageItem
# # update time
# import datetime
# # operate Mysql
# import MySQLdb
# import MySQLdb.cursors
# # two tables
# # displayer_cartridgerecord
# # displaye... | voostar/hp_laserprinter_monitor | background/scrapy_laserprinter_usage_page/scrapy_laserprinter_usage_page/spiders/P4015_maintainkit.py | Python | unlicense | 2,405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.