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 |
|---|---|---|---|---|---|
from django.db import models
from django.contrib.auth.models import User
class RestaurantQueryset(models.query.QuerySet):
"""docstring for RestaurantQueryset"""
def active(self):
return self.filter(active=True)
class RestaurantManager(models.Manager):
"""Manage restaurants"""
def get_query... | quangnguyen-asnet/python-django | mymenu/restaurant/models.py | Python | mit | 1,276 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for polynomial models."""
# pylint: disable=invalid-name
import os
import warnings
from itertools import product
import pytest
import numpy as np
import unittest.mock as mk
from numpy.testing import assert_allclose
from astropy.modeling impor... | pllim/astropy | astropy/modeling/tests/test_polynomial.py | Python | bsd-3-clause | 24,232 |
# Copyright 2017,2018,2019,2020,2021 Sony Corporation.
#
# 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... | sony/nnabla | python/test/function/test_sigmoid_cross_entropy.py | Python | apache-2.0 | 2,063 |
import ConfigParser
import os
class Config_manager:
def __init__(self):
self.config = ConfigParser.ConfigParser()
self.out_folder = None
def set_current_folder(self,t):
self.cwd = t
def set_config(self,file_cfg):
self.config.read(file_cfg)
output_folder_cfg = self.... | cltl/lexical_pattern_extractor | lib/config_manager_indexer.py | Python | gpl-3.0 | 2,820 |
#!/usr/bin/env python
from oil.app import App
app = App()
app.run()
| krzysztof-magosa/oil-fields | backend/server.py | Python | mit | 70 |
from sqlalchemy import exc
from sqlalchemy import event
from sqlalchemy.pool import Pool
@event.listens_for(Pool, "checkout")
def ping_connection(dbapi_connection, connection_record, connection_proxy):
cursor = dbapi_connection.cursor()
try:
cursor.execute("SELECT 1")
except:
# optional - d... | pascalc/narrative-roulette | src/db/reconnect.py | Python | apache-2.0 | 604 |
# -*- coding: utf-8 -*-
#
# xes documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 15 17:02:00 2014.
#
# 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 c... | maxsumrall/xes | docs/conf.py | Python | apache-2.0 | 8,168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2008,2012 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 vers... | staranjeet/fjord | vendor/packages/translate-toolkit/translate/storage/versioncontrol/darcs.py | Python | bsd-3-clause | 4,465 |
import theano
import numpy as np
from sklearn.preprocessing import OneHotEncoder
from sklearn import cross_validation, metrics, datasets
from neupy import algorithms, layers, environment
environment.reproducible()
theano.config.floatX = 'float32'
mnist = datasets.fetch_mldata('MNIST original')
target_scaler = OneHo... | stczhc/neupy | examples/gd/mnist_mlp.py | Python | mit | 1,266 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
author:fang.junpeng\n
email:tfzsll@126.com
time:2017-04-10
'''
class Layer(object):
'''
所有层的基类,未实现padding
'''
def __init__(self, shape, strides=None, padding=None, name=None):
self.shape = shape
self.padding = padding
self.strides =... | ffun/LFDL | ffun/NetHelper.py | Python | gpl-3.0 | 7,032 |
{
'name': "Force move attachments to DB storage",
'version': '1.0.0',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
'category': 'Tools',
'website': 'https://yelizariev.github.io',
'depends': [],
'data': [
'data.xml'
],
'installable': False
}
| iledarn/addons-yelizariev | ir_attachment_force_storage/__openerp__.py | Python | lgpl-3.0 | 315 |
from __future__ import unicode_literals
import json
import re
import uuid
from moto.core.responses import BaseResponse
from .models import lambda_backends
class LambdaResponse(BaseResponse):
@classmethod
def root(cls, request, full_url, headers):
if request.method == 'GET':
return c... | tootedom/moto | moto/awslambda/responses.py | Python | apache-2.0 | 3,543 |
"""
Builds sumatra and uploads results to s3 for easy analysis, viewable at:
https://kjkpub.s3.amazonaws.com/sumatrapdf/buildbot/index.html
"""
import sys
import os
# assumes is being run as ./scripts/buildbot.py
efi_scripts_dir = os.path.join("tools", "efi")
sys.path.append(efi_scripts_dir)
import shutil
i... | Strepto/sumatrapdf | scripts/obsolete/buildbot-obsolete.py | Python | gpl-3.0 | 22,375 |
from django.conf.urls import url
from .views import HostGroupsView, HostInfoView
urlpatterns = [
url(r'^hostgroups/$', HostGroupsView.as_view(), name='hostgroups'),
url(r'^hostinfo/(?P<fqdn>[\w\.]+)/$', HostInfoView.as_view(), name='hostinfo'),
]
| tsadm/webapp | src/tsadmapi/inventory/urls.py | Python | bsd-3-clause | 256 |
from env import *
from env_progress import *
from sync import *
#The Fetch Function
def on_fetch(self, fetch_list):
"""
Initialize environment variables for progress updates
"""
TOT_DEL_FILE[0] = 0
TOT_DEL_AMT[0] = 0
TOT_CP_FILE[0] = 0
TOT_CP_AMT[0] = 0
for item in fetch_list:
... | AsitRout/Syncer | fetch.py | Python | gpl-2.0 | 3,358 |
# Copyright (c) 2019 Dell Inc. or its subsidiaries.
# 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
#
# ... | openstack/manila | manila/tests/share/drivers/dell_emc/plugins/powermax/test_connection.py | Python | apache-2.0 | 98,088 |
from .base import BaseReader
try:
from boto3 import resource
from botocore.exceptions import ClientError
except ImportError: # pragma: no cover
raise ImportError(
'To use "s3" dynamic settings reader\n'
'you need to install simple-settings with s3 dependency:\n'
'pip install simple... | drgarcia1986/simple-settings | simple_settings/dynamic_settings/s3_reader.py | Python | mit | 1,740 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/compositeproto/package.py | Python | lgpl-2.1 | 1,782 |
# -*- coding: utf-8 -*-
from . import test_amount_total_co
| mdietrichc2c/vertical-ngo | logistic_order_multicurrency/tests/__init__.py | Python | agpl-3.0 | 59 |
# Copyright 2002 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""This package implements pairwise sequence alignment using a dynamic
programming algorithm.
... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/pairwise2.py | Python | gpl-2.0 | 33,467 |
#coding:utf8
"""
This is the Justice Cloud's default configuration file.
Changes and additions to settings should be done in the config module
located in the application root rather than this config.
"""
config = {
'environment': "production",
# webapp2 sessions
'webapp2_extras.sessions' : {'secret_key': '_minha_chav... | NAMD/mediacloud | justice/config.py | Python | lgpl-3.0 | 3,983 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except i... | ebagdasa/tempest | tempest/openstack/common/fixture/mockpatch.py | Python | apache-2.0 | 1,577 |
# -*- coding:utf-8 -*-
# Author: Kei Choi(hanul93@gmail.com)
import struct
import hashlib
import zlib
import marshal
import imp
import sys
import os
import py_compile
import random
import shutil
import k2rc4
import k2rsa
import k2timelib
# ---------------------------------------------------------------------
# make... | pck886/kicomav | Engine/kavcore/k2kmdfile.py | Python | gpl-2.0 | 12,966 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('instance', '0011_auto_20150628_0810'),
]
operations = [
migrations.AlterField(
model_name='instancelogentry',
... | omarkhan/opencraft | instance/migrations/0012_auto_20150803_0606.py | Python | agpl-3.0 | 866 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003-2009 The GemRB Project
#
# 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 opt... | awesomethomas/gemrb | gemrb/GUIScripts/GUIREC.py | Python | gpl-2.0 | 34,179 |
import math
import sys
from mutatorMath.objects.error import MutatorError
from mutatorMath.objects.location import Location, sortLocations, biasFromLocations
import mutatorMath.objects.mutator
from error import MutatorError
def noBend(loc): return loc
class WarpMutator(mutatorMath.objects.mutator.Mutator):
def __... | miguelsousa/MutatorMath | Lib/mutatorMath/objects/bender.py | Python | bsd-3-clause | 4,993 |
# /usr/bin/python
import django
import sys
from django.test.runner import DiscoverRunner
from django.conf import settings
settings.configure(
INSTALLED_APPS=(
'ajax_cbv',
),
)
if __name__ == "__main__":
django.setup()
runner = DiscoverRunner()
failures = runner.run_tests(['ajax_cbv'])
... | dipcode-software/django-ajax-views | runtests.py | Python | mit | 361 |
class ListNode:
def __init__(self, val):
self.val = val
self.next = None
class LinkedList:
def __init__(self, val):
self.head = ListNode(val)
def insert_after(self, node, val):
next_node = node.next
new_node = ListNode(val)
node.next = new_node
ne... | starcroce/PyAlgoDataStructure | linked_list/MySingleLinkedList.py | Python | gpl-2.0 | 772 |
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['openstackdocstheme', 'reno.sphinxext']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffi... | openstack/diskimage-builder | releasenotes/source/conf.py | Python | apache-2.0 | 7,596 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ..view.Ui_DocumentDialog import *
from ..utils.PluginUtils import PluginUtils
from ..model.core_classes import CoDocument, ClTypeOfDocument
from sqlalchemy.exc import SQLAlchemyError
from ..model.WntException import *
from ..model.DatabaseHelper import *
class... | gc-i/wntOS | controller/DocumentDialog.py | Python | gpl-3.0 | 5,923 |
# Authors:
# Gabe Alford <redhatrises@gmail.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | ofayans/freeipa | ipatests/test_integration/test_advise.py | Python | gpl-3.0 | 4,944 |
## Copyright 2009-2013 Luc Saffre
## This file is part of the Lino project.
## Lino 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 ver... | MaxTyutyunnikov/lino | lino/core/requests.py | Python | gpl-3.0 | 29,717 |
#!/usr/bin/env vpython3
# Copyright 2017 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.
"""Tests for generate_buildbot_json.py."""
import argparse
import contextlib
import json
import os
import unittest
import generate_... | chromium/chromium | testing/buildbot/generate_buildbot_json_unittest.py | Python | bsd-3-clause | 171,404 |
#!/usr/bin/env python
"""This modules contains tests for artifact API handler."""
import os
from grr.gui import api_test_lib
from grr.gui.api_plugins import artifact as artifact_plugin
from grr.lib import artifact
from grr.lib import artifact_registry
from grr.lib import config_lib
from grr.lib import flags
from gr... | pidydx/grr | grr/gui/api_plugins/artifact_test.py | Python | apache-2.0 | 3,747 |
__author__ = 'lorenzo'
#
# http://stackoverflow.com/a/29681061/2536357
#
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
# run from the project root:
# pip install -t lib -r requirements.txt
# Uncomment if appstat is on
#def webapp_add_wsgi_middleware(app)... | Mec-iS/semantic-data-chronos | appengine_config.py | Python | apache-2.0 | 441 |
#*************************************************************************
#Copyright (C) 2015 by Arash Bakhtiari
#You may not use this file except in compliance with the License.
#You obtain a copy of the License in the LICENSE file.
#Unless required by applicable law or agreed to in writing, software
#distributed un... | arashb/tbslas | scripts/imb_sscal.py | Python | bsd-3-clause | 10,664 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'User'
db.create_table(u'accounts_user', (
(u'id', self.gf('django.db.models.fiel... | Rondineli/django-sso | django_sso/accounts/migrations/0001_initial.py | Python | gpl-2.0 | 7,865 |
"""
Face of a triangle mesh.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.geometry_utilities import evaluate
f... | dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/geometry_tools/face.py | Python | gpl-3.0 | 5,673 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from builtins import open, range
from contextlib import contextmanager
from tex... | twitter/pants | tests/python/pants_test/backend/jvm/tasks/test_junit_run.py | Python | apache-2.0 | 22,649 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
default_app_config = 'dmp_ui.app.DMPUIAppConfig' | rjusher/docker-container-manager | source/dmp_ui/__init__.py | Python | mit | 113 |
# -*- coding: utf-8 -*-
# Kay application: static
| gluwer/przepisymm | static/__init__.py | Python | bsd-3-clause | 51 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2014-2015 eNovance
#
# 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... | idegtiarov/gnocchi-rep | gnocchi/rest/__init__.py | Python | apache-2.0 | 40,077 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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/L... | mattray/stackalytics | stackalytics/openstack/common/importutils.py | Python | apache-2.0 | 2,186 |
import argparse
license= ""
class MainView(object):
def __init__(self, main_controller):
self.parser= argparse.ArgumentParser(description=license, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prefix_chars="-")
self.parser.add_argument('-i','--input', dest='inpu... | ecotox/pacfm | pacfm/view/commandline/main_view.py | Python | mit | 2,692 |
import re
import string
words = ["United States Code", "Federal Register", "U.S.C.",
"Public Law", "Private Law"]
def get_matches(words, text):
return re.findall(r'title \d+, United States Code', text)
def count_matches(words, text):
return sum(len(m) for m in (re.findall(w, text) for w in words))
... | ncollins/nytimeshackday2013 | bill_search.py | Python | mit | 1,258 |
from flask import Flask, render_template, request, session, redirect, url_for
from models import User, db, Place
from forms import SignupForm, LoginForm, AddressForm
app = Flask(__name__) # postgresql[+psycopg2]://user:password@host:port/db_name
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://cgflask:cgflask@lo... | lao-tseu-is-alive/cgflask | routes.py | Python | gpl-2.0 | 3,397 |
# Copyright (C) 2014 Rémi Bèges
# For conditions of distribution and use, see copyright notice in the LICENSE file
from distantio.DistantIO import DistantIO
from distantio.DistantIOProtocol import distantio_protocol
from distantio.SerialPort import SerialPort
from distantio.crc import crc16
| Overdrivr/DistantIO | distantio/__init__.py | Python | mit | 295 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | jonparrott/google-cloud-python | logging/google/cloud/logging_v2/gapic/enums.py | Python | apache-2.0 | 7,726 |
"""
Ethiopian Movie Database.
"""
__author__ = "EtMDB Developers (developers@etmdb.com)"
__date__ = "Date: 25/05/2017"
__version__ = "Version: 1.0"
__Copyright__ = "Copyright: @etmdb"
"""
Django settings for etmdbots project. (Development)
Generated by 'django-admin startproject' using Django 1.11.1.
For more inform... | etmdb/facebookbot | etmdbots/settings/local.py | Python | mit | 993 |
from pentai.base.game import *
import pentai.base.rules as r_m
from persistent import Persistent
class PreservedGame(Persistent):
def __init__(self, game=None, *args, **kwargs):
super(PreservedGame, self).__init__(*args, **kwargs)
if game:
self.game_id = game.game_id
self.r... | cropleyb/pentai | pentai/db/preserved_game.py | Python | mit | 2,388 |
with open('./data13.txt') as data:
sum = 0
for i in range(0,100):
now = data.readline()
now = int(now[0:50:1])
sum += now
print(sum)
| Nuist-319/trashwork | rabitdash/python-pj/projectEuler/problem13.py | Python | apache-2.0 | 142 |
# coding=utf-8
import datetime
import json
import logging
from decimal import Decimal
from urllib.parse import urlparse
import httpretty
import mock
import pytz
from django.core.management import call_command
from django.test import override_settings
from oscar.core.loading import get_model
from testfixtures import ... | edx/ecommerce | ecommerce/extensions/catalogue/tests/test_migrate_course.py | Python | agpl-3.0 | 13,728 |
class Falta:
def __init__(self, categoria, dia, faltas):
self.categoria = categoria
self.dia = dia
self.faltas = faltas
| SamuelTM/univapi | stm/univapi/modelos/falta.py | Python | mit | 148 |
from numpy import array, matrix, inf, nan, ones, zeros, isinf, isfinite
from numpy import linspace, matmul, sign
import matplotlib
matplotlib.use('nbAgg')
import matplotlib.pyplot as plt
def get_image_pos(object_distance, focal_length):
s = object_distance
f = focal_length
if s == f:
# print('I... | stevosn/ray_tracing | ray_tracing.py | Python | mit | 26,138 |
# lecture 3.6, slide 2
# bisection search for square root
x = 12345
epsilon = 0.01
numGuesses = 0
low = 0.0
high = x
ans = (high + low)/2.0
while abs(ans**2 - x) >= epsilon:
print('low = ' + str(low) + ' high = ' + str(high) + ' ans = ' + str(ans))
numGuesses += 1
if ans**2 < x:
low = ans
else:... | nexus2006/mit-6.00.x-homework | sqrt_bisection_search.py | Python | gpl-3.0 | 466 |
import sys
import traceback
import unittest
from pykka import Timeout
from pykka.future import Future, ThreadingFuture, get_all
class FutureBaseTest(unittest.TestCase):
def setUp(self):
self.future = Future()
def test_future_get_is_not_implemented(self):
self.assertRaises(NotImplementedError... | li-ch/pykka | tests/future_test.py | Python | apache-2.0 | 6,667 |
# -*- coding: utf-8 -*-
"""Database connection class."""
import psycopg2
class db(object):
"""A database connection class """
def __init__(self, dbname, host, port, user, password):
self.dbname = dbname
self.host = host
self.port = port
self.user = user
self.password... | balazsdukai/batch3dfier | batch3dfier/db.py | Python | gpl-3.0 | 2,117 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('qualifications', '0014_auto_20150410_1539'),
]
operations = [
migrations.AlterField(
... | gdebure/cream | qualifications/migrations/0015_auto_20150413_1602.py | Python | gpl-3.0 | 466 |
#!/usr/bin/env python
"""
Integration test focused on the omero.api.IShare interface
a running server.
Copyright 2008 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import unittest, time
import integration.library as lib
import omero
from omero_mod... | rleigh-dundee/openmicroscopy | components/tools/OmeroPy/test/integration/ishare.py | Python | gpl-2.0 | 36,350 |
"""Update coordinator for HomeWizard."""
from __future__ import annotations
import asyncio
import logging
import aiohwenergy
import async_timeout
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import ... | rohitranjan1991/home-assistant | homeassistant/components/homewizard/coordinator.py | Python | mit | 2,620 |
"""
WSGI config for tapiriik project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | marxin/tapiriik | tapiriik/wsgi.py | Python | apache-2.0 | 1,425 |
#! /usr/bin/env python3
# Copyright 2015, 2016 Thomas J. Duck <tomduck@tomduck.ca>
# This file is part of bassclef.
#
# Bassclef is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License verson 3 as
# published by the Free Software Foundation.
#
# Bassclef is d... | tomduck/bassclef | bassclef/bcms.py | Python | gpl-3.0 | 2,860 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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
#... | norayr/unisubs | apps/subtitles/tests/test_signals.py | Python | agpl-3.0 | 4,347 |
# Copyright (c) 2012 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... | samsu/neutron | tests/unit/test_policy.py | Python | apache-2.0 | 25,278 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.agent import agent
from lib.core.bigarray import BigArray
from lib.core.common import Backend
from lib.core.common import clearConsoleLine
from lib.co... | undefinedv/Jingubang | sqlmap/plugins/generic/entries.py | Python | gpl-3.0 | 23,532 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-product | base_log/csv.py | Python | agpl-3.0 | 2,747 |
"""
/***************************************************************************
* *
* 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... | gvellut/FreehandRasterGeoreferencer | freehandrastergeoreferencer_layer.py | Python | gpl-2.0 | 27,101 |
# Test the windows specific win32reg module.
# Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
import os, sys, errno
import unittest
from test import support
threading = support.import_module("threading")
from platform import machine
# Do this first so test will be skipped if module doesn't exist
... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_winreg.py | Python | apache-2.0 | 21,014 |
############################################################################
# CoderBot, a didactical programmable robot.
# Copyright (C) 2014, 2015 Roberto Previtera <info@coderbot.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | lostcaggy/coderbot | config.py | Python | gpl-2.0 | 1,410 |
import os
import inflector
from waflib.ConfigSet import ConfigSet
from waflib import Utils
__all__ = [
"check_pkg_config", "check_cc", "check_statement", "check_libs",
"check_headers", "compose_checks", "check_true", "any_version",
"load_fragment", "check_stub", "check_ctx_vars", "check_program"]
any_vers... | victorbriz/mpv | waftools/checks/generic.py | Python | gpl-2.0 | 5,938 |
"""
================================LICENSE======================================
Copyright (c) 2015 Chirag Mello & Mario Tambos
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... | g402chi/SpatialPooler | spatialpooler/utils.py | Python | mit | 14,190 |
######################################################
# ****************************************
# Cloud server on Minnowboard Max \
# Using Yocto /
# \
# /
# Alejandro Enedino Hernandez Samaniego \
#... | aehs29/yocto-examples | iot_knn_server_minnowmax.py | Python | mit | 4,225 |
'''
Created on Oct 3, 2011
@author: sk
'''
import uuid
class Subscription(object):
def __init__(self, proto, _id, _dest, _ack):
self._id = _id
self._ack = _ack
self._dest = _dest
self._proto = proto
def getId(self):
return self._id
def getAck(self):
... | selfsk/stompify | src/stompify/subscription.py | Python | mit | 2,429 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-
#
# Byte Mapper
# Binary Signature Generator
#
# Florian Roth
# June 2014
# v0.1a
import os
import sys
import argparse
import re
import traceback
from colorama import Fore, Back, Style
from colorama import init
from hashlib i... | unusedPhD/yarGen | tools/byte-mapper.py | Python | bsd-3-clause | 5,696 |
# -*- coding: utf-8 -*-
"""Module for parsing status.dat file."""
from __future__ import absolute_import
import pynag.Parsers.main
from pynag.Parsers import retention_dat
class StatusDat(retention_dat.RetentionDat):
""" Easy way to parse status.dat file from nagios
After calling parse() contents of status.... | pynag/pynag | pynag/Parsers/status_dat.py | Python | gpl-2.0 | 3,707 |
#!/usr/bin/env python
import json
import requests
from six import iteritems
try:
from helpers.logger import *
except ImportError:
from .helpers.logger import *
class DhisHandler:
def __init__(self, url, username, password):
self.url = url
self.username = username
self.password ... | SwissTPH/commcare-cases-dhis2-events | app/dhis.py | Python | gpl-3.0 | 2,342 |
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
import pytest
from skidl import (
ERC,
POWER,
SKIDL,
TEMPLATE,
Net,
Part,
Pin,
erc_assert,
erc_logger,
package,
subcircuit,
)
from .setup_teardown import setup_function, teardown_fu... | xesscorp/skidl | tests/test_erc.py | Python | mit | 6,637 |
from lbworkflow.core.datahelper import (
create_category,
create_node,
create_process,
create_transition,
)
def load_data():
load_simplewf()
def load_simplewf():
category = create_category("5f31d065-00cc-0020-beea-641f0a670010", "HR")
ext_data_a = {
"template": """# WorkFlow A
C... | vicalloy/django-lb-workflow | lbworkflow/simplewf/wfdata.py | Python | mit | 2,453 |
#!/usr/local/bin/python3
class Dog(object):
def __init__(self, name):
self.name = name
def bulk(self):
print(self.name, "wang wang wang!")
if __name__ == '__main__':
d1 = Dog("d1")
d2 = Dog("d2")
d3 = Dog("d3")
d1.bulk()
d2.bulk()
d3.bulk()
| jinzekid/codehub | python/day6/dog.py | Python | gpl-3.0 | 296 |
"""Implementations of osid abstract base class queries."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and include no m... | mitsei/dlkit | dlkit/abstract_osid/osid/queries.py | Python | mit | 69,697 |
from django import forms
from proteins.models import Protein, ProteinFamily
class ProteinForm(forms.ModelForm):
class Meta:
model = Protein
class ProteinFamilyForm(forms.ModelForm):
class Meta:
model = ProteinFamily
| davebridges/ExperimentDB | proteins/forms.py | Python | bsd-3-clause | 230 |
#!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... | google/rekall | rekall-lib/setup.py | Python | gpl-2.0 | 2,924 |
# 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... | cisco-openstack/tempest | tempest/lib/services/image/v2/resource_types_client.py | Python | apache-2.0 | 3,135 |
import configparser
import os
import re
from i3pystatus import IntervalModule, formatp
from i3pystatus.core.command import run_through_shell
from i3pystatus.core.desktop import DesktopNotification
from i3pystatus.core.util import lchop, TimeWrapper, make_bar
class UEventParser(configparser.ConfigParser):
@static... | ncoop/i3pystatus | i3pystatus/battery.py | Python | mit | 13,912 |
from dvc.cli import parse_args
from dvc.command.data_sync import CmdDataFetch, CmdDataPull, CmdDataPush
def test_fetch(mocker):
cli_args = parse_args(
[
"fetch",
"target1",
"target2",
"--jobs",
"2",
"--remote",
"remote",
... | dmpetrov/dataversioncontrol | tests/unit/command/test_data_sync.py | Python | apache-2.0 | 2,740 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Slack
#
# 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
... | Slack06/yadg | contact/views.py | Python | mit | 2,579 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | stackforge/python-openstacksdk | openstack/tests/unit/cloud/test_zone.py | Python | apache-2.0 | 7,635 |
class Solution(object):
def wiggleSort(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
for i in range(len(nums) - 1):
if (i % 2) ^ (nums[i] > nums[i+1]):
nums[i], nums[i+1] = nums[i+1], ... | Chasego/codirit | leetcode/280-Wiggle-Sort/WiggleSort.py | Python | mit | 328 |
"""
======================================================
Out-of-core classification of text documents
======================================================
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. ... | depet/scikit-learn | examples/applications/plot_out_of_core_classification.py | Python | bsd-3-clause | 9,535 |
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test transaction download behavior
"""
from test_framework.messages import (
CInv,
CTransaction,
... | OmniLayer/omnicore | test/functional/p2p_tx_download.py | Python | mit | 6,335 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# 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
DOCUMENTATION = r'''
---
author: Ansible Core Team (@ansible)
modul... | Fale/ansible | lib/ansible/modules/import_role.py | Python | gpl-3.0 | 2,861 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2019 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 ... | chipaca/snapcraft | tests/unit/commands/test_create_key.py | Python | gpl-3.0 | 2,614 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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... | tensorflow/tensor2tensor | tensor2tensor/data_generators/wikisum/html.py | Python | apache-2.0 | 2,569 |
# pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world
import time
import json
import re
import platform
# django_url is assigned late in the process of loading lettuce,
# so we import this as a module, and then read django_url from
# it to get the correct value
import lettuce.django
from textwr... | jruiperezv/ANALYSE | common/djangoapps/terrain/ui_helpers.py | Python | agpl-3.0 | 21,575 |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Scientific Package. This package holds all simulators, and
# analysers necessary to run brain-simulations. You can use it stand alone or
# in conjunction with TheVirtualBrain-Framework Package. See content of the
# documentation-folder for more details. See also http://ww... | rajul/tvb-library | tvb/tests/library/simulator/simulator_test_main.py | Python | gpl-2.0 | 3,190 |
__all__ = ["install"]
from panda3d.core import *
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.showbase.PythonUtil import fastRepr
import sys
import traceback
notify = directNotify.newCategory("ExceptionVarDump")
reentry = 0
def _varDump__init__(self, *args, **kArgs):
global reentr... | grimfang/panda3d | direct/src/showbase/ExceptionVarDump.py | Python | bsd-3-clause | 6,999 |
# -*- coding: utf-8 -*-
from cfme.configure.tasks import is_datastore_analysis_finished
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure import datastore, host
from cfme.web_ui import toolbar, Quadicon, InfoBlock
from utils import conf, testgen
from utils.blockers import BZ
from utils.wait imp... | lehinevych/cfme_tests | cfme/tests/infrastructure/test_datastore_analysis.py | Python | gpl-2.0 | 5,376 |
"""
Utility functions for capa.
"""
import bleach
from decimal import Decimal
from calc import evaluator
from cmath import isinf, isnan
import re
from lxml import etree
#-----------------------------------------------------------------------------
#
# Utility functions used in CAPA responsetypes
default_tolerance = '0... | ahmadiga/min_edx | common/lib/capa/capa/util.py | Python | agpl-3.0 | 7,364 |
class PxlLookableMixin():
instances = {}
def register(instance, id, className):
pass
| desk467/pyxel | src/mixins/lookable_mixin.py | Python | mit | 102 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('services', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='service',
name='discou... | dogukantufekci/supersalon | supersalon/services/migrations/0002_auto_20151111_2313.py | Python | bsd-3-clause | 722 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.