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 -*-
# © 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestMedicalPatient(TransactionCase):
def setUp(self):
super(TestMedicalPatient, self).setUp()
... | laslabs/vertical-medical | medical_patient_species/tests/test_medical_patient.py | Python | agpl-3.0 | 1,799 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.forms import (
CharField, DateField, EmailField, FileField, Form, GenericIPAddressField,
HiddenInput, ImageField, IPAddressField, MultipleChoiceField,
MultiValueField, MultiWidget, PasswordInput, SelectMultiple, Sl... | edevil/django | tests/forms_tests/tests/test_extra.py | Python | bsd-3-clause | 35,908 |
# Example for: model.patch_ss_templates() and model.patch_ss()
# This will patch CYS-CYS disulfide bonds using disulfides in aligned templates:
from modeller import *
log.verbose()
env = environ()
env.io.atom_files_directory = ['.', '../atom_files']
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.paramet... | bjornwallner/proq2-server | apps/modeller9v8/examples/commands/patch_disulfides.py | Python | gpl-3.0 | 1,683 |
from ..iter_wrapper import IterWrapper
import unittest
class IterValueTest(unittest.TestCase):
""" Test cases of IterValue """
def test_iterable(self):
""" Test that an iterable is returned properly """
expected = [1,2,3]
actual = IterWrapper(expected)
self.ass... | cloew/KaoJson | kao_json/Test/test_iter_wrapper.py | Python | mit | 599 |
"""
WSGI config for chp2 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chp2.settings")
from django.core.wsgi im... | tzaffi/git-in-practice-repo | chp2/chp2/wsgi.py | Python | mit | 383 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright Camptocamp SA 2011
# SQL inspired from OpenERP original code
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | open-synergy/account-financial-reporting | account_financial_report_webkit/report/common_partner_balance_reports.py | Python | agpl-3.0 | 17,006 |
def test_stub():
return True | openspending/datapackage-pipelines-fiscal | tests/test_main.py | Python | mit | 32 |
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe import _
def execute(filters=None):
if not filters: filters = {}
if not filters.get("date"):
frappe.throw(_("Please select date"))
columns = get_columns(filters)
... | mhbu50/erpnext | erpnext/accounts/report/share_ledger/share_ledger.py | Python | gpl-3.0 | 1,816 |
import marshmallow
from marshmallow import Schema as MarshmallowSchema
from marshmallow import fields # noqa
from marshmallow.exceptions import ValidationError as MarshmallowValidationError
from rest_framework.serializers import BaseSerializer, ValidationError
IS_MARSHMALLOW_LT_3 = int(marshmallow.__version__.split(... | tomchristie/django-rest-marshmallow | rest_marshmallow/__init__.py | Python | isc | 3,269 |
# coding=utf-8
from functools import partial
import Pyro4
from pyage.core import address
from pyage.core.stop_condition import StepLimitStopCondition
from pyage_forams.solutions.distributed.neighbour_matcher import Neighbour2dMatcher
from pyage_forams.solutions.agent.remote_aggegate import create_remote_agent
from py... | maciek123/pyage-forams | pyage_forams/conf/distributed2d/upperright.py | Python | gpl-2.0 | 1,686 |
"""
The child process.
"""
from __future__ import unicode_literals
from prompt_toolkit.eventloop.base import EventLoop
from prompt_toolkit.eventloop.posix_utils import PosixStdinReader
from prompt_toolkit.document import Document
from pygments.token import Token
from .key_mappings import prompt_toolkit_key_to_vt100_k... | jonathanslenders/pymux-test | pymux/process.py | Python | bsd-3-clause | 12,651 |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
from... | worldbit/worldbit | qa/rpc-tests/p2p-acceptblock.py | Python | mit | 12,336 |
import os
from subprocess import Popen
try:
import thread
except ImportError:
import _thread as thread # Py3K changed it.
import platform
from .util import kill_pid
from pulsar.managers.base.directory import DirectoryBaseManager
from pulsar.managers import status
from logging import getLogger
log = getLogger... | jmchilton/pulsar | pulsar/managers/unqueued.py | Python | apache-2.0 | 6,175 |
#!/usr/bin/python
#------------------------------------------------------------------------------
class Solution:
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
positive = (dividend < 0) is (divisor < 0)
divid... | kyle8998/Practice-Coding-Questions | leetcode/29-Medium-Divide-Two-Integers/answer.py | Python | unlicense | 793 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | ity/pants | src/python/pants/backend/project_info/tasks/ide_gen.py | Python | apache-2.0 | 31,400 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import os
import re
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import REDIRECT_FIELD_NAME, S... | bikong2/django | tests/auth_tests/test_views.py | Python | bsd-3-clause | 45,028 |
#
# tsne.py
#
# Implementation of t-SNE in Python. The implementation was tested on Python 2.7.10, and it requires a working
# installation of NumPy. The implementation comes with an example on the MNIST dataset. In order to plot the
# results of this example, a working installation of matplotlib is required.
#
# The ... | legacysurvey/pipeline | py/legacyanalysis/tsne.py | Python | gpl-2.0 | 11,089 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/krl1to5/Work/FULL/Sequence-ToolKit/2016/resources/ui/dialogs/xml_preview.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_m... | carlos-ferras/Sequence-ToolKit | view/dialogs/ui_xml_preview.py | Python | gpl-3.0 | 2,850 |
import datetime
import unittest
from django.utils.dateparse import parse_duration
from django.utils.duration import (
duration_iso_string, duration_microseconds, duration_string,
)
class TestDurationString(unittest.TestCase):
def test_simple(self):
duration = datetime.timedelta(hours=1, minutes=3, s... | georgemarshall/django | tests/utils_tests/test_duration.py | Python | bsd-3-clause | 3,864 |
# -*- coding: UTF-8 -*-
#------------------------------------------------------------------------------
# file: fields.py
# License: LICENSE.TXT
# Author: Ioannis Tziakos
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
i... | ContinuumIO/ashiba | enaml/docs/source/sphinxext/refactordoc/fields.py | Python | bsd-3-clause | 8,370 |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory tha... | navcoindev/navcoin-core | contrib/seeds/generate-seeds.py | Python | mit | 4,508 |
"""
# The NASA93 Data Set
Standard header:
"""
from __future__ import division,print_function
import sys
sys.dont_write_bytecode = True
from lib import *
"""
Data:
Possible Splits= ["variance", "centroid", "median"]
"""
def nasa93(weighFeature = False, split = "median"):
vl=1;l=2;n=3;h=4;vh=5;xh=6;_=0
return da... | ai-se/george | Models/nasa93.py | Python | mit | 8,047 |
import os
import sys
from pathlib import Path
from pkg_resources import VersionConflict, require
from setuptools import find_packages, setup
with open("README.md") as f:
long_description = f.read()
with open("requirements.txt") as f:
requirements = f.read().splitlines()
try:
require("setuptools>=38.3")
... | pyannote/pyannote-audio | setup.py | Python | mit | 1,809 |
# -*- coding: UTF-8 -*-
# Copyright 2017 Luc Saffre
# License: BSD (see file COPYING for details)
from .demo import *
SITE = Site(globals())
# SITE = Site(
# globals(),
# remote_user_header='REMOTE_USER')
DEBUG = True
# SITE.appy_params.update(raiseOnError=True)
# SITE.appy_params.update(pythonWithUnoPath='/us... | khchine5/book | lino_book/projects/adg/settings/doctests.py | Python | bsd-2-clause | 400 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2010 University of Zürich
# Author: Rico Sennrich <sennrich@cl.uzh.ch>
# For licensing information, see LICENSE
from __future__ import division,print_function,unicode_literals
import sys
import time
import math
from operator import itemgetter
from bleualign.gale_... | rsennrich/Bleualign | bleualign/align.py | Python | gpl-2.0 | 47,568 |
# coding=utf-8
#
# 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");... | iemejia/incubator-beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/tostring_test.py | Python | apache-2.0 | 2,331 |
test_type = {
'APP_TEST':"1",
'STANDARD_TEST':'0',
'SERVER_TEST':'2',
'FHIR_TEST':'3'
} | ideaworld/FHIR_Tester | FHIR_Tester_backend/home/config.py | Python | mit | 103 |
# -*- coding: utf-8 -*-
"""
Test accounts module
"""
import os
from decimal import Decimal
from mock import patch
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
from django.test import TestCase
from .factories import UserFactory, UserWithAvatarFactory, AdminFactory
from .mo... | KlubJagiellonski/Politikon | accounts/tests.py | Python | gpl-2.0 | 18,113 |
from __future__ import absolute_import
from kombu import Connection, Producer
from kombu import pools
from kombu.connection import ConnectionPool
from kombu.utils import eqhash
from .case import Case, Mock
class test_ProducerPool(Case):
Pool = pools.ProducerPool
class MyPool(pools.ProducerPool):
d... | 1stvamp/kombu | kombu/tests/test_pools.py | Python | bsd-3-clause | 7,242 |
#!/usr/bin/env python
# coding=utf-8
import pprint
import csv
import click
import requests
import datetime as datetime
from datetime import date
from xml.etree import ElementTree as ET
import os
# from random import sample
import random
import json
import copy
# import os
# import json
# import loggi... | Fatman13/gta_swarm | hb_er.py | Python | mit | 12,262 |
"""
A module for shelling out.
Keep in mind that this module is insecure, in that it can give whomever has
access to the master root execution access to all salt minions.
"""
import base64
import fnmatch
import functools
import glob
import logging
import os
import re
import shutil
import subprocess
import sys
import ... | saltstack/salt | salt/modules/cmdmod.py | Python | apache-2.0 | 166,299 |
import numpy as np
from copy import deepcopy
from tools.belief import DiscreteBelief
#################################################################
# Implements the Tiger POMDP problem
#################################################################
class TigerPOMDP():
# constructor
def __init__(self,
... | sisl/Chimp | chimp/simulators/pomdp/models/tiger.py | Python | apache-2.0 | 5,397 |
import csv
import sys
from models import *
from datetime import datetime
import codecs
import json
# from models import Attorney, Organization
from flask_mail import Message
def load_attorneys_from_csv(filename):
with codecs.open(filename, mode='rb', encoding='utf-8') as csvfile:
attorneys = [row for row ... | mitzvotech/honorroll | app/utils.py | Python | mit | 2,178 |
#!/usr/bin/env python
# Metarunlog, experiment management tool.
# Author: Tom Sercu
# Date: 2015-01-23
from metarunlog import cfg # NOTE cfg is modified by MetaRunLog._loadBasedirConfig() with custom configuration.
from metarunlog.exceptions import *
from metarunlog.util import nowstring, sshify, _decode_dict, _decode... | tomsercu/metarunlog | metarunlog/__init__.py | Python | mit | 22,170 |
#===--- protocol_graph.py -------------------------*- coding: utf-8 -*----===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | slavapestov/swift | utils/protocol_graph.py | Python | apache-2.0 | 6,618 |
#########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | cloudify-cosmo/cloudify-agent-installer-plugin | worker_installer/tests/__init__.py | Python | apache-2.0 | 2,712 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import json
import urllib.request
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from smallsmilhandler import SmallSMILHandler
class KaraokeLocal():
"""
Programa principal
"""
def __init__ (self):
self.original ... | daviddpurjc/ptavi-p3 | karaoke.py | Python | apache-2.0 | 2,151 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py | Python | mit | 2,479 |
import sys
import os
import subprocess
import re
def run(input_fasta_dirpath):
"""This script is very simple, and not very important. It simply reformats the fasta files that were downloaded from the IMGT website, so that there are no white space lines, and that each sequence for each gene is only one line. Note t... | nbstrauli/influenza_vaccination_project | scripts/pipeline/reformat_imgt_fasta_files.py | Python | cc0-1.0 | 1,511 |
#
# file: __init__.py
#
# author: Copyright (C) 2017 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
# distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0... | jasmin-j/distortos | scripts/PrettyPrinters/__init__.py | Python | mpl-2.0 | 826 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Models.FeatureProcessing import *
from keras.models import Sequential
from keras.layers import Activation, Dense, LSTM
from keras.optimizers import Adam, SGD
import numpy as np
import abc
from ClassificationModule import ClassificationModule
class descriptionreponame... | Ichaelus/Github-Classifier | Application/Models/ClassificationModules/descriptionreponamelstm.py | Python | mit | 3,641 |
import hashlib
import binascii
try:
from Crypto.Cipher import AES
except ImportError: # Damn you, OS X
import crypto, sys
sys.modules['Crypto'] = crypto
from crypto.Cipher import AES
PADDING = b'\x42'
BLOCK_SIZE = 16
KEY_LENGTH = 32
STREAM_LENGTH = 3
def _ensure_bytes_key(key, length):
if ty... | AlfioEmanueleFresta/practical-ecb-lib | cp_ecb/encryption.py | Python | gpl-3.0 | 4,616 |
import os
from textwrap import dedent
import os.path
import shutil
try:
import unittest2 as unittest
except ImportError:
import unittest
from rope.base.exceptions import RopeError, ResourceNotFoundError
from rope.base.fscommands import FileSystemCommands
from rope.base.libutils import path_to_resource
from ro... | python-rope/rope | ropetest/projecttest.py | Python | lgpl-3.0 | 46,324 |
from platforms.desktop.desktop_service import DesktopService
from specializations.dlv.dlv_answer_sets import DLVAnswerSets
class DLVDesktopService(DesktopService):
"""Is an extention of DesktopService for DLV's solver"""
def __init__(self, exe_path):
super(DLVDesktopService, self).__init__(exe_pat... | SimoneLucia/EmbASP-Python | specializations/dlv/desktop/dlv_desktop_service.py | Python | mit | 529 |
#!/usr/bin/python
import ldap
import Pmw
import subprocess
import os
from Tkinter import *
class Sistema:
dados_impressao=""
def __init__(self,raiz):
self.run(raiz)
def run(self,raiz):
# Create the ScrolledListBox.
self.box = Pmw.ScrolledListBox(raiz,labelpos='nw',label_text='Lista de I... | clodonil/controle-impressao | controle_de_impressao.py | Python | lgpl-3.0 | 4,148 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (C) 2010-2022 GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero General Public
# License a... | gem/oq-engine | openquake/hmtk/seismicity/selector.py | Python | agpl-3.0 | 16,424 |
#!/usr/bin/env python3
import json
import fileinput
import argparse
import os
from batman import batman
from alfred import alfred
from rrd import rrd
from nodedb import NodeDB
from d3mapbuilder import D3MapBuilder
# Force encoding to UTF-8
import locale # Ensures that subsequent open... | FreifunkMD/ffmap-backend | bat2nodes.py | Python | bsd-3-clause | 2,343 |
import ninjag
import os
from read_all import read_all
def test():
f_inputs = [
"input/in1_const.yaml",
"input/in1_rules.yaml",
"input/in1_tasks.yaml",
]
f_answer = "output/out1_combined.ninja"
f_solution = "solution/sol1.ninja"
cmd = " ".join(["ninjag", f_answer, *f_inp... | yuhangwang/ninjag-python | test/frontend/c/test_2.py | Python | mit | 443 |
# -*- coding: utf-8 -*-
"""
Test cases to cover Accounts-related behaviors of the User API application
"""
from copy import deepcopy
import datetime
import hashlib
import json
import ddt
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.testcases import TransactionTestCase
... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/user_api/accounts/tests/test_views.py | Python | agpl-3.0 | 37,691 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | StefanRijnhart/odoomrp-wip | product_purchase_warrant/__openerp__.py | Python | agpl-3.0 | 1,425 |
# GrandPA, a LedBar lighting controller.
#
# Copyright (c) 2010 aszlig <"^[0-9]+$"@regexmail.net>
#
# GrandPA 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 opti... | aszlig/GrandPA | grandpa/color.py | Python | gpl-3.0 | 6,805 |
#!/usr/bin/env python
#coding=utf-8
# Nathive (and this file) 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 newer.
#
# You should have received a copy of the GNU General ... | johnnyLadders/Nathive_CITA | nathive/gui/utils.py | Python | gpl-3.0 | 1,028 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py | Python | apache-2.0 | 20,111 |
from django.views.generic.base import TemplateView
from django.shortcuts import get_object_or_404
from daprojects_core import models
from .maps import get_map_for_project
class HomeView(TemplateView):
template_name = 'daprojects_webapp/home.html'
def get_context_data(self, **kwargs):
context = supe... | PIWEEK/dungeons-and-projects | server/daprojects_webapp/views.py | Python | agpl-3.0 | 1,477 |
__copyright__ = "Uwe Krien"
__license__ = "GPLv3"
import pandas as pd
# import geopandas as gpd
import numpy as np
import config as cfg
import configuration as config
import logging
import os
import feedin as f
import pvlib
import datetime
import oemof.tools.logger as logger
from matplotlib import pyplot as plt
# imp... | rl-institut/reegis_hp | reegis_hp/de21/analysis.py | Python | gpl-3.0 | 29,649 |
import re
import json
import itertools
from .common import InfoExtractor
from .subtitles import SubtitlesInfoExtractor
from ..utils import (
compat_urllib_request,
compat_str,
get_element_by_attribute,
get_element_by_id,
ExtractorError,
)
class DailymotionBaseInfoExtractor(InfoExtractor):
@s... | daviddupont69/CouchPotatoServer | couchpotato/core/providers/trailer/vftrailers/youtube_dl/extractor/dailymotion.py | Python | gpl-3.0 | 7,924 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst... | WorldBank-Transport/ckanext-resourcemeta | setup.py | Python | agpl-3.0 | 3,649 |
# 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 the... | openstack/blazar | blazar/status.py | Python | apache-2.0 | 12,588 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-07-21 08:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0031_appversion_last'),
]
operations = [
migrations.RenameField(
... | Vespapp/vespapp-web | api/migrations/0032_auto_20160721_1004.py | Python | gpl-3.0 | 423 |
from dal import autocomplete
from django import forms
from django.utils.translation import gettext_lazy as _
from ajapaik.ajapaik.models import Photo, Album
from ajapaik.ajapaik_face_recognition.models import FaceRecognitionRectangle, \
FaceRecognitionUserSuggestion, FaceRecognitionRectangleFeedback
class FaceRe... | Ajapaik/ajapaik-web | ajapaik/ajapaik_face_recognition/forms.py | Python | gpl-3.0 | 2,362 |
# DrawingThought.py
# This file is part of Labyrinth
#
# Copyright (C) 2006 - Don Scorgie <Don@Scorgieorg>
#
# Labyrinth 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
# (a... | Boquete/activity-labyrinth | src/DrawingThought.py | Python | gpl-2.0 | 14,244 |
#!/usr/bin/env python
'''
make_dummy.py - this file is part of S3QL (http://s3ql.googlecode.com)
Creates a dummy copy of an entire bucket. The dummy will appear to contain
all the data of the original bucket. However, in fact only the metadata
will be copied and all files contain just \0 bytes.
---
Copyright (C) 201... | drewlu/ossql | contrib/make_dummy.py | Python | gpl-3.0 | 3,830 |
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
import unittest
import Orange
from Orange.clustering.dbscan import DBSCAN
class TestDBSCAN(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.iris = Orange.data.Table('iris')
def test_dbsc... | cheral/orange3 | Orange/tests/test_clustering_dbscan.py | Python | bsd-2-clause | 784 |
"""Unittest for repo_specific_model. """
import logging
from unittest import mock
import pytest
from label_microservice import mlp
from label_microservice import repo_specific_model
from label_microservice import test_util
def test_predict_labels():
"""A unittest for predict labels.
This function mocks out the e... | kubeflow/code-intelligence | py/label_microservice/repo_specific_model_test.py | Python | mit | 1,647 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('branch', '0028_auto_20141203_0800'),
... | MaximeBiset/care4care | branch/migrations/0029_auto_20141203_1434.py | Python | agpl-3.0 | 2,637 |
import sys
sys.setrecursionlimit(2*10**5)
def dfs(v, graph, memo):
if memo[v] != -1:
return memo[v]
ret = 0
for c in graph[v]:
ret = max(ret, dfs(c, graph, memo) + 1)
memo[v] = ret
return ret
def main():
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
... | knuu/competitive-programming | atcoder/dp/edu_dp_g.py | Python | mit | 589 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple statistical algorithms that are
straightforwardly implemented as a single python function (or family of
functions).
This module should generally not be used directly. Everything in
`__all__` is imported into `astropy.stats... | bsipocz/astropy | astropy/stats/funcs.py | Python | bsd-3-clause | 58,579 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/openssh/package.py | Python | lgpl-2.1 | 2,494 |
"""Tests for Oscapcontent
:Requirement: Oscapcontent
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: SCAPPlugin
:Assignee: jpathan
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import os
import pytest
from nailgun import entities
from robottelo import ssh
from robottelo.confi... | jyejare/robottelo | tests/foreman/ui/test_oscapcontent.py | Python | gpl-3.0 | 3,766 |
import codecs
import os
import os.path
from os.path import join
from setuptools import setup
import cffi_build.cffi_build as cffi_build
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(... | stepjam/PyRep | setup.py | Python | mit | 1,927 |
'''
Author: Giggle Leo
Date : 8 September 2014
Description : physics library
'''
from numpy import *
from numpy.linalg import *
from matplotlib.pyplot import *
import scipy.sparse as sps
import pdb,time
import cPickle as pickle
__all__=['sx','sy','sz','s','s1x','s1y','s1z','s1','fermi','s2vec','vec2s',
'ind2c... | GiggleLiu/tba | hgen/utils.py | Python | gpl-2.0 | 4,377 |
# -*- coding:utf-8 -*-
#定义函数
def add(a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide(a, b):
print "DIVIDING %d / %d\n" % (a, b)
... | Mbdn/Python-Beginner | ex21.py | Python | mit | 841 |
"""Helper functions for tests using REST API."""
from collections import namedtuple
import pytest
from cfme.exceptions import OptionNotAvailable
from cfme.utils.wait import wait_for
def assert_response(
rest_obj, success=None, http_status=None, results_num=None, task_wait=600):
"""
Asserts that the ... | izapolsk/integration_tests | cfme/utils/rest.py | Python | gpl-2.0 | 9,765 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.txt")) as f:
README = f.read()
with open(os.path.join(here, "CHANGES.txt")) as f:
CHANGES = f.read()
requires = []
tests_require = [
"WebTest >= 1.3.1", # py3 com... | qlands/pyramid-pca-jinja2 | pcaplugin/setup.py | Python | agpl-3.0 | 1,054 |
# Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | fweik/espresso | testsuite/python/scafacos_dipoles_1d_2d.py | Python | gpl-3.0 | 5,148 |
from Exercise import *
class Metric( Exercise ):
"""Metric is just another sort of exercise"""
def __init__( self, description_dict ):
super( Metric, self ).__init__( description_dict )
@classmethod
def init_from_json( cls, dict_from_json ):
metric = cls( dict_from_json )
retur... | noooway/exj | Metric.py | Python | mit | 329 |
# 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... | DaanHoogland/cloudstack | test/integration/smoke/test_accounts.py | Python | apache-2.0 | 77,523 |
# Copyright 2020 The gRPC 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 in wri... | ejona86/grpc | src/python/grpcio_tests/tests_aio/unit/secure_call_test.py | Python | apache-2.0 | 5,070 |
# 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... | shakamunyi/neutron-vrrp | neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py | Python | apache-2.0 | 1,994 |
# -*- coding: utf-8 -*-
########################################################################
# #
# python-OBD: A python OBD-II serial module derived from pyobd #
# #
# C... | brendan-w/python-OBD | obd/utils.py | Python | gpl-2.0 | 6,075 |
from matplotlib import use, cm
use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import axes3d
from sklearn import linear_model
from gradientDescent import gradientDescent
from computeCost import computeCost
from warmUpExercise import warmUpExercise
from plotData import plotData... | robotenique/mlAlgorithms | supervised/gradDescent/ex1.py | Python | unlicense | 5,002 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.sale.tests.test_sale_common import TestSale
class TestSaleExpense(TestSale):
def test_sale_expense(self):
""" Test the behaviour of sales orders when managing expenses """
# create ... | chienlieu2017/it_management | odoo/addons/sale_expense/tests/test_sale_expense.py | Python | gpl-3.0 | 4,816 |
import logging
from datetime import datetime
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.crypto import get_random_string
from django.views import Vie... | MOOCworkbench/MOOCworkbench | experiments_manager/views/views.py | Python | mit | 14,934 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 13:33
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotations', '0007_auto_20170826_1446'),
]
def... | bit-bots/imagetagger | src/imagetagger/annotations/migrations/0008_auto_20170826_1533.py | Python | mit | 1,648 |
# coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import io
import json
import logging
import re
import ssl
im... | eliksir/mailmojo-python-sdk | mailmojo_sdk/rest.py | Python | apache-2.0 | 13,147 |
"""
Reimport of fabric.api.
Provides some useful wrappers of stuff.
"""
from fabric.api import *
from fabric import api as _api
from braid import info as _info
def sudo(*args, **kwargs):
"""
Only calls sudo if not already root.
FIXME: Should handle the case where the desired user isn't root.
"""
... | alex/braid | braid/api.py | Python | mit | 396 |
# io.py 21/08/2015 D.J.Whale
#
# Handle the input/output streams to a running program.
# This decides how to read and write data to and from a running program,
# or to and from a stored program file.
#
# Depending on the configuration, it can use decimal, binary or hexadecimal
# of any width in characters/bytes. You ... | whaleygeek/MyLittleComputer | src/python/io.py | Python | mit | 1,524 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Neil Nutt <neilnutt@googlemail.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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | OpenHydrology/StatisticalFloodEstimationTool | floodestimationgui/gui.py | Python | gpl-3.0 | 10,902 |
__author__ = 'Brandon'
from helper import greeting
greeting("This is back in the main branch") | bmblank/cs3240-labdemo | mainTest.py | Python | mit | 96 |
#!/usr/bin/env python
import fileinput
plain = open('plaintext.txt','rb')
key = open('key.txt','rb')
cipher = open('ciphertext.txt','wb')
plain = bytearray(plain.read())
key = bytearray(key.read())
for i,b in enumerate(plain):
if (i + 1) % 16 == 0:
cipher.write('0x%0.2x\n' % (b ^ key[i]))
else:
... | theonewolf/Spoon-Quest-2012 | answers/challenge3/cipher.py | Python | mit | 364 |
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy2Can(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_CAN=y
"""
sample_scripts = ["tests/package/sample_python_can.py"]... | masahir0y/buildroot-yamada | support/testing/tests/package/test_python_can.py | Python | gpl-2.0 | 617 |
from apps.api.utils import SharedAPIRootRouter
from apps.slack import views
urlpatterns = []
router = SharedAPIRootRouter()
router.register('slack', views.InviteViewSet, base_name='slack')
| dotKom/onlineweb4 | apps/slack/urls.py | Python | mit | 191 |
import astropy.io.fits
import numpy as np
import matplotlib.pyplot as plt
# Create an empty numpy array. 2D; spectra with 4 data elements.
filtered = np.zeros((2040,4))
combined_extracted_1d_spectra_ = astropy.io.fits.open("xtfbrsnN20160705S0025.fits")
exptime = float(combined_extracted_1d_spectra_[0].header['EXPTIME... | mrlb05/Nifty | tests/generate_response_curve.py | Python | mit | 1,827 |
#
# Copyright 2016 The BigDL 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 in ... | 122689305/BigDL | spark/dl/src/test/resources/tf/models/vgg16.py | Python | apache-2.0 | 1,359 |
"""
Transition
====================
"""
import spirit.spiritlib as spiritlib
import ctypes
### Load Library
_spirit = spiritlib.load_spirit_library()
_Homogeneous = _spirit.Transition_Homogeneous
_Homogeneous.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int]
_Homogeneous.restype ... | spirit-code/spirit | core/python/spirit/transition.py | Python | mit | 1,673 |
# coding:utf8
class Plugin(object):
__doc__ = '''Плагин предназначен для остановки бота.
Для использования необходимо иметь уровень доступа {protection} или выше
Ключевые слова: [{keywords}]
Использование: {keyword}
Пример: {keyword}'''
name = 'stop'
keywords = (u'стоп', name, '!')
pr... | Fogapod/VKBot | bot/plugins/plugin_stop.py | Python | mit | 684 |
""" Automation of IPA subid feature bugs
:requirement: IDM-IPA-REQ: ipa subid range
:casecomponent: sssd
:subsystemteam: sst_idm_sssd
:upstream: yes
"""
import pytest
import subprocess
import time
import os
from sssd.testlib.common.utils import SSHClient
test_password = "Secret123"
user = 'admin'
def execute_cmd(... | SSSD/sssd | src/tests/multihost/ipa/test_subid_ranges.py | Python | gpl-3.0 | 7,326 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Martine Lenders <m.lenders@fu-berlin.de>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import re
import sys
def generate_changelog(template_filename, changelog_filename, output_filename):
... | jia200x/RIOT | doc/doxygen/generate-changelog.py | Python | lgpl-2.1 | 2,736 |
# -*- coding: utf-8 -*-
from cms_sitemap import * | team-xue/xue | xue/cms/sitemaps/__init__.py | Python | bsd-3-clause | 49 |
"""
# 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... | OBIGOGIT/etch | binding-python/runtime/src/main/python/etch/binding/util/SetSerializer.py | Python | apache-2.0 | 2,079 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.