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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/mentionmemory/modules/mention_losses.py | Python | apache-2.0 | 29,195 |
from .db_utils import PostgresController
from .enums import Action, Change
__all__ = ['PostgresController', 'Action', 'Change']
| dashwav/nano-chan | cogs/utils/__init__.py | Python | mit | 129 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests.utils.test_scanner import TestScanner
class PackageTestLoader(object):
def load_tests_from_package(self, package, parent=__impor... | apdjustino/DRCOG_Urbansim | src/opus_core/tests/utils/package_test_loader.py | Python | agpl-3.0 | 1,581 |
import inspect
# First import the embed function
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.config.loader import Config
# Configure the prompt so that I know I am in a nested (embedded) shell
cfg = Config()
prompt_config = cfg.PromptManager
prompt_config.in_template = 'N.In <\\#>: '
prompt_... | Sylvain303/libido | python/test/embed_ipython.py | Python | gpl-3.0 | 1,140 |
import copy
import re
import astropy.io.fits as fits
import numpy as np
from threeML.exceptions.custom_exceptions import custom_warnings
from threeML.io.file_utils import file_existing_and_readable
from threeML.io.progress_bar import progress_bar
from threeML.plugins.DispersionSpectrumLike import DispersionSpectrumLi... | giacomov/3ML | threeML/utils/data_builders/time_series_builder.py | Python | bsd-3-clause | 44,553 |
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: Fergus Noble <fergus@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITH... | mookerji/libsbp | python/sbp/acquisition.py | Python | lgpl-3.0 | 6,252 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lesson4.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| g10k/sw_lessons | lesson4/manage.py | Python | bsd-3-clause | 250 |
from django.conf import settings
from rest_framework import serializers
from kuma.core.urlresolvers import reverse
class SearchQueryField(serializers.ReadOnlyField):
"""
Field that returns the search query of the current request.
"""
def __init__(self, *args, **kwargs):
kwargs["source"] = "*... | Elchi3/kuma | kuma/search/fields.py | Python | mpl-2.0 | 1,365 |
# -*- coding: utf-8 -*-
"""
ORCA Open Remote Control Application
Copyright (C) 2013-2020 Carsten Thielepape
Please contact me by : http://www.orca-remote.org/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publi... | thica/ORCA-Remote | src/ORCA/utils/Platform/generic/generic_GetUserDataPath.py | Python | gpl-3.0 | 1,056 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Gael Varoquaux <gael.varoquaux@inria.fr>
#
# License: BSD 3 clause
import sys
import warnings
from abc import ABCMeta, abstractmethod
import n... | pratapvardhan/scikit-learn | sklearn/linear_model/coordinate_descent.py | Python | bsd-3-clause | 81,092 |
import sys
if __name__ == '__main__':
print(sys.version)
sys.stdout.flush()
| gr3gdev/node-python-opencv | python/version.py | Python | mit | 85 |
# Copyright (c) 2017 Presslabs SRL
#
# 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 writ... | PressLabs/silver | silver/api/exceptions.py | Python | apache-2.0 | 935 |
# BEGIN_COPYRIGHT
# END_COPYRIGHT
import sys, os, csv
from random import choice, uniform
from bl.core.io import MessageStreamWriter
from bl.vl.kb import KnowledgeBase
PAYLOAD_TYPE = "core.gt.messages.SampleSnpCall"
MAP_FILE = "ssc_map.tsv"
def get_ome_env():
ome_env = {}
for var in 'OME_HOST', 'OME_USER', 'OME... | crs4/omero.biobank | test/tools/importer/make_ssc.py | Python | gpl-2.0 | 2,496 |
# -*- coding: utf-8 -*-
"""
Example DU task for ABP Table
Copyright Naver Labs Europe(C) 2018 H. Déjean
Developed for the EU project READ. The READ project has received funding
from the European Union's Horizon 2020 research and innovation programme
under grant agreement No 6749... | Transkribus/TranskribusDU | TranskribusDU/tasks/TablePrototypes/DU_ABPTableRC.py | Python | bsd-3-clause | 10,711 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('user_management', '0006_auto_20150122_1334'),
]
operations = [
migrations.RenameField(
model_name='profileaddres... | easy-as-pie-labs/tweap | tweap/user_management/migrations/0007_auto_20150122_1532.py | Python | gpl-3.0 | 412 |
import sys, os
def timeSplit( ETR ):
h = int(ETR/3600)
m = int(ETR - 3600*h)/60
s = int(ETR - 3600*h - 60*m)
return h, m, s
def printProgress( current, total, deltaIter, deltaTime ):
terminalString = "\rProgress: "
if total==0: total+=1
percent = 100.*current/total
nDots = int(percent/5)
dotsStri... | bvillasen/phyGPU | tools/tools.py | Python | gpl-3.0 | 1,660 |
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
pin = 17
first = 1
gap = 1
second = 1
# F Letter
firstCount = 7
secondCount = 8
firstSleepTimeOn = 0.02
firstSleepTimeOff = 0.04
secondSleepTimeOn = 0.04
secondSleepTimeOff = 0.06
gapSleepTime = 0.2
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin,GPIO.OUT)
... | larssima/AmiJukeBoxRemote | AmiJukeBoxRemote/gui/RaspberryPi/f8.py | Python | mit | 780 |
# Copyright 2014 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.
import imp
import os.path
import sys
def _GetDirAbove(dirname):
"""Returns the directory "above" this file containing |dirname| (which must
also be "abo... | 7kbird/chrome | mojo/public/tools/bindings/pylib/mojom/parse/lexer.py | Python | bsd-3-clause | 6,089 |
'''
@author: xiaowing
@license: Apache Lincese 2.0
'''
import requests, urllib.parse
class Executor():
PING_API_PATH = "api/v1.0/ping"
VALIDATE_API_PATH = "api/v1.0/validation"
SSO_PAGE_PATH = "sso"
NEGO_TOKEN = "TSWC"
def __init__(self, ssosv_url, ssocl_returnurl):
if... | xiaowing/tinysso | sdk/python/tinyssosdk/tinyssocl.py | Python | apache-2.0 | 3,003 |
# Copyright (C) 2013 - 2016 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
import os
from collections import defaultdict
from anaconda_go.lib import go, cache
from anaconda_go.lib.plugin import typing
from anaconda_go.lib.panels import ExplorerPanel
from ana... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/anaconda_go/commands/explore.py | Python | mit | 12,890 |
"""FRR Fleetspeak server
Receives messages from a client, prints them and forwards them to master server
"""
import logging
import time
import grpc
from absl import app
from absl import flags
from fleetspeak.server_connector.connector import InsecureGRPCServiceClient
from fleetspeak.src.inttesting.frr.proto.fleetsp... | google/fleetspeak | frr_python/frr_server.py | Python | apache-2.0 | 1,893 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import random
import copy
from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
from h2o.grid.grid_search import H2OGridSearch
def grid_cars_NB():
cars = h2o.import_file(path=pyunit_ut... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/naivebayes/pyunit_grid_carsNB.py | Python | apache-2.0 | 4,260 |
# coding: utf-8
from django import forms
from tinymce.widgets import TinyMCE
from pmsal.event.models import Calendar
class CalendarModelForm(forms.ModelForm):
body = forms.CharField(widget=TinyMCE(
attrs={'cols': 100, 'rows': 50}))
class Meta:
model = Calendar
| klebercode/pmsal | pmsal/blog/forms.py | Python | mit | 308 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Verifies that GRD resource files define all the strings used by a given
set of source files. For file formats where it is not po... | Philippe12/external_chromium_org | remoting/tools/verify_resources.py | Python | bsd-3-clause | 5,148 |
"""
This is the Django template system.
How it works:
The Lexer.tokenize() function converts a template string (i.e., a string containing
markup with custom template tags) to tokens, which can be either plain text
(TOKEN_TEXT), variables (TOKEN_VAR) or block statements (TOKEN_BLOCK).
The Parser() class takes a list ... | BlindHunter/django | django/template/base.py | Python | bsd-3-clause | 39,574 |
# Copyright (c) 2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and t... | google/deepconsensus | deepconsensus/utils/dc_constants.py | Python | bsd-3-clause | 3,351 |
"""
Django settings for khclass project.
Generated by 'django-admin startproject' using Django 1.11.5.
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 os... | shsdev/khclass | khclass/settings.py | Python | gpl-3.0 | 3,732 |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import redirect
from django.db.models import Q
from django.core import serializers
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
import urllib2
... | TeamUACS1/410Project | main/serverViews.py | Python | apache-2.0 | 14,034 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlTestFatal(PerlPackage):
"""Incredibly simple helpers for testing code with exceptions"... | iulian787/spack | var/spack/repos/builtin/packages/perl-test-fatal/package.py | Python | lgpl-2.1 | 648 |
# Copyright 2015 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.
import re
from telemetry.story import shared_state as shared_state_module
_next_story_id = 0
class Story(object):
"""A class styled on unittest.TestCas... | sahiljain/catapult | telemetry/telemetry/story/story.py | Python | bsd-3-clause | 4,429 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import get_object_or_404, redirect, render, reverse
from django.core.urlresolvers import reverse_lazy
from django.forms import modelformset_factory
from giap.forms import formcentral, formcooperativa, formpa, formcliente, formtran... | dalraf/iap | giap/views.py | Python | gpl-3.0 | 17,385 |
"""Selectors module.
This module allows high-level and efficient I/O multiplexing, built upon the
`select` module primitives.
The following code adapted from trollius.selectors.
"""
from abc import ABCMeta, abstractmethod
from collections import namedtuple, Mapping
import math
import select
import sys
from gunicor... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/gunicorn/selectors.py | Python | mit | 18,997 |
# These are all from IS-GPS-200G unless otherwise noted
# Some fundamental constants have specific numeric definitions to ensure
# consistent results in curve fits:
c = 2.99792458e8 # m/s
pi = 3.1415926535898
# Physical parameters of the Earth
earth_gm = 3.986005e14 # m^3/s^2 (WGS84 earth's gravitational constant)
om... | StefanD986/peregrine | peregrine/gps_constants.py | Python | gpl-3.0 | 611 |
# mailstat.metric
# A versatile module for creating metrics for reports
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sun Dec 29 22:59:37 2013 -0600
#
# Copyright (C) 2013 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
"""
A versatile module... | bbengfort/email-analysis | mailstat/metric/__init__.py | Python | mit | 586 |
#from numpy import np.dot, arange, abs
#from numpy.linalg import lstsq
import numpy as np
import random
def computeErrorAndCount(A,b,x,group,tol):
error = np.abs(b - np.dot(A,x))
tot_error = 0.0
count = 0
inliers = np.zeros(b.shape,dtype=np.bool)
for j in range(0,len(error),group):
e = 0
... | hitdong/pyvision | src/pyvision/vector/RANSAC.py | Python | bsd-3-clause | 6,867 |
"""
Tests BLAS functions. Since it supports C as well as Fortran
matrix, that leads to various combinations of matrices to test.
"""
from __future__ import print_function
from unittest import TestCase, skipIf
import numpy as np
from numpy.testing import run_module_suite, assert_allclose
from pkg_resources import parse... | ContinuumIO/gulinalg | gulinalg/tests/test_gufunc_general.py | Python | bsd-2-clause | 21,058 |
import matplotlib.pyplot as plt
import numpy as np
import time
import datetime
import math
from influxdb.influxdb08 import InfluxDBClient
time_min = '2017-03-25 3:10:00'
time_max = '2017-03-25 4:10:00'
time_range = 'time >\'' + time_min + '\' AND time < \'' + time_max + '\' '
time_grouped = '5s'
def query(_field):
... | cloudcomputinghust/IoT | test-component/draw_graph_3.py | Python | mit | 2,380 |
"""
:Author: Juti Noppornpitak
This package contains decorators for common use.
"""
import inspect
from tori.exception import *
class BaseDecoratorForCallableObject(object):
"""
Base decorator based from an example at http://www.artima.com/weblogs/viewpost.jsp?thread=240808.
"""
def __init__(self, ... | shiroyuki/Tori | tori/decorator/common.py | Python | mit | 5,178 |
##
# Copyright 2014-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | wpoely86/easybuild-framework | easybuild/toolchains/mpi/craympich.py | Python | gpl-2.0 | 3,478 |
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
... | adrianp/django-tutorial | django-polls/polls/models.py | Python | unlicense | 954 |
#!/usr/bin/python
#
# Copyright 2011 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 requir... | mashery/io-wraps | google-apis-client-generator/src/googleapis/codegen/template_helpers.py | Python | mit | 30,278 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
try:
use_license_code_nd = orm.UseLicense.objects.get(license_code='nd')
... | jamilatta/scielo-manager | scielomanager/journalmanager/migrations/0049_normalizacao_de_codigos_de_use_license.py | Python | bsd-2-clause | 31,266 |
#
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2012 Red Hat, 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
#
# Unle... | ityaptin/ceilometer | ceilometer/compute/pollsters/cpu.py | Python | apache-2.0 | 6,258 |
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('./cs231n/datasets/MNIST_data', one_hot=False)
# show a batch
show_images(mnist.train.next_batch(16)[0])
| ThyrixYang/LearningNotes | MOOC/stanford_cnn_cs231n/assignment3(without_extra)/cs231n/tmp.py | Python | gpl-3.0 | 199 |
import sys
sys.path.insert(1, "../../../")
import h2o
def demo_prostateGBM(ip,port):
# Connect to a pre-existing cluster
h2o.init(ip,port)
# execute ipython notebook
h2o.ipy_notebook_exec(h2o.locate("h2o-py/demos/prostate_gbm.ipynb"),save_and_norun=False)
if __name__ == "__main__":
h2o.run_test(s... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_demos/notebooks/pyunit_prostate_gbm.py | Python | apache-2.0 | 347 |
from django.http import HttpResponse
from django.http import JsonResponse
from django.template import loader
import generated_proto.proto_io as proto_io
import generated_proto.messages_pb2 as messages_pb2
import os
from ioant.proto import proto
from ioant.utils import utils
import paho.mqtt.client as mqtt
proto_opti... | ioants/ioant | tools/prango/protoselector/views.py | Python | mit | 5,372 |
'''Author Lolmattylol
Creation date 08/09/2017
Verion No 1.01
Contact info reddit:lolmattylol
if you modify this for the better, please consider sharing with the community over at reddit.com/r/prisonarchitect
Version No Date of Change Author Change
1.00 08/09/2017 ... | lolmattylol/DeathRowPrison | DeathRow.py | Python | mit | 2,202 |
#
# Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any late... | levelrf/level_basestation | gr-digital/python/pkt.py | Python | gpl-3.0 | 6,472 |
#!/usr/bin/pypy
import cProfile
import time
import json
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)-15s %(levelname)s %(filename)s:%(funcName)s:%(lineno)s %(message)s')
import datalogger
from datalogger import DataLogger as DataLogger
from datalogger import QuantillesArray as QuantillesArr... | gunny26/datalogger | development/test_quantilles_web.py | Python | apache-2.0 | 876 |
import os.path
from coalib.bears.LocalBear import LocalBear
from coalib.results.Diff import Diff
from coalib.results.Result import Result
from coalib.bearlib.naming_conventions import (
to_camelcase, to_pascalcase, to_snakecase, to_spacecase)
class FilenameBear(LocalBear):
LANGUAGES = {'All'}
AUTHORS = {... | sounak98/coala-bears | bears/general/FilenameBear.py | Python | agpl-3.0 | 2,186 |
#!/usr/bin/python
import sys, libxml2
libxml2.debugMemory(True)
expect="""--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
--> Invalid expression
"""
err=""
def... | vrtadmin/clamav-devel | win32/3rdparty/libxml2/python/tests/xpathleak.py | Python | gpl-2.0 | 1,203 |
# Copyright (c) 2013 Mirantis 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 writ... | esikachev/scenario | sahara/service/heat/heat_engine.py | Python | apache-2.0 | 9,066 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init,invalid-name
"""
Thi... | mganeva/mantid | Framework/PythonInterface/plugins/functions/Examples/Example1DFunction.py | Python | gpl-3.0 | 2,739 |
# Find the contiguous subarray within an array (containing at least one number) which has the largest product.
# For example, given the array [2,3,-2,4],
# the contiguous subarray [2,3] has the largest product = 6.
class Solution(object):
def maxProduct(self, nums):
"""
:type nums: List[int]
... | youhusky/Facebook_Prepare | Wepay and OfferUp/152. Maximum Product Subarray.py | Python | mit | 762 |
""" XFW Library (c) www.modxvm.com 2013-2015 """
#############################
# Command
def getDossier(args):
return _dossier.getDossier(args)
def requestDossier(args):
_dossier.requestDossier(args)
#############################
# Private
from pprint import pprint
import traceback
from adisp import proc... | Satariall/xvm-test | src/xpm/xvm_main/dossier.py | Python | gpl-3.0 | 8,453 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 ... | rmyers/trove-dashboard | setup.py | Python | apache-2.0 | 673 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Marcelo Jorge Vieira <metal@alucinados.com>
#
# This program 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
# License, or (at... | scorphus/politicos | tests/unit/models/test_political_party.py | Python | agpl-3.0 | 3,246 |
# coding=utf-8
# __author__='wujide'
import httplib
import json
httpClient = None
try:
httpClient = httplib.HTTPConnection('www.baidu.com', 80, timeout=30) # 注意,此处域名不要带http://
headers = {'Accept': 'application/xml', 'cookie': 'BAIDUID=A49722ED1DEB8291B5CF5DDC3B7A6053:FG=1'} # 如果有headers的话就带上。没有则不用
httpC... | wujide/awesome-python-webapp | demo/httplib_test.py | Python | gpl-2.0 | 668 |
# Copyright 2017 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, softwa... | google/vulkan_test_applications | gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py | Python | apache-2.0 | 1,043 |
# Copyright: (c) 2018, Pluribus Networks
# 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
import json
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn... | Jorge-Rodriguez/ansible | test/units/modules/network/netvisor/test_pn_user.py | Python | gpl-3.0 | 3,099 |
#
# Copyright 2021 GoPro Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 ... | gopro/gopro-lib-node.gl | tests/filter.py | Python | apache-2.0 | 4,601 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1.1, s, q"
tags = "CallFunc, visible"
import cocos
from cocos.director import director
from cocos.actions import CallFunc, Delay
from cocos... | eevee/cocos2d-mirror | test/test_callfunc.py | Python | bsd-3-clause | 1,086 |
from os import urandom
def genkey(length):
"""Generate key"""
return urandom(length)
def xor_strings(s, t):
"""xor two strings together"""
return "".join(chr(ord(a) ^ ord(b)) for a, b in zip(s, t))
message = 'This is a secret message'
print 'message:', message
key = genkey(len(message))
print 'k... | nbari/my-sandbox | python/xor/xor_chiper.py | Python | bsd-3-clause | 569 |
#!/usr/bin/env python
# SerialGrabber reads data from a serial port and processes it with the
# configured processor.
# Copyright (C) 2012 NigelB
#
# 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 Foundatio... | nigelb/SerialGrabber | examples/ThingSpeak/ThingSpeakTransformer.py | Python | gpl-2.0 | 2,101 |
from colorsys import rgb_to_hsv
import time
def id_generator():
timestr = time.strftime("%Y%m%d-%H%M%S")
return timestr
def lightness(pixel):
# For backwards compatibility with python2
return rgb_to_hsv(pixel[0], pixel[1], pixel[2])[2] / 255.0
def hue(pixel):
return rgb_to_hsv(pixel[0], pixel[... | satyarth/pixelsort | pixelsort/util.py | Python | mit | 1,262 |
from unittest import TestCase
from app.config import Config
__author__ = 'cenk'
class ConfigTest(TestCase):
def setUp(self):
self.path = "sample.json"
def test_conf_read(self):
config = Config(self.path)
config.load_config_from_json()
config.parse()
spark_master = ... | egemsoft/cassandra-spark-rollup | cronjob/tests/test_config.py | Python | mit | 373 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from django.db import migrations, models
def populate_partner_users(apps, schema_editor):
User = apps.get_model("auth", "User")
for user in User.objects.exclude(profile__partner=None):
partner = user.profile.partner
... | praekelt/casepro | casepro/cases/migrations/0041_populate_partner_users.py | Python | bsd-3-clause | 731 |
"""
This file contains (or should), all access control logic for the courseware.
Ideally, it will be the only place that needs to know about any special settings
like DISABLE_START_DATES.
Note: The access control logic in this file does NOT check for enrollment in
a course. It is expected that higher layers check f... | B-MOOC/edx-platform | lms/djangoapps/courseware/access.py | Python | agpl-3.0 | 26,189 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'CreditProvider.fulfillment_instructions'
db.add_column('c... | xingyepei/edx-platform | openedx/core/djangoapps/credit/migrations/0014_auto__add_field_creditprovider_fulfillment_instructions.py | Python | agpl-3.0 | 12,629 |
# -*- coding: utf-8 -*-
# Module: Navigation
# Author: asciidisco
# Created on: 11.10.2017
# License: MIT https://goo.gl/5bMj3H
"""Tests for the `Navigation` module"""
import unittest
import mock
from resources.lib.Navigation import Navigation
class NavigationTestCase(unittest.TestCase):
pass
| asciidisco/plugin.video.netflix | resources/test/test_Navigation.py | Python | mit | 301 |
#==================================
#Author Bjorn Burr Nyberg
#University of Bergen
#Contact bjorn.nyberg@uni.no
#Copyright 2013
#==================================
'''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 Sof... | BJEBN/Geometric-Analysis | Scripts/Old Scripts/Extract_Non_Duplicate_Nodes.py | Python | gpl-3.0 | 2,434 |
from optparse import make_option
import itertools
import traceback
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.core.management.sql import custom_sql_for_model, emit_p... | edisonlz/fruit | web_project/base/site-packages/django/core/management/commands/syncdb.py | Python | apache-2.0 | 8,418 |
import _plotly_utils.basevalidators
class OpacityValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="opacity", parent_name="splom.marker", **kwargs):
super(OpacityValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/splom/marker/_opacity.py | Python | mit | 575 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import unicode_literals
from pprint import pformat
from marrow.server.http import HTTPServer
from marrow.wsgi.objects.decorator import wsgify
@wsgify
def hello(request):
resp = request.response
resp.mime = "text/plain"
resp.body = "%r\n\n%s\n\n%s"... | marrow/wsgi.objects | examples/wsgify.py | Python | mit | 521 |
from __future__ import unicode_literals
from django.test import TestCase
from django.utils.six import text_type
from django.utils.translation import override as override_language
from oidc_provider.lib.claims import ScopeClaims, StandardScopeClaims, STANDARD_CLAIMS
from oidc_provider.tests.app.utils import create_fak... | ByteInternet/django-oidc-provider | oidc_provider/tests/cases/test_claims.py | Python | mit | 2,911 |
import flask
def create_app(**config):
from zechat import models
from zechat import node
from zechat import backend
from zechat import common
app = flask.Flask(__name__)
app.config.update(common.DEFAULTS)
app.config.update(config)
app.config.from_pyfile('../settings.py', silent=False)
... | mgax/zechat | zechat/app.py | Python | mit | 711 |
import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
module_uri = "/isam/felb/configuration/logging"
requires_modules = None
requires_versions = None
requires_model = "Appliance"
def get(isamAppliance):
"""
Retrieving logging configuration attributes
"""
return... | IBM-Security/ibmsecurity | ibmsecurity/isam/base/network/felb/attributes/log.py | Python | apache-2.0 | 2,157 |
import time
import json
import warnings
from random import random
from tqdm import tqdm
from random import random
from ..api.request import Request
from ..getter import Getter
from ..user import UserController, User
class Sender(object):
def __init__(self, username, password=None):
self.get = Getter()
... | instagrambot/instapro | instabot/sender/sender.py | Python | apache-2.0 | 5,665 |
# Implementation of the SAX -- Symbolic Aggregate approXimation
#
#
import numpy as np
import string
class SAX(object):
_normal_cutoffs = {
2: [0],
3: [-0.43, 0.43],
4: [-0.67, 0, 0.67],
5: [-0.84, -0.25, 0.25, 0.84],
... | tarmstro/mvbop | utils/sax.py | Python | mit | 4,975 |
# -*- coding: utf-8 -*-
import glob as glob
import os
from natsort import natsorted
import bibtexparser as bt
def parse_bib(f):
bib_database = bt.bparser.BibTexParser(common_strings=True).parse_file(open(f))
bd = bib_database.entries[0]
s = "<span style=\"font-size:1.0em;\">**"+bd['title']+"**</span><br>... | delton137/delton137.github.io | build_bibliography.py | Python | mit | 7,322 |
import re
from PyQt4.QtCore import Qt
from PyQt4.QtTest import QTest
from mock import Mock
from golem.core.common import is_windows
from golem.testutils import TempDirFixture
from gnr.application import GNRGui
from gnr.customizers.newtaskdialogcustomizer import NewTaskDialogCustomizer
from gnr.renderingapplicationlo... | imapp-pl/golem | tests/gnr/customizers/test_newtaskdialogcustomizer.py | Python | gpl-3.0 | 3,488 |
# -*- coding: utf-8 -*-
import redis
import time
from time import strftime, localtime
r = redis.Redis(host='localhost', port=6379, db=9)
def post(tag):
val = r.hget(tag, "val")
timestamp = r.hget(tag, "timestamp")
print("%s, %s-%s" % (tag, timestamp,val) )
def main():
#print(... | mabotech/mabo.io | node/test/redis_sub.py | Python | mit | 1,424 |
# PyTransit: fast and easy exoplanet transit modelling in Python.
# Copyright (C) 2010-2020 Hannu Parviainen
#
# 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 Licen... | hpparvi/PyTransit | tests/test_ma_quadratic.py | Python | gpl-2.0 | 6,476 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tqchen/tvm | tests/python/frontend/tensorflow/test_forward.py | Python | apache-2.0 | 155,287 |
from .caches import *
from .databases import *
from .debug import *
from .email import *
from .external import *
from .localization import *
from .reporting import *
from .preflight import *
from .static import *
from .storages import *
from .templates import * | bpeschier/django-preflight-checks | preflight/checks/__init__.py | Python | mit | 261 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# DCASE 2016::Acoustic Scene Classification / Baseline System
import argparse
import textwrap
import timeit
import skflow
from sklearn import mixture
from sklearn import preprocessing as pp
from sklearn.externals import joblib
from sklearn.metrics import confusion_matri... | rohit21122012/DCASE2013 | runs/2016/dnn2016med_mfcc_51/task1_scene_classification.py | Python | mit | 37,780 |
#!/usr/bin/python3
# coding: utf-8
import sys
import json
import requests
import pprint
import unittest
import string
import random
import os
import json
import time
import datetime
import base64
import uuid
import argparse
pp = pprint.PrettyPrinter(depth=6)
parser = argparse.ArgumentParser()
parser.add_argument('--... | hgn/hippod | tests/0200-random-mass-slowly.py | Python | mit | 9,079 |
"""Test different accessory types: Fans."""
from collections import namedtuple
from pyhap.const import HAP_REPR_AID, HAP_REPR_CHARS, HAP_REPR_IID, HAP_REPR_VALUE
import pytest
from homeassistant.components.fan import (
ATTR_DIRECTION,
ATTR_OSCILLATING,
ATTR_SPEED,
ATTR_SPEED_LIST,
DIRECTION_FORWAR... | pschmitt/home-assistant | tests/components/homekit/test_type_fans.py | Python | apache-2.0 | 19,219 |
import random
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from sqlalchemy.orm import joinedload
from externals.lib.misc import subdict, first
from externals.lib.log import log_event
from . import web, action_ok, action_error, etag_decorator, cache, cache_none, generate_cache_ke... | richlanc/KaraKara | website/karakara/views/tracks.py | Python | gpl-3.0 | 6,280 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
"... | Arzie/deluge | deluge/core/torrent.py | Python | gpl-3.0 | 51,853 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks 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
import os
import json
import pytest
import sys
if sys.version_info < (2... | Dhivyap/ansible | test/units/modules/network/f5/test_bigip_log_publisher.py | Python | gpl-3.0 | 3,883 |
# -*- coding: utf-8 -*-
from os.path import exists
from Plugins.Extensions.MediaPortal.plugin import _
from Plugins.Extensions.MediaPortal.resources.imports import *
from Plugins.Extensions.MediaPortal.additions.mediatheken.youtube import YT_ListScreen
default_cover = "file://%s/youtube.png" % (config.mediaportal.icon... | schleichdi2/OpenNfr_E2_Gui-6.0 | lib/python/Plugins/Extensions/MediaPortal/additions/mediatheken/youtube_user.py | Python | gpl-2.0 | 3,054 |
##
# Copyright 2016 DECaF Project Group, University of Paderborn
# This file is part of the decaf orchestration framework
# All Rights Reserved.
#
# 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 htt... | CN-UPB/OpenBarista | utils/decaf-utils-components/decaf_utils_components/annotations.py | Python | mpl-2.0 | 2,125 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import os
import pytest
from dolfin import (assemble, assign, dx, grad, inner, FiniteElement, Function, FunctionSpace, MixedElement, Point,
project, RectangleMesh, Spatial... | mathLab/RBniCS | tests/methodology/eim/test_eim_approximation_19.py | Python | lgpl-3.0 | 10,824 |
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC
#
# 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 agr... | googleapis/python-life-sciences | docs/conf.py | Python | apache-2.0 | 12,456 |
"""
Tests image.
"""
import os
import sys
import pytest
from pygmt import Figure
TEST_IMG = os.path.join(os.path.dirname(__file__), "baseline", "test_logo.png")
@pytest.mark.skipif(sys.platform == "win32", reason="crashes on Windows")
@pytest.mark.mpl_image_compare
def test_image():
"""
Place images on map.... | GenericMappingTools/gmt-python | pygmt/tests/test_image.py | Python | bsd-3-clause | 427 |
##
# Copyright 2009-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/c/cp2k.py | Python | gpl-2.0 | 35,231 |
#!/usr/bin/python
"""A session demonstration app."""
import calendar
from datetime import datetime
import sys
import cherrypy
from cherrypy.lib import sessions
from cherrypy._cpcompat import copyitems
page = """
<html>
<head>
<style type='text/css'>
table { border-collapse: collapse; border: 1px solid #663333; }
th ... | flakey-bit/plugin.audio.spotify | resources/libs/cherrypy/test/sessiondemo.py | Python | gpl-3.0 | 5,447 |
from gdal_array import *
from numpy import *
| Esri/raster2gpkg | Desktop10.4.1/python/osgeo/gdalnumeric.py | Python | apache-2.0 | 47 |
# coding: utf-8
import pickle
import multiprocessing
import logging
import sys
import pandas as pd
import numpy as np
from __future__ import print_function
from sklearn.cross_validation import StratifiedKFold
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegres... | laugustyniak/textlytics | examples/experiments_code/timik/sentiment_messages.py | Python | mit | 8,884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.