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 |
|---|---|---|---|---|---|
"""
Tests for transforming a filterset class (with `filters` list as a class
attribute) into a blob of JSON.
"""
import json
from django.template import Template, Context
from moztrap import model
from moztrap.view.lists import filters
from tests import case
class FiltersetToJSONTests(case.DBTestCase):
def te... | mozilla/moztrap | tests/view/templatetags/test_filterset.py | Python | bsd-2-clause | 4,063 |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=... | XiaosongWei/crosswalk-test-suite | webapi/tct-systemsetting-tizen-tests/inst.xpk.py | Python | bsd-3-clause | 6,662 |
__author__ = 'lew'
import unittest
import random
from binary_dec_converter import to_binary, to_decimal
class TestBinaryDecConverted(unittest.TestCase):
def setUp(self):
self.random_numbers = []
for i in range(100):
self.random_numbers.append(random.randint(1,1000000000000))
def t... | LGordon2/Projects | Python/binary_dec_converter/test_binary_dec_converter.py | Python | mit | 681 |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 BigML
#
# 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 ... | jaor/python | bigml/tests/test_40_local_from_file.py | Python | apache-2.0 | 26,058 |
import os.path
import re
import collections
from operator import itemgetter
import FiltusUtils
#import memory_profiler
#import psutil
class ColumnData(object):
def __init__(self, columnNames, variants, columnDescriptions=None, meta=''):
self.columnNames = columnNames
self.variants = variants if v... | magnusdv/filtus | filtus/DataContainer.py | Python | gpl-2.0 | 27,101 |
"""Support for MQTT Template lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE,
ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS,
SUPPOR... | mezz64/home-assistant | homeassistant/components/mqtt/light/schema_template.py | Python | apache-2.0 | 15,477 |
#!/usr/bin/python
#######################################################
# Xpath tool v2.0 - Automated Xpath Sql Injection #
# Author: Nasir khan (r0ot h3x49) #
#######################################################
import os, re
from Payload.BigintDoublePayloads import *
from _compat import... | hackersql/sq1map | Web/xpath_injection/Xpath/Xtract/_BigintDouble.py | Python | gpl-3.0 | 80,822 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | CeltonMcGrath/TACTIC | src/tactic/ui/panel/edit_wdg.py | Python | epl-1.0 | 46,136 |
#!/usr/bin/env python
def Person(name, age):
def data():
pass
def setName(name):
data.__dict__['name'] = name
def getName():
return data.name
def setAge(age):
if age <= 0:
raise ValueError('age error')
data.__dict__['age'] = age
def getAge():... | veltzer/demos-python | src/exercises/advanced/oo_using_closure/solution.py | Python | gpl-3.0 | 770 |
from django.db import models
from django_boto.s3.storage import S3Storage
s3 = S3Storage()
class Service(models.Model):
'''Descriptions about services that the society provides'''
title = models.CharField(max_length=128)
description = models.TextField()
image = models.ImageField(storage=s3, upload_to='uploads')
... | DUCSS/ducss-site-old | project/main/models.py | Python | mit | 364 |
# -*- coding: utf-8 -*-
"""Unittests for the MDPClient class.
"""
__license__ = """
This file is part of MDP.
MDP 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... | dash-dash/pyzmq-mdp | mdp/test_client.py | Python | gpl-3.0 | 5,815 |
from srqi.core import inquiry
import matplotlib.pyplot as plt
import numpy as np
def get_accumulation_fig(proc):
fig = plt.figure()
plt.title("Accumulation During Procedure for Patient " + str(proc.PatientID) + " on " + str(proc.StudyDate))
event_starts = [e.DateTime_Started for e in proc.get_events... | mcstrother/dicom-sr-qi | inquiries/high_cases.py | Python | bsd-2-clause | 7,573 |
import os
from urllib.parse import urlparse, urljoin
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from pontoon.base.models import Project, User
class Command(BaseCommand):
help = "Setup an instance of Pontoon deployed via Heroku Deploy."
def handle(self,... | mathjazz/pontoon | pontoon/base/management/commands/heroku_deploy_setup.py | Python | bsd-3-clause | 811 |
# (c)2016 Andrew Zenk <azenk@umn.edu>
#
# 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 later version.
#
# ... | roadmapper/ansible | test/units/plugins/lookup/test_lastpass.py | Python | gpl-3.0 | 6,829 |
import pickle
import gzip
import os, sys, errno
import time
import math
# numpy & theano imports need to be done in this order (only for some numpy installations, not sure why)
import numpy
#import gnumpy as gnp
# we need to explicitly import this in some cases, not sure why this doesn't get imported with numpy itse... | bajibabu/merlin | src/work_in_progress/run_merlin_v2.py | Python | apache-2.0 | 58,040 |
# Copyright 2013 Canonical Corp.
# 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 ... | bigswitch/nova | nova/tests/unit/virt/vmwareapi/test_vif.py | Python | apache-2.0 | 16,871 |
#!/usr/bin/python
# -*- 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | romain-dartigues/ansible | lib/ansible/modules/network/f5/bigip_profile_udp.py | Python | gpl-3.0 | 14,551 |
# 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, software
# distributed under th... | liefdiy/bite-project | deps/mrtaskman/server/handlers/packagefiles.py | Python | apache-2.0 | 1,447 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Erik van Widenfelt
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import sys
from builtins import FileNotFoundError
from django.core.management.base import BaseComman... | botswana-harvard/getresults-distribute | getresults_dst/management/commands/load_remote_folders.py | Python | gpl-2.0 | 941 |
# 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/tfx | tfx/orchestration/experimental/core/task_scheduler_test.py | Python | apache-2.0 | 4,126 |
import logging
from chatterbot.conversation import Statement
from flask_restful import Resource
from .nameparser import extract_names_regex
from .parsers import query_parser, teach_parser, auth_parser
from .logic.requests import Request, text, InputRequest, InvalidTokenError
from common.utils import obscure
log = lo... | WaldurChatbot/Waldur-Chatbot | backend/waldur/resources.py | Python | mit | 5,488 |
#!/usr/bin/env python
"""
Polyalpha_encrypt.py
This program generates a stream of random length out of a wordlist:
1) select the type of wordlist (dictionary 1 or 2) by using the -two switche, defaults
to dictionary 1.
2) Send the keylength by using the -k switch: "-k 20"
3) The length of ... | SantiagoTorres/modern_crypto_project_1 | scripts/polyalpha_encrypt.py | Python | mit | 3,216 |
#!/usr/bin/env python
#pylint: disable=missing-docstring
#################################################################
# DO NOT MODIFY THIS HEADER #
# MOOSE - Multiphysics Object Oriented Simulation Environment #
# #... | Chuban/moose | python/chigger/tests/chigger/test_chigger.py | Python | lgpl-2.1 | 2,346 |
#!/usr/bin/env python
# Module: generator2.py
# Purpose: sample generator classes #2
# Date: N/A
# Notes:
# 1) Test python code
# 2) Ref: https://docs.python.org/2/reference/expressions.html
import numpy as np
print "generator2.py: python generator test code #2"
# echo from the generator examples
# - ... | wadester/wh_test_py | generator2.py | Python | gpl-2.0 | 2,181 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nachi Ueno, NTT MCL, 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... | tanglei528/horizon | openstack_dashboard/dashboards/admin/routers/tabs.py | Python | apache-2.0 | 1,350 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 单例模式
Desc : 实际上python里面不需要单例模式,直接用模块就行了
"""
def singleton(cls, *args, **kw):
"""定义一个单例装饰器"""
instances = {}
def _singleton():
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return... | tongpo/Holle-World | py/python3-cookbook/basic/mydesign/d01_singleton.py | Python | gpl-2.0 | 611 |
# *****************************************************************************
# Copyright (c) 2014, 2018 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distrib... | ibm-watson-iot/iot-python | src/wiotp/sdk/device/deviceInfo.py | Python | epl-1.0 | 2,709 |
# Generated by Django 1.11.15 on 2018-10-06 14:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mail', '0004_auto_20181005_1537'),
]
operations = [
migrations.AlterField(
model_name='mailtemplate',
name='usage',... | vIiRuS/Lagerregal | mail/migrations/0005_auto_20181006_1619.py | Python | bsd-3-clause | 784 |
#
# Copyright 2008-2017 Red Hat, Inc.
#
# 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 program is distributed ... | nirs/vdsm | lib/vdsm/virt/vmpowerdown.py | Python | gpl-2.0 | 7,550 |
# Copyright 2011 VMware, 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 by a... | sajuptpm/neutron-ipam | neutron/service.py | Python | apache-2.0 | 10,715 |
import unittest
from robot.errors import DataError
from robot.running.userkeyword import (EmbeddedArgs, EmbeddedArgsTemplate,
UserKeywordHandler)
from robot.running.arguments import EmbeddedArguments, UserKeywordArgumentParser
from robot.utils.asserts import assert_equals, assert... | yahman72/robotframework | utest/running/test_userhandlers.py | Python | apache-2.0 | 6,393 |
# Copyright 2017 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py | Python | apache-2.0 | 4,836 |
import copy
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied, FieldError
from django.db import models, transaction
from django.forms.models import modelform_factory, modelform_defines_fields
from django.http import Http404, HttpResp... | ly0/xxadmin | xadmin/views/edit.py | Python | bsd-3-clause | 20,025 |
VERSION = '0.1.9.1'
VERSION_PRIMARY = '0'
VERSION_SECONDARY = '1'
VERSION_MINOR = '9'
VERSION_FIX = '1' | iissnan/tita | version.py | Python | gpl-2.0 | 104 |
try:
# Python 3
from collections.abc import Mapping
except ImportError:
# Python 2.7
from collections import Mapping
from rollbar.lib import text, transforms
from rollbar.lib.transforms.scrub_redact import ScrubRedactTransform, REDACT_REF
from rollbar.test import BaseTest
class NotRedactRef():
p... | rollbar/pyrollbar | rollbar/test/test_scrub_redact_transform.py | Python | mit | 2,252 |
import os
def pytest_load_initial_conftests(early_config, parser, args):
"""Configure test runs."""
# set env variable
os.environ['LEAFLETS_TEST'] = 'test.py'
| mruwnik/leaflets | tests/pytest_plugin.py | Python | gpl-3.0 | 173 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import os
import json
import tempfile
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from werkzeug.wrappers import Respon... | Mushiyo/isso | isso/tests/test_comments.py | Python | mit | 15,825 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import stock_picking
| Comunitea/CMNT_00098_2017_JIM_addons | stock_picking_variant_mgmt/models/__init__.py | Python | agpl-3.0 | 117 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | Daniel-CA/odoomrp-wip-public | purchase_pricelist_rules/models/purchase.py | Python | agpl-3.0 | 11,399 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Inventory',
'version': '1.1',
'summary': 'Manage your stock and logistics activities',
'description': "",
'website': 'https://www.odoo.com/page/warehouse',
'depends': ['product', 'barco... | rven/odoo | addons/stock/__manifest__.py | Python | agpl-3.0 | 3,674 |
import transmissionrpc
from core import config
class TorrentClient(object):
def __init__(self, clientConfig=config.get('downloads.torrentClient')):
super(TorrentClient, self).__init__()
self._client = transmissionrpc.Client(**clientConfig)
def add(self, torrentFile, destinationPath):
... | twissell-/rui | rui/core/torrentClient.py | Python | mit | 456 |
# 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 use this file except in compliance with
# the License. You may obtain a ... | dcorbacho/libcloud | libcloud/compute/drivers/kili.py | Python | apache-2.0 | 3,067 |
# -*- coding: utf-8 -*-
import urllib.parse
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider
from scrapy.spiders import Rule
from sc_scrapy.items import SongCiItem
from sc_scrapy.spiders.spider_utils import ignore_case_re
class GushiwenSpider(CrawlSpider):
name = "gushiwen"... | wings27/sc_spider | sc_scrapy/spiders/gushiwen.py | Python | apache-2.0 | 1,779 |
import wx
import re
import os
import time
import inspect
cmdFolder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
gcRegex = re.compile("[-]?\d+[.]?\d*")
from cnc import CNC
from reprapenums import RepRapEventEnum
from gcframe import GcFrame
from properties import Pr... | jbernardis/repraptoolbox | src/Printer/printmon.py | Python | gpl-3.0 | 26,866 |
#!/usr/bin/env python
# encoding=utf-8
import sys
import argparse
import requests
import urllib
import re
# parse the console params
parser = argparse.ArgumentParser()
parser.add_argument('domain', help='a domain like baidu.com | a ipv4 addr', type=str)
parser.add_argument('-v', help='show request detail info', actio... | wangdiwen/ip2geo | ip2geo.py | Python | mit | 2,340 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Optional
from hwt.code import If, Switch, CodeBlock
from hwt.code_utils import rename_signal
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.defs import BIT
from hwt.hdl.types.enum import HEnum
from hwt.hdl.types.struct import HStruct
from hwt.i... | Nic30/hwtLib | hwtLib/peripheral/usb/usb2/device_core.py | Python | mit | 20,195 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Wrapper for all miscellaneous functions and classes from psychopy.tools
"""
# pylint: ... | psychopy/versions | psychopy/misc.py | Python | gpl-3.0 | 1,562 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='veh-platform',
version='0.0.1',
description='Prototyping and documentation environment for the vehicle platform.',
l... | localmotors/veh-engineering | veh-platform/setup.py | Python | unlicense | 548 |
# Copyright 2020 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | jhuapl-boss/intern | intern/resource/dvid/tests/test_data_instance.py | Python | apache-2.0 | 5,123 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow | google/cloud/dialogflow_v2/services/conversation_models/transports/base.py | Python | apache-2.0 | 10,509 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/robj | robj_test/testserver/datastore.py | Python | apache-2.0 | 4,339 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
###########################################################
# © 2011 Daniel 'grindhold' Brendle and Team
#
# This file is part of Skarphed.
#
# Skarphed is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as ... | skarphed/skarphed | core/lib/users.py | Python | agpl-3.0 | 11,598 |
"""
Module for abstract serializer/unserializer base classes.
"""
from io import StringIO
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
DEFER_FIELD = object()
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class Serialization... | fenginx/django | django/core/serializers/base.py | Python | bsd-3-clause | 11,607 |
import os
import re
import stat
import socket
import ntpath
import traceback
import threading
from paramiko.message import Message
from paramiko.py3compat import byte_chr
from paramiko.buffered_pipe import BufferedPipe
# CloudScape Libraries
from cloudscape.common import logger
from cloudscape.agent.config import Agen... | djtaylor/cloudscape | python/cloudscape/agent/win/sshd/scp.py | Python | gpl-3.0 | 11,807 |
def score(i, name):
return (i + 1) * sum(ord(c) - ord('A') + 1 for c in name)
def solve():
names = open('names.txt').read().replace('"', '').split(',')
names.sort()
return sum(score(i, name) for i, name in enumerate(names))
if __name__ == '__main__':
print solve()
| elemel/project-euler | src/22.py | Python | mit | 297 |
# -*- coding: utf-8 -*-
# Copyright (c) 2002 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to add a new language to the project.
"""
from __future__ import unicode_literals
from PyQt5.QtWidgets import QDialog
from .Ui_AddLanguageDialog import Ui_AddLanguageDialog
class Add... | testmana2/test | Project/AddLanguageDialog.py | Python | gpl-3.0 | 1,142 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apac... | varunarya10/ironic | ironic/openstack/common/lockutils.py | Python | apache-2.0 | 9,977 |
"""
There are two types of functions:
1) defined function like exp or sin that has a name and body
(in the sense that function can be evaluated).
e = exp
2) undefined function with a name but no body. Undefined
functions can be defined using a Function class as follows:
f = Function('f')
(the result... | amitjamadagni/sympy | sympy/core/function.py | Python | bsd-3-clause | 74,218 |
from Command import Command
import Constants
import subprocess
import logging
logger = logging.getLogger("Command")
logger.setLevel(logging.INFO)
## Command that executes a shutdown operation on the client computer.
#
#
class ShutdownCommand(Command):
def __init__(self):
Command.__init__(self, Constants.S... | tadgh/Shizuka | src/client/ShutdownCommand.py | Python | mit | 716 |
from copy import copy
from itertools import combinations
import pytest
from stp_core.loop.eventually import eventually
from stp_core.network.auth_mode import AuthMode
from stp_core.test.helper import Printer, prepStacks, \
checkStacksConnected, chkPrinted
from stp_zmq.test.helper import genKeys
from stp_zmq.kit_z... | evernym/zeno | stp_zmq/test/test_zstack_communication.py | Python | apache-2.0 | 2,211 |
"""
WSGI config for somethingcool project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | jailuthra/taskzilla | somethingcool/wsgi.py | Python | mit | 403 |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | intel-analytics/analytics-zoo | pyzoo/test/zoo/orca/learn/spark/test_estimator_for_spark.py | Python | apache-2.0 | 25,922 |
from . import Checker
class ExactChecker(Checker):
async def check(self, sandbox, task):
output = await sandbox.read("/tmp/output.txt")
task.accepted = output == task.testcase.output
task.verdict = "AC" if task.accepted else "WA"
| johnchen902/toyoj | judge/toyojjudge/checker/exact.py | Python | agpl-3.0 | 259 |
from stomp.connect import StompConnection11
import logging
log = logging.getLogger("darwindb")
##### Code for STOMP debugging
#import logging
#console = logging.StreamHandler()
#console.setFormatter(logging.Formatter('[%(asctime)s] %(name)-12s %(levelname)-8s %(message)s'))
#logging.getLogger().addHandler(console)
#l... | fasteroute/darwin-db | darwindb/client.py | Python | apache-2.0 | 2,093 |
import basic_container
class RubyContainer(basic_container.BasicContainer):
def __init__(self):
super(self.__class__, self).__init__()
self.image = "ruby"
self.command = "ruby main.rb"
self.file_extension = ".rb"
| tobegit3hub/lambda-docker | runtime/ruby_container.py | Python | mit | 234 |
# -*- coding: utf-8 -*-
from django.conf import settings
__all__ = (
'common',
)
def common(request):
return {
'settings': settings,
}
| umax/diabetto2 | diabetto/context_processors.py | Python | gpl-2.0 | 159 |
from nose.tools import *
import NAME
def setup():
print "SETUP!"
def teardown():
print "TEAR DOWN!"
def test_basic():
print "I RAN!" | valueforvalue/pybak | tests/pybak_tests.py | Python | mit | 147 |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | wunderlins/learning | python/zodb/lib/osx/ZEO/tests/ThreadTests.py | Python | gpl-2.0 | 5,136 |
# 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, software
# d... | ruyang/ironic | ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py | Python | apache-2.0 | 14,369 |
from rpi_courses.sis_parser import CourseCatalog
from rpi_courses import models
from test.rpi_courses.utils import TestCaseForModel
from mock import Mock
import os
import unittest
from time import mktime
from constants import SIS_FILE_SPRING2012
with open(SIS_FILE_SPRING2012) as f:
CONTENTS_SPRING2012 = f.read()... | jeffh/rpi_courses | test/rpi_courses/test_sis_parser.py | Python | mit | 13,856 |
from OldGameofLife import OldUniverse
import pygame
from pygame.locals import *
import time
from copy import deepcopy
class environment(object):
def __init__(self):
self.universe = OldUniverse()
width = int(input("Grid width: "))
height = int(input("Grid height: "))
self.cell_size =... | ClaymoreAdrendamar/Game-of-life | Old/OldGameofLifeGUI.py | Python | gpl-3.0 | 5,532 |
__author__ = 'Allison MacLeay'
import matplotlib.pyplot as plt
def points(array):
plt_range = get_axes(array)
print plt_range
#plt.scatter(array, 'ro')
plt.scatter(array[0], array[1])
#plt.axis(plt_range)
plt.show()
def get_axes(array):
x_max = max(array[0])
x_min = min(array[0])
... | alliemacleay/MachineLearning_CS6140 | utils/plots.py | Python | mit | 641 |
import os
import sys
b = sys.argv[1]
maxi = int(sys.argv[2])
for i in range(1,maxi):
c = b+str(i)+'.jpg'
print('fetching ' + c)
os.system('aria2c ' + c)
| isubham/isubham.github.io | down.py | Python | mit | 167 |
COLORS = ['red', 'green', 'blue']
def get_number_rows_cols(image):
return len(image), len(image[0])
def create_new_image_matrix(rows, cols):
new_image = [
[() for x in range(cols)] for y in range(rows)
]
return new_image
def invert_pixel(pixel):
return [255 - x for x in pixel]
def li... | pepincho/Python-Course-FMI | 02_challenge/solution.py | Python | mit | 2,343 |
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_4(fissureCoude):
"""
problème de fissure du Coude : ASCOU09A
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
... | FedoraScientific/salome-smesh | src/Tools/blocFissure/CasTests/fissureCoude_4.py | Python | lgpl-2.1 | 4,424 |
# -*- coding: utf-8 -*-
#
# Moonstone is platform for processing of medical images (DICOM).
# Copyright (C) 2009-2011 by Neppo Tecnologia da Informação LTDA
# and Aevum Softwares LTDA
#
# This file is part of Moonstone.
#
# Moonstone is free software: you can redistribute it and/or modify
# it under the terms of the GN... | aevum/moonstone | src/moonstone/gui/qt/volumeview.py | Python | lgpl-3.0 | 24,356 |
#===============================================================================
# PyTyle - A manual tiling manager
# Copyright (C) 2009 Andrew Gallant <andrew@pytyle.com>
#
# 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
# t... | BurntSushi/pytyle1 | PyTyle/Tilers/Maximal.py | Python | gpl-3.0 | 3,426 |
# Copyright 2009 Matt Chaput. 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 the... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/whoosh/automata/fst.py | Python | mit | 44,863 |
"""
Count the number of matches between a phage and some hosts for each file
and report the mean, median, and stdev of the number of hits per phage.
You can also do this with perl and bash on the command line:
perl -lane 'print "$#F\n"' NCIDS_FILE | awk '{s+=$1}END{print "Average:",s/NR}'
"""
import os
import ... | linsalrob/PhageHosts | code/summarize_mathes.py | Python | mit | 636 |
#!/usr/bin/python
from app import app
if __name__ == '__main__':
from config import SERVER_HOST, SERVER_PORT, DEBUG
app.run(host=SERVER_HOST, port=SERVER_PORT, debug = DEBUG)
| te11ur/twitter_watcher | run.py | Python | mit | 178 |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="scatter3d.error_x", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/error_x/_width.py | Python | mit | 438 |
import unittest
from lib.data_structures.graphs.simple_graph import SimpleGraph
from lib.data_structures.graphs.breadth_first_search import BreathFirstSearchGraph
from lib.data_structures.graphs.depth_first_search import DepthFirstSearchGraph
from lib.data_structures.graphs.topological_sort import TopologicalGraph
from... | anthonynsimon/python-data-structures-algorithms | tests/test_graphs.py | Python | apache-2.0 | 2,348 |
#!/usr/bin/python
#coding=utf-8
# from __future__ import with_statement # This isn't required in Python 2.6
# Copyright (C) 2013 Roberto Ripio, Alberto Miguelez & Rafael Sanchez
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | rripio/FIRtro | bin/mcd_orig.py | Python | gpl-3.0 | 5,584 |
#!/usr/bin/python2.7
# Link a python source tree into a single self-executing zip archive.
# The zip can also be extracted and run manually.
#
# Distributed under a BSD license.
# Copyright (c) 2012-2014 Mike Solomon
import cStringIO
import compileall
import imp
import marshal
import optparse
import os
import shutil
... | mzhaom/trunk | third_party/plink/plink.py | Python | apache-2.0 | 11,643 |
#!/usr/bin/python
#######################################################################
# A simple script that prints contents from table of interest from DB #
#######################################################################
import MySQLdb as mdb
import sys
import csv
import re
from mySQLConnect import mysql_... | mnikoli/GARLIC | scripts/view_table_data.py | Python | gpl-3.0 | 1,506 |
# -*- 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):
# Adding unique constraint on 'SocialGroup', fields ['slug', 'site']
db.creat... | suselrd/django-social-network | social_network/migrations/0012_unique_slug_per_site.py | Python | bsd-3-clause | 14,753 |
##
# Copyright (c) 2005-2017 Apple 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 by applicable l... | macosforge/ccs-calendarserver | twistedcaldav/test/test_timezones.py | Python | apache-2.0 | 10,266 |
"""
Test the keycache
"""
import os
import tempfile
import shutil
import unittest
from unittest import mock
from scitokens.utils.keycache import KeyCache
from scitokens.utils.errors import UnableToCreateCache
from cryptography.hazmat.primitives.asymmetric.rsa import generate_private_key
from cryptography.hazmat.backen... | scitokens/scitokens | tests/test_keycache.py | Python | apache-2.0 | 8,359 |
from collections import OrderedDict
import sys
import warnings
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
from django.core.paginator import InvalidPage
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from ... | rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/contrib/admin/views/main.py | Python | apache-2.0 | 17,793 |
import doctest
from datetime import datetime
from insights.parsers import libvirtd_log
from insights.tests import context_wrap
LIBVIRTD_LOG = """
2013-10-23 17:32:19.909+0000: 14069: debug : do_open:1174 : trying driver 0 (Test) ...
2013-10-23 17:32:19.909+0000: 14069: debug : do_open:1180 : driver 0 Test returned D... | RedHatInsights/insights-core | insights/parsers/tests/test_libvirtd_log.py | Python | apache-2.0 | 3,176 |
import base64
def toBase64(s):
return base64.b64encode(str(s))
def fromBase64(s):
return base64.b64decode(str(s))
| HellTech/NAG_IoE_2016 | 30_HellTech_1602_1/08_Meteostanice_GUI_v2/Meteo2/base64function.py | Python | gpl-3.0 | 119 |
from CatalogSurfaceItem import *
WTTextureName = 0
WTColor = 1
WTBorderList = 2
WTBasePrice = 3
BDTextureName = 0
BDColor = 1
All = (1000,
1010,
1020,
1030,
1040,
1050,
1060,
1070)
WallpaperTypes = {1000: ('phase_5.5/maps/flat_wallpaper1.jpg',
CTFlatColor,
(0, 1000),
180),
1100: ('phase_... | ksmit799/Toontown-Source | toontown/catalog/CatalogWallpaperItem.py | Python | mit | 20,537 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | photoninger/ansible | lib/ansible/modules/network/aci/aci_ap.py | Python | gpl-3.0 | 4,504 |
from ..syntax_production import Production
from ..symbol_type import SymbolType
from .base_types import ObjectSet, Item
from .base_algorithms import calcClosure, goto, calcFirstDict
import unittest
BeginningNonterminal = '__Begin'
EndingTerminal = '__End'
def construct(productionList, isDebug=False):
# 初始化symbo... | xdegtyarev/sublime-config | Unity Shader/vendor/beautify_unity_shader/app/lr/lr1.py | Python | mit | 4,634 |
# A demo of a fairly complex dialog.
#
# Features:
# * Uses a "dynamic dialog resource" to build the dialog.
# * Uses a ListView control.
# * Dynamically resizes content.
# * Uses a second worker thread to fill the list.
# * Demostrates support for windows XP themes.
# If you are on Windows XP, and specify a ... | zhanqxun/cv_fish | win32/Demos/win32gui_dialog.py | Python | apache-2.0 | 15,197 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-05 09:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rules', '0057_auto_20180302_1312'),
]
operations = [
migrations.AddField(
model_name='source',
... | StamusNetworks/scirius | rules/migrations/0058_source_public_source.py | Python | gpl-3.0 | 440 |
"""
This algorithm was created for sdbm (a public-domain reimplementation of ndbm)
database library.
It was found to do well in scrambling bits, causing better distribution of the keys
and fewer splits.
It also happens to be a good general hashing function with good distribution.
The actual func... | TheAlgorithms/Python | hashes/sdbm.py | Python | mit | 1,342 |
#!/usr/bin/env python3
__version__ = '0.2.0'
from . import quickstart
from .game import *
from .forums import *
from .actors import *
from .multiplayer import *
from .messages import *
from .tokens import *
from .errors import *
| kxgames/kxg | kxg/__init__.py | Python | mit | 231 |
# Copyright 2009-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | Juniper/euca2ools | euca2ools/commands/ec2/resetimageattribute.py | Python | bsd-2-clause | 1,964 |
from nose.tools import assert_equal,raises
import networkx as nx
def test_smetric():
g = nx.Graph()
g.add_edge(1,2)
g.add_edge(2,3)
g.add_edge(2,4)
g.add_edge(1,4)
sm = nx.s_metric(g,normalized=False)
assert_equal(sm, 19.0)
# smNorm = nx.s_metric(g,normalized=True)
# assert_equal(sm... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/tests/test_smetric.py | Python | bsd-2-clause | 435 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.