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 |
|---|---|---|---|---|---|
# Generated by Django 3.0.7 on 2020-07-23 12:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("trans", "0091_json_key"),
]
operations = [
migrations.AddField(
model_name="alert",
name="dismissed",
fi... | nijel/weblate | weblate/trans/migrations/0092_alert_dismissed.py | Python | gpl-3.0 | 392 |
import os
def slimdict(hangmanWord, badguess, goodguess):
wl = len(hangmanWord)
dictionary = []
with open("dict.txt", 'r', encoding='utf-8') as rawdict:
for word in rawdict:
word = word[:-1]
if len(word) == wl:
dictionary.append(word)
# while based searc... | deidyomega/hangmansolver | hangmansolver.py | Python | mit | 3,193 |
from pycloudia.services.interfaces import IInvoker
from pycloudia.activities.facades.interfaces import IService
from pycloudia.activities.facades.consts import HEADER
class ClientProxy(IService):
"""
:type sender: L{pycloudia.cluster.interfaces.ISender}
:type target_factory: L{pycloudia.services.interfac... | cordis/pycloudia | pycloudia/activities/facades/proxies.py | Python | mit | 1,059 |
"""The tests for the MQTT lock platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.const import (STATE_LOCKED, STATE_UNLOCKED,
ATTR_ASSUMED_STATE)
import homeassistant.components.lock as lock
from tests.common import (
mock_mqtt_component... | MungoRae/home-assistant | tests/components/lock/test_mqtt.py | Python | apache-2.0 | 4,146 |
# -*- coding: utf-8 -*-
# This code is part of Ansible, but is an independent component.
# This particular file, and this file only, is based on
# Lib/ipaddress.py of cpython
# It is licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
... | azaghal/ansible | test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py | Python | gpl-3.0 | 83,170 |
"""
reminder mail test
"""
import sys
import locale
import datetime
import pytest
from admin.mailing.mailer import get_template
from admin.mailing.mailer import send_mail_plain_text
from admin.mailing.mailer import FROM
@pytest.mark.skip(reason='Not valid for pytest')
def test_reminder():
locale.setlocale(locale... | dmartin35/pronosfoot | admin/test/test_reminder_mail.py | Python | mit | 944 |
from __future__ import print_function
from itertools import product
import obarasaika.shell as shell
import obarasaika.obara_saika as os
za = 1.1
zb = 1.2
zc = 1.3
zd = 1.4
ra = [1.0, 0.0, 1.0]
rb = [0.0, 1.0, 2.0]
rc = [0.0, 0.0, 3.0]
rd = [0.0, 0.0, 4.0]
q_base = [0, 0, 0, 0, 0, 0]
q_small = [0, 1, 0, 0, 0, 1]... | berquist/obarasaika | examples/compute.py | Python | bsd-3-clause | 2,414 |
# -*- coding: utf-8 -*-
# 只是个模板,继承还是有问题,不用于继承
class Singleton(object):
def __init__(self):
globals()[self.__class__.__name__] = self
def __call__(self):
return self
# class Singleton:
# def __call__(self):
# return self
#
# Singleton = Singleton() | yes7rose/maya_utils | python/maya_utils/singleton.py | Python | mit | 330 |
"""
Test the garbage collection if we pass the picoscope object.
By: Mark Harfouche
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from picoscope import ps6000
# import the garbage collection interface
import ... | arunpersaud/pico-python | examples/garbageCollectorTest.py | Python | bsd-2-clause | 1,002 |
#
#
# Author : fcbruce <fcbruce8964@gmail.com>
#
# Time : Mon 01 May 2017 20:14:00
#
#
from keras.applications.vgg16 import VGG16, preprocess_input
from FeatureGenerator import FeatureGenerator
class VGG16FeatureGenerator(FeatureGenerator):
def __init__(self, weights='imagenet'):
FeatureGenerator.__init... | fcbruce/DBIR | src/VGG16FeatureGenerator.py | Python | mit | 377 |
"""
Django settings for maoaberta project.
Generated by 'django-admin startproject' using Django 1.8.5.
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 pa... | MauricioAlmeida/maoaberta | maoaberta/maoaberta/settings.py | Python | gpl-2.0 | 3,126 |
# 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 unittest
from telemetry.internal.platform.power_monitor import android_dumpsys_power_monitor
class DumpsysPowerMonitorMonitorTest(unittest.TestCase... | CapOM/ChromiumGStreamerBackend | tools/telemetry/telemetry/internal/platform/power_monitor/android_dumpsys_power_monitor_unittest.py | Python | bsd-3-clause | 1,315 |
# This script generates phase space portraits for the standard map at many different values of the "kicking" parameter L
# William Gilpin, 2014
from numpy import *
from scipy import *
from matplotlib.pyplot import *
from random import randrange
# steps to run simulation for (generally only needs a few
# to sketch fu... | williamgilpin/stdmap | stdmap_plotter.py | Python | mit | 1,084 |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import os
import shutil
import uuid
import pytest
import salt.modules.seed as seed
import salt.utils.files
import salt.utils.odict
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {seed: {}}
@p... | saltstack/salt | tests/pytests/unit/modules/test_seed.py | Python | apache-2.0 | 3,332 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Nick Hall
#
# 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 l... | dermoth/gramps | gramps/gui/views/tags.py | Python | gpl-2.0 | 24,494 |
from django.conf.urls import patterns
urlpatterns = patterns('', )
| goinnn/deldichoalhecho | promises_instances/urls.py | Python | gpl-3.0 | 68 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... | azumimuo/family-xbmc-addon | plugin.video.exodus/resources/lib/modules/trailer.py | Python | gpl-2.0 | 4,049 |
# 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_metadata.py | Python | apache-2.0 | 113,783 |
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
# systemd-networkd tests
import os
import re
import shutil
import signal
import socket
import subprocess
import sys
import time
import unittest
from shutil import copytree
network_unit_file_path='/run/systemd/network'
networkd_runtime_directory='/run/systemd... | bengal/systemd | test/test-network/systemd-networkd-tests.py | Python | gpl-2.0 | 59,885 |
# Get the configuration
import os
import json
spath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "settings.json")
configuration = json.loads(open(spath, "r").read())
| jonwedell/homeautomation | modules/__init__.py | Python | gpl-3.0 | 190 |
# 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 applica... | jbedorf/tensorflow | tensorflow/python/kernel_tests/string_split_op_test.py | Python | apache-2.0 | 10,529 |
from __future__ import print_function
import numpy as np
import tensorflow as tf
import argparse
import time
import os
from six.moves import cPickle
from utils import TextLoader
from model import Model
from six import text_type
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--save_dir',... | hpssjellis/char-rnn-tensorflow-music-3dprinting | sample.py | Python | mit | 1,557 |
# -*- encoding: utf-8 -*-
from . import FixtureTest
class BikeShopTest(FixtureTest):
def test_bicycle_shop_node(self):
import dsl
z, x, y = (16, 10479, 25331)
self.generate_fixtures(
# https://www.openstreetmap.org/node/2484293076
dsl.point(2484293076, (-122.4322... | mapzen/vector-datasource | integration-test/1627-modify-zoom-bicycle-theatre-water-tower.py | Python | mit | 7,856 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | dbbhattacharya/kitsune | vendor/packages/logilab-astng/test/data/module2.py | Python | bsd-3-clause | 2,470 |
# -*- coding: utf-8 -*-
import six
from jenkinsapi_utils.compat import (
to_string,
needs_encoding,
)
def test_needs_encoding_py2():
if six.PY2:
unicode_str = u'юникод'
assert needs_encoding(unicode_str)
assert not needs_encoding('string')
assert not needs_encoding(5)
assert n... | salimfadhley/jenkinsapi | jenkinsapi_tests/unittests/test_compat.py | Python | mit | 599 |
from django import forms
from stall.forms.bases import BaseForm
class SellerForm(BaseForm):
circle_name = forms.CharField(max_length=40)
circle_description = forms.CharField(required=False, widget=forms.Textarea)
proposer_name = forms.CharField(max_length=20)
proposer_sex = forms.CharField(max_length... | sunoru/pokemon_only | stall/forms/seller.py | Python | gpl-2.0 | 507 |
# -*- coding: utf-8 -
def app(environ, start_response):
data = 'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', str(len(data)))
]
start_response(status, response_headers)
return iter([data])
| tanacasino/gunicorn-ssl | app.py | Python | apache-2.0 | 290 |
# -*- coding: utf-8 -*-
#
# Jansson documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 5 21:47:20 2010.
#
# 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... | andrei14vl/cubrid | external/jansson-2.4/doc/conf.py | Python | gpl-3.0 | 7,025 |
"""
Test_collection_measures
------------------------
Test the module functions.
"""
import numpy as np
from corrs_measures import measure_corrs_sumstd, measure_corrs_std,\
measure_corrs_mean
def test():
### Measures testing
corrs = np.random.random((10, 10))
val = measure_corrs_sumstd(corrs)
v... | tgquintela/pythonUtils | pythonUtils/CollectionMeasures/test_collectionmeasures.py | Python | mit | 386 |
"""
NeuroTools.parameters
=====================
A module for dealing with model parameters.
Classes
-------
Parameter
ParameterRange - for specifying a list of possible values for a given parameter.
ParameterReference - specify a parameter in terms of the value of another parameter.
ParameterSet - for representing... | meduz/NeuroTools | src/parameters/__init__.py | Python | gpl-2.0 | 35,171 |
#!/usr/bin/env python
import re
from setuptools import setup, find_packages
def read_version():
with open("pandas_td/version.py") as f:
m = re.match(r'__version__ = "([^\"]*)"', f.read())
return m.group(1)
requires = [
"certifi",
"pytz",
"tzlocal",
"pandas>=0.16.0",
"requests>... | treasure-data/pandas-td | setup.py | Python | apache-2.0 | 1,186 |
#!/usr/bin/env python
"""
Utils to interact with the redis DB
"""
import csv
from datetime import datetime
import json
import os
import redis
LOCAL_REDIS = 'redis://localhost:6379/0'
REDIS_URL = os.environ.get('REDISCLOUD_URL', LOCAL_REDIS)
CALLEE_COUNTER_KEY = 'callee_counter'
EVENTS_KEY = 'events'
CALLED_NUMBERS_S... | gabrielgrant/callaborate | db.py | Python | apache-2.0 | 2,734 |
import maya.cmds as cmds
try:
from MetacubeScripts import MetacubeFileNameConvention
except:
pass
class genericRigStructure(object):
def __init__(self):
self.groups = {
"mesh": {"group": "mesh_grp",
"subGroup": ["body_grp", "cloth_grp", "accesories_grp", "hair_grp... | rendermotion/RMPY | AutoRig/RMGenericRigStructure.py | Python | lgpl-3.0 | 2,106 |
# 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 os
import subprocess
import sys
# This script prints information about the build system, the operating
# system and the iOS or Mac SDK (depending on ... | axinging/chromium-crosswalk | build/config/mac/sdk_info.py | Python | bsd-3-clause | 2,283 |
# encoding: UTF-8
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
name = 'crrCython',
ext_modules = cythonize("crrCython.pyx"),
include_dirs = [numpy.get_include()]
)
| mumuwoyou/vnpy-master | vnpy/pricing/crrCython/setup.py | Python | mit | 215 |
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
# Optimal 2 Heap O(1) Solution
#-------------------------------------------------------------------------------
from heapq import *
class MedianFinder:
def __init__(self):
"""
initialize your ... | kyle8998/Practice-Coding-Questions | leetcode/295-Hard-Find-Median-From-Data-Stream/answer.py | Python | unlicense | 2,682 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# python-simple-rest-client documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 15 17:57:28 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pr... | allisson/python-simple-rest-client | docs/conf.py | Python | mit | 4,990 |
# !/usr/bin/env python
import unittest
from xor_string import xor_string
class EqualityTest(unittest.TestCase):
def testEqual(self):
ori = 'attack at dawn'
enc = xor_string(ori, 's3cr3t')
dec = xor_string(enc, 's3cr3t')
self.failUnlessEqual(ori, dec)
if __name__ == '__main__':
... | Akagi201/xor_string | tests/test_xor_string.py | Python | mit | 338 |
import json
from rest_framework import serializers
from rest_framework_hstore.serializers import HStoreSerializer
from nodeshot.core.nodes.models import Node
from nodeshot.core.nodes.serializers import NodeListSerializer
from .models import Layer
from .settings import ADDITIONAL_LAYER_FIELDS
__all__ = [
'Layer... | ninuxorg/nodeshot | nodeshot/core/layers/serializers.py | Python | gpl-3.0 | 2,337 |
# -*- coding: utf-8 -*-
from functools import wraps
from http.client import BadStatusLine
from socket import error as socket_error
from socket import gaierror
from ssl import SSLError
from tweepy import API as TwitterAPI # NOQA: N811
from tweepy import OAuthHandler as TwitterOAuthHandler
from tweepy import TweepErro... | hasgeek/lastuser | lastuser_oauth/providers/twitter.py | Python | bsd-2-clause | 4,255 |
from yozuch.generators.post_item_collection import PostItemCollectionGenerator
class TagGenerator(PostItemCollectionGenerator):
def __init__(self, url_template, name, template=None):
super().__init__('tags', 'tag', url_template, name, template)
| akrylysov/yozuch | yozuch/generators/tag.py | Python | bsd-3-clause | 260 |
#!/usr/bin/env python
from tools.multiclass_shared import prepare_data
[traindat, label_traindat, testdat, label_testdat] = prepare_data(False)
parameter_list = [[traindat,testdat,label_traindat,label_testdat,2.1,1,1e-5],[traindat,testdat,label_traindat,label_testdat,2.2,1,1e-5]]
def classifier_multilabeloutputlibli... | abhiatgithub/shogun-toolbox | examples/undocumented/python_modular/classifier_multilabeloutputliblinear_modular.py | Python | gpl-3.0 | 1,051 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-24 22:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0013_auto_20160424_2247'),
]
operations =... | EricZaporzan/evention | evention/events/migrations/0014_auto_20160424_2258.py | Python | mit | 709 |
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
#
# This file is part of Ansible.
#
# Ansible 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 lat... | kisoku/ansible | lib/ansible/plugins/connection/winrm.py | Python | gpl-3.0 | 14,871 |
r"""
Run Link Grammar Python scripts using the build target locations.
This program sets PYTHONPATH and PATH.
This program is designed to reside in this directory.
It reads Local.props in order to find Python's EXE location.
It also generates relative PYTHONPATH and PATH.
In case it is desired to move it to a... | linas/link-grammar | msvc/make-check.py | Python | lgpl-2.1 | 4,317 |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
# ------------------------------------------------------------
# Libraries
# ------------------------------------------------------------
import os
import sys
# ------------------------------------------------------------
# Variables and Constants
# -------------------------... | brunocalado/downloadkhanacademy | downloadkhanacademy.py | Python | gpl-3.0 | 5,050 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__all__ = ["Discontinuity"]
import numpy as np
from ..pipeline import Pipeline
from .prepare import LightCurve
class Discontinuity(Pipeline):
query_parameters = dict(
discont_window=(51, False),
discont_... | dfm/ketu | ketu/kepler/discontinuity.py | Python | mit | 3,464 |
#coding:utf-8
# 感知器 y = f(Wn * x + b)
# 代码实现的是一个逻辑AND操作,输入最后一项一直为1,代表我们可以理解偏置项b的特征值输入一直为1
# 这样就是 y = f(Wn+1*[x,1]), Wn+1就是b
# https://www.zybuluo.com/hanbingtao/note/433855
from numpy import array, dot, random
from random import choice
def fun_1_or_0(x): return 0 if x < 0 else 1
training_data = [(array([0, 0, 1... | kkzzzzzz/Deep-Learing | Sensor/code.py | Python | mit | 991 |
from django.conf import settings
from django.template import Library
import os
from django.utils.safestring import mark_safe
register = Library()
base_directory = settings.STATICFILES_DIRS[0]
@register.simple_tag
def css_href(directory=""):
links_css = ""
completed_directory = base_directory +"/css/" + direct... | Joneyviana/todolist-django-angular | utils/templatetags/get_links_assets.py | Python | mit | 809 |
import numpy as np
from .status import StatusGrid
from .links import link_is_active, find_active_links, LinkGrid
from .links import _split_link_ends
from .cells import CellGrid
from .nodes import NodeGrid
from landlab.utils.decorators import deprecated
def _default_axis_names(n_dims):
"""Returns a tuple of the d... | csherwood-usgs/landlab | landlab/grid/unstructured/base.py | Python | mit | 19,608 |
"""
DFO-GN
====================
A derivative-free solver for least squares minimisation with bound constraints
Call structure is:
x, f, nf, exit_flag, exit_str = dfogn(objfun, x0, lower, upper,
maxfun, init_tr_radius, rhoend=1e-8)
Required inputs:
objfun Obje... | numericalalgorithmsgroup/dfogn | dfogn/dfogn.py | Python | gpl-3.0 | 39,987 |
import sys
import wqio
if "--strict" in sys.argv:
sys.argv.remove("--strict")
tester = wqio.teststrict
else:
tester = wqio.test
sys.exit(tester(*sys.argv[1:]))
| phobson/wqio | check_wqio.py | Python | bsd-3-clause | 175 |
import wx
from cuttlebug import util
import os
class OptionsEvent(wx.PyEvent):
def __init__(self, type, object=None):
super(OptionsEvent, self).__init__()
self.SetEventType(type.typeId)
self.SetEventObject(object)
EVT_OPTION_CHANGED = wx.PyEventBinder(wx.NewEventType())
class Tree(wx.Tre... | ryansturmer/cuttlebug | cuttlebug/ui/options/options.py | Python | mit | 9,515 |
"""
ElasticSearch wrapper
"""
__RCSID__ = "$Id$"
import logging
from cmreslogging.handlers import CMRESHandler
from DIRAC.Resources.LogBackends.AbstractBackend import AbstractBackend
class ElasticSearchBackend(AbstractBackend):
"""
ElasticsearchBackend is used to create an abstraction of the handler and the for... | andresailer/DIRAC | Resources/LogBackends/ElasticSearchBackend.py | Python | gpl-3.0 | 3,666 |
"""Implementation of the WebSocket protocol.
`WebSockets <http://dev.w3.org/html5/websockets/>`_ allow for bidirectional
communication between the browser and server.
WebSockets are supported in the current versions of all major browsers,
although older versions that do not support WebSockets are still in use
(refer ... | obsh/tornado | tornado/websocket.py | Python | apache-2.0 | 41,216 |
import numpy as np
from . import util
protocols = dict([(lambda a:(int(a[1]), a[0]))(l.split('\t')[:2]) for l in open('/etc/protocols', 'r').readlines() if not l.startswith('#')])
def process(msdu):
dsap, ssap, control = msdu[:3]
protocol_id = util.shiftin(util.shiftout(msdu[3:6][::-1], 8), 24)[0]
if not ... | piannucci/blurt | blurt_py_80211/streaming/blurt/phy/msdu.py | Python | mit | 2,013 |
import json
import os
import sys
def parsejson(directory):
base=os.path.basename(directory)
in_path= os.getcwd()+'/Data/Apk_data/'+base+'/'+base+"method.json" # input file path.
out_path = os.getcwd()+'/Data/Apk_data/'+base+'/'+base+'method.csv'
# out_path= os.path.join(directoryoutfile) # output file pat... | OmkarMozar/CUPAP | code/own/jsonparser.py | Python | apache-2.0 | 1,239 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/mgmt_avail_set/lib/models/__init__.py | Python | mit | 1,439 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os.path
import string
import webbrowser
import shutil
import json
import base64
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PyQt5.QtCore import QFile
from PyQt5.QtCore import QUrl
from PyQt5.QtWebKit import QWebSettings
from ... | marcoconstancio/yanta | plugins/viewers/html_editor/html_editor.py | Python | gpl-2.0 | 16,041 |
#
# 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... | apache/incubator-airflow | tests/providers/openfaas/hooks/test_openfaas.py | Python | apache-2.0 | 6,559 |
from estrategias.jogadores import Jogador
import random
class MeuJogador(Jogador):
def __init__(self):
Jogador.__init__(self)
self.total_jogador = 0
def escolha_de_cacada(self, rodada, comida_atual, reputacao_atual, m, reputacoes_dos_jogadores):
if rodada == 1:
self.total_... | fccoelho/jogos_vorazes | estrategias/AraraClayton.py | Python | mit | 773 |
##########################################################################
#Copyright 2015 Rasmus Dall #
# #
#Licensed under the Apache License, Version 2.0 (the "License"); #
#you may not use thi... | RasmusD/SiRe | SiReUtils/visualisation_tools.py | Python | apache-2.0 | 4,519 |
# pylint: disable=fixme, invalid-name, too-many-arguments, too-many-locals, too-many-lines
# pylint: disable=too-many-branches, too-many-statements
"""MXNet model module"""
from __future__ import absolute_import, print_function
import time
import logging
import warnings
from collections import namedtuple
import numpy ... | hotpxl/mxnet | python/mxnet/model.py | Python | apache-2.0 | 39,119 |
#
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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/licens... | blueboxgroup/cinder | cinder/tests/test_hp3par.py | Python | apache-2.0 | 178,661 |
# $HeadURL$
__RCSID__ = "$Id$"
import time
import copy
import os.path
import GSI
from DIRAC.Core.Utilities.ReturnValues import S_ERROR, S_OK
from DIRAC.Core.Utilities.Network import checkHostsMatch
from DIRAC.Core.Utilities.LockRing import LockRing
from DIRAC.Core.Security import Locations
from DIRAC.Core.Security.X50... | marcelovilaca/DIRAC | Core/DISET/private/Transports/SSL/SocketInfo.py | Python | gpl-3.0 | 13,388 |
'''----------------------------- Imports -----------------------------'''
# Hack computer
from ._x__components import *
'''------------------------- Program counter -------------------------'''
class ProgramCounterN_():
''' N bit program counter
if rst(t-1) : out(t) = 0
elif write(t-1) ... | JetStarBlues/Nand-2-Tetris | OldArchitecture/v1.0/Components/_6__programCounter.py | Python | mit | 1,119 |
class Solution(object):
def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
# related to 84.py
if not matrix:
return 0
m, n = len(matrix), len(matrix[0])
max_area = 0
for i in range(m):
... | sogapalag/problems | leetcode/85.Maximal-Rectangle.py | Python | mit | 1,148 |
number = int(input("Number: "))
i = 2
while number > 1:
if number % i == 0:
number //= i
print(i)
else:
i += 1
| JoachimVandersmissen/CodingSolutions | python/PythonForEveryone/chapter4/16.py | Python | apache-2.0 | 143 |
# -*- coding: utf-8 -*-
"""
Sycamore - "create a new wiki" action
This action allows you to create a new wiki in your wiki farm if you:
1) Have wiki_farm = True set in your config
2) Have allow_web_based_wiki_creation = True set in your config
@copyright: 2006 Philip Neustrom <philipn@gmai... | philipn/sycamore | Sycamore/action/new_wiki.py | Python | gpl-2.0 | 7,553 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.apach... | citrix-openstack-build/tempest | tempest/common/ssh.py | Python | apache-2.0 | 5,573 |
# Copyright (c) 2016-2017, Parallels International GmbH
# Copyright (c) 2017-2022, Virtuozzo International GmbH, All rights reserved
#
# This file is part of OpenVZ. OpenVZ 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 ... | OpenVZ/vcmmd | vcmmd/util/optparse.py | Python | lgpl-2.1 | 2,269 |
# Django settings for example_project project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add '... | caspyyy/SCRAPY_DDS | example_project/example_project/settings.py | Python | bsd-3-clause | 5,820 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import django.contrib.auth.models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
]
... | crypotex/taas | taas/user/migrations/0001_create_user_model.py | Python | gpl-2.0 | 2,973 |
from enum import Enum
from abc import ABCMeta
from kivy.uix.widget import WidgetMetaclass
class AbstractWidget(ABCMeta, WidgetMetaclass):
""" Necessary because python meta classes do not support multiple
inheritance. """
pass
class Type(Enum):
ANY = 0.9, 0.9, 0.9
DATAFRAME = .667, .224, .224
... | AlvarBer/Persimmon | persimmon/view/util/types.py | Python | mit | 673 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
... | Antiun/sale-workflow | sale_automatic_workflow_exception/automatic_workflow_job.py | Python | agpl-3.0 | 1,376 |
#coding=utf-8
import csv
class Robot:
##统计结果 80%的session交互次数小于25
##80% 的句子长度小于59个词 (实际上是20个中文单词)
def __init__(self):
self.in_path = 'skin.csv'
self.out_path = 'skin.txt'
def run(self):
length_static ={}
sent_len_count = {}
with open(self.in_path,'rb') as csvfile:
#spamreader = csv.reader(csvfile, delimit... | liangjz92/deeplearning4chatbot | seqs2seq/dialogue/data/scipts/dataset_length_static.py | Python | gpl-3.0 | 1,457 |
from twisted.internet.protocol import Factory, Protocol
class Graphite(Protocol):
def sendMessage(self, msg):
self.transport.write(msg)
class GraphiteFactory(Factory):
def buildProtocol(self, addr):
return Graphite()
| cmek/homeserv | uservices/graphite/graphite.py | Python | bsd-2-clause | 244 |
from django.contrib import admin
from signbank.video.models import Video, GlossVideo
#admin.site.register(Video)
class GlossVideoAdmin(admin.ModelAdmin):
search_fields = ['^gloss__idgloss']
admin.site.register(GlossVideo, GlossVideoAdmin) | Woseseltops/signbank | signbank/video/admin.py | Python | bsd-3-clause | 250 |
from zope.interface.verify import verifyObject, verifyClass
from zope.interface.exceptions import DoesNotImplement
from IOperation import IOperation
from utils import Plus
assert verifyClass(IOperation, Plus) == True
assert verifyObject(IOperation, Plus()) == True
try:
verifyObject(IOperation, object())
except ... | duboviy/zca | ifaces/verifier.py | Python | mit | 444 |
import sys # pragma: no cover
from remoteappmanager.command_line_config import (
CommandLineConfig) # pragma: no cover
from remoteappmanager.environment_config import (
EnvironmentConfig) # pragma: no cover
from remoteappmanager.file_config import FileConfig # pragma: no cover
from tornado.options impor... | simphony/simphony-remote | remoteappmanager/cli/remoteappmanager/__main__.py | Python | bsd-3-clause | 1,009 |
#!/usr/bin/env python
# Copyright 2014, Rackspace US, 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 applicabl... | claco/rpc-openstack | maas/plugins/glance_api_local_check.py | Python | apache-2.0 | 2,771 |
import urllib2
import json
APP_NAME = "GDGDevFest-Android-App"
API_KEY = "AIzaSyCsAij0bSMlGHdta3snhfxD4rAOw9WeSDg" #from the APIs console
CLIENT_ID = "903246180582.apps.googleusercontent.com" #from the APIs console
#gdgdevfest
# Conference API - specific config
# NOTE: the backend used for the Google ... | printminion/gdgsched | scripts/checkAgenda.py | Python | apache-2.0 | 4,422 |
import hashlib
import csv
import os
import sys
class Log(object):
def __init__(self, f):
self.log_name = f
self.data = self.get_data(f)
self.log_dict = self.log_parser(self.data)
def get_data(self, f):
"""pulls a csv reader from the file"""
data = []
csvfile = open(f, 'rb')
reader = csv.reader(csvfi... | jayGattusoNLNZ/Safe_mover | log_compare.py | Python | gpl-2.0 | 2,515 |
# Copyright 2015-2016, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | msiedlarek/grpc | src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py | Python | bsd-3-clause | 20,180 |
# Copyright 2019 The Meson development team
# 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 ... | jpakkane/meson | mesonbuild/templates/objcpptemplates.py | Python | apache-2.0 | 5,358 |
import numpy as np
from matplotlib.pylab import imread
from scipy import io as sio
from scipy import optimize
import os, sys
from base import image as sig
from base import data as dm
from base import files as f
from emmetrop.database import Database as db
class Images(object):
"""Compute the amplitude spec... | bps10/emmetrop | emmetrop/scene/Images.py | Python | mit | 13,121 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | 1ukash/horizon | horizon/dashboards/admin/projects/tests.py | Python | apache-2.0 | 34,446 |
# -*- coding: utf-8 -*-
"""Tests for certificates views. """
import datetime
import json
from collections import OrderedDict
from uuid import uuid4
import ddt
import six
from django.conf import settings
from django.test.client import Client, RequestFactory
from django.test.utils import override_settings
from django.... | cpennington/edx-platform | lms/djangoapps/certificates/tests/test_webview_views.py | Python | agpl-3.0 | 73,129 |
from regularregion import RegularRegion
from region import Region
from icoolobject import *
class SubRegion(RegularRegion):
"""
A SubRegion is a:
(1) IRREG r-region number;
(2) RLOW Innter radius of this r subregion;
(3) RHIGH Outer radius of this r subregion;
(4) Field object; and
(5) Ma... | jon2718/ipycool_2.0 | subregion.py | Python | mit | 2,296 |
from pycwt import * | ElOceanografo/PyCWT | pycwt/__init__.py | Python | gpl-2.0 | 19 |
"""
run_SIM_machine_generated.py
Script to generate model SIM from [G&L 2012] from text equation specification.
"""
import sfc_models.deprecated.iterative_machine_generator as generator
from sfc_models.examples.Quick2DPlot import Quick2DPlot
filename = 'SIM_model.py'
eqn = """# Model SIM - Simplest model with gover... | brianr747/SFC_models | sfc_models/examples/scripts/deprecated/run_SIM_machine_solved_equations.py | Python | apache-2.0 | 2,388 |
from django.contrib import admin
from activities.models import *
# Register your models here.
admin.site.register(Activity)
| studentisgss/booking | activities/admin.py | Python | gpl-3.0 | 126 |
from itertools import product
from unittest.mock import PropertyMock, patch
from django.test import TestCase, override_settings, tag
from ..factories import CountryRegionFactory
@tag('models', 'subregions')
class CountryRegionModelTests(TestCase):
def test_field_max_lengths(self):
region = CountryRegion... | tejo-esperanto/pasportaservo | tests/models/test_countryregion_model.py | Python | agpl-3.0 | 8,821 |
# This file is part of Peach-Py package and is licensed under the Simplified BSD license.
# See license.rst for the full text of the license.
from peachpy.x86_64 import *
from peachpy import *
matrix = Argument(ptr(float_))
with Function("transpose4x4_opt", (matrix,)):
reg_matrix = GeneralPurposeRegister64()
... | silky/PeachPy | examples/nmake/transpose4x4-opt.py | Python | bsd-2-clause | 1,848 |
# Copyright (C) 2016 The OpenTimestamps developers
#
# This file is part of python-opentimestamps.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-opentimestamps including this file, may be copied,
# modified, propagated, or distr... | petertodd/python-opentimestamps | opentimestamps/core/notary.py | Python | lgpl-3.0 | 10,936 |
# The Hazard Library
# Copyright (C) 2014-2022 GEM Foundation
#
# 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 your option) any later version.
#... | gem/oq-engine | openquake/hazardlib/tests/gsim/utils_test.py | Python | agpl-3.0 | 2,918 |
# Color palette returns an array of colors (rainbow)
from matplotlib import pyplot as plt
import numpy as np
from plantcv.plantcv import params
def color_palette(num, saved=False):
"""color_palette: Returns a list of colors length num
Inputs:
num = number of colors to return.
saved = use... | danforthcenter/plantcv | plantcv/plantcv/color_palette.py | Python | mit | 1,143 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'Script that uses a config file to generate a WordPress plugin scaffold.',
'author': 'Richard Royal',
'url': 'https://github.com/richardroyal/wp-plugin-generator',
'download_url': 'h... | richardroyal/wp-plugin-generator | setup.py | Python | bsd-2-clause | 579 |
from cjklib import characterlookup
cjk = characterlookup.CharacterLookup('T')
ENTRIES_PER_ROW = 8
LONELIES_PER_ROW = 16
INPUT_FILENAME = 'hsk3.txt'
CAPTION = 'HSK3 Words indexed by characters'
f = open(INPUT_FILENAME, 'r')
words = []
chars = {}
lonely_words = []
for line in f:
words.append(line.rstrip().decode('u... | hhatinen/HanziWordList | hanziwordlist.py | Python | unlicense | 2,307 |
import threading
from I_thread import IThread
from server import DatabaseServer
class ServerThread(IThread, threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self._queue = queue
def run(self):
service = DatabaseServer(self._queue)
print('st... | BenjaminLang/cpen_321 | Server/src/server_thread.py | Python | mit | 366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.