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 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ShippingStatus'
db.create_table(u'orders_shippingstatus', (
(u'id', self.gf('dja... | ferdyrod/basic-ecommerce | orders/migrations/0003_auto__add_shippingstatus.py | Python | apache-2.0 | 8,083 |
# -*- 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 os
from pathlib import Path
from django.conf import settings
from django.core.cache imp... | MichaelKohler/bedrock | lib/l10n_utils/tests/test_gettext.py | Python | mpl-2.0 | 13,596 |
import openturns as ot
from openturns.viewer import View
ot.RandomGenerator.SetSeed(0)
dimension = 2
R = ot.CorrelationMatrix(dimension)
R[0, 1] = 0.8
distribution = ot.Normal([3.] * dimension, [2.] * dimension, R)
size = 100
sample = distribution.getSample(size)
firstSample = ot.NumericalSample(size, 1)
secondSample... | aurelieladier/openturns | python/doc/pyplots/VisualTest_DrawLinearModelResidual.py | Python | lgpl-3.0 | 724 |
#!/usr/bin/env python
"""Multi Bridge Example
Identical to the Hello Bridge Example but with a 2nd child.
"""
from __future__ import print_function
from os import getpid
from circuits import ipc, Event, Component
class go(Event):
"""go Event"""
class hello(Event):
"""hello Event"""
class Child(Comp... | nizox/circuits | examples/hello_multi_bridge.py | Python | mit | 1,122 |
from flask import Flask, jsonify
from flask.views import MethodView
from flask_swagger import swagger
app = Flask(__name__)
class UserAPI(MethodView):
def get(self, team_id):
"""
Get a list of users
First line is the summary
All following lines until the hyphens is added to descri... | ibratoev/flask-swagger | examples/example.py | Python | mit | 3,764 |
############################################
# Copyright (c) 2012 Microsoft Corporation
#
# Z3 Python interface
#
# Author: Leonardo de Moura (leonardo)
############################################
import sys, io, z3
from z3consts import *
from z3core import *
from ctypes import *
##############################
#
# C... | jirislaby/z3 | src/api/python/z3printer.py | Python | mit | 40,207 |
"""
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
This file is part of the Smart Developer Hub Project:
http://www.smartdeveloperhub.org
Center for Open Middleware
http://www.centeropenmiddleware.com/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=... | SmartDeveloperHub/sdh-curator | sdh/curator/test/query.py | Python | apache-2.0 | 3,809 |
# Copyright (C) 2010 Oregon State University et al.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program i... | dmS0Zq/ganeti_webmgr | ganeti_webmgr/ganeti_web/views/importing.py | Python | gpl-2.0 | 7,249 |
#
# 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... | airbnb/airflow | tests/dags_with_system_exit/b_test_scheduler_dags.py | Python | apache-2.0 | 1,070 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | jslhs/barf-project | barf/barf/__init__.py | Python | bsd-2-clause | 1,409 |
import datetime
from loguru import logger
from flexget import plugin
from flexget.event import event
from flexget.utils.database import Session
logger = logger.bind(name='est_movies_bluray')
class EstimatesMoviesBluray:
@plugin.priority(2)
def estimate(self, entry):
if 'movie_name' not in entry:
... | ianstalk/Flexget | flexget/components/estimate_release/estimators/est_movies_bluray.py | Python | mit | 1,377 |
#!python
"""
Copyright (C) 2004-2017 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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 Li... | edespino/gpdb | gpMgmt/test/behave_utils/PgHba.py | Python | apache-2.0 | 13,767 |
#!/usr/bin/python3
# requirements: btrfs on /dev/sdc1 with qgroup 1/0 and 1/1
from storage import *
from storageitu import *
set_logger(get_logfile_logger())
environment = Environment(False)
storage = Storage(environment)
storage.probe()
staging = storage.get_staging()
print(staging)
blk_device = BlkDevice.fi... | aschnell/libstorage-ng | integration-tests/filesystems/btrfs/quota/set-limits.py | Python | gpl-2.0 | 1,040 |
import os
# For backward compatibility, we import get_qapp here
from ..external.qt import get_qapp
def teardown():
# can be None if exceptions are raised early during setup -- #323
if get_qapp is not None:
app = get_qapp()
app.exit()
_app = get_qapp()
import atexit
atexit.register(teardown)
| JudoWill/glue | glue/qt/__init__.py | Python | bsd-3-clause | 320 |
# Copyright (c) 2015 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 ... | noironetworks/neutron | neutron/tests/unit/agent/l3/test_ha_router.py | Python | apache-2.0 | 7,211 |
#!/usr/bin/python
def solve():
combinations = {}
opposed = {}
l = raw_input().split(' ')
c = int(l.pop(0))
for i in range(c):
c1, c2, r = l.pop(0)
combinations[tuple(sorted((c1, c2)))] = r
d = int(l.pop(0))
for i in range(d):
d1, d2 = l.pop(0)
... | sanSS/programming-contests | codejam/2011/Qualification/B.py | Python | gpl-3.0 | 1,108 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016, ICEA
#
# This file is part of atn-sim
#
# atn-sim 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 op... | icea-dev/atn-sim | atn/surveillance/icea/Message.py | Python | gpl-3.0 | 1,837 |
#!/usr/bin/env python
# coding: utf8
from gluon.html import *
from gluon.http import *
from gluon.validators import *
from gluon.sqlhtml import *
class Auth:
@staticmethod
def isLoggedIn(session):
if session.logged_in:
if session.user and session.user.is_logged_in():
retur... | davidhampgonsalves/mix-tree | init/modules/simple_auth.py | Python | mit | 441 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3
import logging
log = logging.getLogger('subdownloader.callback.ProgressCallback')
class ProgressCallback(object):
"""
This class allows calling function to be informed of eventual progress.
Subclasses should only... | subdownloader/subdownloader | subdownloader/callback.py | Python | gpl-3.0 | 6,305 |
from abc import ABCMeta, abstractmethod
class Parent(object):
__metaclass__ = ABCMeta
@abstractmethod
def my_method2(self):
pass
@abstractmethod
def my_method(self, foo):
pass | akosyakov/intellij-community | python/testData/refactoring/pullup/abstractMethodHasMeta/SuperClass.after.py | Python | apache-2.0 | 215 |
# Copyright (c) 2009-2013 Samuel Stauffer <samuel@descolada.com>
# 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... | jjhoo/sudoku.rb | erlastic/types.py | Python | agpl-3.0 | 4,125 |
#!/usr/bin/env python
import sys
import re
import math
import scipy
import scipy.stats
def extract_data(data_files):
unormalised_concurrence = []
entropy = []
trace = []
entropy_regex = '^ # Unnormalised von Neumann entropy ='
concurrence_regex = '^ # Unnormalised concurrence ='
trace_regex = ... | ruthfranklin/hande | tools/dmqmc/average_entropy.py | Python | lgpl-2.1 | 2,794 |
# Generated by Django 2.2.6 on 2019-11-12 08:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('registration', '0011_betatestapplication_privacy_policy_url'),
# Make sure that data from the removed fields has been copied over before
# they are r... | open-craft/opencraft | registration/migrations/0012_auto_20191112_0838.py | Python | agpl-3.0 | 709 |
from mitmproxy import contentviews
from mitmproxy.test import tflow
from mitmproxy.test import tutils
from mitmproxy.test import taddons
from mitmproxy.net.http import Headers
from ..mitmproxy import tservers
class TestScripts(tservers.MasterTest):
def test_add_header(self, tdata):
with taddons.context()... | ujjwal96/mitmproxy | test/examples/test_examples.py | Python | mit | 3,859 |
# Adapted from unittest2/loader.py from the unittest2 plugins branch.
# This module contains some code copied from unittest2/loader.py and other
# code developed in reference to that module and others within unittest2.
# unittest2 is Copyright (c) 2001-2010 Python Software Foundation; All
# Rights Reserved. See: http:/... | ptthiem/nose2 | nose2/loader.py | Python | bsd-2-clause | 4,345 |
import requests
import json
import os
from socket import TagoRealTime
API_TAGO = os.environ.get('TAGO_SERVER') or 'https://api.tago.io'
REALTIME = os.environ.get('TAGO_REALTIME') or 'https://realtime.tago.io'
class Device:
def __init__(self, token):
self.token = token
self.default_headers = { 'con... | madhavbhatt/tago-sdk-python | tago/device/__init__.py | Python | apache-2.0 | 1,879 |
"""
Comsystem command module.
Comm commands are OOC commands and intended to be made available to
the Player at all times (they go into the PlayerCmdSet). So we
make sure to homogenize self.caller to always be the player object
for easy handling.
"""
from django.conf import settings
from src.comms.models import Chann... | GhostshipSoftware/avaloria | src/commands/default/comms.py | Python | bsd-3-clause | 41,902 |
#
# Copyright (C) 2009-2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it wi... | atodorov/blivet | blivet/osinstall.py | Python | gpl-2.0 | 43,581 |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from six import StringIO
import ramrod
import ramrod.stix
import ramrod.stix.stix_1_1
import ramrod.utils as utils
from ramrod.test import (_BaseVocab, _BaseTrans)
UPDATER_MOD = ramrod.stix.stix_1_... | STIXProject/stix-ramrod | ramrod/test/stix/stix_1_1_test.py | Python | bsd-3-clause | 4,360 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os, sys
sys.path.insert(0, os.path.abspath('../'))
from libs import utils
class TestBasePage(unittest.TestCase):
def test_user_in_group(self):
self.assertTrue(utils.test_in_group())
with self.assertRaises(SystemExit) as... | maidstone-hackspace/dockyard | tests/test_user_in_group.py | Python | gpl-3.0 | 486 |
from celery.task import task
from django.core.cache import cache
from soil import DownloadBase
from corehq.apps.locations.bulk import import_locations
from corehq.apps.commtrack.bulk import import_stock_reports
from soil.util import expose_download
from dimagi.utils.excel import WorkbookJSONReader
@task
def import_lo... | gmimano/commcaretest | corehq/apps/commtrack/tasks.py | Python | bsd-3-clause | 1,204 |
class Solution(object):
def canFinish(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool
"""
| rx2130/Leetcode | python/207 Course Schedule.py | Python | apache-2.0 | 196 |
import calendar
import datetime
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from corehq.apps.app_manager.dbaccessors import get_brief_apps_in_domain
from corehq.apps.commtrack.const import USER_LOCATION_OWNER_MAP_TYPE
from core... | dimagi/commcare-hq | corehq/apps/reports/filters/select.py | Python | bsd-3-clause | 4,942 |
class ReadableException(Exception):
default_detail = 'A server error occurred.'
default_code = 'error'
def __init__(self, detail=None, code=None):
if detail is None:
detail = self.default_detail
if code is None:
code = self.default_code
self.detail = detail
... | makeev/django-boilerplate | back/main/exceptions.py | Python | mit | 345 |
# Copyright (c) 2016, Louis Opter <louis@opter.org>
#
# This file is part of lightsd.
#
# lightsd 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 late... | lopter/lightsd | apps/monolight/monolight/ui/__init__.py | Python | gpl-3.0 | 738 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | alsrgv/tensorflow | tensorflow/compiler/tests/random_ops_test.py | Python | apache-2.0 | 7,283 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostScsiTopologyInterface(vim, *args, **kwargs):
'''This data object type describes t... | xuru/pyvisdk | pyvisdk/do/host_scsi_topology_interface.py | Python | mit | 1,076 |
#!/usr/bin/env python3
import argparse
import sys
import os
from fluxghost.pipe_route import get_match_pipe_service, ROUTES
from fluxghost.launcher import setup_env, show_version
def main():
parser = argparse.ArgumentParser(description='FLUX Shadow')
parser.add_argument("--log", dest='logfile', type=str, de... | flux3dp/fluxghost | shadow.py | Python | agpl-3.0 | 2,230 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/cloudstack/cs_network_acl.py | Python | gpl-3.0 | 5,606 |
###
# Copyright (c) 2004, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/Time/plugin.py | Python | gpl-2.0 | 5,772 |
#!/usr/bin/env python
'''
Copyright 2009, The Android Open Source Project
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
Un... | houseofadams/dotfiles | bin/coloredlogcat.py | Python | apache-2.0 | 4,876 |
import lldb
import re
import testutils as test
# bpmd -clearall
def runScenario(assembly, debugger, target):
process = target.GetProcess()
res = lldb.SBCommandReturnObject()
ci = debugger.GetCommandInterpreter()
# Run debugger, wait until libcoreclr is loaded,
# set breakpoint at Test.Main and s... | ragmani/coreclr | src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py | Python | mit | 1,713 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=invalid-name
from __future__... | mganeva/mantid | scripts/Interface/reduction_gui/widgets/sans/hfir_background.py | Python | gpl-3.0 | 12,663 |
# Django
from django.conf.urls import url
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$',
TemplateView.as_view(template_name='home/home.html'),
name='index'),
]
| systers/vms | vms/home/urls.py | Python | gpl-2.0 | 208 |
"""Test PsychoPy sound.py using pyo backend
"""
from __future__ import division
from builtins import object
from past.utils import old_div
import pytest
from scipy.io import wavfile
import shutil, os
from tempfile import mkdtemp
import numpy as np
from psychopy import prefs, core
from psychopy import sound, micropho... | hoechenberger/psychopy | psychopy/tests/test_sound/test_sound_pyo.py | Python | gpl-3.0 | 3,229 |
from cbagent.collectors.collector import Collector
class NSServer(Collector):
COLLECTOR = "ns_server"
def _get_stats_uri(self):
for bucket, stats in self.get_buckets(with_stats=True):
uri = stats["uri"]
yield uri, bucket # cluster wide
def _get_stats(self, uri):
... | couchbase/perfrunner | cbagent/collectors/ns_server.py | Python | apache-2.0 | 3,972 |
#!/usr/bin/env python
import sys,os,random,errno
import numpy as np
import argparse
from argparse import RawTextHelpFormatter
# ---------------- Arguments
parser = argparse.ArgumentParser(description='''Take as input time serial data (one locus). The output can be either mles or likelihood surface over a grid or the ... | sapfo/ancientselection | ancientselection/ancientselection.py | Python | gpl-3.0 | 12,851 |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.test import TestCase
from django.conf import settings
from django.utils import timezone
from .factories import UserFactory, LocationFactory
from .models import Media, User, Tag, Location
from .api import InstagramError
USER_ID = 237074561 # tnt_onli... | ramusus/django-instagram-api | instagram_api/tests.py | Python | bsd-3-clause | 14,673 |
'''
Created on Jun 1, 2015
@author: joep
'''
from unittest import TestCase
import pygame
from util.rect import are_touching
class RectTest(TestCase):
def test_are_touching(self):
rect_1 = pygame.Rect(3, 3, 1, 1)
self.assertTrue(are_touching(rect_1, pygame.Rect(2, 3, 1, 1)))
s... | JoepDriesen/Township | Township/util/test/test_rect.py | Python | gpl-3.0 | 2,000 |
# -*- coding: utf-8 -*-
'''
The EC2 Cloud Module
====================
The EC2 cloud module is used to interact with the Amazon Elastic Cloud
Computing. This driver is highly experimental! Use at your own risk!
To use the EC2 cloud module, set up the cloud configuration at
``/etc/salt/cloud.providers`` or ``/etc/salt... | MadeiraCloud/salt | sources/salt/cloud/clouds/ec2.py | Python | apache-2.0 | 74,589 |
# Code from http://fi.am/entry/plugging-a-rss-feed-into-a-django-template/
from datetime import datetime
import time
from django.core.cache import cache
from django import template
import feedparser
register = template.Library()
@register.filter
def todatetime(value):
return datetime(*time.localtime(time.mktim... | DraXus/andaluciapeople | sitios/templatetags/rssplug.py | Python | agpl-3.0 | 1,286 |
import pandas as pd
import numpy as np
import pyaf.HierarchicalForecastEngine as hautof
import pyaf.Bench.TS_datasets as tsds
import datetime
#get_ipython().magic('matplotlib inline')
b1 = tsds.load_AU_infant_grouped_dataset();
# reduce the number of possible values of State.
b1.mHierarchy['Groups']['State'] = ["NS... | antoinecarme/pyaf | tests/bugs/issue_56/issue_56_order1.py | Python | bsd-3-clause | 920 |
from django.conf.urls import url
from django.contrib import messages
from django.contrib.admin import ModelAdmin
from django.db.models import Q
from django.template.response import TemplateResponse
from django.templatetags.static import static
from django.urls import reverse
from django.utils.translation import ugettex... | interop-dev/django-netjsongraph | django_netjsongraph/base/admin.py | Python | mit | 7,984 |
"""
Copyright 2015 Matthew D. Ball (M4Numbers)
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 o... | M4Numbers/Walkers | tests/ImgurCrawlerTest.py | Python | apache-2.0 | 898 |
# -*- coding: utf-8 -*-
#
# Link Attachment in Website
# Copyright (C) 2014 Xpansa Group (<http://xpansa.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either ver... | xpansa/website | website_link_attachment/__init__.py | Python | agpl-3.0 | 840 |
import sys; sys.path[0:0] = './' # Puts current directory at the start of path
import settings
import pymc as pm
import numpy as np
import scipy as sp
import detrital_ui.common as ba
from detrital_ui.data_types import *
BIN = True
err = pm.Uniform('RelErr',settings.error_prior[0],settings.error_prior[1],plot=Tr... | cossatot/py_thermochron | detrital_ui/simple_model.py | Python | mit | 2,866 |
# mysql/pymysql.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+pymysql
:name: PyMySQL
:dbapi: pymysql
:connect... | fernandog/Medusa | ext/sqlalchemy/dialects/mysql/pymysql.py | Python | gpl-3.0 | 1,989 |
# -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import RootOrgViewMixin
from common.permissions import IsValidUs... | zsjohny/jumpserver | apps/ops/api/command.py | Python | gpl-2.0 | 2,150 |
"""Test Z-Wave config panel."""
import asyncio
import json
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.bootstrap import async_setup_component
from homeassistant.components import config
from homeassistant.components.zwave import DATA_NETWORK, const
from tests.mock.zwave import MockNod... | persandstrom/home-assistant | tests/components/config/test_zwave.py | Python | apache-2.0 | 16,984 |
from chainer import cuda
class GradientHardClipping(object):
"""Optimizer/UpdateRule hook function for gradient clipping.
This hook function clips all gradient arrays to be within a lower and upper
bound.
Args:
lower_bound (float): The lower bound of the gradient value.
upper_bound ... | rezoo/chainer | chainer/optimizer_hooks/gradient_hard_clipping.py | Python | mit | 1,937 |
# shipBonusMiningDroneAmountPercentRookie
#
# Used by:
# Ship: Gnosis
# Ship: Taipan
# Ship: Velator
type = "passive"
def handler(fit, container, context):
fit.drones.filteredItemBoost(lambda drone: drone.item.group.name == "Mining Drone",
"miningAmount", container.getModifiedItem... | Ebag333/Pyfa | eos/effects/shipbonusminingdroneamountpercentrookie.py | Python | gpl-3.0 | 346 |
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from exhibitions.models import Exhibition
class ExhibitionAdmin(TranslationAdmin):
readonly_fields = ('get_img_tag_for_admin',)
fieldsets = [
(
None, {
'fields': (
('begin', 'end',),
'title',
'showroom',
... | hombit/olgart | app/exhibitions/admin.py | Python | mit | 482 |
"""
Daplug keyset creation class
"""
from conv import *
class KeySet:
"""@KeySet"""
# Key constants
USAGE_GP = 0x01
"""@KeySet.USAGE_GP"""
USAGE_GP_AUTH = 0x02
"""@KeySet.USAGE_GP_AUTH"""
USAGE_HOTP = 0x03
"""@KeySet.USAGE_HOT... | Plug-up/daplug-python | daplug/keyset.py | Python | apache-2.0 | 3,442 |
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A kaleidoscope pattern with icosahedral symmetry
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import hsv_to_rgb
def Klein(z):
"""Klein's icosahedral invariants."""
return (
... | neozhaoliang/pywonderland | src/misc/kaleidoscope.py | Python | mit | 1,447 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
#... | MostlyOpen/odoo_addons | myo_summary/models/annotation.py | Python | agpl-3.0 | 1,419 |
import sys
import xbmc,xbmcaddon
import sqlite3
ADDON = xbmcaddon.Addon(id='script.tvguide.Vader')
channel = sys.argv[1]
start = sys.argv[2]
if ADDON.getSetting('playing.channel') != channel:
quit()
elif ADDON.getSetting('playing.start') != start:
quit()
ADDON.setSetting('playing.channel','')
ADDON.setSettin... | ledtvavs/repository.ledtv | script.tvguide.Vader/stop.py | Python | gpl-3.0 | 386 |
import _plotly_utils.basevalidators
class SymbolValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="symbol", parent_name="scatter3d.marker", **kwargs):
super(SymbolValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/marker/_symbol.py | Python | mit | 863 |
#!/usr/bin/env python
# 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/.
from selenium.webdriver.common.by import By
from pages.base import Page
class PlatformFilter(P... | staranjeet/fjord | smoketests/pages/regions/platform_filter.py | Python | bsd-3-clause | 3,098 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ve... | tersmitten/ansible | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | Python | gpl-3.0 | 3,548 |
#!/usr/env python
def fib(li, maxval):
if li[-1] >= maxval:
return li[:-1]
return fib(li + [li[-1] + li[-2]], maxval)
print sum([x for x in fib([1, 2], 4000000) if x % 2 == 0])
| kalikaneko/euler | 002/fibo.py | Python | lgpl-3.0 | 194 |
# 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 agreed to in writing, ... | googleapis/python-aiplatform | samples/snippets/job_service/create_batch_prediction_job_text_classification_sample_test.py | Python | apache-2.0 | 1,972 |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponseBadRequest, HttpResponse
from bootcamp.tasks.models import Task
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from bootcamp.tasks.forms import TaskForm
from django.contrib.auth.decorators impo... | davismathew/netbot-django | bootcamp/ipam/views.py | Python | mit | 3,045 |
#!/usr/bin/env python
# Diffing two jar files can be a surprisingly subtle task. It is possible
# for jar files to differ in packaging, but have the same content (examples:
# when they are zipped using different compresssion levels, or if the
# timestamps for entries differ, or if the ordering inside the jar is
# dif... | shs96c/buck | scripts/jardiffer.py | Python | apache-2.0 | 6,484 |
# -*- coding: utf-8 -*-
"""
:mod:`traceview.formatters`
This module contains functions used to format TraceView API results.
"""
from collections import namedtuple
def identity(results):
return results
def tuplify(results, class_name='Result'):
""" Formats API results into :class:`namedtuple` objects. S... | danriti/python-traceview | traceview/formatters.py | Python | mit | 1,451 |
# coding=utf-8
# Author: Dustyn Gibson <miigotu@gmail.com>
#
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 o... | Maximilian-Reuter/SickRage-1 | sickbeard/providers/hdtorrents.py | Python | gpl-3.0 | 7,743 |
# Copyright 2019 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 agreed to in writing, ... | googleapis/python-bigquery | samples/query_external_sheets_permanent_table.py | Python | apache-2.0 | 3,135 |
import dbus
import nm
import nmdevice
DBUS_INTERFACE_DEVICE_WIRED = "org.freedesktop.NetworkManager.Device.Wired"
class WiredDevice(nmdevice.Device):
def __init__(self, path):
nmdevice.Device.__init__(self, path)
def get_hw_address(self):
return self.get_property(DBUS_INTERFACE_DEVICE_WIRED, ... | mvidner/nmcli | src/nmwireddevicecmds.py | Python | gpl-2.0 | 743 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003-2013] [Jürgen Hamel, D-32584 Löhne]
##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 later v... | CuonDeveloper/cuon | cuon_client/cuon/bin/cuon/Articles/articles.py | Python | gpl-3.0 | 44,421 |
# 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/.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^new/", views.new_spark_job, name="jobs-... | mozilla/telemetry-analysis-service | atmo/jobs/urls.py | Python | mpl-2.0 | 924 |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
class PostForm(Form):
post = StringField('post', validators=[DataRequired()])
class SearchForm(Form):
search = StringField('search', validators=[DataRequired()])
class Logi... | skrillex581/flask-insight | app/forms.py | Python | gpl-2.0 | 1,099 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('block', '0002_auto_20141011_2223'),
]
operations = [
migrations.CreateModel(
name='HeaderFooter',
fi... | pkimber/cms | cms/migrations/0001_initial.py | Python | apache-2.0 | 2,513 |
#!/usr/bin/env python
import sys
import math
import time
import os
from cv2 import *
import numpy as np
from src.server import CubeScoutServer
class SightingInfo:
def __init__(self):
self.since_sighting = 9999999 # Time since last sighting
self.since_notify = 9999999 # Time since last notificati... | tedsta/cube-scout | cubescout.py | Python | mit | 7,051 |
import websocket
import json
import requests
import urllib
import os
import logging
# Suppress InsecureRequestWarning
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
###VARIABLES THAT YOU NEED TO SET MANUALLY IF NOT ON HEROKU##... | dukeluke16/greetingslack | bot.py | Python | mit | 2,880 |
#!/usr/bin/env python3
'''
Class to take care of peerme config
'''
import configparser
import logging
class PeermeConfig():
def __init__(self, conf_file):
self.conf_file = conf_file
self.config = configparser.ConfigParser()
self.config.read(conf_file)
if not self.config.sect... | afenioux/peerme | peerme/config.py | Python | bsd-2-clause | 1,027 |
# 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... | pkreissl/espresso | src/python/espressomd/reaction_ensemble.py | Python | gpl-3.0 | 21,499 |
# -*- encoding: utf-8 -*-
# Pilas engine - A video game framework.
#
# Copyright 2010 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
import pilas
from pilas.actores import Texto
class Opcion(Texto):
def __init__(self, texto, x=0, y=0, fu... | cristian99garcia/pilas-activity | pilas/actores/opcion.py | Python | gpl-3.0 | 1,044 |
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/rlds | rlds/transformations/alignment.py | Python | apache-2.0 | 3,077 |
# Author: Jayden Navarro
# Date: 10/14/2015
class HashTable():
LOAD_THRESHOLD = 0.3
GOLDEN_VALUE = 0.618034
LOW_CAP = 10
def __init__(self, capacity=-1):
self.size = 0
self.capacity = max(self.LOW_CAP, capacity)
self.table = [None] * self.capacity
def loadFactor(self):
retur... | JDNdeveloper/Interview-Practice-Python | src/HashTable.py | Python | mit | 1,734 |
import sys
import unittest
sys.path.insert(1, '.')
import General_Maths
class test_stuff(unittest.TestCase):
def test_Sieve_upto_20(self):
expected = [2, 3, 5, 7, 11, 13, 17, 19]
actual = General_Maths.Sieve_Of_Eratosthenes(20)
self.assertEqual(expected, actual)
def test_sieve_with_p... | jonathan0wilson/general_scripts | tests/General_Maths_Tests.py | Python | mit | 2,669 |
"""Imports:
TrackData: for containing the extracted information
"""
import TrackData
# Valid Frame IDs for each of the different versions
_V22_FRAME_IDS = [\
"BUF", "CNT", "COM", "CRA", "CRM", "ETC", "EQU", "GEO", "IPL", "LNK", "MCI",
"MLL", "PIC", "POP", "REV", "RVA", "SLT", "STC", "TAL", "TBP", "TCM", "T... | jonsim/music_tagger | ID3v2.py | Python | gpl-3.0 | 29,580 |
import itertools
from sqlalchemy import Boolean
from sqlalchemy import delete
from sqlalchemy import exc as sa_exc
from sqlalchemy import func
from sqlalchemy import insert
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import Sequence
from sqlalchemy impor... | zzzeek/sqlalchemy | test/sql/test_returning.py | Python | mit | 25,076 |
"""
WSGI config for dndsite 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | TheIncredibleK/dndtoolbox | dndsite/wsgi.py | Python | mit | 392 |
##
## This file is part of the sigrok project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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... | robacklin/sigrok | decoders/rtc8564/__init__.py | Python | gpl-3.0 | 912 |
"""
.. UIExample:: 100
from flexx import app, ui
# A red widget
class Example(ui.Widget):
CSS = ".flx-example {background:#f00; min-width: 20px; min-height:20px}"
"""
import json
import threading
from .. import react
from ..app import Pair, get_instance_by_id
from ..app.serialize import... | synmnstr/flexx | flexx/ui/_widget.py | Python | bsd-2-clause | 13,195 |
import numbers
import inspect
import numpy as np
import tensorflow as tf
from neupy import init
from neupy.utils import as_tuple
from neupy.core.docs import SharedDocs
__all__ = (
'BaseProperty', 'Property', 'ArrayProperty', 'BoundedProperty',
'ProperFractionProperty', 'NumberProperty', 'IntProperty',
'... | itdxer/neupy | neupy/core/properties.py | Python | mit | 10,272 |
'''
Created on Jul 5, 2013
Updated on Jun 6, 2016 - Adding Python 3, sqlite, dotEnv, dryrun option, argparse, and reviewing code
@author: kinow
'''
from dotenv import load_dotenv
import configparser
import sqlite3
import argparse
from datetime import datetime
from pytz import timezone
import logging
import os
impor... | tupilabs/asf_releases_aggregator | markmail_consumer.py | Python | apache-2.0 | 8,635 |
# *****************************************************************************
#
# 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
#
# ... | Thrameos/jpype | jpype/__init__.py | Python | apache-2.0 | 2,537 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | jehine-MSFT/azure-storage-python | azure/storage/_connection.py | Python | apache-2.0 | 5,691 |
import datetime
import urllib
from django.http import HttpRequest, HttpResponse
from apps.canvas_auth.models import AnonymousUser
from canvas import bgwork
from canvas.middleware import (RequestSetupMiddleware, DeferredWorkMiddleware, ExceptionLogger, ResponseGuard,
safe_middleware)
fro... | canvasnetworks/canvas | website/canvas/tests/test_middleware.py | Python | bsd-3-clause | 4,965 |
from mock import MagicMock, patch
from nose.plugins.attrib import attr
from ion.agents.data.handlers.handler_utils import _get_type, list_file_info, \
list_file_info_http, list_file_info_ftp, list_file_info_fs, \
get_time_from_filename, calculate_iteration_count, get_sbuffer
from pyon.util.unit_test import Pyon... | ooici/coi-services | ion/agents/data/handlers/test/test_handler_utils.py | Python | bsd-2-clause | 8,108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.