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
"""
Problem 60
12 September 2013
The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them
in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are
prime. The sum of these four primes, 792, represents the low... | arturh85/projecteuler | python/src/problem060.py | Python | mit | 5,277 |
import pygame
class Boton(object):
def __init__(self, tamx, tamy, posx, posy, texto, imagen="res/boton_1.png",
imagen_click="res/boton_2.png"):
### imagen, surface y rect
if not imagen:
self.surface_normal = pygame.surface.Surface((tamx, tamy))
else:
... | damasko/editor-de-mapas-pygame | src/boton_editor.py | Python | gpl-2.0 | 3,515 |
import pytest
from bluebook import Bluebook
def test_set_context__():
class A(Bluebook):
pass
a = A()
a.set_context__(name="PYLOT", live=True)
assert a._context.get("name") == "PYLOT"
assert a._context.get("live") is True
def test_extends__():
class A(Bluebook):
name = "A"... | mardix/webportfolio | webportfolio/tests/_test_pylot.py | Python | mit | 1,670 |
# Copyright (c) 2018, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
'''
Fields to move from the item to item defaults child table
[ default_warehouse, buying_cost_center, expense_account, selling_cost_center, ... | manassolanki/erpnext | erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py | Python | gpl-3.0 | 2,120 |
# 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 Li... | dstufft/warehouse | warehouse/migrations/versions/7750037b351a_remove_useless_index.py | Python | apache-2.0 | 936 |
class Cluster:
"""
a cluster has N simulators
"""
def __init__(self,region_pool):
self.region_pool = region_pool
self.filepath = CLUSTER_DATA_DIR+"cluster"
# simulator list
self.simulator_list = []
def get_simulator_list(self):
return self.simulator_list
def get_simulator_count(self):
return len(s... | justasabc/kubernetes-ubuntu | ke/images/python/backup/backup_cluster.py | Python | apache-2.0 | 4,855 |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save, post_syncdb
from django.shortcuts import get_object_or_404
import requests
class UserProfile(models.Model):
user = models.OneToOneField(User)
login_status = models.I... | ShinJJang/Podium | Maple/models.py | Python | mit | 17,270 |
#!/usr/bin/python
# import sys
from collections import deque
import os
import time
import mxnet as mx
import numpy as np
import random
from utilities import *
import logging
logging.basicConfig(level=logging.DEBUG)
import gym
ITER_SUM_SIZE = 32
LEARNING_BATCH_SIZE = 8
REPLAY_SIZE = 512
INITIAL_EPSI... | boddmg/openai-mxnet | LunarLander-v2/run.py | Python | mit | 8,258 |
#! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditi... | tkaitchuck/nupic | build_system/unix/vision_toolkit/build_vision_toolkit_app.py | Python | gpl-3.0 | 12,412 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""The command group for cloud container operations."""
from googlecloudsdk.calliope import base
class Operations(base.Group):
"""Get and list operations for Google Container Engine clusters."""
@staticmethod
def Args(parser):
"""Add arguments to the pars... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/container/commands/operations/__init__.py | Python | apache-2.0 | 976 |
"""
PyChromecast: remote control your Chromecast
"""
from __future__ import print_function
import logging
import fnmatch
# pylint: disable=wildcard-import
from .config import * # noqa
from .error import * # noqa
from . import socket_client
from .discovery import discover_chromecasts
from .dial import get_device_sta... | roberthorlings/chromecast-web | pychromecast/__init__.py | Python | mit | 7,818 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import os
import sys
import logging
import logging.config
import yaml
import fermipy
def log_level(level):
"""This is a function that returns a python like
level from a HEASOFT like... | jefemagril/fermipy | fermipy/logger.py | Python | bsd-3-clause | 5,010 |
from collections import OrderedDict
import re
import os
import unittest
from coalib.settings.Setting import (Setting,
path,
path_list,
typed_list,
typed_dict,
... | SambitAcharya/coala | coalib/tests/settings/SettingTest.py | Python | agpl-3.0 | 2,841 |
def extractNightskytlWordpressCom(item):
'''
Parser for 'nightskytl.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNightskytlWordpressCom.py | Python | bsd-3-clause | 560 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^/save/(?P<name>[^/]+)$', views.save, name='dashboard_save'),
url(r'^/save_template/(?P<name>[^/]+)/(?P<key>[^/]+)$', views.save_template,
name='dashboard_save_template'),
url(r'^/load/(?P<name>[^/]+)$', views.load, name='da... | criteo-forks/graphite-web | webapp/graphite/dashboard/urls.py | Python | apache-2.0 | 1,463 |
# ShipdB - Program to keep track of ship miniatures.
# Copyright (C) 2016 Christian K. Kier
#
# 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 opti... | ckier/shipdb | app/api_1_0/__init__.py | Python | gpl-3.0 | 946 |
"""
Initialize the application.
"""
import logging
logger = logging.getLogger(__name__)
import appdirs
import click
import datetime
import distutils.dir_util
import os
import putiopy
import sqlite3
APP_NAME = 'putio-automator'
APP_AUTHOR = 'datashaman'
DIRS = appdirs.AppDirs(APP_NAME, APP_AUTHOR)
from .db import cre... | datashaman/putio-automator | putio_automator/__init__.py | Python | mit | 1,262 |
#!/usr/bin/env python
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
from __future__ import print_fun... | scheib/chromium | third_party/android_deps/libs/com_google_errorprone_error_prone_annotation/3pp/fetch.py | Python | bsd-3-clause | 1,400 |
# Copyright 2013-2015 ARM Limited
#
# 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... | Sticklyman1936/workload-automation | wlauto/instrumentation/fps/__init__.py | Python | apache-2.0 | 21,087 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from ...rule import Rule
class ClosedCaptionRule(Rule):
"""Closed caption rule."""
cc_re = re.compile(r'(\bcc\d\b)', re.IGNORECASE)
def execute(self, props, pv_props, context):
"""Execute closed caption rule."""
... | pymedusa/Medusa | ext/knowit/rules/subtitle/closedcaption.py | Python | gpl-3.0 | 463 |
from __future__ import absolute_import
import re
from django.conf.urls import patterns, include, url
from sentry.plugins import plugins
urlpatterns = patterns('')
for _plugin in plugins.all():
_plugin_url_module = _plugin.get_url_module()
if _plugin_url_module:
urlpatterns += (url('^%s/' % re.escap... | ifduyue/sentry | src/sentry/plugins/base/urls.py | Python | bsd-3-clause | 369 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/linux_configuration.py | Python | mit | 1,857 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2013 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 opt... | kntem/webdeposit | modules/bibworkflow/lib/bibworkflow_hp_field_widgets.py | Python | gpl-2.0 | 1,922 |
"""Summon people"""
import re
from learn import Main as Learn
from madcow.util import Module
from smtplib import SMTP
from madcow.conf import settings
from madcow.util.text import *
class Main(Module):
pattern = re.compile(r'^\s*summons?\s+(\S+)(?:\s+(.*?))?\s*$')
require_addressing = True
help = u'summo... | cjones/madcow | madcow/modules/summon.py | Python | gpl-3.0 | 1,335 |
#!/usr/bin/env python3
"""
Module TAGS -- Simple Blog Tags Extension
Sub-Package SIMPLEBLOG.EXTENSIONS
Copyright (C) 2012-2013 by Peter A. Donis
Released under the GNU General Public License, Version 2
See the LICENSE and README files for more information
"""
from plib.stdlib.strings import split_string
from simpleb... | pdonis/simpleblog3 | simpleblog/extensions/tags.py | Python | gpl-2.0 | 3,583 |
"""
AtModExplorer
This tool is designed for the use of students of atmospheric and space science and other interested parties.
This tool is being actively developed. Don't expect it to be correct, or even work right now.
No warranties, no liability, as per the LICENSE.txt.
"""
from atmodexplorer import *
import sys
de... | lkilcommons/atmodexplorer | atmodexplorer/__init__.py | Python | gpl-3.0 | 447 |
# Binary tree example from ActiveState Code > Recipes
from Node import Node
class BinaryTree:
def __init__(self):
self.root = None
def createNode(self, data):
return Node(data)
def insert(self, data):
node = Node(data)
if self.root == None:
self.root = node
else:
current = self.root
w... | marquesarthur/learning_python | datastructures/binary_tree/BinaryTreeNonRecursive.py | Python | gpl-2.0 | 911 |
from rest_framework.test import APITestCase
from .factories import NormalUserFactory
from core.tests import APITestMixin
class UserAPITests(APITestCase, APITestMixin):
def setUp(self):
self.user = NormalUserFactory.create()
self.model_url = 'users/'
self.data = {
'username': ... | azul-cloud/django-rest-server | accounts/tests.py | Python | mit | 490 |
"""Remove an origin pull mapping."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command()
@click.argument('unique_id')
@click.argument('origin_path')
@environment.pass_env
def cli(env, unique_id, origin_path):
"""Removes an origin pa... | kyubifire/softlayer-python | SoftLayer/CLI/cdn/origin_remove.py | Python | mit | 536 |
# 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-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py | Python | mit | 35,290 |
import re
import inspect
import textwrap
import pydoc
import collections
import os
from jinja2 import FileSystemLoader
from jinja2.sandbox import SandboxedEnvironment
import sphinx
from sphinx.jinja2glue import BuiltinTemplateLoader
from .docscrape import NumpyDocString, FunctionDoc, ClassDoc
IMPORT_MATPLOTLIB_RE =... | astroML/astroML | doc/sphinxext/numpy_ext/docscrape_sphinx.py | Python | bsd-2-clause | 14,950 |
a = [8, 2, 7, 9, 1, 3 ]
b = [73, 23, 34, 34, 7, 8, 3, 5, 4]
a.extend(b)
print a
print sorted(set(a), key=a.index)
| deggs7/py-practice | sweet/merge_sort.py | Python | unlicense | 118 |
# encoding: 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/painless/basic_add_op.py | Python | mpl-2.0 | 562 |
"""
MIT License
Copyright (c) 2017 MontageML
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, dis... | MontageML/MarchMania2k17 | tests/LearnerTests/test_main.py | Python | mit | 1,325 |
# Copyright (C) 2013 ABRT Team
# Copyright (C) 2013 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... | abrt/faf | src/pyfaf/actions/repoassign.py | Python | gpl-3.0 | 4,580 |
#!/usr/bin/env python
"""
a class to access the REST API of the website www.factuursturen.nl
"""
import collections
import ConfigParser
from datetime import datetime, date
import re
import requests
from os.path import expanduser
import copy
import urllib
__author__ = 'Reinoud van Leeuwen'
__copyright__ = "Copyright 2... | reinoud/factuursturen | factuursturen/__init__.py | Python | bsd-2-clause | 19,420 |
"""
Unit tests for LTI 1.3 consumer implementation
"""
from unittest.mock import MagicMock, patch
import ddt
from Cryptodome.PublicKey import RSA
from django.test.testcases import TestCase
from rest_framework import exceptions
from lti_consumer.lti_1p3.consumer import LtiConsumer1p3
from lti_consumer.lti_1p3.extensi... | edx/xblock-lti-consumer | lti_consumer/lti_1p3/tests/extensions/rest_framework/test_authentication.py | Python | agpl-3.0 | 4,164 |
import time
import math
from functions import prime_sieve
times = []
times.append(time.clock())
limit = 1000000
primes = prime_sieve(limit)
pset = set(primes)
# search with a sliding window that shrinks in size
maxi = len(primes)
start = sum(primes[:-1])
stop = False
if start in pset:
print(start)
else:
fo... | esosn/euler | 50.py | Python | mit | 797 |
# eventBasedAnimationClass.py
from Tkinter import *
import sys
class EventBasedAnimationClass(object):
def onMousePressed(self, event): pass
def onKeyPressed(self, event): pass
def onTimerFired(self): pass
def redrawAll(self): pass
def initAnimation(self): pass
def __init__(self, width=300, h... | cvsmith/kosbeat | eventBasedAnimationClass.py | Python | mit | 2,566 |
#!/usr/bin/env python
import os, sys, argparse
BENCHMARK_DIR = os.path.dirname(os.path.abspath(__file__))
THEMIS_SCRIPTS_DIR = os.path.join(
BENCHMARK_DIR, os.pardir, os.pardir, os.pardir, "scripts", "themis")
CLUSTER_SCRIPTS_DIR = os.path.join(THEMIS_SCRIPTS_DIR, "cluster")
# Prepend so we can get the other r... | mconley99/themis_tritonsort | src/tritonsort/benchmarks/networkbench/run_benchmark.py | Python | bsd-3-clause | 3,173 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/interleave_bb_2i/tests/test_interleave_bb_2i.py | Python | gpl-3.0 | 4,075 |
from ethereum.tools import tester
from utils import longToHexString
def test_decimals(contractsFixture):
reputationTokenFactory = contractsFixture.contracts['ReputationTokenFactory']
assert reputationTokenFactory
reputationTokenAddress = reputationTokenFactory.createReputationToken(contractsFixture.control... | redsquirrel/augur-core | tests/reporting/test_reputation.py | Python | gpl-3.0 | 1,043 |
#!/usr/bin/env python
# Copyright (c) 2016, Simon Brodeur
# 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, th... | sbrodeur/ros-icreate-bbb | src/action/scripts/record/data/convert_hdf5.py | Python | bsd-3-clause | 14,904 |
from random import choice
from string import ascii_uppercase
from datetime import datetime
from boto3.s3.transfer import S3Transfer
def upload_to_s3_rand(session, file_to_upload, s3bucket,
prefix=None, postfix=None, rand_length=12):
"""
Uploads a file to an S3 bucket giving it a randomized name and r... | bgdnlp/emrer | awslib.py | Python | bsd-3-clause | 5,708 |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import datetime
import decimal
from storage import Storage
from html import TAG, XmlComponent
from html import xmlescape
from languages impor... | ccpgames/eve-metrics | web2py/gluon/serializers.py | Python | mit | 6,730 |
from ddtrace import tracer
from flask import Blueprint, flash, jsonify, redirect, render_template, request, session, url_for
import everyclass.server.user.exceptions
from everyclass.rpc.tencent_captcha import TencentCaptcha
from everyclass.server import logger
from everyclass.server.calendar import service as calendar... | fr0der1c/EveryClass-server | everyclass/server/user/views.py | Python | mpl-2.0 | 16,167 |
import character
import json
import pprint
class Player(object):
def __init__(self):
self.id = 0
self.champs = []
self.chosen = []
self.added = 0
self.averagePower = 0
def load(self, file):
with open(file) as data_file:
data = json.load(data_file)
... | dschrimpsher/mcoc_aw_diversity | src/player.py | Python | mit | 1,477 |
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, MultipleStringValue, ModuleValue
from django.utils.translation import ugettext_lazy as _
# First, setup a grup to hold all our possible configs
MYAPP_GROUP = ConfigurationGroup('MyApp', _('My App Settings'), ordering=0)
# Now, add our... | craigds/django-livesettings | livesettings/test_app/localsite/config.py | Python | bsd-3-clause | 1,224 |
from formatting import print_call
import credentials
import os.path
import re
import xmlrpclib
def api_call(method_name, endpoint, params=[], user_name="alice", verbose=False):
key_path, cert_path = "%s-key.pem" % (user_name,), "%s-cert.pem" % (user_name,)
res = ssl_call(method_name, params, endpoint, key_pa... | dana-i2cat/felix | modules/resource/manager/stitching-entity/src/core/utils/calls.py | Python | apache-2.0 | 4,733 |
from __future__ import absolute_import
import logging
from functools import partial
from concurrent.futures import ThreadPoolExecutor
import celery
import tornado.web
from tornado import ioloop
from tornado.httpserver import HTTPServer
from .api import control
from .urls import handlers
from .events import Events
... | jzhou77/flower | flower/app.py | Python | bsd-3-clause | 2,486 |
# -*- coding: utf-8 -*-
###############################################################################
#
# DeleteUser
# Deletes a specified user. The user must not belong to any groups, have any keys or signing certificates, or have any attached policies.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo I... | jordanemedlock/psychtruths | temboo/core/Library/Amazon/IAM/DeleteUser.py | Python | apache-2.0 | 3,822 |
"""Script to send a mailing to compute the Net Promoter Score.
We send it to users that signed up more than N days ago (N to be set as a
commandline flag) but we send it only once.
Usage:
docker-compose run --rm \
-e MONGO_URL ... \
frontend-flask python bob_emploi/frontend/server/mail_nps.py 2
"""
from typ... | bayesimpact/bob-emploi | frontend/server/mail/nps.py | Python | gpl-3.0 | 1,794 |
"""this module processes all the in-going packets by using nfqueue"""
from socket import AF_INET6
import sys
from NDprotector.Log import warn
from NDprotector.Address import Address
from NDprotector.NeighCache import NeighCache
from NDprotector.CertCache import CertCache
from NDprotector.Tool import SigAlgList_split,... | tcheneau/NDprotector | NDprotector/In.py | Python | bsd-3-clause | 19,566 |
# pylint: disable=old-style-class,missing-docstring,too-few-public-methods
__version__ = "1.0"
SOME_CONSTANT = 42 # [invalid-name]
def say_hello(some_argument):
return [some_argument * some_value for some_value in range(10)]
class MyClass: # [invalid-name]
def __init__(self, arg_x):
self._my_secre... | lucidmotifs/auto-aoc | .venv/lib/python3.5/site-packages/pylint/test/functional/name_preset_snake_case.py | Python | mit | 570 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('rules', '0015_auto_20141229_1610'),
]
operations = [
migrations.AlterField(
model_name='category',
name='created_date',
... | StamusNetworks/scirius | rules/migrations/0016_auto_20141229_1629.py | Python | gpl-3.0 | 1,089 |
from django.shortcuts import render
from django.db.models import F
from members.models import Show
class TimeSlot():
def __init__(self, time, shows):
self.time = time
self.shows = shows
class TimeSlotItem():
def __init__(self, name='', host='', genre='Empty', description='', row_span=1):
... | ngpitt/wrpi-web | public/views.py | Python | apache-2.0 | 2,659 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Sketches/MH/Editor2/Sandbox.py | Python | apache-2.0 | 5,670 |
# -*- coding: utf-8 -*-
"""
This file specifies the tests which are to be run on the default template.
modules/tests/suite.py runs this file to get the test_list which is to be loaded.
To add more tests which are to run on this template, simply add the class name
to the list below.
"""
from gluon imp... | code-for-india/sahana_shelter_worldbank | private/templates/uvg/tests.py | Python | mit | 1,964 |
#!/usr/bin/env python
import sys
import os
from os.path import expanduser
import getopt
import socket
import cson
import json
import time
import errno
from EIBConnection import EIBBuffer
from EIBConnection import EIBConnection
from Knx.KnxLogFileHandler import KnxLogFileHandler
from Knx.KnxAddressCollection import Kn... | TrondKjeldas/knxmonitor | knxmonitor/knxmonitor.py | Python | gpl-2.0 | 4,289 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import decimal
from shoop.utils.money import Money
class Price(Money):
includes_tax = None
... | arth-co/shoop | shoop/core/pricing/price.py | Python | agpl-3.0 | 1,198 |
#!/usr/bin/env python2
# vim: set fileencoding=utf-8 :
"""
Add [Newtonsoft.Json.JsonIgnore] to EF navigation properties
so they serialize correctly
"""
import os
for root, dirs, files in os.walk(os.getcwd()):
files[:] = [f for f in files if f[-3:].lower() == '.cs']
for f in files:
print('File {0}'.fo... | eas604/ef.jsonignore | efjsonignore.py | Python | mit | 1,142 |
"""
Django settings for pantry project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | tomp/food_pantry | pantry/settings.py | Python | mit | 4,038 |
# -*- ENCODING: UTF-8 -*-
"""
* File: Globales.py
* Authors: Miguel Ochoa Hernandez
*
"""
from Componentes.TablaSimbolos import TablaSimbolos
# from . import Globales
__author__ = "Miguel Ochoa Hernandez"
tabla_simbolos = TablaSimbolos()
ambito = "global"
ambitos_anteriores = []
mientras = -1
condicion_simple =... | Mike325/MiniC-Compiler | Componentes/Globales.py | Python | gpl-3.0 | 2,430 |
# -*- coding: utf-8 -*-
# Copyright 2006 Emfox Zhou <EmfoxZhou@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 Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | digris/openbroadcast.org | website/tools/mutagen/_tools/mid3iconv.py | Python | gpl-3.0 | 5,498 |
#!/usr/bin/env python
import functools
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
def initialize_options(self):
TestCommand.initialize_options(self)
... | justanr/objtoolz | setup.py | Python | mit | 1,229 |
from nose.tools import assert_equal, assert_raises
from ..test_utils import assert_is_instance
from encryptit.compat import struct_unpack
# See https://docs.python.org/2/library/struct.html
TESTS = [
# (0x01 << 24) + (0x02 << 16) + (0x03 << 8) + 0x04
(bytearray([1, 2, 3, 4]), '>I', (16909060,)),
# (0x04... | paulfurley/encryptit | encryptit/tests/compat/test_struct_unpack.py | Python | agpl-3.0 | 1,982 |
# coding=utf-8
"""
appinstance
Active8 (04-03-15)
license: GNU-GPL2
"""
from setuptools import setup
setup(name='consoleprinter',
version='95',
description='Console printer with linenumbers, stacktraces, logging, conversions and coloring..',
url='https://github.com/erikdejonge/consoleprinter',
... | erikdejonge/consoleprinter | setup.py | Python | gpl-2.0 | 917 |
"""
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 use this ... | JunHe77/bigtop | bigtop-packages/src/common/bigtop-ambari-mpack/bgtp-ambari-mpack/src/main/resources/stacks/BGTP/1.0/hooks/before-START/scripts/params.py | Python | apache-2.0 | 14,001 |
#!/usr/bin/python
# ============ cubex-cl.py ====================
# Version of CubeX for command line operation
# Use command python ./cubex-cl.py <filename>
# <filename> should refer to an input file containing tab-delimited columns of data
# where each column is one of nine diplotypes.
# ============================... | jknightlab/mePipe | exec/cubex-cl.py | Python | mit | 27,464 |
from __future__ import print_function
# Routines for manipulating grid files
try:
from boututils.datafile import DataFile
except ImportError:
print("ERROR: restart module needs DataFile")
raise
from numpy import ndarray, zeros
def slice(infile, outfile, region = None, xind=None, yind=None):
"""
x... | erikgrinaker/BOUT-dev | tools/pylib/boutdata/griddata.py | Python | gpl-3.0 | 12,671 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 ABF OSIELL (<http://osiell.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | abstract-open-solutions/server-tools | auditlog/models/rule.py | Python | agpl-3.0 | 22,385 |
from django.conf import settings
from django.contrib.auth.models import User
from django.shortcuts import render
def list(request):
speakers = User.objects.filter(
groups__name__exact=settings.SPEAKERS_GROUP_NAME)
context = {
'speakers': speakers
}
return render(request, 'speakers/list... | arscariosus/django-mango | mango/apps/speakers/views.py | Python | isc | 337 |
import sys
import argparse
parser = argparse.ArgumentParser(description="calculate X to the power of Y")
#positional arguments:
parser.add_argument("echo",
help="echo the string you use here",
type = int, #<int/float/str/...>
choices=[0, 1, 2]) # limit optio... | GiladAmar/Crash_courses | Python/Base/argparse.py | Python | mit | 5,247 |
########################################################################
#
# File Name: HTMLTableColElement
#
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Ri... | selfcommit/gaedav | pyxml/dom/html/HTMLTableColElement.py | Python | lgpl-2.1 | 2,425 |
__author__ = 'shinyorke_mbp'
| Shinichi-Nakagawa/xp2015_baseball_tools | service/__init__.py | Python | mit | 29 |
"""
Module with tests for exporter.py
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---... | mattvonrocketstein/smash | smashlib/ipy3x/nbconvert/exporters/tests/test_exporter.py | Python | mit | 1,879 |
import json
import struct
import os
origen = open("./FK.ind", "rb")
destino = open("./extra_data","w")
origen.read(256 + 7) # saco header
cantidad_mapas = struct.unpack('<H', (origen.read(2)))[0] # l1
x = 1
while (x < cantidad_mapas +1):
# numero X = numero de mapa
lluvia = struct.unpack('<B', (origen.read(1)))... | horacioMartinez/dakara-client | tools/misc/traductor de indices y mapas/mapas/extra_data_generator/lluvia_extra_data_generator.py | Python | mit | 601 |
from django.views.generic.base import TemplateView
class Home(TemplateView):
template_name = "home.html"
| kanu/django_longpolling_demo | lpdemo/views.py | Python | unlicense | 111 |
import os
import re
i = 0
output_file = str()
for file in os.listdir("UniformGaussian40D"):
if file.endswith(".txt") and file.startswith("f"):
f = open("UniformGaussian40D/"+file, "r")
last_file = output_file
output_file = re.sub ('_[0-9]*.txt', '.txt', file)
g = open("results_UniformGaussian40D/"+output_fi... | PyQuake/earthquakemodels | result_exp_benchmark/results_UniformGaussian40D-cleaner.py | Python | bsd-3-clause | 625 |
#!/usr/bin/env python
# Copyright (c) 2014, OpenCog Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | geni-lab/hri_common | src/hri_common/mini_head_expressions.py | Python | bsd-3-clause | 1,794 |
from PySide.QtGui import QGridLayout, QFileDialog
from prehistorydisplay import PrehistoryDisplay
from prehistorysimulation import PrehistorySimulation
from planetdata import Data
from simthread import SimThread
class PrehistoryPresenter(object):
def __init__(self, view, uistack):
self._view = view
... | tps12/Tec-Nine | prehistorypresenter.py | Python | gpl-3.0 | 3,030 |
# Copyright 2013 NEC Corporation.
# 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... | openstack/tempest | tempest/api/compute/admin/test_aggregates.py | Python | apache-2.0 | 12,688 |
from flask import render_template
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask.ext.appbuilder import ModelView
from app import appbuilder, db
"""
Create your Views::
class MyModelView(ModelView):
datamodel = SQLAInterface(MyModel)
Next, register your Views::
... | msampathkumar/rms | app/old_views.py | Python | apache-2.0 | 709 |
from airos import AirOSBackend
from junos import JunosBackend
from openwrt import OpenwrtBackend
from procurve import ProcurveBackend
from sftp import SFTPBackend
| cfra/configuroscope | backends/__init__.py | Python | gpl-3.0 | 163 |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
PROJECT_PHASES = getattr(settings, 'PROJECT_PHASES', (
('concept', _("Concept")),
('private_beta', _("Private Beta")),
('public_beta', _("Public Beta")),
('release', _("Released")),
))
PROJECT_UPLOAD_ROOT = getatt... | airtonix/django-project-portfolio | projects/settings.py | Python | bsd-3-clause | 1,355 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | TaskEvolution/Task-Coach-Evolution | taskcoach/tests/unittests/widgetTests/DragAndDropTest.py | Python | gpl-3.0 | 2,279 |
#!/usr/bin/env python3
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program ... | snapcore/snapcraft | tools/collect_ppa_autopkgtests_results.py | Python | gpl-3.0 | 2,694 |
##########################################################################
#
# Copyright (c) 2012, 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... | lento/cortex | test/IECoreGL/FontTest.py | Python | bsd-3-clause | 2,204 |
#!/usr/bin/env python3
"""Generate an updated requirements_all.txt."""
import difflib
import importlib
import os
from pathlib import Path
import pkgutil
import re
import sys
from homeassistant.util.yaml.loader import load_yaml
from script.hassfest.model import Integration
COMMENT_REQUIREMENTS = (
"Adafruit_BBIO",... | turbokongen/home-assistant | script/gen_requirements_all.py | Python | apache-2.0 | 10,856 |
# Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | google/tf-quant-finance | tf_quant_finance/datetime/holiday_calendar_test.py | Python | apache-2.0 | 11,852 |
import functools
from .lexer import compile_plim_source
from . import syntax as available_syntax
def preprocessor_factory(custom_parsers=None, syntax='mako'):
"""
:param custom_parsers: a list of 2-tuples of (parser_regex, parser_callable) or None
:type custom_parsers: list or None
:param syntax: na... | avanov/Plim | plim/__init__.py | Python | mit | 924 |
__author__ = 'victor'
from theano import shared, config
class ParamStore(dict):
def __init__(self, *args, **kwargs):
super(ParamStore, self).__init__(*args, **kwargs)
self.__dict__ = self
class Param(dict):
def __init__(self, name, shape, init=None, initializer=None, regularizer=None, tran... | vzhong/pystacks | pystacks/layers/params.py | Python | mit | 1,010 |
# found at http://stackoverflow.com/questions/855759/python-try-else
# The statements in the else block are executed if execution falls off
# the bottom of the try, i.e. if there was no exception.
try:
operation_that_can_throw_ioerror()
except IOError:
handle_the_exception_somehow()
else:
# we don't wan... | jabbalaci/PrimCom | data/python/my_except.py | Python | gpl-2.0 | 660 |
"""Base classes and convenience functions for writing indexers and skimmers"""
from collections import namedtuple
from operator import itemgetter
from os.path import join, islink
from warnings import warn
from funcy import group_by, decorator, imapcat
from dxr.utils import build_offset_map, split_content_lines
STR... | jbradberry/dxr | dxr/indexers.py | Python | mit | 22,661 |
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | juanchopanza/NeuroM | neurom/io/datawrapper.py | Python | bsd-3-clause | 11,091 |
from __future__ import unicode_literals
from django.contrib import admin
from .models import PlanfixContacts
@admin.register(PlanfixContacts)
class PlanfixContactsAdmin(admin.ModelAdmin):
list_display = ['id_contact','email']
| chadoneba/django-planfix | planfix/admin.py | Python | apache-2.0 | 239 |
import codecs
import doctest
import inspect
import io
import os
import platform
import re
import shutil
import subprocess
import sys
import textwrap
import time
import traceback
import types
def place( frame_record):
'''
Useful debugging function - returns representation of source position of
caller.
... | ArtifexSoftware/mupdf | scripts/jlib.py | Python | agpl-3.0 | 81,616 |
# 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... | tylertian/Openstack | openstack F/horizon/horizon/dashboards/syspanel/instances/urls.py | Python | apache-2.0 | 1,257 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import threading
from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import OutputMessageConnector
from ComssServiceDevelopment.development import DevServiceController
from GifConverter import video_info
print 'starting stu... | michaellas/streaming-vid-to-gifs | src/gif_convert_service/stub_input.py | Python | mit | 1,285 |
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ans... | simonwydooghe/ansible | test/units/modules/storage/netapp/test_na_ontap_unix_user.py | Python | gpl-3.0 | 11,306 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.