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 |
|---|---|---|---|---|---|
# Copyright 2013 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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... | KristianJensen/cameo | cameo/parallel.py | Python | apache-2.0 | 7,545 |
"""High frequency PWM mode demo."""
from nanpy.arduinotree import ArduinoTree
from nanpy.serialmanager import SerialManager
FREQ = 10007
def highfreqpwm():
connection = SerialManager()
a = ArduinoTree(connection=connection)
pin9 = a.pin.get(9)
pin9.mode = 1
pin9.write_digital_value(1)
pwm = ... | pooyapooya/rizpardazande | rizpar/lib/python2.7/site-packages/nanpy/examples/highfreqpwm.py | Python | mit | 511 |
# Django settings for testmixins project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'my... | rafaelsierra/django-json-mixin-form | testmixins/testmixins/settings.py | Python | mit | 5,462 |
#Part 1: Terminology (15 points)
#1 1pt) What is the symbol "=" used for?
# assign value to variable
# +1 point
#
#2 3pts) Write a technical definition for 'function'
# Function is a named sequence of statements that performs a computation.
# When you define a function, you specify the name and the sequence of statem... | joook1710-cmis/joook1710-cmis-cs2 | cs2quiz1.py | Python | cc0-1.0 | 2,971 |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import API.DFAAPI as DFA
import API.CFGAPI as CFG
import API.converter as converter
import API.socketAPI as socketAPI
import threading
# construct DFA based Data Extractor
consumer = DFA.dfa_construction('DataModel/cfi_dm.txt')
consumer_dfa = consumer[0]
consumer_extractedinfo ... | kimjinyong/i2nsf-framework | Hackathon-104/SecurityController/testserver.py | Python | apache-2.0 | 1,854 |
# coding=utf-8
from .. import Provider as BaseProvider
class Provider(BaseProvider):
vat_id_formats = (
'CZ########',
'CZ#########',
'CZ##########',
)
def vat_id(self):
"""
http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
:return: A random Czech V... | deanishe/alfred-fakeum | src/libs/faker/providers/ssn/cs_CZ/__init__.py | Python | mit | 409 |
# -*- 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):
# Changing field 'ItemMenu.link'
db.alter_column(u'menu_itemmenu', 'link', self.gf('django.db.models.fields... | daviferreira/leticiastallone.com | leticiastallone/menu/migrations/0003_auto__chg_field_itemmenu_link.py | Python | mit | 1,020 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | simark/simulavr | regress/test_opcodes/test_MOV.py | Python | gpl-2.0 | 2,229 |
"""
Trends library module.
"""
import datetime
from lib import database as db
from lib.twitter_api import authentication
# Global object to be used as api connection. During execution of the insert
# function, this can be setup once with default app then reused later,
# to avoid time calling Twitter API. It can be l... | MichaelCurrin/twitterverse | app/lib/trends.py | Python | mit | 3,038 |
#!/usr/bin/env python
import boto3
import sys
import json
import logging
from botocore.exceptions import ClientError
from CoinCollection import ValueRecord
logger = logging.getLogger("tango")
logger.setLevel(logging.DEBUG)
class Cache():
def stash(self, key, record):
logger.debug("Stash request for: " + ... | robcz/tangosnake | TangoServices.py | Python | apache-2.0 | 2,895 |
import os
def find_program(program):
"""Tries to localize the executable for the requested program.
:returns: The path to the executable or None if not found.
Implementation based on
http://stackoverflow.com/q/377017/test-if-executable-exists-in-python
"""
def isexe(fpath):
return os... | scorpilix/Golemtest | golem/environments/utils.py | Python | gpl-3.0 | 1,014 |
#!/usr/bin/env python
from __future__ import absolute_import
import linchpin.FilterUtils.FilterUtils as filter_utils
class FilterModule(object):
''' A filter to fix network format '''
def filters(self):
return {
'combine_hosts_names': filter_utils.combine_hosts_names
}
| samvarankashyap/linch-pin | linchpin/provision/roles/azure/filter_plugins/combine_hosts_names.py | Python | gpl-3.0 | 309 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="color",
parent_name="scatterpolargl.unselected.textfont",
**kwargs
):
super(ColorValidator, self).__init__(
plotly_name=pl... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterpolargl/unselected/textfont/_color.py | Python | mit | 455 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions as F
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
@testing.parameterize(
*testing.product({
'wrap_m': [True, False],
'wrap_v': [True, ... | anaruse/chainer | tests/chainer_tests/functions_tests/loss_tests/test_vae.py | Python | mit | 6,938 |
#!/usr/bin/python
import cgi
def cgiFieldStorageToDict( fieldStorage ):
"""Get a plain dictionary, rather than the '.value' system used by the cgi module."""
params = {}
for key in fieldStorage.keys():
params[ key ] = fieldStorage[ key ].value
return params
if __name__ == "__main__":
dict = cgiF... | ActiveState/code | recipes/Python/81547_Using_simple_dictionary_CGI/recipe-81547.py | Python | mit | 419 |
# -*- coding: utf8 -*-
"""
.. module:: lesscpy.scripts.compiler
CSS/LESSCSS run script
http://lesscss.org/#docs
Copyright (c)
See LICENSE for details
.. moduleauthor:: Johann T. Mariusson <jtm@robot.is>
"""
from __future__ import print_function
import os
import sys
import glob
import copy
import arg... | lesscpy/lesscpy | lesscpy/scripts/compiler.py | Python | mit | 8,439 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator().SetSeed(0)
try :
dimension = 2
epsilon = NumericalPoint( dimension, 1e-4 )
x = NumericalPoint( dimension, 2.0 )
step = ConstantStep( epsilon )
print 'step type=', step.getClassName(), 'step value=', step( x )
et... | dbarbier/privot | python/test/t_FiniteDifferenceStep_std.py | Python | lgpl-3.0 | 563 |
#!/usr/bin/env python
import sys
import re
import subprocess
import cmd
error_regexps = [
"error:",
"warning:",
]
print_error_format = "{id}) {summary}"
class Error():
def __init__(self,
id,
error_type,
match_position):
self.id = id
self... | mfergie/errorless | errorless.py | Python | gpl-2.0 | 3,992 |
import numpy as np
trainData = []
vals = {}
with open('../train_data/invited_info_train.txt', 'r') as f1:
for line in f1:
qid, uid, val = line.rstrip('\n').split()
trainData.append((qid, uid))
if (qid, uid) not in vals:
vals[(qid, uid)] = []
vals[(qid, uid)].append(int(val))
with open('../train_data/trai... | jashwanth9/Expert-recommendation-system | code/normFeat.py | Python | apache-2.0 | 464 |
import os
from unittest import mock
import pytest
from click.testing import CliRunner
from great_expectations import DataContext
from great_expectations.cli import cli
from great_expectations.data_context import BaseDataContext
from tests.cli.utils import (
VALIDATION_OPERATORS_DEPRECATION_MESSAGE,
assert_no_... | great-expectations/great_expectations | tests/cli/test_docs.py | Python | apache-2.0 | 20,613 |
from ..sound_player import Sound
class Note:
def __init__(self, note: int, duration: int=2):
self.note = note
self.duration = duration
def __str__(self):
return '[', self.note, ' ,', self.duration, ']'
def __repr__(self):
return '[' + str(self.note) + ' ,' + str(self.dur... | Hoomano-Hackathon/CozmoIsCute | CozmoMusicMan/model/Partition.py | Python | mit | 1,645 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2015, 2016 CERN.
#
# CERN Document Server 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
# Licens... | nikofil/cds | cds/config.py | Python | gpl-2.0 | 12,098 |
# Copyright (c) 2014-2016, Santiago Videla
#
# This file is part of caspo.
#
# caspo 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.
#
... | bioasp/caspo | caspo/core/clamping.py | Python | gpl-3.0 | 14,531 |
from __future__ import print_function
"""
To add another bonded force interacton in one of the existing categories:
1. Add the force name to the appropriate forcelist
2. Define the parameters. Order should reflect the most common order.
Different orderers are specified by providing a parameterlist with
the sa... | shirtsgroup/InterMol | intermol/forces/forcedata.py | Python | mit | 18,422 |
# Copyright 2011-2013 Cloudscaling Group, Inc
#
# 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 appl... | derekchiang/keystone | keystone/openstack/common/rpc/matchmaker_ring.py | Python | apache-2.0 | 3,538 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_link_to_form, \
comma_or, get_fullname... | anandpdoshi/erpnext | erpnext/hr/doctype/leave_application/leave_application.py | Python | agpl-3.0 | 16,682 |
import warnings
import sys
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def rbbt():
print("Rbbt")
| mikisvaz/rbbt-util | python/rbbt.py | Python | mit | 109 |
#!/usr/bin/env python3
import time
class rateLimit: # rate limit like iptables limit (per minutes)
tLast = None
def __init__(self, _rate_limit, _rate_burst):
self.rate_limit = _rate_limit
self.rate_burst = _rate_burst
self.bucket = _rate_burst
def limit(self):
tNow = time.time()
if self.t... | Sunz3r/ext-respondd | lib/ratelimit.py | Python | agpl-3.0 | 651 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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 ... | uber/ludwig | tests/integration_tests/test_experiment.py | Python | apache-2.0 | 28,472 |
# -*- coding: utf-8 -*-
import datetime, dateutil.tz
DATETIME_FORMAT='%Y-%m-%d %H:%M:%S'
DATE_FORMAT='%Y-%m-%d'
TIME_FORMAT='%H:%M:%S'
def gmdbtime(t):
res = datetime.datetime.utcfromtimestamp(t)
res = res.replace(tzinfo=datetime.timezone.utc)
return res.strftime('%Y-%m-%d %H:%M:%S')
def gmfromtimestamp(t):
re... | vistoyn/python-foruse | foruse/datelib.py | Python | mit | 1,059 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.db import transaction
from core.models import StudentProgress
from django.utils import timezone
class Command(BaseCommand):
help = 'Mark every pending activity from students as complete with the current timestamp. Beaware that... | hacklabr/timtec-theme-hacklab | timtec_theme_hacklab/management/commands/mark_progress_as_complete.py | Python | agpl-3.0 | 685 |
# Copyright (c) 2008-2013 Szczepan Faber, Serhiy Oplakanets, Herr Kaste
#
# 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
... | zhilts/pymockito | mockito/mocking.py | Python | mit | 4,551 |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | xlqian/navitia | source/jormungandr/jormungandr/realtime_schedule/tests/realtime_proxy_test.py | Python | agpl-3.0 | 5,729 |
# coding=utf-8
import boto3
# https://aqy9q7jfavde2.iot.us-west-2.amazonaws.com/things/PXL-CF2016/shadow
client = boto3.client('iot-data', region_name='us-west-2')
response = client.update_thing_shadow(
thingName='PXL-CF2016',
payload=b'{ \
"state": { \
"desired": { \
"message_1": ",.... | PXL-CF2016/pxl-master-server | aws-iot-device-sdk-js/app_to_thing.py | Python | mit | 414 |
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from anitya.lib.backends import BaseBackend, get_versions_by_regex
REGEX = b'<a href="/projects/[^/]*/releases/[0-9]*">([^<]*)</a>'
class FreshmeatBackend(BaseBackend):
''' The custom clas... | Prashant-Surya/anitya | anitya/lib/backends/freshmeat.py | Python | gpl-2.0 | 2,063 |
"""
These functions are imported into the global namespace of the script, and can
be called without any module prefix.
"""
import subscript.langtypes as langtypes
import subscript.script as script
import subscript.registry as registry
functions = registry.Registry('main')
# =========================================
... | Touched/subscript | subscript/functions.py | Python | gpl-3.0 | 20,863 |
# -*- coding: utf-8 -*-
#
# test_connect_fixed_outdegree.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 o... | hakonsbm/nest-simulator | pynest/nest/tests/test_connect_fixed_outdegree.py | Python | gpl-2.0 | 5,633 |
##
# Copyright 2012-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | rjeschmi/easybuild-framework | easybuild/toolchains/gqacml.py | Python | gpl-2.0 | 1,634 |
from pathlib import Path
import pytest
import socketio.exceptions
from mock import MagicMock, AsyncMock, call
from randovania.game_description.resources.pickup_entry import PickupEntry, PickupModel
from randovania.games.game import RandovaniaGame
from randovania.network_client.game_session import GameSessionPickups
f... | henriquegemignani/randovania | test/network_client/test_network_client.py | Python | gpl-3.0 | 8,044 |
from __future__ import absolute_import
import unittest
import types
if __name__ == "__main__":
from optional import * #imports from package, not sub-module
else:
from .optional import *
from .nulltype import *
class TestNullType(unittest.TestCase):
def test_supertype(self):
self.assert_(isinst... | OaklandPeters/optional | optional/test_optional.py | Python | mit | 3,279 |
import re
from loguru import logger
from sqlalchemy import desc
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.manager import Session
from . import db
logger = logger.bind(name='next_series_episodes')
class NextSeriesEpisodes:
"""
Emit next episode ... | Flexget/Flexget | flexget/components/series/next_series_episodes.py | Python | mit | 13,951 |
import pandas as pd
df = pd.DataFrame({'value': range(1, 32, 2)},
index=pd.date_range('2018-01-01', '2018-01-31', freq='2D'))
print(df)
# value
# 2018-01-01 1
# 2018-01-03 3
# 2018-01-05 5
# 2018-01-07 7
# 2018-01-09 9
# 2018-01-11 11
# 2018-01-13 13
# 20... | nkmk/python-snippets | notebook/pandas_time_series_rolling_resample.py | Python | mit | 1,430 |
# isn't perfect, but gets mostly everything
import csv
import re
line_regex = re.compile('^"Resene ([a-zA-Z ]+?)"\s+?(\d{1,3})\s+?(\d{1,3})\s+(\d{1,3})$')
rawfile = open("resene.raw", "r")
outfile = open("db.csv", "w")
csvwriter = csv.writer(outfile)
for line in rawfile:
line = line.strip()
matches = re.matc... | andrewortman/colorbot | data/scraped/resene/tocsv.py | Python | mit | 638 |
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# 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 ap... | TrimBiggs/calico | calico/felix/test/test_splitter.py | Python | apache-2.0 | 5,146 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Partner External Maps module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redi... | alanljj/oca-partner-contact | partner_external_maps/__openerp__.py | Python | agpl-3.0 | 1,666 |
"""
WSGI config for school_registry 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | agustin380/school-registry | src/school_registry/wsgi.py | Python | gpl-3.0 | 407 |
# SPDX-FileCopyrightText: 2014, Mangaki Authors
# SPDX-License-Identifier: AGPL-3.0-only
from datetime import datetime
from django.db import connection
import logging
class Chrono(object):
checkpoint = None
connection = None
is_enabled = True
def __init__(self, is_enabled):
self.is_enabled =... | mangaki/mangaki | mangaki/mangaki/utils/chrono.py | Python | agpl-3.0 | 658 |
import os
import sys
import uuid
import logging
import datetime
import contextlib
from typing import Any, Tuple, Iterator, Iterable
try:
from petname import Generate as pet_generate
except ImportError:
def pet_generate(_1: str, _2: str) -> str:
return str(uuid.uuid4())
from cephlib.common import run_... | Mirantis/disk_perf_test_tool | wally/utils.py | Python | apache-2.0 | 3,311 |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class ExampleCmsApp(CMSApp):
name = _("Example CMS App")
urls = ["example_cms_app.urls"]
apphook_pool.register(ExampleCmsApp)
| qris/toptalkers-website | django/website/example_cms_app/cms_app.py | Python | gpl-3.0 | 266 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 13:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20160522_1240'),
]
operations = [
migrations.AddField(
... | gen1us2k/django-example | django_example/users/migrations/0003_user_balance.py | Python | mit | 476 |
"""
Instances of WSTConnectionWindowController are the controlling object
for the document windows for the Web Services Tool application.
Implements a standard toolbar.
"""
# Note about multi-threading.
# Although WST does its network stuff in a background thread, with Python 2.2
# there are still moments where the a... | albertz/music-player | mac/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTConnectionWindowControllerClass.py | Python | bsd-2-clause | 15,912 |
"""
Created on 5 Sep 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
in /boot/config.txt
# RPi...
# Uncomment for i2c-0 & i2c-3 access (EEPROM programming)
# dtparam=i2c_vc=on
dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1
"""
import time
from scs_core.sys.eeprom_image import EEPROMImage
from s... | south-coast-science/scs_dfe_eng | src/scs_dfe/interface/component/cat24c32.py | Python | mit | 2,699 |
# -*- coding: utf-8 -*-
import sqlite3
import os
from u_logger import log
from u_txt_num import grup, nul2z
def select(dbpath, sql, rows_as_dic=True):
'''
A select for every situation !!!
Returns dictionary
{
'fields': columnNames, List with field names.
'labels': labels, List with ... | tedlaz/pyted | pymiles/pymiles.old/u_db_select.py | Python | gpl-3.0 | 2,028 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-06-07 00:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0019_delete_fil... | osonwanne/virgilglobal | services/migrations/0003_servicepagegalleryimage.py | Python | gpl-3.0 | 1,219 |
#!/usr/bin/python3
import os
import urllib
import socket
from gi.repository import GObject, Nautilus
class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoProvider):
nautilusVFSFile_table = {}
registered_paths = {}
remainder = ''
connected = False
watch_id = 0
d... | ckamm/mirall | shell_integration/nautilus/ownCloud.py | Python | gpl-2.0 | 5,047 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | elfnor/sverchok | utils/geom.py | Python | gpl-3.0 | 28,917 |
# -*- coding: utf-8 -*-
import unittest
from mock import Mock, patch
from flask import Flask
from werkzeug import exceptions, MultiDict
from werkzeug.wrappers import Request
from werkzeug.datastructures import FileStorage
from flask_restful.reqparse import Argument, RequestParser, Namespace
import six
import decimal
i... | ueg1990/flask-restful | tests/test_reqparse.py | Python | bsd-3-clause | 29,848 |
#!/usr/bin/python
import sys
import logging, traceback
from katello.repos import upload_enabled_repos_report
from katello.utils import combined_profiles_enabled
from katello.enabled_report import EnabledReport
from zypp_plugin import Plugin
from katello.constants import ZYPPER_REPOSITORY_PATH
class EnabledReposUploa... | Katello/katello-agent | src/zypper_plugins/enabled_repos_upload.py | Python | gpl-2.0 | 992 |
# coding: utf-8
# Copyright 2015 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
from rpaas import plan, storage
class MongoDBStorageTestCase(unittest.TestCase):
def setUp(self):
self.storage = st... | vfiebig/rpaas | tests/test_storage.py | Python | bsd-3-clause | 5,053 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2019-05-17 19:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('geral', '0032_config_usuario'),
]
operations = [
migrations.AddField(
... | anselmobd/fo2 | src/geral/migrations/0033_painel_habilitado.py | Python | mit | 453 |
import time
class Timer(object):
def __init__(self, verbose=False):
self.verbose = verbose
def __enter__(self):
self.start = time.time()
def __exit__(self, *args):
self.end = time.time()
self.secs = self.end - self.start
self.msecs = self.secs * 1000 # millisecs
... | rolandovillca/python_basis | performance_measuring/timer.py | Python | mit | 828 |
import unittest
import logging
import os
import re
from rdflib import Graph, Literal, URIRef
from rdflib.plugins.parsers import ntriples
from rdflib.py3compat import bytestype, b
log = logging.getLogger(__name__)
class NTTestCase(unittest.TestCase):
def testIssue78(self):
g = Graph()
g.add((URIRef... | Letractively/rdflib | test/test_ntparse.py | Python | bsd-3-clause | 6,599 |
import os
import csv
import json
import pickle
import logging
from random import choice, randint, shuffle
from django.core.exceptions import ObjectDoesNotExist
import python_football
from settings.base import SITE_ROOT
from .models import Playbook, City, Nickname, Team
from people import names
from people.models i... | gvpeek/django_football | django_football/teams/utils.py | Python | mit | 4,708 |
"""
Convert the US Census DP1 ESRI GeoDatabase into an SQLite Database.
This is a thin wrapper around the GDAL ogr2ogr command line tool. We use it
to convert the Census DP1 data which is distributed as an ESRI GeoDB into an
SQLite DB. The module provides ogr2ogr with the Census DP 1 data from the
PUDL datastore, and ... | catalyst-cooperative/pudl | src/pudl/convert/censusdp1tract_to_sqlite.py | Python | mit | 4,443 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 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 th... | CERNDocumentServer/invenio | modules/bibfield/lib/bibfield.py | Python | gpl-2.0 | 4,411 |
from django.db.models.signals import post_save
from django.dispatch import receiver
from ..users.models import CustomUser
from . import models
@receiver(post_save, sender=CustomUser)
def create_email_verification(sender, instance, created, **kwargs):
""" Create EmailVerification objects for new users """
if... | gpodder/mygpo-auth | mygpoauth/registration/signals.py | Python | agpl-3.0 | 409 |
# file: numpy_pi.py
"""Calculating pi with Monte Carlo Method and NumPy.
"""
from __future__ import print_function
import numpy #1
@profile
def pi_numpy(total): #2
"""Compute pi.
"""
x = numpy.random.rand(total) ... | rawrgulmuffins/presentation_notes | pycon2016/tutorials/measure_dont_guess/handout/pi/numpy_pi.py | Python | mit | 834 |
hand = ['A',2,3,4,10]
print hand
value = 0
for i in hand:
if i == 'A':
if value + 11 > 21:
value += 1
else:
value += 11
else:
if value + i > 21 and (hand.count('A') > 0 or 'A' in hand):
value += i
value -= 10
else:
value += i
print value
if 'A' in hand and value > 21:
pri... | peterhogan/python | testforblackjack.py | Python | mit | 395 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class CardekhoPipeline(object):
def process_item(self, item, spider):
return item
| darshanime/scrapy-tutorials | cardekho/cardekho/pipelines.py | Python | mit | 288 |
from plugins._lastfm_helpers import *
from operator import itemgetter
from formatting import *
def parse_onlines(async_responses):
''' take a list of Futures() for who's online, wait for each to complete,
and yield if each user is online or not
'''
for async_response in async_responses:
re... | sentriz/steely | steely/plugins/_lastfm_list.py | Python | gpl-3.0 | 2,024 |
# -*- coding: utf-8 -*-
import sys, os
sys.path.insert(0, os.path.abspath('..'))
from config.all import *
language = 'en'
| javiersanp/CatAtom2Osm | doc-src/en/conf.py | Python | bsd-2-clause | 126 |
# -*- coding: utf-8 -*-
from BJFinanceLib.instruments.swapleg import SwapLegFixed, SwapLegFloating
from BJFinanceLib.objects.cashflowschedule import CashflowSchedule
from numbers import Number
class IRS():
pass
class IRSFixedForFloat():
@staticmethod
def payerReceiver(payerReceiverFlag):
if isi... | bramjochems/BJFinanceLib | BJFinanceLib/instruments/irs.py | Python | gpl-3.0 | 3,360 |
"""
frontend_auth is a wrapper around the `django.contrib.auth.view` Views.
* **templates/** Contains the templates for login / pw change / pw reset views and the password_reset emails
* **auth_mixins.py** Provides a simple mixin that tests if `instance.agency == request.user.agencyemployee.agency`, more to come
... | phelmig/outside_ | mvp/outside/frontend_auth/__init__.py | Python | mit | 1,006 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | ElDeveloper/qiita | qiita_pet/handlers/analysis_handlers/listing_handlers.py | Python | bsd-3-clause | 4,783 |
# _mc_pefparm.py
#
# openipmi GUI handling for MC PEF parms
#
# Author: MontaVista Software, Inc.
# Corey Minyard <minyard@mvista.com>
# source@mvista.com
#
# Copyright 2005 MontaVista Software Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GN... | ystk/debian-openipmi | swig/python/openipmigui/_mc_pefparm.py | Python | gpl-2.0 | 7,497 |
#!/usr/bin/env python
import telnetlib
import subprocess
import signal
import time
###############################################################
# This script will automatically flash and start a GDB debug
# session to the STM32 discovery board using OpenOCD. It is
# meant to be called from the rake task "debug" (... | timbrom/lightshow | scripts/flash_and_debug.py | Python | apache-2.0 | 2,657 |
import smbus
from time import sleep
def delay(time):
sleep(time/1000.0)
def delayMicroseconds(time):
sleep(time/1000000.0)
from hd44780 import HD44780
class Screen(HD44780):
"""A driver for MCP23008-based I2C LCD backpacks. The one tested had "WIDE.HK" written on it."""
def __init__(self, bus=1, ad... | CRImier/pyLCI | output/drivers/mcp23008.py | Python | apache-2.0 | 2,598 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.core.validators
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations... | koleror/django-two-factor-auth | two_factor/migrations/0001_initial.py | Python | mit | 1,534 |
from src import Msg
from src.attacks import AttackerHelper
def wrongInterface(a):
""" Sends a valid message impersonating another device with the wrong interface Number 0x03. """
victim = AttackerHelper.selectVictim(a.clientConfigs)
victim['msg']['clientID'] = a.clientID
victim['msg']['iface'] = 0x03
... | Egomania/SOME-IP_Generator | src/attacks/wrongInterface.py | Python | agpl-3.0 | 845 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | steedos/odoo7 | openerp/addons/point_of_sale/point_of_sale.py | Python | agpl-3.0 | 67,731 |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
nid = args.getTag('nid')
actor = j.apps.actorsloader.getActor("system", "gridmanager")
out = []
#this makes sure bootstrap datatables functionality is used
out.append("{{datatables_use}}\n")
#[u'other... | Jumpscale/jumpscale6_core | apps/gridportal/base/Grid/.macros/wiki/machines/1_machines.py | Python | bsd-2-clause | 1,855 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | kilon/sverchok | nodes/modifier_make/convex_hull.py | Python | gpl-3.0 | 2,846 |
# We only list usable missions here, not base classes.
__all__ = [
"Mission_Browse", "Mission_Calibrate", "Mission_Fan",
"Mission_Fan_Straight", "Mission_Forward", "Mission_Infrared",
"Mission_Infrared_Grid", "Mission_Pathfind", "Mission_RF_Sensor",
"Mission_Search", "Mission_Square"
]
| timvandermeij/mobile-radio-tomography | mission/__init__.py | Python | gpl-3.0 | 303 |
from django.views.generic import CreateView, DeleteView, UpdateView, View
from django.http import Http404
from django.shortcuts import redirect
from django.forms.utils import ErrorList
from django import forms
from wquests import common_functions
from wqengine.models import WebQuest, WebQuestVersion, WebQuestVersionSe... | priakni/wquests | wquests/portal/views.py | Python | mit | 15,470 |
from bottle import template
from os import system
import numpy as np
from bin2svg import bin2svg
from store_dicts import subgroup_name_to_tuple_bidict, pairs_to_num_bidict
system('mkdir FILES')
def create_file(subgroup_name, svg_path):
context = {'path': svg_path}
t = template('svg_matrix_code', context)
... | watchduck/full_octahedral_group | projects/p03_subgroups/app.py | Python | mit | 733 |
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import minimize
from functools import partial
from adapters import hung_ji_adapter
from common import Plate
from configs import Locations
from csv import writer
def growth(timepoints, stepness, maxVal, midpoint, delay):
# maxVal = 50 # w... | chiffa/TcanAnalyzer | src/curve_fitting.py | Python | bsd-3-clause | 3,961 |
# -*- coding: utf-8 -*-
"""
This example demonstrates many of the 2D plotting capabilities
in pyqtgraph. All of the plots may be panned/scaled by dragging with
the left/right mouse buttons. Right click on any plot to show a context menu.
"""
import initExample ## Add path to library (just for examples; you do not nee... | nmearl/pyqtgraph | examples/Plotting.py | Python | mit | 3,197 |
# Seraphim documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are... | malaclypse2/seraphim | docs/conf.py | Python | mit | 7,774 |
from flask import Flask, url_for, json
from flask import request, jsonify
from functools import wraps
import time
import sys
import datetime
app = Flask(__name__)
import logging
file_handler = logging.FileHandler('server.log')
app.logger.addHandler(file_handler)
app.logger.setLevel(logging.INFO)
from utils import *
... | fordham-css/ptp | vis-api-server.py | Python | mit | 1,000 |
import re
import os
def load_model(f_name):
_curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) )
prob_p_path = os.path.join(_curpath,f_name)
return eval(open(prob_p_path,"rb").read())
prob_start = load_model("prob_start.py")
prob_trans = load_model("prob_trans.py")
prob_emit = load_... | htfy96/nanoSearcher | jieba/finalseg/__init__.py | Python | gpl-3.0 | 1,820 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('catalog', '0010_auto_20150706_0052'),
]
operations = [
migrations.AlterModelOptions(
name='address',
... | dchaplinsky/garnahata.in.ua | garnahata_site/catalog/migrations/0011_auto_20150706_0117.py | Python | mit | 768 |
"""Support for ZHA covers."""
import asyncio
import functools
import logging
from typing import List, Optional
from zigpy.zcl.foundation import Status
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_POSITION,
DEVICE_CLASS_DAMPER,
DEVICE_CLASS_SHADE,
DOMAIN,
CoverEntity... | partofthething/home-assistant | homeassistant/components/zha/cover.py | Python | apache-2.0 | 10,469 |
# iterative solution
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
q = [""]
def is_valid(seq):
level = 0
while seq:
head = seq[0]
if head == '(':
level += 1
elif head == ')':
... | 1337/yesterday-i-learned | leetcode/22m (2).py | Python | gpl-3.0 | 862 |
#
# 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... | apache/incubator-airflow | airflow/migrations/versions/4446e08588_dagrun_start_end.py | Python | apache-2.0 | 1,372 |
# Copyright 2013 IBM Corp.
# 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 app... | ewindisch/nova | nova/api/openstack/compute/plugins/v3/versions.py | Python | apache-2.0 | 1,692 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logs', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='entry',
name='date',
),
]
| Marpop/daily-log | logs/migrations/0002_remove_entry_date.py | Python | mit | 262 |
#############################################################################
##
## Copyright (C) 2012 Hans-Peter Jansen <hpj@urpla.net>.
## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
## This file is part of the examples... | Distrotech/PyQt-x11 | examples/demos/spreadsheet/printview.py | Python | gpl-2.0 | 2,136 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EquivalentNumField.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*******************... | stevenmizuno/QGIS | python/plugins/processing/algs/qgis/VectorLayerScatterplot.py | Python | gpl-2.0 | 3,727 |
from findARestaurant import findARestaurant
from models import Base, Restaurant
from flask import Flask, jsonify, request
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy import create_engine
import sys
import codecs
sys.stdout = codecs.getwr... | AtmaMani/pyChakras | udacity_restful_apis/lesson_3/06_Adding Features to your Mashup/Starter Code/views.py | Python | mit | 962 |
# -*- coding: utf-8 -*-
# extracted rules for stemming
rules = {
'verbs': {
'irregular': {
'type_1': ['ΕΙΜΑΙ', 'ΕΙΣΑΙ', 'ΕΙΝΑΙ', 'ΕΙΜΑΣΤΕ', 'ΕΙΣΤΕ', 'ΕΙΣΑΣΤΕ'],
'type_2': ['ΗΜΟΥΝ', 'ΗΣΟΥΝ', 'ΗΤΑΝΕ', 'ΗΜΟΥΝΑ', 'ΗΣΟΥΝΑ', 'ΗΜΑΣΤΕ', 'ΗΣΑΣΤΕ', 'ΗΜΑΣΤΑΝ', 'ΗΣΑΣΤΑΝ', 'ΗΤΑΝ',
... | kpech21/Greek-Stemmer | greek_stemmer/closets/rules.py | Python | lgpl-3.0 | 7,944 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.