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 |
|---|---|---|---|---|---|
class Solution(object):
def findBlackPixel(self, picture, N):
"""
:type picture: List[List[str]]
:type N: int
:rtype: int
"""
if not picture or not picture[0]: return 0
row = [i for i in range(len(picture)) if picture[i].count('B') == N]
col = [i for... | Mlieou/oj_solutions | leetcode/python/ex_533.py | Python | mit | 678 |
#!/usr/bin/env python3
#
# Generate Serpent deck for FastCube Serpent deck
# Ondrej Chvala, ochvala@utk.edu
# 2016-07-30
import materials
import cells
import surfaces
def write_deck(N, r, refl):
'''Function to write the FastCube Serpent input deck.
Inputs:
N: size of the N x N checkerboard lattic... | ondrejch/FSM | scripts/mk0/cubedeck.py | Python | gpl-3.0 | 1,663 |
import rospy
import actionlib
from bitbots_msgs.msg import KickAction, KickFeedback, KickActionResult, KickGoal
from actionlib_msgs.msg import GoalStatus
class KickCapsule():
last_feedback = None # type: KickFeedback
last_feedback_received = None # type: rospy.Time
last_goal = None # type: KickGoal
... | bit-bots/bitbots_behaviour | bitbots_blackboard/src/bitbots_blackboard/capsules/kick_capsule.py | Python | bsd-3-clause | 2,507 |
# Copyright (c) 2010-2014 openpyxl
#
# stdlib imports
from io import BytesIO
import zipfile
import pytest
# package imports
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
@pytest.mark.pil_required
def test_write_images(datadir):
datadir.chdir()
wb = Workbook()
ew =... | Hitachi-Data-Systems/org-chart-builder | openpyxl/writer/tests/test_drawing.py | Python | apache-2.0 | 711 |
import urllib
from .oauth import OAuthSharer
class TwitterSharer(OAuthSharer):
def send(self, message, hashtag='', **kw):
if hashtag:
message += ' ' + hashtag
request = self.client.request(
'https://api.twitter.com/1.1/statuses/update.json',
method='POST',
... | FelixLoether/python-sharer | sharer/twitter.py | Python | mit | 424 |
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
class TestAdapterDDL(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.run_sql_file("test/integration/018_adapter_ddl_tests/seed.sql")
@property
def schema(self):
ret... | nave91/dbt | test/integration/018_adapter_ddl_tests/test_adapter_ddl.py | Python | apache-2.0 | 666 |
# Copyright (c) 2021 Ultimaker B.V.
from typing import Optional
class PaginationMetadata:
"""Class representing the metadata related to pagination."""
def __init__(self,
total_count: Optional[int] = None,
total_pages: Optional[int] = None,
**kwargs) -> None... | Ultimaker/Cura | plugins/DigitalLibrary/src/PaginationMetadata.py | Python | lgpl-3.0 | 828 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | trunglq7/horizon | openstack_dashboard/dashboards/admin/flavors/urls.py | Python | apache-2.0 | 1,298 |
import obd,time
import json, os
from log import Log
from Logger import Logger
class car:
def __init__(self, logger):
self.connection = obd.Async()
self.log = Log()
self.logger = logger
self.counter = 0
def getSpeed(self,r):
self.log.add("SPEED", str(r.value))
self.c... | rahutchinson/PyTahoeLog | mainLogger.py | Python | mit | 2,045 |
from django.contrib import admin
from taxonomy.models import *
from ajax_select import make_ajax_form
from ajax_select.admin import AjaxSelectAdmin
from django.contrib.admin import SimpleListFilter
from django.contrib.admin.views import main
from django.http import HttpResponseRedirect
class OrderFilter(SimpleListFilt... | wabarr/taxonomy | taxonomy/admin.py | Python | gpl-2.0 | 2,141 |
"""Plot to test line collections"""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection
def main():
t = np.linspace(0, 10, 100)
x = 0.1 * t * np.cos(np.pi * t)
y = 0.1 * t * np.sin(np.pi * t)
points = np.array([x, y]).T.reshape(100, 1, 2)
segments = ... | mpld3/mpld3_rewrite | test_plots/test_line_collections.py | Python | bsd-3-clause | 829 |
# -*- coding: utf-8 -*-
'''
some tools that help you define operator grammars to preparse python expression.
see dinpy.py for a real sample.
>>> from dao.solve import set_run_mode, noninteractive
>>> set_run_mode(noninteractive)
>>> from dao.term import Var
>>> from dao.builtins.terminal import eoi
>>> fro... | chaosim/dao | dao/dinpy/pysyntax.py | Python | gpl-3.0 | 13,132 |
"""
Copyright 2008 Serge Matveenko
This file is part of Picket.
Picket 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.
Picket is distribut... | lig/picket_deadend | apps/picket/__init__.py | Python | gpl-3.0 | 1,859 |
from urlparse import urlparse
from api_tests.nodes.views.test_node_contributors_list import NodeCRUDTestCase
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from tests.base import fake
from tests.factories import (
ProjectFactory,
... | abought/osf.io | api_tests/registrations/views/test_withdrawn_registrations.py | Python | apache-2.0 | 7,791 |
#! /usr/bin/env python
import random
import utilities
def read_nodes_from_training(file_name):
"""
Returns a list of all the nodes in the graph
"""
node_set = set()
for nodes in utilities.edges_generator(file_name):
for node in nodes:
node_set.add(node)
return list(node_s... | ameyavilankar/social-network-recommendation | preprocessing/random_benchmark.py | Python | bsd-2-clause | 1,033 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['MovingAverage'] , ['Seasonal_Second'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Anscombe/model_control_one_enabled_Anscombe_MovingAverage_Seasonal_Second_MLP.py | Python | bsd-3-clause | 161 |
#!/usr/bin/env python
#
# Copyright 2018 by Ruben Undheim
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This software is distributed in... | andrmuel/gr-dab | python/app/curses_app.py | Python | gpl-3.0 | 12,694 |
# -*- encoding: utf8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2017 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Li... | marmarek/qubes-core-mgmt-client | qubesadmin/tests/tools/qvm_pause.py | Python | lgpl-2.1 | 3,376 |
# -*- coding: utf-8 -*-
from hello import mod
def register_hello_module(app):
app.register_blueprint(mod) | liufan/cornerstone | src/op_site/domain/hello/__init__.py | Python | apache-2.0 | 110 |
from layers.models import *
import TileStache
from django.core.cache import cache
import logging
import json
from django.conf import settings
CACHE_KEY = "config.json"
def get_config(force=False):
"""
Get TileStache confiuration.
"""
cached = cache.get(CACHE_KEY, None)
if not force and cached is... | trailbehind/EasyTileServer | webApp/layers/config.py | Python | bsd-3-clause | 1,239 |
import math
def points_form_square(points):
p0 = points[0]
dist = lambda a, b: math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
dist_from_p0 = lambda p: dist(p0, p)
points = sorted(points, key=dist_from_p0)
if dist(points[0], points[1]) != dist(points[0], points[2]):
return False
if ... | frasertweedale/drill | py/geom.py | Python | mit | 501 |
#####################################################################
# vec3 - 3-dimensional vector
#
# Copyright (C) 2002, Matthias Baas (baas@ira.uka.de)
#
# You may distribute under the terms of the BSD license, as
# specified in the file license.txt.
#################################################################... | RAPD/RAPD | src/plugins/subcontractors/xdsme/pycgtypes/vec3.py | Python | agpl-3.0 | 13,964 |
# Copyright(c) 2013 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOU... | rbbratta/site_lib | lndir_test.py | Python | gpl-2.0 | 4,142 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chartsheet06.py | Python | bsd-2-clause | 1,649 |
from insights.parsers import qpid_stat
from insights.tests import context_wrap
QPID_STAT_Q = """
COMMAND> qpid-stat -q --ssl-certificate=/etc/pki/katello/qpid_client_striped.crt -b amqps://localhost:5671
Queues
queue dur autoDel excl msg msgI... | PaulWay/insights-core | insights/parsers/tests/test_qpid_stat.py | Python | apache-2.0 | 7,553 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
"""Tests for the Hello World"""
import os
from autopilot.matchers import Eventually
from testtools.matchers import Equals
import Piano
class MainViewTestCase(Piano.ClickAppTestCase):
"""Generic tests for the Hello World"""
def tes... | ZacharyIgielman/uPiano | Piano/tests/autopilot/Piano/test_main.py | Python | cc0-1.0 | 768 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization Account Product',
'summary': "Brazilian Localization Account Product",
'category': 'Localisation',
'license': 'AGPL-3',
'author': '... | rvalyi/l10n-brazil | l10n_br_account_product/__openerp__.py | Python | agpl-3.0 | 2,324 |
import unittest
from book_store import calculate_total
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.1
class BookStoreTests(unittest.TestCase):
def test_only_a_single_book(self):
self.assertAlmostEqual(calculate_total([1]), 8.00,
places=2)
... | mweb/python | exercises/book-store/book_store_test.py | Python | mit | 2,408 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistribu... | appleseedhq/cortex | test/IECoreScene/SceneInterfaceTest.py | Python | bsd-3-clause | 5,128 |
"""
Utility Mixins for unit tests
"""
import json
import sys
from mock import patch
from django.conf import settings
from django.core.urlresolvers import clear_url_caches, resolve
from django.test import TestCase
from util.db import OuterAtomic, CommitOnSuccessManager
class UrlResetMixin(object):
"""Mixin to ... | hamzehd/edx-platform | common/djangoapps/util/testing.py | Python | agpl-3.0 | 5,229 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 0.33, s, t 0.66, s, t 1.1, s, q"
tags = "MoveCornerUp"
import pyglet
imp... | vyscond/cocos | test/test_move_corner_up.py | Python | bsd-3-clause | 1,021 |
#!/usr/bin/env python3
import os
import re
import json
import plistlib
import argparse
from typing import List
# region Global sets
# A set of category folder names in current sample viewer.
categories = {
'Maps',
'Layers',
'Features',
'Display information',
'Search',
'Edit data',
'Geomet... | Esri/arcgis-runtime-samples-ios | Scripts/CI/README_Metadata_StyleCheck/title_differ.py | Python | apache-2.0 | 10,499 |
"""
This is your project's main settings file that can be committed to your
repo. If you need to override a setting locally, use local.py
"""
import os
import logging
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.excepti... | lxdiyun/mail_sender | mail_sender/settings/base.py | Python | bsd-3-clause | 9,917 |
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
from datetime import datetime, timedelta
from airflow.operators import PythonOperator
from airflow.hooks import RedisHook
from airflow.models import Variable
from airflow.hooks import MemcacheHook
from etl_tasks_functions import... | vipul-tm/DAG | dags-ttpl/subdags/interference_kpi_subdag.py | Python | bsd-3-clause | 23,550 |
from __future__ import division
import time
from conseval.params import ParamDef, Params, WithParams
from conseval.utils.general import norm_scores, window_scores
################################################################################
# Fetch tools
############################################################... | jwayne/conseval | conseval/scorer.py | Python | gpl-2.0 | 3,882 |
# -*- coding: utf-8 -*-
# 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/.
import json
import os
import waffle
from django.conf import settings
from django.http import Htt... | davehunt/bedrock | bedrock/firefox/tests/test_base.py | Python | mpl-2.0 | 33,460 |
# 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... | airbnb/superset | superset/models/alerts.py | Python | apache-2.0 | 6,835 |
# load defaults and override with devlopment settings
from defaults import *
DEBUG = False
WSGI_APPLICATION = 'bucketlist_django.wsgi.application'
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for reque... | andela-tadesanya/django-bucketlist-application | bucketlist_django/bucketlist_django/settings/production.py | Python | mit | 932 |
"""
Centralized location for useful control associated functions and variables
2013
"""
from control.thrusters import thrusters, desires
def set_all_motors_from_seq(pwms, got_thrusters):
g = desires.group()
for i, motor in enumerate(got_thrusters):
motor.update_shm_group(g, pwms[i])
desires.set(g)... | cuauv/software | control/util.py | Python | bsd-3-clause | 1,581 |
"""Dummy module to create rax security groups"""
#!/usr/bin/env python
import pyrax
from ansible.module_utils.basic import *
uri_sgs = 'https://dfw.networks.api.rackspacecloud.com/v2.0/security-groups'
def get_sg(cnw, name):
try:
result, sgs = cnw.identity.method_get(uri_sgs)
if result.status_co... | xroot88/rax_ansible | library/rax_security_group.py | Python | apache-2.0 | 3,554 |
#!/bin/python
#Copyright (c) 2013, Regents of the University of California
#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... | amplab/smash | test/chrom_variants.py | Python | bsd-2-clause | 14,153 |
# -*- coding: utf-'8' "-*-"
import base64
try:
import simplejson as json
except ImportError:
import json
import logging
import urlparse
import werkzeug.urls
import urllib2
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_mercadopago.controllers.main import... | Trust-Code/payment_mercadopago | models/mercadopago.py | Python | gpl-2.0 | 25,619 |
from django.test import TestCase
from django.db import models, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.core import management
from django.core.exceptions import FieldError
from django.contrib.contenttypes.models import ContentType
from models import MyPerson, Person, StatusPerson, LowerStatu... | mzdaniel/oh-mainline | vendor/packages/Django/tests/modeltests/proxy_models/tests.py | Python | agpl-3.0 | 11,673 |
"""
Module providing easy API for working with remote files and folders.
"""
from __future__ import with_statement
import hashlib
import tempfile
import re
import os
from six import string_types, BytesIO as StringIO
from fabric.api import *
from fabric.utils import apply_lcwd
def exists(path, use_sudo=False, verbo... | pashinin/fabric | fabric/contrib/files.py | Python | bsd-2-clause | 15,835 |
# pylint: disable=no-self-use,invalid-name
import numpy
from numpy.testing import assert_almost_equal
import keras.backend as K
from keras.layers import Input, Masking
from keras.models import Model
from deep_qa.layers.backend import BatchDot
from deep_qa.layers.wrappers import OutputMask
from deep_qa.testing.test_case... | allenai/deep_qa | tests/layers/backend/batch_dot_test.py | Python | apache-2.0 | 11,778 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2014 rdiffweb contributors
#
# 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, ei... | sbellver/rdiffweb | rdiffweb/page_prefs.py | Python | gpl-3.0 | 5,423 |
from activitystreams import parse as as_parser
from dino.config import ApiActions
from dino.config import ErrorCodes
from dino.config import SessionKeys
from dino.validation import request
from test.base import BaseTest
class RequestListRoomsTest(BaseTest):
def test_list_rooms_status_code_true(self):
sel... | thenetcircle/dino | test/validation/test_request_list_rooms.py | Python | apache-2.0 | 4,432 |
#!/usr/bin/env python3
"""Example YAML input:
geom:
fn: lib:h2o2_hf_321g_opt.xyz
calc1:
type: orca5
keywords: hf sto-3g
blocks: "%tddft nroots 2 iroot 1 end"
pal: 2
calc2:
type: orca5
keywords: hf sto-3g
blocks: "%tddft nroots 2 iroot 1 end"
pal: 2
# Either wf|tden
ovlp_type: wf
"""
import argparse
from pp... | eljost/pysisyphus | scripts/overlaps.py | Python | gpl-3.0 | 3,442 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2019 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathToolControllerGui.py | Python | lgpl-2.1 | 12,377 |
"""
Utilities for SUR and 3SLS estimation
"""
__author__= "Luc Anselin lanselin@gmail.com, \
Pedro V. Amaral pedrovma@gmail.com"
import numpy as np
import numpy.linalg as la
from .utils import spdot
__all__ = ['sur_dictxy','sur_dictZ','sur_mat2dict','sur_dict2mat',\
'sur_corr'... | lixun910/pysal | pysal/model/spreg/sur_utils.py | Python | bsd-3-clause | 12,555 |
#!/usr/bin/env python3
from test_framework.authproxy import JSONRPCException
from test_framework.test_framework import ElysiumTestFramework
from test_framework.util import assert_equal, assert_raises_message
class ElysiumSendMintTest(ElysiumTestFramework):
def run_test(self):
super().run_test()
si... | zcoinofficial/zcoin | qa/rpc-tests/elysium_sendmint.py | Python | mit | 3,905 |
# Generated by Django 3.0.5 on 2020-05-01 08:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adventure', '0061_auto_20191213_0007'),
]
operations = [
migrations.AlterField(
model_name='artifact',
name='armor_t... | kdechant/eamon | adventure/migrations/0062_auto_20200501_0144.py | Python | mit | 1,129 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | hurricanerix/swift | test/unit/obj/test_replicator.py | Python | apache-2.0 | 89,158 |
#!/usr/bin/env python
import os
import sys
import json
import argparse
import stat
import string
import time
hooks_script = {'pre-receive': 'PreReceiveHook',
'post-receive': 'PostReceiveHook',
'update': 'UpdateHook',
'pre-commit': 'PreCommitHook',
'prepa... | GaelMagnan/PyGitHook | src/PyGitHookDeployment.py | Python | gpl-2.0 | 3,574 |
# PyTransit: fast and easy exoplanet transit modelling in Python.
# Copyright (C) 2010-2020 Hannu Parviainen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | hpparvi/PyTransit | pytransit/lpf/eclipselpf.py | Python | gpl-2.0 | 7,924 |
# -*- coding: utf-8 -*-
from ..utility import generate_file
class ReduceProperty:
def generate(self, module):
ctx = {'module': module}
generate_file(module['module_path'], 'mpi/ReduceProperty.templ.h', ctx)
| lssfau/walberla | python/mesa_pd/mpi/ReduceProperty.py | Python | gpl-3.0 | 230 |
#!/usr/bin/env python
## @package testsLeapMotionAngle
#
# - program of tests : save data for results analyse and validation of software
#
# DEPENDENCIES
# ----------------------------------------------------------------------------------------------------------------------
#
# EXTERNAL PYTHON PACKAGES
# - L... | marieandreeo/GBM4900 | LMPY/src/testsLeapMotionAngle.py | Python | apache-2.0 | 53,403 |
"""
Classes representing uploaded files.
"""
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from airy.core.conf import settings
from airy.core.files.base import File
from airy.core.files import temp as tempfile
from airy.utils.encoding import smart_str
__all__... | letolab/airy | airy/core/files/uploadedfile.py | Python | bsd-2-clause | 4,222 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | subutai/htmresearch | tests/frameworks/layers/l2l4_network_creation_test.py | Python | agpl-3.0 | 40,335 |
#!/usr/bin/env python
# This file is part of Openplotter.
# Copyright (C) 2015 by sailoog <https://github.com/sailoog/openplotter>
#
# Openplotter 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 versio... | sailoog/openplotter | classes/conf.py | Python | gpl-2.0 | 3,587 |
import unittest
from django.http import Http404
from django.core.exceptions import ObjectDoesNotExist
# Ugh. Settings for Django.
from django.conf import settings
settings.configure(DEBUG=True)
from restless.dj import DjangoResource
from restless.exceptions import Unauthorized
from restless.preparers import FieldsPr... | viniciuscainelli/restless | tests/test_dj.py | Python | bsd-3-clause | 11,425 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | ctmil/meli_oerp | models/banner.py | Python | agpl-3.0 | 1,268 |
"""mapa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | laurybueno/MoniBus | mapa/urls.py | Python | agpl-3.0 | 1,112 |
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... | obulpathi/cdn1 | cdn/openstack/common/log.py | Python | apache-2.0 | 25,481 |
import sys
if len(sys.argv) < 2:
print("\nUso: e09-09.py arquivo1 arquivo2 arquivo3 arquivoN\n")
sys.exit()
for nome in sys.argv[1:]:
arquivo = open(nome, "r")
for linha in arquivo:
print(linha, end="")
arquivo.close() | laenderoliveira/exerclivropy | cap09/exercicio-09-09.py | Python | mit | 248 |
'''
multi-processing abstraction
This wraps the multiprocessing module, using billiard on MacOS
and multiprocessing on Linux and Windows
The key problem on MacOS is that you can't fork in any process that uses
threading, which is almost all of processes as so many libraries use
threads. So instead billiard uses an app... | ArduPilot/MAVProxy | MAVProxy/modules/lib/multiproc.py | Python | gpl-3.0 | 2,301 |
from collections import defaultdict
import rest_framework_filters as filters
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import (HTTP_200_OK,
HTTP_400_BAD_REQUEST,
HTTP_404_NOT_FOUND)
... | akhileshpillai/treeherder | treeherder/webapp/api/text_log_summary_line.py | Python | mpl-2.0 | 3,293 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ksrajkumar/openerp-6.1 | openerp/addons/itara_refund_survey/__openerp__.py | Python | agpl-3.0 | 1,491 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
import frappe.defaults
from frappe import msgprint, _
from frappe.utils import cstr, flt, cint
from erpnext.stock.stock_ledger im... | patilsangram/erpnext | erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py | Python | gpl-3.0 | 11,573 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
# Copyright Pi-Developers
# @author Mohamed rashad
import sys
import math
import binascii
from math import *
from sys import *
from decimal import *
##########################
def calc(n):
t= Decimal(0)
pi = Decimal(0)
deno= Decimal(0)
k = 0
for k in ra... | AndroidFire/PMaths | PMaths.py | Python | gpl-2.0 | 5,425 |
import logging
import sys
import time
import urllib.parse
from .trace import FunctionTrace
from .transaction import Transaction
from .wrapper import callable_name, FuncWrapper
_logger = logging.getLogger(__name__)
class WebTransaction(Transaction):
def __init__(self, environ): # flake8: noqa
# The web ... | PushAMP/pamagent | pamagent/web_transaction.py | Python | gpl-3.0 | 5,179 |
# -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | muraliselva10/cloudkitty | cloudkitty/billing/hash/db/sqlalchemy/__init__.py | Python | apache-2.0 | 935 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | rules_management/mixins.py | Python | agpl-3.0 | 4,454 |
from __future__ import absolute_import
from typing import Any, Dict, List, Set, Tuple, TypeVar, Text, \
Union, Optional, Sequence, AbstractSet, Pattern, AnyStr
from typing.re import Match
from zerver.lib.str_utils import NonBinaryStr
from django.db import models
from django.db.models.query import QuerySet
from dja... | niftynei/zulip | zerver/models.py | Python | apache-2.0 | 57,696 |
from analog.exceptions import UnknownLogKind
from analog.settings import KINDS
class LogEntryKindMap:
"""
A helper class for transitioning old code.
Allows looking up log entry kinds by "enumish" name, i.e.
``LogEntryKind.OTHER`` would map to the "other" kind's ID.
"""
def __getattr__(self, ... | andersinno/django-analog | analog/util.py | Python | mit | 695 |
import json
import cherrypy
import cherrypy_cors
import datetime
from dateutil.parser import parse
from jinja2 import Environment, FileSystemLoader
from pymongo import MongoClient
import pymongo
class server:
def __init__(self):
self.env = Environment(loader=FileSystemLoader('../'))
cherrypy_cors.... | kearnsw/Twitt.IR | src/server.py | Python | gpl-3.0 | 2,260 |
"""Commands to query Minecraft service status and user information."""
import re
import plumeria.util.http as http
from plumeria.command import commands, CommandError
from plumeria.message import Response
from plumeria.util.ratelimit import rate_limit
MINECRAFT_STATUS_URL = "http://xpaw.ru/mcstatus/status.json"
HEAD... | sk89q/Plumeria | orchard/minecraft.py | Python | mit | 4,077 |
"""Test module for config.py."""
import sys
import os
import shutil
from tempfile import mkdtemp
from unittest import TestCase, main, TestLoader
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib'))) # noqa
from quattordocbuild import config
class ConfigTest(TestCase):
"""Test class... | jouvin/release | src/documentation_builder/test/config.py | Python | apache-2.0 | 3,456 |
# dispatch.py - command dispatching for mercurial
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from i18n import _
import os, sys, atexit, signal, pdb, socket, errno, shlex,... | hekra01/mercurial | mercurial/dispatch.py | Python | gpl-2.0 | 35,318 |
import logging
import pytest
import sdk_hosts
import sdk_install
import sdk_networks
from tests import config
log = logging.getLogger(__name__)
@pytest.fixture(scope="module", autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)... | mesosphere/dcos-commons | frameworks/helloworld/tests/test_custom_service_tld.py | Python | apache-2.0 | 1,407 |
import sys
from numpy.testing import *
from swig_ext import example
class TestExample(TestCase):
def test_fact(self):
assert_equal(example.fact(10),3628800)
def test_cvar(self):
assert_equal(example.cvar.My_variable,3.0)
example.cvar.My_variable = 5
assert_equal(exam... | beiko-lab/gengis | bin/Lib/site-packages/numpy/distutils/tests/swig_ext/tests/test_example.py | Python | gpl-3.0 | 403 |
# Send test commands.
import socket
import time
ip_gc = "127.0.0.1"
port_data = 10000
port_health = 10001
port_uplink = 10002
def sendData():
adsbMessage = "%s,2\n1234567890123456789012345678\n1234567890123456789012345679\n" % (int(time.time()))
udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udpS... | thasti/arca-gc | send_test_cmd.py | Python | gpl-2.0 | 914 |
"""The tests for the Restore component."""
from datetime import datetime
from asynctest import patch
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.core import CoreState, State
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity import Entity
from ho... | leppa/home-assistant | tests/helpers/test_restore_state.py | Python | apache-2.0 | 8,646 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | tysonholub/twilio-python | twilio/rest/video/v1/composition/__init__.py | Python | mit | 20,700 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# file prefs2prefs-lfuns.py
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
# author Richard Heck
# Full author contact details are available in file CREDITS
# This file houses conversion information for the bind ... | mandeepsimak/Lyx | lib/scripts/prefs2prefs_lfuns.py | Python | gpl-2.0 | 4,605 |
"""
Sphinx plugins for Django documentation.
"""
import json
import os
import re
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx import addnodes, __version__ as sphinx_ver
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.writers.html import SmartyPantsHTMLTranslato... | liavkoren/djangoDev | docs/_ext/djangodocs.py | Python | bsd-3-clause | 12,017 |
# Version 5
'''This takes a base MineCraft level and adds or edits trees.
Place it in the folder where the save files are (usually .../.minecraft/saves)
Requires mcInterface.py in the same folder.'''
# Here are the variables you can edit.
# This is the name of the map to edit.
# Make a backup if you are experimenting... | DragonQuiz/MCEdit-Unified | stock-filters/Forester.py | Python | isc | 51,634 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2015 CERN.
#
# Invenio 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... | nharraud/b2share | invenio/modules/deposit/storage.py | Python | gpl-2.0 | 7,376 |
from ctx.toolkit import Widget
__author__ = 'fmca'
class AgendaWidget(Widget):
def __init__(self, *generators):
super(AgendaWidget, self).__init__("Ocupado", None, *generators)
def update(self, event):
now = self.get_property("time")
events = self.get_property("calendar")
occ... | fmca/ctxpy | ctx/widgets/agenda.py | Python | mit | 518 |
import os
import re
from prospector2.formatters.base import Formatter
class PylintFormatter(Formatter):
"""
This formatter outputs messages in the same way as pylint -f parseable , which is used by several
tools to parse pylint output. This formatter is therefore a compatability shim between tools built
... | landscapeio/prospector | prospector2/formatters/pylint.py | Python | gpl-2.0 | 1,632 |
import random
from numbers import Integral
import numpy as np
class QuantumBitMachine(object):
def __init__(self, nqubits):
assert isinstance(nqubits, Integral)
self.nqubits = nqubits
self.state = np.zeros([2 ** nqubits], dtype=complex)
self.state[0] = 1.
# Representations for... | garrison/pyqis | pyqis/__init__.py | Python | mit | 4,319 |
import logging
import logging.handlers
import datetime
# The DHCP lease time for all static addresses. Dynamic lease times are configured on the pool.
static_lease_time = 86400
listen_address='0.0.0.0'
client_port=68
server_port=67
# The amount of time we wait before we will process a request of the same type.
# Th... | ehuelsmann/openipam | openIPAM/openipam/config/dhcp.py | Python | gpl-3.0 | 1,419 |
import time
from django import template
from main import models as main_models
from knowall import models as knowall_models
register = template.Library()
LAST_ITEMS_COUNT = 5
@register.inclusion_tag('knowall/top_pages.html', name='top_pages', takes_context=True)
def top_pages(context):
print(context['request'].pa... | audiua/shkolyar_django | knowall/templatetags/top_pages.py | Python | mit | 671 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_30/ar_/test_artificial_32_RelativeDifference_Lag1Trend_30__20.py | Python | bsd-3-clause | 273 |
#! /usr/bin/env python
import matplotlib
if __name__ == '__main__':
matplotlib.use('Agg')
import numpy as np
import pylab as plt
import os
import sys
import tempfile
import datetime
import gc
from functools import reduce
from scipy.ndimage.morphology import binary_dilation
from scipy.ndimage.measurements import la... | dstndstn/unwise-coadds | unwise_resample.py | Python | gpl-2.0 | 12,170 |
# Spruce - a tool to help manage system software states.
# Copyright (C) 2017 Matt North
# This file is part of Spruce.
# Spruce 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 Licens... | Mattsky/spruce | spruce/apps.py | Python | gpl-3.0 | 824 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-cognitiveservices-search-websearch/azure/cognitiveservices/search/websearch/web_search_api.py | Python | mit | 2,615 |
# -*- coding: utf-8 -*-
#
# 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
... | yiqingj/airflow | airflow/migrations/versions/211e584da130_add_ti_state_index.py | Python | apache-2.0 | 1,036 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-18 11:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
initial = True
dependencies = [
('cms', '0016_au... | rouxcode/django-cms-plugins | cmsplugins/teasers/migrations/0001_initial.py | Python | mit | 2,774 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# bts_tools - Tools to easily manage the bitshares client
# Copyright (c) 2014 Nicolas Wack <wackou@gmail.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 Softwa... | wackou/bts_tools | bts_tools/monitoring/__init__.py | Python | gpl-3.0 | 976 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.