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 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017-2022 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | gem/oq-engine | openquake/commands/checksum.py | Python | agpl-3.0 | 1,947 |
#!/bin/python
import fileinput
import json
for line in fileinput.input():
event = json.loads(line)
series = event['series']
revision = event['parameters']['revision']
print("series %d (rev %d)" % (series, revision))
| joselamego/patchwork | docs/examples/testing-show-series.py | Python | gpl-2.0 | 229 |
import logging
from datetime import datetime
from edc_lab.lab_clinic_api.models import TestCode
logger = logging.getLogger(__name__)
class NullHandler(logging.Handler):
def emit(self, record):
pass
nullhandler = logger.addHandler(NullHandler())
class BaseImport(object):
"""Base class for importing ... | botswana-harvard/edc-lab | old/lab_clinic_reference/classes/base_import.py | Python | gpl-2.0 | 4,426 |
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.t411api import Base
from couchpotato.core.media.movie.providers.base import MovieProvider
log = CPLog(__name__)
autoload = 't411api'
class t411api(MovieProvider, Base):
pass
| cyberden/CouchPotatoServer | couchpotato/core/media/movie/providers/torrent/t411api.py | Python | gpl-3.0 | 276 |
# Copyright (c) 2005 Allan Saddi <allan@saddi.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, this list of c... | dbcls/dbcls-galaxy | lib/galaxy/web/framework/servers/flup/preforkthreadedserver.py | Python | mit | 17,258 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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_... | cyberark-bizdev/ansible | lib/ansible/modules/network/aci/aci_access_port_to_interface_policy_leaf_profile.py | Python | gpl-3.0 | 10,401 |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
import csv
from json import dumps
from functools import wraps
from datetime import datetime
import logging
from lxml import etree
from flask import Response
from presence_analyzer.main import app
log = logging.getLogger(__name__) # pylint: disable=in... | stxnext-kindergarten/presence-analyzer-adubiel | src/presence_analyzer/utils.py | Python | mit | 6,677 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | etherkit/OpenBeacon2 | client/win/venv/Lib/site-packages/PyInstaller/hooks/hook-usb.py | Python | gpl-3.0 | 3,168 |
# Add paths, we want to be able to run in either root or Run/
import sys
import os
# print sys.path
sys.path = ["py", "../py"]+sys.path
from CosmoMCImportanceSampler import *
from MCMCAnalyzer import *
from MaxLikeAnalyzer import *
from LikelihoodMultiplier import *
from CompositeLikelihood import *
from HubbleParamet... | slosar/april | Run/RunBase.py | Python | gpl-2.0 | 6,646 |
#coding: utf-8
import os
import xlrd
from django.conf import settings
from chemistry.models import ChemInfoLocal
DATA_FILE = os.path.join(settings.SETTINGS_ROOT, 'deploy', "data.xls")
SHEET_NAME = "work"
CAS = 0
EINECS = 1
EINECS_Name = 2
EINECS_MF = 3
Frequency = 4
Num_PositiveAtoms = 5
Num_NegativeAtoms = 6
Formal... | chemistryTools/ChemToolsWebService | tools/deploy/import_local.py | Python | agpl-3.0 | 2,706 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2018_08_01/aio/operations/_public_ip_addresses_operations.py | Python | mit | 43,544 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 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 is distributed in ... | elopio/snapcraft | tests/unit/plugins/test_go.py | Python | gpl-3.0 | 19,215 |
# Copyright 2022 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | magenta/magenta | magenta/models/image_stylization/image_stylization_transform.py | Python | apache-2.0 | 5,514 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_angular_token_auth.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| famachot/django_angular_token_auth | manage.py | Python | apache-2.0 | 268 |
#
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of SimplePL.
#
# SimplePL is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your opt... | scott-maddox/simplepl | src/simplepl/dialogs/gratings_and_filters_config_dialog.py | Python | agpl-3.0 | 10,761 |
# Copyright 2013 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 agreed to in... | jumpstarter-io/keystone | keystone/tests/unit/test_token_bind.py | Python | apache-2.0 | 7,952 |
# -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | thomasaarholt/hyperspy | hyperspy/signal_tools.py | Python | gpl-3.0 | 82,298 |
from django import forms
from django.forms.models import inlineformset_factory
from cruditor.forms import (
CruditorFormsetFormMixin, CruditorFormsetMixin, CruditorTapeformMixin)
from examples.store.models import Person, RelatedPerson
class PersonForm(CruditorTapeformMixin, forms.ModelForm):
reminder = form... | moccu/django-cruditor | examples/formset/forms.py | Python | mit | 700 |
#!/usr/bin/env python
def main():
import requests
batch_size=1000
cores=['core_de_DE','core_fr_FR','core_es_ES','core_en_GB']
for core in cores:
start_id='*'
done=False
while not done:
r=requests.get('http://localhost:8080/Solr_EUMSSI_DW/{core}/select'.format(core=co... | EUMSSI/EUMSSI-tools | scripts/export-Solr_EUMSSI_DW.py | Python | apache-2.0 | 804 |
from __future__ import division
import math
import random
from collections import Counter
from matplotlib import pyplot as plt
# uniform probability density function
def uniform_pdf(x):
return 1 if x >= 0 and x < 1 else 0
# uniform cumulative distribution function
def uniform_cdf(x):
""" returns the probabili... | buckiracer/data-science-from-scratch | RefMaterials/Ch6-Probability/random-variables.py | Python | unlicense | 3,580 |
from tests import BaseTestCase
from redash.models import db
from redash.utils import json_dumps
class TestQueryResultsCacheHeaders(BaseTestCase):
def test_uses_cache_headers_for_specific_result(self):
query_result = self.factory.create_query_result()
query = self.factory.create_query(latest_query... | chriszs/redash | tests/handlers/test_query_results.py | Python | bsd-2-clause | 9,245 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | thaim/ansible | lib/ansible/modules/network/f5/bigip_cli_alias.py | Python | mit | 11,693 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def selectionsort(list):
""" Idea: Get the minimum and swap it to the front. """
n = len(list)
for i in xrange(0, n-1):
minimum = i # This is the index of the minimum!
for j in xrange(i, n):
if list[j] < list[minimum]:
mi... | saisai/algorithms_by_other | sorting.py | Python | mit | 6,274 |
from pymuco.midi.lhl import DrumKit
from pymuco.lhl.representations import Grid, Meter, TimeSignature
from pymuco.util import commandline
import pickle
ts = TimeSignature(4, 4)
ts.divisions = (2, 2, 2, 2)
witek = pickle.load(open('/home/bastiaan/PhD/Data/custom/witek.pickle', 'rb'))
rhythms = list(sorted(witek.keys... | bjvanderweij/pymuco | scripts/play.py | Python | gpl-2.0 | 595 |
#!/usr/bin/env python
"""
crate_anon/crateweb/userprofile/migrations/0001_initial.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it an... | RudolfCardinal/crate | crate_anon/crateweb/userprofile/migrations/0001_initial.py | Python | gpl-3.0 | 3,534 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 R. RIGNIER
#This file is part of ltsp-osdeploy.
#
# Foobar 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... | leschartreux/ltsp-osdeploy | pyddlaj/changestate.py | Python | gpl-2.0 | 3,934 |
# custom signals
import django.dispatch
message_received = django.dispatch.Signal(providing_args=["message"]) | meska/telegrambot | signals.py | Python | gpl-2.0 | 110 |
import dbus
from servicetest import call_async, EventPattern
from gabbletest import make_result_iq, elem, elem_iq
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber.client import IQ
import constants as cs
import ns
def properties_to_xml(properties):
result = []
for key, (type, v... | Ziemin/telepathy-gabble | tests/twisted/olpc/util.py | Python | lgpl-2.1 | 2,844 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | stansonhealth/ansible-modules-core | network/nxos/nxos_bgp_neighbor.py | Python | gpl-3.0 | 26,488 |
import tflearn
from tflearn.data_utils import to_categorical, pad_sequences
from tflearn.datasets import imdb
# IMDB Dataset loading
train, test, _ = imdb.load_data(path='imdb.pkl', n_words=10000,
valid_portion=0.1)
trainX, trainY = train
testX, testY = test
# Data preprocessing
# Sequ... | sethuiyer/mlhub | Deep Sentiment Analysis/build_sentiment_model.py | Python | mit | 1,105 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
'''Unit tests for grit.format.html_inline'''
from __future__ import print_function
import os
import re
import sys
if __name__ == ... | endlessm/chromium-browser | tools/grit/grit/format/html_inline_unittest.py | Python | bsd-3-clause | 26,838 |
import re
from parsimonious.nodes import NodeVisitor
from luna import ast
class AstBuilder(NodeVisitor):
def generic_visit(self, node, vc):
return vc
# Program
def visit_program(self, node, vc):
ws, block = vc
return ast.Program(block)
def visit_block(self, node, vc):
... | numerodix/luna | luna/parser/astbuilder.py | Python | mit | 4,614 |
from __future__ import absolute_import, division, print_function
import numpy as np
from dask.array.chunk import coarsen, keepdims_wrapper, trim
def test_keepdims_wrapper_no_axis():
def summer(a, axis=None):
return a.sum(axis=axis)
summer_wrapped = keepdims_wrapper(summer)
assert summer_wrappe... | minrk/dask | dask/array/tests/test_chunk.py | Python | bsd-3-clause | 2,888 |
import twoInputGateTest
from constants import LOW, HIGH
class NANDUnitTests(twoInputGateTest.TwoInputGateTest):
def testLowLowShouldResultInHigh(self):
self.assertOutputIsHigh(a=LOW, b=LOW, outputName = "NAND")
def testLowHighShouldResultInHigh(self):
self.assertOutputIsHigh(a=LOW, b=HIGH, outputName = ... | JustgeekDE/gatorV2 | tests/unitTests/test_NAND.py | Python | mit | 850 |
import stripe
import datetime
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth import logout as logout_user
from django.contrib.auth import login as login_user
from django.db.mod... | nriley/NewsBlur | apps/profile/views.py | Python | mit | 23,407 |
import redis
import web
"original https://gist.github.com/pokstad/1202066"
SESSION = 'SESSION:'
class RedisStore(web.session.Store):
"""Store for saving a session in redis:
import rediswebpy
session = web.session.Session(app, rediswebpy.RedisStore(), initializer={'count': 0})
"""
def __init__(sel... | zignig/substrate_app | rediswebpy.py | Python | apache-2.0 | 2,493 |
from django.http import HttpRequest
import mock
import pytest
from nose.tools import assert_false
import amo
from amo.tests import TestCase, req_factory_factory
from amo.urlresolvers import reverse
from addons.models import Addon, AddonUser
from users.models import UserProfile
from .acl import (action_allowed, check... | SuriyaaKudoIsc/olympia | apps/access/tests.py | Python | bsd-3-clause | 8,586 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | tonyli71/designate | designate/tests/test_dnsutils.py | Python | apache-2.0 | 5,616 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para itafilmtv
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import sys
import urlparse
from core import con... | orione7/Italorione | channels/itafilmtv.py | Python | gpl-3.0 | 12,743 |
"""
Put Tests in here
""" | Jawbone/UPPlatform_Python_SDK | tests/__init__.py | Python | apache-2.0 | 25 |
#Minecraft Turtle Example
#Ported from the scratch turtle project in "Adventures in Raspberry Pi"
import minecraftturtle
import minecraft
import block
#create connection to minecraft
mc = minecraft.Minecraft.create()
#get players position
pos = mc.player.getPos()
#create minecraft turtle
steve = minecraftturtle.Mine... | Nekrofage/MinecraftPython | example_adventuresinrpi.py | Python | mit | 752 |
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def ackley_arg0(sol):
return benchmarks.ackley(sol)[0]
fig = plt.figure()
# ax = Axes3D(fig, azim = -... | GrimRanger/GeneticAlgorithm | helps/deap/deap-master/doc/code/benchmarks/ackley.py | Python | mit | 687 |
import unittest
from katas.kyu_6.longest_2_character_substring import substring
class SubstringTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(substring(''), '')
def test_equals_2(self):
self.assertEqual(substring('a'), 'a')
def test_equals_3(self):
self.ass... | the-zebulan/CodeWars | tests/kyu_6_tests/test_longest_2_character_substring.py | Python | mit | 1,191 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | joyxu/kernelci-backend | app/handlers/bisect.py | Python | agpl-3.0 | 11,989 |
"""SCons.Scanner.D
Scanner for the Digital Mars "D" programming language.
Coded by Andy Friesen
17 Nov 2003
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy... | h4ck3rm1k3/OpenWrt-Firefly-SDK | staging_dir/host/lib/scons-2.3.1/SCons/Scanner/D.py | Python | gpl-2.0 | 2,564 |
"""
Platform plugins to support course bookmarks.
"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from openedx.features.course_experience.course_tools import CourseTool
class CourseBookmarksTool(CourseTool):
"""
The course bookmarks tool.
"""
@class... | miptliot/edx-platform | openedx/features/course_bookmarks/plugins.py | Python | agpl-3.0 | 969 |
"""
Django settings for eCIP project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... | nickjstevens/eCIP | eCIP/settings.py | Python | mit | 3,869 |
#!/usr/bin/python
# This test opens a file with wrong extenstion.
import os
os.environ['LANG']='C'
srcdir = os.environ['srcdir']
from dogtail.procedural import *
run('evince', arguments=' '+srcdir+'/test-mime.bin')
# Close evince
click('File', roleName='menu')
click('Close', roleName='menu item')
| m4heshd/evince | test/test3.py | Python | gpl-2.0 | 303 |
# 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 unde... | stackforge/python-senlinclient | senlinclient/tests/functional/test_cluster_policy.py | Python | apache-2.0 | 5,035 |
import bisect
def calculate_angle_boat_wind(boat_compass, wind_direction):
wind_dir = wind_direction
angle = abs(boat_compass - wind_dir)
if angle > 180:
angle = 360 - angle
return angle
def assign_length(diff_wind_boat):
angles = [
(45, 1), #downwind
(50, 0.95),
(... | Southampton-Maritime-Robotics/autonomous-sailing-robot | src/boat_servo_sail/src/boat_servo_sail/sail_angle.py | Python | bsd-2-clause | 877 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import unittest
from httmock import urlmatch, HTTMock, response
from wechatpy.enterprise import WeChatClient
from wechatpy._compat import json
_TESTS_PATH = os.path.abspath(os.path.dirname(__file__))
_FIXTURE_PATH = os.path.j... | cysnake4713/wechatpy | tests/test_enterprise_client.py | Python | mit | 5,260 |
'''
Created on 19.04.2014
@author: Oliver Flegler
'''
import notification
import subprocess
def checkCPUTemperatur(config):
pass
def checkFanSpeed(config):
notification.printHeader("Checking fan speeds")
try:
defaultMinSpeed = config['hardware']['fanSpeed']['minSpeed']
except (KeyError,... | Twain69/pymon | src/main/resources/hardware.py | Python | gpl-2.0 | 1,914 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.md').read()
history = open('HISTORY.md')... | arnaldorusso/PyPAM | setup.py | Python | mit | 1,547 |
from methods.PlanToConfiguration import (
PlanToConfigurationCompleteTest,
PlanToConfigurationStraightLineTest,
PlanToConfigurationTest,
PlanToConfigurationTestCollisionTest,
)
from prpy.planning.chomp import CHOMPPlanner
from planning_helpers import BasePlannerTest
from unittest import TestCase
class... | personalrobotics/prpy | tests/planning/test_CHOMP.py | Python | bsd-3-clause | 7,427 |
from rdflib.namespace import Namespace
BASE_URI = 'http://rdf.hardcoded.net/dgeq/'
ns_division = Namespace(BASE_URI + 'division#') # /division/taschereau
ns_election = Namespace(BASE_URI + 'election#') # /election/72 (dgeq id)
ns_candidate = Namespace(BASE_URI + 'candidate#') # /candidate/roy-serge
ns_agent = Namespac... | hsoft/dgeq-rdf | ns.py | Python | bsd-3-clause | 532 |
from toc import setup as toc_setup
from ctxhelp import setup as ctxhelp_setup
def setup(app):
app.add_config_value('eclipse_base_path', 'build/html', 'html')
toc_setup(app)
ctxhelp_setup(app)
| aps-parallels/sphinx-eclipse | sphinx_eclipse/__init__.py | Python | mit | 207 |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField(... | mammique/django | tests/regressiontests/introspection/models.py | Python | bsd-3-clause | 951 |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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
#
# U... | pyfarm/pyfarm-docs | setup.py | Python | apache-2.0 | 866 |
import unittest
from FakeSocket import FakeSocket
import tHome as T
#===========================================================================
#===========================================================================
class TestAcTotalEnergy ( T.util.test.Case ) :
def test_acTotalEnergy( self ):
reply... | TD22057/T-Home | python/tHome/sma/test/acTotalEnergy.py | Python | bsd-2-clause | 1,244 |
#***************************************************************
#* Name: LMS7002_NCO.py
#* Purpose: Class implementing LMS7002 NCO functions
#* Author: Lime Microsystems ()
#* Created: 2016-11-14
#* Copyright: Lime Microsystems (limemicro.com)
#* License:
#**************************************************... | myriadrf/pyLMS7002M | pyLMS7002M/LMS7002_NCO.py | Python | apache-2.0 | 7,906 |
from __future__ import division
from itertools import product
from decimal import Decimal
from datetime import datetime
import random
import time
import sys
numbers = ['5' , '2' , '7', '9']
cleanNumbers = numbers[:]
operators = ['+', '-', '/', '*']
possibleChars = operators + numbers
lengthOfPossibleChar... | Dane99/WGYN | WGYN.py | Python | mit | 3,202 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('programacao', '0004_auto_20141221_1952'),
]
operations = [
migrations.AddField(
model_name='tarefadeprogramacao'... | dudanogueira/microerp | microerp/programacao/migrations/0005_auto_20141221_2023.py | Python | lgpl-3.0 | 721 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dataset', '0009_remove_selection_model'),
]
operations = [
migrations.AlterField(
model_name='dataset',
... | michaelbrooks/uw-message-coding | message_coding/apps/dataset/migrations/0010_auto_20150619_2106.py | Python | mit | 419 |
r"""
Util functions (:mod: `qiita_db.util`)
======================================
..currentmodule:: qiita_db.util
This module provides different util functions.
Methods
-------
..autosummary::
:toctree: generated/
quote_data_value
scrub_data
exists_table
exists_dynamic_table
get_db_files_b... | RNAer/qiita | qiita_db/util.py | Python | bsd-3-clause | 35,922 |
# -*- coding: utf-8 -*-
import _ast
from SublimePythonIDE import pep8
from SublimePythonIDE.sublime_python_errors import OffsetError, Pep8Error, Pep8Warning, PythonError
import SublimePythonIDE.pyflakes.checker as pyflakes
def pyflakes_check(code, encoding, filename, ignore=None):
try:
tree = compile(code... | JulianEberius/SublimePythonIDE | server/linter.py | Python | gpl-2.0 | 4,292 |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponseForbidden, HttpResponseBadRequest, HttpResponse
from bootcamp.articles.models import Article, Tag, ArticleComment
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from bootcamp.articles.forms imp... | maxpinto/Ptz | bootcamp/articles/views.py | Python | mit | 4,877 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# tar util for packing file with gb18030 charset filename encoded
import tarfile
import os
import sys
import string
import argparse
class Mytar:
def __init__(self):
self.filter = None
self.tar = None
self.charset='gb18030'
def setch... | zarelaky/chstar | chstar.py | Python | apache-2.0 | 3,016 |
# -*- coding: utf-8 -*-
# Copyright 2016 Cédric Pigeon, ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
import odoo.addons.decimal_precision as dp
class SaleImportProducts(models.TransientModel):
_name = 'sale.import.prod... | kittiu/sale-workflow | sale_product_multi_add/wizards/sale_import_products.py | Python | agpl-3.0 | 2,624 |
# Django settings for QuEST project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['.grapesmoker.net']
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 60... | grapesmoker/qems2 | qems2/settings.py | Python | gpl-2.0 | 8,299 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-28 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('UCLGo', '0007_auto_20170728_1635'),
]
operations = [
migrations.AlterField(... | ribeiro-ucl/UCLGoProject | UCLGo/migrations/0008_auto_20170728_1635.py | Python | mit | 574 |
"""
A lot of the inspiration (and straight up code copying!) for this class comes from EsiPy <https://github.com/Kyria/EsiPy>
Much of the credit goes to the maintainer of that package, Kyria <tweetfleet slack: @althalus>. The reasoning for no
longer using EsiPy was due to it's reliance on pyswagger, which has caused a... | DarkFenX/Pyfa | service/esiAccess.py | Python | gpl-3.0 | 9,283 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 Trustcode - www.trustcode.com.br #
# ... | Trust-Code/trust-addons | trust_second_unit_of_measure/models/product.py | Python | agpl-3.0 | 3,556 |
#! python3
# downloadXkcd.py - Downloads every single XKCD comic.
import requests, os, bs4
url = 'http://xkcd.com' # starting url
os.makedirs('xkcd', exist_ok=True) # store comics in ./xkcd
while not url.endswith('#'):
# Download the page.
print('Downloading page %s...' % url)... | rfreiberger/Automate-the-Boring-Stuff | ch11/downloadXkcd.py | Python | bsd-2-clause | 1,327 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend lusocoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a lusocoind or L... | lusocoin/lusocoin | src/contrib/spendfrom/spendfrom.py | Python | mit | 10,094 |
# ------------------------------------------------------------------------
#
# Copyright 2005-2015 WSO2, Inc. (http://wso2.com)
#
# 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.... | anuradhakarunamuni/private-paas-cartridges | wso2am/1.9.1/plugins/wso2am-startup-handler.py | Python | apache-2.0 | 39,604 |
def mystery(s1, s2, s3):
# complete the docstring below (4 MARKS)
''' (str, str, str) -> int
Precondition: len(s1) == len(s2) == len(s3)
Return the number of characters with matching positions between the
three strings.
>>> mystery('cat', 'bat', 'hat')
2
>>> mystery('cat', 'dog... | mdnu/snake | csc work/final/w16/Q4.py | Python | mit | 845 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-27 21:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20170927_1834'),
]
operations = [
migrations.Remove... | CryptTrader/CryptTrader | trader/core/migrations/0005_auto_20170927_1854.py | Python | mit | 542 |
# coding: utf-8
# MediaSanción, aplicación web para acceder a los datos públicos de la
# actividad legislativa en Argentina.
# Copyright (C) 2010,2011,2012 Renzo Carbonara <renzo @carbonara .com .ar>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General... | k0001/mediasancion | mediasancion/api0/urls.py | Python | agpl-3.0 | 1,185 |
#!/usr/bin/env python
import rospy
import tf
import numpy
import yaml
from math import pi
from geometry_msgs.msg import Pose, Point, Quaternion
from visualization_msgs.msg import Marker, MarkerArray
import visualization_msgs.msg
# TODO: add averaging/filtering, auto-add to param server or urdf or file
config_folder... | osrf/baxter_demos | scripts/get_ar_calib.py | Python | apache-2.0 | 4,923 |
import os
import logging
def get_logger(name, to_sderr=False):
if os.environ.get("C3_DEBUG_MODE", False):
tmp_dir = "./tmp"
try:
os.mkdir(tmp_dir)
except OSError as e:
print(str(e))
else:
tmp_dir = "/var/log/c3"
logger = logging.getLogger(name)
l... | pkulev/c3 | common/log.py | Python | mit | 579 |
#
# Copyright 2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | nirs/vdsm | tests/storage/guarded_test.py | Python | gpl-2.0 | 8,334 |
import uuid
from client import QuickBooks
from exceptions import QuickbooksException
from objects.batchrequest import IntuitBatchRequest, BatchItemRequest, BatchOperation, BatchResponse, BatchItemResponse
class BatchManager(object):
def __init__(self, operation, max_request_items=30):
self._max_request_i... | ferdiaz/python-quickbooks | quickbooks/batch.py | Python | mit | 2,885 |
import datetime
from django.db import models
class UpdatableModel(models.Model):
last_modified_time = models.DateTimeField(null=True)
last_checked_time = models.DateTimeField(null=True)
def mark_modified(self):
now = datetime.datetime.now()
self.last_modified_time = now
def mark_che... | kansanmuisti/kamu | parliament/models/base.py | Python | agpl-3.0 | 448 |
# -*- coding: utf-8 -*-
from itertools import chain
from olympia import amo
from olympia.addons.indexers import AddonIndexer
from olympia.addons.models import (
Addon, Preview, attach_tags, attach_translations)
from olympia.amo.models import SearchMixin
from olympia.amo.tests import (
ESTestCase, TestCase, add... | aviarypl/mozilla-l10n-addons-server | src/olympia/addons/tests/test_indexers.py | Python | bsd-3-clause | 25,314 |
from sys import stdin
import sys
def contains_dig(d):
return any(int(char)==7 for char in str(d))
def isDivisible(d):
return d%7==0
#input=stdin.read()
input='''2
10
17'''
lines = input.splitlines()
nbLines = lines[0].split()
yellCounter = 1
position = 1
inc = 1
for favNbIdx in range(1,len(lines)):
... | mathieumg/ieee | 19_Problem_AF/solAF.py | Python | mit | 766 |
R, C, Q = map(int, input().split())
board = [input() for _ in range(R)]
query = [input() for _ in range(Q)]
pos = dict()
for r, row in enumerate(board):
for c, s in enumerate(row):
if s != '*':
pos[s] = (r+1, c+1)
for q in query:
if q in pos:
print(*pos[q])
else:
print('N... | knuu/competitive-programming | atcoder/other/qupc2014_c.py | Python | mit | 324 |
#!/usr/bin/env python3
#
# PLASMA : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# 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 ... | joelpx/plasma | plasma/lib/generate_ast.py | Python | gpl-3.0 | 25,145 |
"""Raffle widget administration"""
import random
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from apps.managers.challenge_mgr import challenge_mgr
from apps.widgets.notifications.models import NoticeTemplate, UserNotification
... | yongwen/makahiki | makahiki/apps/widgets/raffle/admin.py | Python | mit | 4,739 |
# The authors of this work have released all rights to it and placed it
# in the public domain under the Creative Commons CC0 1.0 waiver
# (http://creativecommons.org/publicdomain/zero/1.0/).
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARR... | amfox/af_algorithms | literate_programming/blit.py | Python | mit | 1,286 |
# Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
import pprint
import werkzeug
from odoo import http
from odoo.http import request
from odoo.addons.payment.controllers.portal import PaymentProcessing
_logger = logging.getLogger(__name__)
class Ci... | OCA/l10n-brazil | payment_cielo/controllers/main.py | Python | agpl-3.0 | 4,916 |
import logging
from django.core.management.base import BaseCommand
from citation import dedupe, models
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Removes orphans from Platform and Sponsors Table"
def handle(self, *args, **options):
qs = models.Platform.objects.exclude(p... | dhruvilpatel/citation | citation/management/commands/remove_orphans.py | Python | gpl-3.0 | 1,634 |
"""The Django url to handler mappings.
:Authors: Sana dev team
:Version: 2.0
"""
from django.conf.urls.defaults import patterns, url, include
#from piston.resource import Resource
#from .handlers import *
from .resources import *
#concept_handler = Resource(ConceptHandler)
#relationship_handler = Resource(Relations... | dekatzenel/team-k | mds/core/urls.py | Python | bsd-3-clause | 5,129 |
import time
from kinesis_producer.accumulator import RecordAccumulator
from kinesis_producer.buffer import RawBuffer
CONFIG = {
'buffer_time_limit': 0.1,
'buffer_size_limit': 100,
'record_delimiter': b'X',
}
def test_append():
acc = RecordAccumulator(RawBuffer, CONFIG)
success = acc.try_append(... | ludia/kinesis_producer | tests/test_accumulator.py | Python | mit | 1,668 |
from random import randrange
import re
def test_compare_data_of_contacts_byww_index(app):
index = randrange(app.contact.count())
contact_from_home_page_by_index = app.contact.get_contact_list()[index]
contact_from_edit_page_by_index = app.contact.get_contact_info_from_edit_page(index)
assert contact_f... | elenagradovich/python_training | test/test_compare_contacts.py | Python | apache-2.0 | 2,524 |
import settings
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^polls/',include('polls.urls')),
(r'^inovafi/',include('inovafi.urls')),
(r'^images/(?P<path>.*)$', 'django.vi... | trvd1707/inovafi | mysite/urls.py | Python | mit | 782 |
#---------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Joelson Pereira Lima 1715310060
# Gabriel Nascimento de Oliveira 1715310052
# Hugo Thadeu Silva Cardoso 1715310013... | jucimarjr/IPC_2017-1 | lista05/lista05_lista01_questao28.py | Python | apache-2.0 | 1,190 |
from django.contrib import admin
from models import UserProfile
class UserProfileAdmin(admin.ModelAdmin):
pass
admin.site.register(UserProfile, UserProfileAdmin)
| noamelf/Open-Knesset | user/admin.py | Python | bsd-3-clause | 173 |
# Add here your website's root address:
# Have a slash in the end.
WEBSITE_ROOT_ADDR = "http://www.example.com/"
| xorpd/static_weber | conf/general.py | Python | mit | 114 |
from abc import ABCMeta, abstractmethod
import base64
import hashlib
import pathlib
import pickle
from .session import CachedResponse
from .filter import CacheFilter
def b64encode(byte_str):
return base64.b64encode(byte_str).decode()
class CachingStrategy(metaclass=ABCMeta):
@abstractmethod
async def g... | leesdolphin/rentme | aioutils/aiohttp/cache/strategy.py | Python | agpl-3.0 | 3,348 |
from pyboost_ipc import message_queue, open_or_create
import pytest
@pytest.yield_fixture
def queue():
message_queue.remove(b'foo_queue')
queue = message_queue(open_or_create, b"foo_queue", 1, 10)
yield queue
message_queue.remove(b'foo_queue')
@pytest.mark.parametrize('buff', [
bytearray([42]),
... | ESSS/pyboost_ipc | source/python/_tests/test_message_queue.py | Python | mit | 1,221 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.