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 (c) 2013 Mirantis 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 applicable law or agreed to in writ... | esikachev/scenario | sahara/service/networks.py | Python | apache-2.0 | 3,742 |
# encoding: 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 field 'RainMeter.flag_only'
db.add_column('rainman_rainmeter', 'flag_only', self.gf('django.db.mo... | smurfix/HomEvenT | irrigation/rainman/migrations/0015_auto__add_field_rainmeter_flag_only__add_field_site_rain_delay.py | Python | gpl-3.0 | 16,856 |
# Copyright 2015 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... | hfp/tensorflow-xsmm | tensorflow/python/layers/base_test.py | Python | apache-2.0 | 23,643 |
from tkinter import *
from sympy import *
import math
import SerieDeTaylor
try:
import ttk
except ImportError:
import tkinter.ttk as ttk
class metodosyseries:
def __init__(self, other, Op):
print("Estoy en ProcSerieDeTaylor.py")
#print(str(SerieDeTaylor.windows.listbox))
self.clsp... | FelipeMora/MetodosNumericos | ProcSerieDeTaylor.py | Python | bsd-2-clause | 10,965 |
"""Tests for init functions."""
from datetime import timedelta
from zoneminder.zm import ZoneMinder
from homeassistant import config_entries
from homeassistant.components.zoneminder import const
from homeassistant.components.zoneminder.common import is_client_in_data
from homeassistant.config_entries import (
ENT... | tchellomello/home-assistant | tests/components/zoneminder/test_init.py | Python | apache-2.0 | 4,539 |
# Copyright 2013 the Melange 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 wr... | rhyolight/nupic.son | app/soc/logic/program.py | Python | apache-2.0 | 944 |
#################################################################
# #
# Refinement data preparation script #
# #
# Copyright: Molecular Images 2005 ... | mifit/miexpert | mi_dataprep.py | Python | gpl-3.0 | 29,658 |
# Example: recursive runs
from bluesky import RunEngine
from bluesky.callbacks.best_effort import BestEffortCallback
import bluesky.preprocessors as bpp
import bluesky.plan_stubs as bps
from databroker import Broker
from event_model import RunRouter
from ophyd.sim import hw
hw = hw()
RE = RunEngine({})
db = Broker.... | ericdill/bluesky | docs/source/examples/multi_run_plans_recursive.py | Python | bsd-3-clause | 1,601 |
# -*- coding: utf-8 -*-
#
# SASNets documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 20 10:15:25 2017.
#
# 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.
#
# A... | scattering/sasnets | docs/conf.py | Python | bsd-3-clause | 12,231 |
from __future__ import print_function, division, absolute_import
__author__ = "Pierre Barbier de Reuille <pierre@barbierdereuille.net>"
__docformat__ = "restructuredtext"
import scipy
from scipy import rot90, zeros, cumsum, sqrt, maximum, std, absolute, array, real
from scipy.signal.signaltools import correlate2d, fftc... | PierreBdR/point_tracker | point_tracker/normcross.py | Python | gpl-2.0 | 3,343 |
from zope.interface.verify import verifyClass, verifyObject
from twisted.trial.unittest import TestCase
from bafload.interfaces import ITransmissionCounter
from bafload.common import BaseCounter
from bafload.test.util import FakeLog
class InterfacesTestCase(TestCase):
def test_base_counter_ifaces(self):
... | djfroofy/bafload | bafload/test/test_common.py | Python | mit | 2,014 |
# rhn-client-tools
#
# Copyright (c) 2006--2012 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; version 2 of the License.
#
# This program is distributed in the hope t... | davidhrbac/spacewalk | client/rhel/rhn-client-tools/src/up2date_client/rhnserver.py | Python | gpl-2.0 | 8,608 |
largest = smallest = None
while True:
s_in = input("Enter a number: ")
if s_in == 'done':
break
try:
i = int(s_in)
except:
print('Invalid input')
continue
if largest is None:
largest = i
else:
if i > largest:
largest = i
if smallest is None:
smallest = i
else:
if ... | rlmitchell/coursera | py4e/1_python_for_everybody/ex-5-2.py | Python | gpl-3.0 | 414 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-27 16:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('database', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | jacobdein/datawaves | server/database/migrations/0002_auto_20160827_1654.py | Python | gpl-3.0 | 728 |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;upnp
The following license agreement remains valid unless any additions or
changes a... | dNG-git/pas_upnp | src/dNG/data/upnp/control_point_event.py | Python | gpl-2.0 | 14,823 |
from email.header import decode_header
DEFAULT_CODEC = 'utf-8'
def ensure_encoded(some_str):
"""
:param some_str:
:return: Try to encode the string with a series of encodings,
returning the successfully encoded string. Uses ascii, then utf-8,
then latin-1. If neither works, force a default.
""... | wilbertom/gmail_client | gmail_client/codecs/__init__.py | Python | mit | 1,360 |
import angr
######################################
# stub, for unsupported syscalls
######################################
#pylint:disable=redefined-builtin,arguments-differ
class syscall(angr.SimProcedure):
IS_SYSCALL = True
def run(self, resolves=None):
self.resolves = resolves # pylint:disable=... | axt/angr | angr/procedures/stubs/syscall_stub.py | Python | bsd-2-clause | 671 |
# -*- coding: utf-8 -*-
import unittest
import util.email
class GetNameAndEmailTest(unittest.TestCase):
"""Tests util.email.get_name_and_email()"""
def test_bare_email(self):
email_string = 'darwin@example.com'
email, name = util.email.get_name_and_email(email_string)
self.assertEqua... | Yelp/love | tests/util/email_test.py | Python | mit | 647 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .validators import ISBNValidator
from django.db.models import CharField, SubfieldBase
class ISBNField(CharField):
__metaclass__ = SubfieldBase
def __init__(self, *args, **kwargs):
# Establecer la longitud máxima para ISBN13, y añadir validacion.
... | secnot/tutorial-tienda-django-paypal-1 | tiendalibros/isbn_field/fields.py | Python | gpl-3.0 | 774 |
################ Copyright 2005-2013 Team GoldenEye: Source #################
#
# This file is part of GoldenEye: Source's Python Library.
#
# GoldenEye: Source's Python Library 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 So... | goldeneye-source/ges-python | ges/Ai/Tasks/common.py | Python | gpl-3.0 | 5,970 |
import logging
from datetime import datetime
from collections import defaultdict
from servicelayer.jobs import Job
from aleph.core import db, cache
from aleph.authz import Authz
from aleph.queues import cancel_queue, ingest_entity, get_status
from aleph.model import Collection, Entity, Document, Mapping
from aleph.mod... | pudo/aleph | aleph/logic/collections.py | Python | mit | 7,335 |
# Copyright 2015 Google Inc. 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 applicable law or a... | DeepThoughtTeam/tensorflow | tensorflow/python/training/rmsprop_test.py | Python | apache-2.0 | 8,104 |
import httpretty
import requests
def test_get_all_requests():
httpretty.register_uri(httpretty.POST, 'http://127.0.0.1:5001/notification')
httpretty.enable()
requests.post('http://127.0.0.1:5001/notification')
requests.post('http://127.0.0.1:5001/notification?test=2')
calls = httpretty.latest_requ... | pxg/HTTPretty | test_last_requests.py | Python | mit | 471 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Optimizing a simple CNN model with one hyper-parameter (learning rate).
The model itself isn't different from "Hello World Example", except for the hyper-parameter that
is now taken from the input dictionary: `params['learning_rate']`.
Also pay attention to `strategy... | maxim5/hyper-engine | hyperengine/examples/1_2_getting_started_with_tuning.py | Python | apache-2.0 | 2,752 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | sunu/oppia | extensions/rules/nonnegative_int.py | Python | apache-2.0 | 877 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/color.py
#
# 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 ... | zigitax/king-phisher | king_phisher/color.py | Python | bsd-3-clause | 5,054 |
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='nifty-gemini',
version='0.1.3',
description='Gemini NIFS data reduction pipeline.',
long_description=readme(),
url='https://github.com/Nat1405/newer-nifty',
author='Nat Comeau... | mrlb05/Nifty | nifty/extras/setup.py | Python | mit | 731 |
import asyncio
import json
import requests
from autoreiv import BasePlugin
class Plugin(BasePlugin):
def __init__(self):
super().__init__({
'name': 'Urban Dictionary',
'command': 'ud',
'req_params': True,
})
@asyncio.coroutine
def callback(self, bot, ms... | diath/AutoReiv | autoreiv/plugins/urbandict.py | Python | mit | 1,017 |
import os
import urllib
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
DEFAULT_GUESTBOOK_NA... | SimonBiggs/electrons-appengine | guestbook.py | Python | gpl-3.0 | 2,807 |
# -*- coding: utf-8 -*-
"""A series of classes that hold collections of the resources' app objects."""
from django.utils import simplejson as json
from transifex.resources.models import SourceEntity, Translation
from transifex.resources.formats.utils.hash_tag import hash_tag
from transifex.txcommon.log import logger
... | tymofij/adofex | transifex/resources/formats/resource_collections.py | Python | gpl-3.0 | 6,101 |
import gensim
import math
import copy
import numpy as np
from gensim.models import Doc2Vec, Word2Vec
class Document2Vec(Doc2Vec):
def __init__(self, filename=None, min_count=1, alpha_initial=0.002,
alpha_start=0.0005, alpha_end=0.0002, min_iters=10,
monitor=None):
Doc2Vec... | cemoody/Document2Vec | document2vec/document2vec.py | Python | mit | 5,391 |
# -*- coding: utf8 -*-
SQL = (
("lists", """select SQL_CALC_FOUND_ROWS O.*, KOD as DELO_ID,L1,L2,L3,L4,L6,L7,DATE_FORMAT(L8,'%%Y-%%m-%%d')L8, DATE_FORMAT(L9,'%%Y-%%m-%%d')L9,L11 FROM `af3_delo` D LEFT JOIN `afweb_opis` O on (OPIS_ID=D.OPIS) where MATCH (L1,L4,L5,L14) AGAINST ('%(q)s') order by L1 limit %(offset)d,%... | ffsdmad/af-web | cgi-bin/plugins2/delo_search.py | Python | gpl-3.0 | 664 |
from django.conf.urls import url
from . import views
app_name = 'movies'
urlpatterns = [
url(r'^$', views.get_all_movies_as_tile, name='index'),
url(r'^list/$', views.get_all_movies_as_list, name='list-index'),
url(r'^released/$', views.get_released_movies_as_tile, name='get-released'),
url(r'^list/r... | vvnc/django-dvd-releases | movies/urls.py | Python | gpl-3.0 | 851 |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Tests for the end-to-end internal operation of the Flocker cluster.
In particular this does not cover testing interactions with external systems.
"""
| achanda/flocker | flocker/acceptance/endtoend/__init__.py | Python | apache-2.0 | 214 |
#!/usr/bin/env python
# -*- coding: utf_8 -*-
# Copyleft (c) 2016 Cocobug All Rights Reserved.
import argparse,os,sys,shutil,markdown
from generator import *
choosen_model=models.dual
def saveData(path,data):
if not args.dry:
with open(path,"w+") as f:
f.write(data)
def savePath(path):
r... | Malphaet/vkyweb | vkyweb.py | Python | unlicense | 5,498 |
"""
(C) 2011 by Holger Hans Peter Freyther
All Rights Reserved
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.
T... | marcelmaatkamp/docker-gnuradio-osmocom-tetra | src/demod/python/__init__.py | Python | agpl-3.0 | 1,025 |
"""
pystrix.agi.core
================
All standard AGI actions as instantiable classes, suitable for passing to the
`execute()` function of an AGI interface.
Also includes constants to make programmatic interaction cleaner.
Legal
-----
This file is part of pystrix.
pystrix is free software; you can redistribute it... | IVRTech/pystrix | pystrix/agi/core.py | Python | lgpl-3.0 | 34,976 |
# Author(s): Job van Riet
# Date of creation: 27-3-14
# Date of modification: Initial version
# Version: 1.0
# Modifications: None
# Known bugs: None Known
# Function:
# This script can read the PROTECT ADR files and upload the data to the DB
from optparse import OptionParser
import os
# Get the co... | J0bbie/AdverseEffectsPredictor | writeData2DB/readPROTECTADR.py | Python | apache-2.0 | 618 |
import platform
import threading
import time
from unittest import mock
import pytest
import redis
from redis.exceptions import ConnectionError
from .conftest import _get_client, skip_if_redis_enterprise, skip_if_server_version_lt
def wait_for_message(pubsub, timeout=0.1, ignore_subscribe_messages=False):
now =... | alisaifee/redis-py | tests/test_pubsub.py | Python | mit | 21,177 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class HrEmployee(models.Model):
_inherit = 'hr.employee'
def action_open_work_entries(self):
self.ensure_one()
return {
'type': 'ir.actions.act_window',
... | jeremiahyan/odoo | addons/hr_work_entry/models/hr_employee.py | Python | gpl-3.0 | 596 |
#
# Qubit dynamics shown in a Bloch sphere.
#
from qutip import *
from pylab import *
def qubit_integrate(w, theta, gamma1, gamma2, psi0, tlist):
# Hamiltonian
sx = sigmax()
sy = sigmay()
sz = sigmaz()
sm = sigmam()
H = w * (cos(theta) * sz + sin(theta) * sx)
# collapse operators
c_op_... | Vutshi/qutip | qutip/examples/ex_27.py | Python | gpl-3.0 | 1,483 |
import locale
locale.setlocale(locale.LC_ALL, '')
from flask import abort
from flask import Flask
from flask import g
from flask import request
from flask import render_template
from flask import session
from flask import url_for
from jinja2 import Markup
from uberlytics.lib import stats
from uberlytics.model import... | jestrada/uberlytics | uberlytics/web.py | Python | gpl-2.0 | 2,535 |
# 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 ... | xingwu1/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py | Python | mit | 5,402 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------... | Ecpy/ecpy | exopy/instruments/drivers/driver_decl.py | Python | bsd-3-clause | 10,506 |
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff']
def customItemName():
return 'Power Output Device'
def stackable():
return 1
def junkDealerPrice():
return 21
def junkType():
return 0
| ProjectSWGCore/NGECore2 | scripts/loot/lootItems/re_junk/power_output_device.py | Python | lgpl-3.0 | 256 |
import sys
if sys.version_info >= (3, 8):
from functools import singledispatchmethod
else:
from functools import singledispatch, update_wrapper
def singledispatchmethod(func):
dispatcher = singledispatch(func)
def wrapper(*args, **kw):
return dispatcher.dispatch(args[1].__clas... | adamcharnock/lightbus | lightbus/utilities/singledispatch.py | Python | apache-2.0 | 447 |
#!/usr/bin/env python
import sys
import numpy
import logging
from openquake.baselib import sap
from openquake.sub.create_2pt5_model import (read_profiles_csv,
get_profiles_length,
get_interpolated_profiles,
... | GEMScienceTools/oq-subduction | openquake/sub/build_complex_surface.py | Python | agpl-3.0 | 3,532 |
# Copyright (c) Moshe Zadka
# See LICENSE for details.
"""ncolony.client.heart
=====================
A heart beater.
"""
from __future__ import division
import json
import os
from twisted.python import filepath
from twisted.application import internet as tainternet, service as taservice
class Heart(object):
... | ncolony/ncolony | ncolony/client/heart.py | Python | mit | 1,713 |
class compiler_flags(object):
def __init__(self, conf):
self.conf = conf
def _check(self, func, key, enable_prefix, disable_prefix, name):
enable_flag = enable_prefix + name
disable_flag = disable_prefix + name
kw = { 'mandatory': False, key.lower(): enable_flag }
if not... | theefer/xmms2 | waftools/compiler_flags.py | Python | lgpl-2.1 | 2,553 |
from itertools import combinations
n, l, r, x = map(int, input().split())
C = list(map(int, input().split()))
ans = 0
for i in range(2, n+1):
for c in combinations(C, i):
s = sum(c)
if s < l or r < s:
continue
if max(c) - min(c) < x:
continue
ans += 1
print(an... | knuu/competitive-programming | codeforces/cdf306_b.py | Python | mit | 323 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | task_set/datasets_test.py | Python | apache-2.0 | 2,173 |
from builtins import object
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_budovysearchform.ui'
#
# Created: Fri Nov 20 17:50:07 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from qgis.PyQt import QtCore, QtWidgets
try:
_... | ctu-osgeorel/qgis-vfk-plugin | ui_budovysearchform.py | Python | gpl-2.0 | 3,469 |
"""
Copyright 2011 Software Freedom Conservancy.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | superchilli/webapp | venv/lib/python2.7/site-packages/selenium/selenium.py | Python | mit | 77,927 |
#-*- coding: utf-8 -*-
"""OAuth 2.0 Authentication"""
try: import simplejson as json
except ImportError: import json
from hashlib import sha256
from urlparse import parse_qsl
from django.conf import settings
from django.http import HttpResponse
from .exceptions import OAuth2Exception
from .models import AccessToken... | RaduGatej/SensibleData-Platform | sensible_data_platform/oauth2app/authenticate.py | Python | mit | 12,203 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-25 05:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('interactive', '0010_auto_20160925_0213'),
]
operations = [
migrations.AddFi... | adminq80/Interactive_estimation | game/interactive/migrations/0011_interactive_channel.py | Python | mit | 531 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Roger Philibert
#
# This file is part of weboob.
#
# weboob 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 yo... | frankrousseau/weboob | modules/tinder/browser.py | Python | agpl-3.0 | 3,945 |
import dataclasses
import typing
import module4
@dataclasses.dataclass()
class Foo:
bars: typing.List[module4.Bar]
| github/codeql | python/ql/test/query-tests/Imports/cyclic-module-annotations-fp/module3.py | Python | mit | 121 |
from tohu.v6.primitive_generators import Constant, Integer, HashDigest, FakerGenerator
from .common import NUM_PARAMS
class TimeConstant:
params = NUM_PARAMS
def setup(self, num):
self.g = Constant("foobar")
def time_constant(self, num):
self.g.generate(num=num)
class TimeInteger:
... | maxalbert/tohu | benchmarks/benchmarks/benchmark_primitive_generators.py | Python | mit | 911 |
# -*- coding: utf-8 -*-
from django import forms
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from accounts.forms import CollaboratorForm
from accounts.models import AccessLevel
from core.forms import UntaggedFormMixin
from core.widgets import Select2
from crispy_forms.b... | srtab/alexandriadocs | alexandriadocs/projects/forms.py | Python | apache-2.0 | 4,238 |
import pytest
import capnp
import os
import tempfile
import sys
from capnp.lib.capnp import KjException
this_dir = os.path.dirname(__file__)
@pytest.fixture
def addressbook():
return capnp.load(os.path.join(this_dir, "addressbook.capnp"))
@pytest.fixture
def all_types():
return capnp.load(os.path.join(thi... | jparyani/pycapnp | test/test_struct.py | Python | bsd-2-clause | 8,177 |
#!/usr/bin/python
import sys
import os
homedir = os.getenv("HOME")
sys.path.append(homedir + '/Pigrow/scripts/')
import pigrow_defs
# setting defaults and blank variables
trigger_name = None
set_direct = None
cooldown = "none"
# Handle command line arguments
for argu in sys.argv[1:]:
if argu == '-h' or argu == '-... | Pragmatismo/Pigrow | scripts/cron/set_trigger_condition.py | Python | gpl-3.0 | 1,603 |
from flask import Flask, request, jsonify, render_template, abort
import subprocess
import re
import db as database
from iptables import IPTables
from helper import Helper
app = Flask(__name__)
# create objects needed here
ipt = IPTables()
helper = Helper()
db = database.DB()
@app.route('/', methods=['GET', 'POST'],... | Freifunk-Rhein-Neckar/ffrn-gw-splash | backend.py | Python | mit | 1,527 |
# Copyright 2016 Internap
#
# 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, sof... | mat128/python-ubersmith-remote-module-server | ubersmith_remote_module_server/api.py | Python | apache-2.0 | 1,954 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File Title: Aria2.py
# Author: Selphia
# Mail: LoliSound@gmail.com
# Time: 2017年07月29日 星期六 21时49分38秒
# Version:
import os
import shutil
print('\033[32mYou will use the /var/www/html directory !!! y/n\033[0m')
confirm=input()
while True:
if confirm == "y" or con... | selphia/ManagementScript | Aria2.py | Python | gpl-3.0 | 5,019 |
# This file is part of quichem.
#
# quichem is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# quichem is distributed in the ho... | spamalot/quichem | quichem/gui/generic.py | Python | lgpl-3.0 | 5,169 |
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from tracpro.test import TracProTest
class HomeViewTest(TracProTest):
def test_home(self):
# can't access it anonymously
response = self.url_get('unicef', reverse('home.home'))
self.asser... | ewheeler/tracpro | tracpro/home/tests.py | Python | bsd-3-clause | 905 |
import unittest
from app.itbms import calcular_itbms
class TestITBMS(unittest.TestCase):
def test_calcular_itbms(self):
self.assertEqual(calcular_itbms(1.0),0.07)
if __name__=='__main__':
unittest.main()
| amedina14/uip-iq17-pc3 | clase 7/Documentacion/tests/TestITBMS.py | Python | mit | 231 |
"""
SoftLayer.tests.managers.ticket_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import fixtures
from SoftLayer import testing
class TicketTests(testing.TestCase):
def set_up(self):
self.ticket = SoftLayer.TicketMan... | kyubifire/softlayer-python | tests/managers/ticket_tests.py | Python | mit | 4,226 |
#!/usr/bin/env python2
import sys, signal
def sigint(*a):
print("\n*break*")
sys.exit(0)
if __name__ == "__main__":
signal.signal(signal.SIGINT, sigint)
from syncthing_gtk.tools import init_logging, IS_WINDOWS
init_logging()
if IS_WINDOWS:
from syncthing_gtk import windows
windows.fix_localized_system_err... | GeoffreyFrogeye/syncthing-gtk | syncthing-gtk.py | Python | gpl-2.0 | 477 |
# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
default_app_config = 'openedx.core.djangoapps.schedules.apps.SchedulesConfig'
| stvstnfrd/edx-platform | openedx/core/djangoapps/schedules/__init__.py | Python | agpl-3.0 | 158 |
import os
bfdir = os.path.dirname(os.path.abspath(__file__))
| thoughtpolice/bf-pypy | bf/__init__.py | Python | mit | 61 |
import matplotlib
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from matplotlib import cm
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import cm as cm_base
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matp... | peterwilletts24/Python-Scripts | modules/map_plot_defaults.py | Python | mit | 1,220 |
# -*- coding: utf-8 -*-
from app import app
from app.models import term
from flask import abort, jsonify, request
# from pprint import pprint
from elasticsearch import Elasticsearch
ES_HOST = {
"host": "localhost",
"port": 9200
}
INDEX_NAME = 'glossary'
es = Elasticsearch(hosts=[ES_HOST])
@app.route('/gl... | tranhuucuong91/dev-tools | app/routes/glossary.py | Python | mit | 1,944 |
#! /usr/bin/python3
"""
The database connections are read‐only, so SQL injection attacks can’t be a
problem.
"""
import sys
import os
import threading
import decimal
import time
import json
import re
import requests
import collections
import logging
logger = logging.getLogger(__name__)
from logging import handlers as... | tokenly/counterparty-lib | counterpartylib/lib/api.py | Python | mit | 38,515 |
from . import layers, loaders, definitions
import numpy as np
import tensorflow.compat.v1 as tf
import tensorflow.contrib
from tensorflow.python.client import device_lib
import os
import json
import datetime
import time
import warnings
import copy
import math
import random
from abc import ABC, abstractmethod
from tqdm ... | p2irc/deepplantphenomics | deepplantphenomics/deepplantpheno.py | Python | gpl-2.0 | 135,043 |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 11 18:19:21 2016
@author: boldingd
"""
import SnnBase
import SpikingNetwork
import DopamineStdp
class SpikeRewarder:
"""ticks up the dopamine manager every time a spike is received"""
def __init__(self, reward_manager, per_spike_multiplier):
self.r... | boldingd/BadSnn | dopamine 5hz attractor.py | Python | bsd-3-clause | 4,459 |
#!/usr/bin/python
import MySQLdb, os, datetime
mysql = MySQLdb.connect(host='192.168.1.251',user='aircraft',passwd='Password01',db='aircraft')
mysqlcursor = mysql.cursor()
adsb = os.popen("/home/chuck/src/dump1090/dump1090 --net --aggressive")
while True:
line = adsb.readline()
if ( line.find(' Identificat... | cswiger/logplanes | logplanes.py | Python | gpl-2.0 | 1,087 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'PurpleRobotEvent.name'
db.add_column(u'purple_robot_app_p... | cbitstech/Purple-Robot-Django | migrations/0011_auto__add_field_purplerobotevent_name.py | Python | gpl-3.0 | 4,877 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2007 Donald N. Allingham, Martin Hawlisch
# Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2012 Benny Malengier
# Copyright (C) 2014 Bastien Jacquet
#
# This program is free software; you can redistribute it and/or modify
# it under the term... | Nick-Hall/gramps | gramps/gui/widgets/fanchart2way.py | Python | gpl-2.0 | 30,849 |
"""unused import"""
# pylint: disable=undefined-all-variable, import-error, no-absolute-import, too-few-public-methods, missing-docstring,wrong-import-position, useless-object-inheritance, multiple-imports
import xml.etree # [unused-import]
import xml.sax # [unused-import]
import os.path as test # [unused-import]
fr... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/u/unused/unused_import.py | Python | mit | 1,681 |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) [2016] [Gaurav Mathur]
#
# 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 t... | gnmathur/code-samples | boggle/boggle.py | Python | mit | 4,759 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Pardus Desktop Services
# Copyright (C) 2010, TUBITAK/UEKAE
# 2010 - Gökmen Göksel <gokmen:pardus.org.tr>
# 2010 - H. İbrahim Güngör <ibrahim:pardus.org.tr>
# 2011 - Comak Developers <comak:pardus.org.tr>
# This program is free software; you can redistribute it and/or modif... | Pardus-Linux/pds | pds/environments.py | Python | gpl-2.0 | 3,998 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Midokura PTE LTD.
# 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/LICENS... | midonet/python-midonetclient | src/midonetclient/host_version.py | Python | apache-2.0 | 1,367 |
import os
from .tools import import_module
class Router(object):
"""
Allow to match url address with appropriate controller.
"""
def __init__(self, project_dir=os.getcwd()):
self._routes = {}
self._project_dir = project_dir
self.load_routes()
def load_routes(self):
... | webpages/webpages | webpages/router.py | Python | mit | 1,652 |
import gitlab
from .. import mock, wrapped_config_get
gitlab.Gitlab("") # instantiation necessary to discover gitlab ProjectManager
class _GitlabProject:
def __init__(self, status):
self.commits = {"my_ref": self._Commit(status)}
self.tags = self._Tags()
self.releases = self._Releases()... | relekang/python-semantic-release | tests/mocks/mock_gitlab.py | Python | mit | 4,092 |
# coding: utf-8
# web_utils.py written by Duncan Murray 26/5/2014
# functions to convert data to HTML, etc for web dev
import csv
import os
import fnmatch
from flask import request
import sys
import csv
def GetFileList(rootPaths, lstXtn, shortNameOnly='Y'):
"""
builds a list of files and returns as a list
... | acutesoftware/aikif.com | webapp/web_utils.py | Python | gpl-3.0 | 5,244 |
import functools
import numpy as np
import pytest
import tensorflow as tf
from tests.helper import assert_variables
from tests.layers.flows.helper import invertible_flow_standard_check
from tfsnippet.layers import ActNorm, act_norm
from tfsnippet.shortcuts import global_reuse
def naive_act_norm_initialize(x, axis)... | korepwx/tfsnippet | tests/layers/normalization/test_act_norm.py | Python | mit | 8,945 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
import profiles.urls
import accounts.urls
from . import views
from profiles.models import *
urlpatterns = patterns(
'',
url(r'^$', views.HomePage.as_v... | justiceeq/csc309individualassignment | src/my_proj/urls.py | Python | mit | 1,965 |
import re
import time
from hashlib import sha1
from base64 import b16encode, b32decode
import sickbeard
from sickbeard import logger
from sickbeard.exceptions import ex
from sickbeard.clients import http_error_code
from lib.bencode import bencode, bdecode
from lib import requests
from lib.requests import exceptions
c... | ressu/SickGear | sickbeard/clients/generic.py | Python | gpl-3.0 | 8,862 |
##
# Copyright (c) 2010-2017 Apple Inc. 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 applicable l... | macosforge/ccs-calendarserver | contrib/od/setup_directory.py | Python | apache-2.0 | 16,127 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/application_gateway_backend_address_pool_py3.py | Python | mit | 2,635 |
# Copyright 2018 ForgeFlow, S.L. (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
class ActivityStatementWizard(models.TransientModel):
"""Activity Statement wizard."""
_inh... | OCA/account-financial-reporting | partner_statement/wizard/activity_statement_wizard.py | Python | agpl-3.0 | 1,787 |
"""Problem 67: Maximum path sum II.
Dynamic programming"""
import unittest
def file_reader(filename):
with open(filename) as f:
tree = []
for line in f.readlines():
weights = [int(x) for x in line.split()]
tree.append(weights)
return tree
def path_finder(tree):
... | mattrid93/ProjectEuler | probs/prob67.py | Python | mit | 1,350 |
# -*- coding: utf-8 -*-
# Copyright 2006 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Read and write Ogg Theora comments.
This module handles Theora files wrap... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/mutagen/oggtheora.py | Python | gpl-3.0 | 3,895 |
# Django settings for example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
import os, sys
APP = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.append(APP)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABAS... | callowayproject/django-kamasutra | example/settings.py | Python | apache-2.0 | 3,185 |
#!/usr/bin/python
# Copyright (c) 2014-2015, Intel Corporation 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
# notic... | seanjensengrey/pyMIC | benchmarks/bind.py | Python | bsd-3-clause | 2,162 |
import constants
import pycrawl
class FaviconCrawl(pycrawl.PyCrawl):
def download(self, base_url):
url = "http://g.etfv.co/http://{0}?defaulticon=none".format(base_url)
path = constants.DATA_PATH_FAVICON.format(base_url)
error = super(FaviconCrawl, self).download(url, path)
if error is not None:
... | 6/crawl-tools | faviconcrawl.py | Python | mit | 548 |
#!/usr/bin/python2
# 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 the hope that... | StuntsPT/4Pipe4_to_genotyping_array | 4Pipe4_to_sequenom.py | Python | gpl-3.0 | 4,371 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_configuration.py | Python | mit | 2,982 |
# Copyright (c) 2015, MapR Technologies
#
# 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... | mapr/sahara | sahara/plugins/mapr/versions/v4_0_1_mrv1/version_handler.py | Python | apache-2.0 | 2,598 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.