code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# coding: utf8
"""
Contains the Python package for Algorithm used
"""
# Import numpy
import numpy as np
# Import control for plotting option
import control as cn
# Import bokeh for plotting
import bokeh.plotting as bk
# TUBS Rot, Gelb, Orange, Hellgrün, Grün, Dunkelgrün, Hellblau, Blau, Dunkelblau, Violett
TUBSco... | AlCap23/Thesis | Python/Algorithms_Graphic.py | Python | gpl-3.0 | 17,966 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | sgerhart/ansible | lib/ansible/modules/network/vyos/vyos_static_route.py | Python | mit | 8,147 |
# -*- coding: utf-8 -*-
"""
"""
# ------------------------------------------------------------------------------
# entity state
# ------------------------------------------------------------------------------
ENTITY_STATE_UNKNOW = -1
ENTITY_STATE_FREE = 0
ENTITY_STATE_DEAD = 1
ENTITY_STATE_... | daaoling/KBEngine-LearnNote | kbengine_demos_assets/scripts/common/GlobalDefine.py | Python | gpl-2.0 | 2,439 |
import xlwt
import datetime
# 设置表格样式
def set_style(name, height, bold=False):
style = xlwt.XFStyle()
font = xlwt.Font()
font.name = name
font.bold = bold
font.color_index = 4
font.height = height
style.font = font
return style
def set_date_style(name, height, num_format_str, bold=Fal... | hhj0325/pystock | com/hhj/excel/write_excel.py | Python | apache-2.0 | 1,404 |
# Copyright 2016 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... | hehongliang/tensorflow | tensorflow/python/kernel_tests/matrix_band_part_op_test.py | Python | apache-2.0 | 5,978 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ip_other_block_alloc: {"optional": true, "size": "8", "type": "number", "oid": "17", "format": "counter"}
:param entry_match_drop: {"optional": true... | amwelch/a10sdk-python | a10sdk/core/cgnv6/cgnv6_ddos_protection_stats.py | Python | apache-2.0 | 4,533 |
from bs4 import BeautifulSoup
import requests
import random
import urlparse
class BufferOverflow():
def __init__(self, url, detail):
self.url = url
self.detail = detail
self.input_pairs = []
self.tag_num = []
self.status = [0,0,0,0,0]
self.input_tag_num = {}
def ... | FakerKimg/sulley | Firefuzzer/BufferOverflow.py | Python | gpl-2.0 | 4,836 |
#!/usr/bin/env python
# Copyright 2017 Google 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 a... | cschnei3/forseti-security | tests/enforcer/enforcer_test.py | Python | apache-2.0 | 4,766 |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
"""The fogbench exceptions module contains Exception subclasses
"""
# nothing to import yet
__author__ = "Praveen Garg"
__copyright__ = "Copyright (c) 2017 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"... | foglamp/FogLAMP | extras/python/fogbench/exceptions.py | Python | apache-2.0 | 735 |
# coding: utf-8
from app import db
class Content(db.Model):
__tablename__ = "contents"
session = db.session
data = db.Column(db.Text())
_type = db.Column(db.String(80), primary_key=True)
def __init__(self, data, type):
self.data = data
self._type = type
def to_dict(self):
... | pygamebrasil/pygame-site | src/app/contents/models.py | Python | mit | 969 |
'''
model without galaxy assembly bias
'''
import numpy as np
import os.path as path
from Corrfunc import _countpairs
from Corrfunc.utils import read_catalog
from astropy.table import Table
from halotools.mock_observables import FoFGroups
from halotools.sim_manager import CachedHaloCatalog
from halotools.empirical_mo... | mjvakili/gambly | code/hod_group.py | Python | mit | 3,355 |
"""
EarthBound Patcher - An easy-to-use EarthBound ROM patcher.
Copyright (C) 2013 Lyrositor <gagne.marc@gmail.com>
This file is part of EarthBound Patcher.
EarthBound Patcher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... | Lyrositor/EBPatcher | EBPPatch.py | Python | gpl-3.0 | 3,532 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# django-bbcode: templatetags/bbcode.py
##
from django import template
from bbcode import util as bbcode
register = template.Library()
def render_bbcode(value):
return bbcode.to_html(value)
register.filter('render_bbcode', render_bbcode)
##
# End of File
##
| stitzelj/Ficlatte | django-bbcode-master/bbcode/templatetags/bbcode.py | Python | agpl-3.0 | 317 |
#!/usr/bin/python2.7
#coding:utf-8
import requests
import re
from dummy import *
info = {
'NAME':'WordPress cp multi view calendar <= 1.1.4 - SQL Injection',
'AUTHOR':'WJK,yangbh,lkz',
'TIME':'20150320',
'WEB':'https://www.yascanner.com/#!/n/120',
'DESCRIPTION':''
}
opts = {
'url':'http://testasp.vulnweb.com', ... | xujun10110/Hammer | plugins/Web_Applications/WordPress_cp_multi_view_calendar1_1_4_SQL_Injection.py | Python | gpl-2.0 | 1,333 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import models
from . import wizards
| OCA/carrier-delivery | stock_picking_delivery_rate/__init__.py | Python | agpl-3.0 | 167 |
#!/usr/bin/env python
#Useful utilities for automate.py
import os
import time
import datetime
import xml.etree.ElementTree as ET
import hgapi
import re
from sumatra.projects import Project
from sumatra.projects import load_project
from sumatra.parameters import build_parameters
def check_file_exis... | adammaikai/OmicsPipe2.0 | omics_pipe/utils.py | Python | mit | 10,719 |
"""
Stackoverflow OAuth support.
This contribution adds support for Stackoverflow OAuth service. The settings
STACKOVERFLOW_CLIENT_ID, STACKOVERFLOW_CLIENT_SECRET and
STACKOVERFLOW_CLIENT_SECRET must be defined with the values given by
Stackoverflow application registration process.
Extended permissions are supported... | limdauto/django-social-auth | social_auth/backends/contrib/stackoverflow.py | Python | bsd-3-clause | 4,043 |
# -*- coding: utf-8 -*-
"""
This program measures the equivalent isotropic radiated power of an equipment under test (maximal spectral density to be precise)
If the polarization of the EUT is known without any doubt (e.g the EUT has an external linear antenna) one polarization (along the antenna) can be enough.
3 ... | manuamador/PIRE | EIRP_light.py | Python | agpl-3.0 | 5,124 |
# -*- coding: utf-8 -*-
# Copyright(C) 2009-2011 Romain Bignon, Florent Fourcot
#
# 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 Lice... | frankrousseau/weboob | modules/ing/pages/__init__.py | Python | agpl-3.0 | 1,220 |
import numpy as np
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links.model.faster_rcnn import FasterRCNNTrainChain
from chainercv.utils import generate_random_bbox
from tests.links_tests.model_tests.faster_rcnn_tests.dummy_faster_rcnn \
import DummyF... | chainer/chainercv | tests/links_tests/model_tests/faster_rcnn_tests/test_faster_rcnn_train_chain.py | Python | mit | 1,758 |
#!/usr/bin/python3
#coding:utf-8
import numpy as np
a = np.array([x*2 for x in range(6)], dtype=float)
print(a)
b = np.array([y*3 for y in range(6)], dtype=np.float64)
print(b)
print([key for key, value in np.typeDict.items() if value is np.float64])
print(set(np.typeDict.values()))
c = a.astype(np.int32)
print(c)... | qrsforever/workspace | python/learn/numpy/l1/type.py | Python | mit | 352 |
from collections import Iterable
import py
from .utils import TIME_UNITS
from .utils import slugify
try:
from pygal.graph.box import Box
from pygal.style import DefaultStyle
except ImportError as exc:
raise ImportError(exc.args, "Please install pygal and pygaljs or pytest-benchmark[histogram]")
class C... | thedrow/pytest-benchmark | src/pytest_benchmark/histogram.py | Python | bsd-2-clause | 3,478 |
"""Defines models related to rooms."""
import string
from sqlite3 import IntegrityError
import random
from blinker import Namespace
from flask import request
from flask_login import current_user
from sqlalchemy import Column, INTEGER, VARCHAR, ForeignKey, Table
from sqlalchemy.orm import relationship
from base.model... | BenjaminSchubert/web-polls | backend/rooms/models.py | Python | mit | 1,907 |
# Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/
#
# 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 to use, copy,... | adamfisk/littleshoot-client | server/appengine/boto/pyami/installers/ubuntu/installer.py | Python | gpl-2.0 | 3,378 |
# -*- coding: utf-8 -*-
"""demimove-ui
Usage:
demimove-ui [<path>] [-c <file>] [-v|-vv|-vvv] [-q] [-h]
Options:
-c, --config=<file> Specify a config file to load.
-v Logging verbosity level, up to -vvv.
-q, --quiet Do not print logging messages to console.
-h, --help ... | mikar/demimove | demimove/gui.py | Python | mit | 30,975 |
import requests
from flask import current_app, render_template, url_for, flash
from flask_wtf import Form, RecaptchaField
from wtforms import StringField, PasswordField, SelectField, SubmitField
from wtforms.validators import DataRequired
from app.mod_frontend import mod_frontend
@mod_frontend.route('/', methods=['... | xsteadfastx/bib-api | app/mod_frontend/views.py | Python | mit | 2,456 |
#!/usr/bin/env python
# coding=utf-8
"""446. Retractions B
https://projecteuler.net/problem=446
For every integer n>1, the family of functions fn,a,b is defined by
fn,a,b(x)≡ax+b mod n for a,b,x integer and 0<a<n, 0≤b<n, 0≤x<n.
We will call fn,a,b a _retraction_ if f n,a,b(fn,a,b(x))≡fn,a,b(x) mod n for
every 0≤x<n... | openqt/algorithms | projecteuler/pe446-retractions-b.py | Python | gpl-3.0 | 476 |
import datetime
import os
import re
import shutil
from . import util
_sourceless_rev_file = re.compile(r'(?!__init__)(.*\.py)(c|o)?$')
_only_source_rev_file = re.compile(r'(?!__init__)(.*\.py)$')
_legacy_rev = re.compile(r'([a-f0-9]+)\.py$')
_mod_def_re = re.compile(r'(upgrade|downgrade)_([a-z0-9]+)')
_slug_re = re.co... | SeaFalcon/Musicool_Pr | lib/alembic/script.py | Python | apache-2.0 | 18,125 |
# -*- coding: utf-8 -*-
#
# bender-hooks documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 09 17:09:52 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
# autogenerat... | bender-bot/bender-hooks | docs/conf.py | Python | lgpl-3.0 | 8,798 |
# Copyright (c) 2014 eBay Software 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/LICENSE-2.0
#
# Unl... | Tesora-Release/tesora-python-troveclient | troveclient/v1/clusters.py | Python | apache-2.0 | 3,850 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from datetime import datetime
class Migration(migrations.Migration):
dependencies = [
('testmanualrunner', '0005_auto_20140703_0928'),
]
operations = [
migrations.AddField(
... | mwasilew/testmanager | testmanager/testmanualrunner/migrations/0006_auto_20140703_0953.py | Python | agpl-3.0 | 1,072 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_project_completed'),
]
operations = [
migrations.CreateModel(
name='Unit',
fields=[
... | bonnieblueag/farm_log | core/migrations/0004_unit.py | Python | gpl-3.0 | 722 |
#!/usr/bin/python
# (c) 2016, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.py | Python | bsd-3-clause | 39,322 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | odoousers2014/LibrERP | l10n_it_sale_group/__init__.py | Python | agpl-3.0 | 1,004 |
"""
Rsync helper functions
"""
from fabric.api import env
from fabric.contrib.project import rsync_project
def rsync_update_project():
rsync_project(
remote_dir=env.project_path,
local_dir=env.rsync_local,
exclude=env.rsync_exclude,
delete=env.rsync_delete
)
def setup_rsy... | tomaszroszko/rsfab | rsfab/rsync_deploy.py | Python | bsd-3-clause | 526 |
import ckan.plugins as plugins
import ckan.lib.helpers as helpers
import ckan.plugins.toolkit as toolkit
import ckan.lib.base as base
import ckan.lib.render as render
import routes.mapper
from routes import redirect_to
import os.path
import py2psql
import json
from pylons import config
import re
from helpers import *
... | jiankaiwang/ckanext-download | ckanext/download/plugin.py | Python | agpl-3.0 | 6,218 |
"""Area filter module"""
from weakref import WeakValueDictionary
import numpy as np
from matplotlib.path import Path
try:
from rtree.index import Index
except (ImportError, OSError):
print('Warning: RTree could not be loaded. areafilter get_intersecting and get_knearest won\'t work')
class Index:
''... | ProfHoekstra/bluesky | bluesky/tools/areafilter.py | Python | gpl-3.0 | 8,158 |
from __future__ import absolute_import
from __future__ import unicode_literals
import os.path
import pytest
from pre_commit import git
from pre_commit.errors import FatalError
from pre_commit.util import cmd_output
from pre_commit.util import cwd
from testing.fixtures import git_dir
def test_get_root_at_root(tmpdi... | Teino1978-Corp/pre-commit | tests/git_test.py | Python | mit | 3,799 |
###############################################################################
#
# $Id: example6.py 718 2012-04-15 23:59:35Z weegreenblobbie $
#
###############################################################################
from Nsound import *
sr = 44100.0;
BITS_PER_SAMPLE = 16;
#################################... | weegreenblobbie/nsound | src/examples/example6.py | Python | gpl-2.0 | 2,748 |
import unittest
from flask import current_app
from app import create_app, db
class BasicsTestCase(unittest.TestCase):
# Runs before each test
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
... | bitmotive/flask-boilerplate | tests/test_basics.py | Python | mit | 705 |
from __future__ import absolute_import
from __future__ import print_function
from chains.commandline.formatter import Formatter
import time
class FormatterManagerList(Formatter):
def main(self, result):
# fmt = '%-20s %-10s %-10s %s'
fmt = '%-20s %-10s %s'
ret = []
ret.append('-' *... | ChainsAutomation/chains | lib/chains/commandline/formatter/ManagerList.py | Python | gpl-2.0 | 1,318 |
# coding: utf-8
from pymorphy2 import MorphAnalyzer
import re
from random import shuffle
class Morpher(MorphAnalyzer):
def __init__(self):
super(Morpher, self).__init__()
self.zaebat = self.parse(u'заебать')[0]
self.genders = ('neut', 'femn', 'masc')
def is_noun(self, word):
... | strizhechenko/twitterbots | morpher.py | Python | gpl-3.0 | 1,400 |
from dateutils import date
class Config(object):
SECRET_KEY = '%\xe3\xc2\x8c\xff\x1c\x16\xf0\x82\xc9\x15\nG|e\x85[\x82\x19:\xb7\xb6\xf6h'
ALLOWED_EXTENSIONS = set(['jpg', 'jpeg'])
MAX_CONTENT_LENGTH = 2 * 1024 * 1024
SQLALCHEMY_ECHO = False
THUMB_WIDTH = 200
THUMB_HEIGHT = 200
SQLALCHEMY_DA... | thibault/UrbanJungle | site/urbanjungle/config.py | Python | gpl-3.0 | 860 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if not matrix:
return 0
m, n = len(matrix), len(matrix[0])
left, right, height = [0] * n, [n] * n, [0] ... | Lanceolata/code-problems | python/leetcode/Question_085_Maximal_Rectangle.py | Python | mit | 1,126 |
import os; os.environ.setdefault("DJANGO_SETTINGS_MODULE", "foodtrucks.settings")
import requests, json, datetime, logging, geopy
from geopy.geocoders import GoogleV3
from trucks.models import Truck
api_url = 'https://data.sfgov.org/resource/6a9r-agq8.json?$$exclude_system_fields=false&status=APPROVED'
headers = {'X... | ricefield/foodtrucksofsf | fetch_data.py | Python | mit | 1,269 |
from ggrade import read_tab_file
import argparse
################################################################################
################################################################################
def main():
# Parse the input arguments
parser = argparse.ArgumentParser()
parser.add_argument... | mattbellis/ggrade | scripts/parse_response_file.py | Python | gpl-2.0 | 2,923 |
# -*- coding: utf-8 -*-
# Copyright © 2014 SEE AUTHORS FILE
#
# 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.
#
#... | RHInception/re-worker-servicenow | replugin/servicenowworker/__init__.py | Python | agpl-3.0 | 20,375 |
from __future__ import absolute_import
from __future__ import division
# Copyright (c) 2010-2017 openpyxl
import math
#constants
DEFAULT_ROW_HEIGHT = 15. # Default row height measured in point size.
BASE_COL_WIDTH = 13 # in characters
DEFAULT_COLUMN_WIDTH = 51.85 # in points, should be characters
DEFAULT_LEFT_MA... | 171121130/SWI | venv/Lib/site-packages/openpyxl/utils/units.py | Python | mit | 2,629 |
# -*- coding: utf-8 -*-
'''
Yoda Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program ... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en/dizigold.py | Python | gpl-2.0 | 4,450 |
# -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# Copyright (c) 2012 Berlin Institute of Technology
# All rights reserved.
#
# Developed by: Philipp Meier <pmeier82@gmail.com>
# Neural Information Processing Group (NI)
# School for Ele... | pmeier82/BOTMpy | botmpy/common/datafile/wri.py | Python | mit | 4,875 |
"""
cclib (http://cclib.sf.net) is (c) 2006, the cclib development team
and licensed under the LGPL (http://www.gnu.org/copyleft/lgpl.html).
"""
__revision__ = "$Revision: 742 $"
import copy
import numpy
try:
from PyQuante.CGBF import CGBF
module_pyq = True
except:
module_pyq = False
try:
from pyvt... | faribas/RMG-Java | source/cclib/method/volume.py | Python | mit | 9,507 |
# Copyright 2013-2014 MongoDB, 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 writin... | XDestination/mongo-connector | tests/test_synchronizer.py | Python | apache-2.0 | 5,053 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the VSS resolver helper implementation."""
import unittest
from dfvfs.resolver import vshadow_resolver_helper
from tests.resolver import test_lib
class VShadowResolverHelperTest(test_lib.ResolverHelperTestCase):
"""Tests for the VSS resolver helper implementa... | manashmndl/dfvfs | tests/resolver/vshadow_resolver_helper.py | Python | apache-2.0 | 786 |
from django.views.generic import DetailView
from widgy.contrib.form_builder.views import HandleFormMixin
from test_form.models import TestModel
class TestView(DetailView, HandleFormMixin):
model = TestModel
def post(self,request, *args, **kwargs):
self.object = self.get_object()
return super... | zmetcalf/fusionbox-demo-project | test_form/views.py | Python | gpl-3.0 | 365 |
from ..algo import Algo
import numpy as np
import pandas as pd
from .. import tools
import logging
from cvxopt import solvers, matrix
solvers.options['show_progress'] = False
class Kelly(Algo):
""" Kelly fractioned betting. See
http://en.wikipedia.org/wiki/Kelly_criterion#Application_to_the_stock_market
f... | greenlin/universal-portfolios | universal/algos/kelly.py | Python | mit | 3,834 |
#
# Copyright 2013 Quantopian, 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 wr... | ChinaQuants/zipline | zipline/data/loader.py | Python | apache-2.0 | 14,176 |
from jawaf.exceptions import ServerError
async def create_pool(**connection_settings):
"""Create a pool using the `engine` to call the right db backend.
:param connection_settings: Kwargs.
:return: Pool.
"""
engine = connection_settings.pop('engine')
if engine == 'postgresql':
from jaw... | danpozmanter/jawaf | jawaf/adapters/db/__init__.py | Python | bsd-3-clause | 505 |
import cv2
from matplotlib import pyplot
import numpy as np
def read_sample(filenames):
images = []
for filename in filenames:
image = cv2.imread(filename)
image = cv2.resize(image, (96, 96))
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
image_array = []
for y in ra... | kanak87/oldboy_rep | yong_celeb_recognize/image.py | Python | mit | 1,069 |
#!/usr/bin/env python
#
# find and import a version of 'py'
#
import sys
import os
from os.path import dirname as opd, exists, join, basename, abspath
def searchpy(current):
while 1:
last = current
initpy = join(current, '__init__.py')
if not exists(initpy):
pydir = join(curren... | snim2/rcsp | py/bin/_findpy.py | Python | gpl-2.0 | 1,167 |
# -*- coding: utf-8 -*-
"""WebHelpers used in BlueEgg."""
from webhelpers import date, feedgenerator, html, number, misc, text
| Zex/Starter | script/json/BlueEgg/blueegg/lib/helpers.py | Python | mit | 129 |
from django.test import TestCase
from flows.statestore.django_store import StateStore
from flows.statestore.tests.utils import test_store_state
class DjangoStateStoreTest(TestCase):
def test_django_store_state(self):
store = StateStore()
test_store_state(self, store)
| laterpay/django-flows | flows/statestore/tests/test_django.py | Python | bsd-2-clause | 309 |
"""
Copyright 2018 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap 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.
pmbootstrap ... | postmarketOS/pmbootstrap | pmb/flasher/__init__.py | Python | gpl-3.0 | 833 |
#
# 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 | tests/providers/google/cloud/operators/test_datacatalog_system.py | Python | apache-2.0 | 1,370 |
from storelocator.models import Location, StoreLocator, Shop
import factory
class LocationFactory(factory.DjangoModelFactory):
FACTORY_FOR = Location
iso = 'DE'
postalcode = '10437'
city = 'Berlin'
state = 'Brandenburg'
latitude = 52.5565
longitude = 13.3911
class StoreLocatorFactory(... | moccu/django-storelocator | storelocator/factories.py | Python | mit | 867 |
#!/usr/bin/env python
# Copyright (C) 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | pyatil/jenkins-job-builder | jenkins_jobs/builder.py | Python | apache-2.0 | 13,004 |
# Imports
import sys, os
#sys.path.insert(0, os.path.abspath('.'))
# Configuration
extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon']
master_doc = 'index'
# Data
project = u'pygame-mvctools'
release = '0.1.0'
| vxgmichel/pygame-mvctools | docs/source/conf.py | Python | gpl-3.0 | 224 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['MovingMedian'] , ['Seasonal_Hour'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_MovingMedian_Seasonal_Hour_NoAR.py | Python | bsd-3-clause | 169 |
import requests
import json
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class ListingsTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 3
def setup_network(self):
self.setup_nod... | OpenBazaar/openbazaar-go | qa/listings.py | Python | mit | 5,086 |
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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.
#
# wger W... | DeveloperMal/wger | wger/exercises/admin.py | Python | agpl-3.0 | 1,236 |
# 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, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.j... | cevaris/pants | src/python/pants/backend/jvm/targets/java_library.py | Python | apache-2.0 | 1,499 |
#!/usr/bin/env python
# -*- coding: utf-8 *-*
"""This program imports the peanut module and sets variable value equal to
constant in peanut module."""
import task_01.peanut
TIME = task_01.peanut.BUTTER
| neal-rogers/is210-week-06-warmup | task_02.py | Python | mpl-2.0 | 204 |
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from tests import MongoTestCase
from django_mongoengine.forms.fields import DictField
from django_mongoengine.forms.widgets import Dictionary, SubDictionary, Pair
#TODO : test for max_depth
class DictFieldTest(Mongo... | arpitgoyaiitkgp/django-mongoengine | tests/forms/tests.py | Python | bsd-3-clause | 8,729 |
"""
Module defining Predicate Interface
contains list of methods every predicate must implement
Copyright (c) 2017 Michaela Bielikova <xbieli06@stud.fit.vutbr.cz>
"""
import abc
class PredicateInterface(object):
"""
Module defining Predicate Interface
"""
__metaclass__ = abc.ABCMeta
is_epsilon... | Miskaaa/symboliclib | symboliclib/predicate_interface.py | Python | gpl-3.0 | 1,980 |
import logging
pvl_logger = logging.getLogger('pvlib')
import numpy as np
import pandas as pd
from nose.tools import raises
from numpy.testing import assert_almost_equal
from pandas.util.testing import assert_frame_equal, assert_series_equal
from pvlib.location import Location
from pvlib import clearsky
from pvlib i... | dacoex/pvlib-python | pvlib/test/test_clearsky.py | Python | bsd-3-clause | 6,118 |
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2008 Johan Dahlin
#
# This library 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; eithe... | anthrotype/gobject-introspection | giscanner/libtoolimporter.py | Python | gpl-2.0 | 2,704 |
from datetime import datetime
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import six
import sqlalchemy as sa
from sqlalchemy.ext.compiler import compiles
from .dialects.postgresql import (
CreateTemporaryTransactionTableSQL,
InsertTemporaryTransacti... | avilaton/sqlalchemy-continuum | sqlalchemy_continuum/transaction.py | Python | bsd-3-clause | 5,496 |
__author__ = 'ganeshchand'
def main():
print("This program uses main()")
# in python, you can call function and define it later
printhello()
def printhello():
print("Hello")
#boiler code to to call the main() to beging the program
if __name__ == "__main__":main()
| ganeshchand/python3 | basic/usingmainfunction.py | Python | apache-2.0 | 286 |
import contextlib
from datetime import datetime
import io
import os
from pathlib import Path
import dateutil.parser
import numpy as np
import pytest
from pandas.errors import EmptyDataError
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def dirpath(datapa... | pandas-dev/pandas | pandas/tests/io/sas/test_sas7bdat.py | Python | bsd-3-clause | 12,142 |
import sys
import time
import threading
import BaseHTTPServer
import json
import kafka
from monascaclient import client
from monascaclient import ksclient
import warnings
# suppress warnings to improve performance
def no_warnings(*args):
pass
warnings.showwarning = no_warnings
max_wait_time = 20 # seconds
# ... | hpcloud-mon/monasca-perf | monasca_perf/notification_functional.py | Python | apache-2.0 | 6,537 |
#Copyright 2011 Dan Klinedinst
#
#This file is part of Gibson.
#
#Gibson 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 any
#later version.
#Gibson is distributed in the hop... | robscetury/gibson | lib/gibson/slugs/__init__.py | Python | gpl-3.0 | 927 |
import datetime
import luigi
from io import *
from babel_datapipeline.util.misc import *
class AMinerParse(luigi.Task):
date = luigi.DateParameter(default=datetime.date.today())
def requires(self):
return AminerS3Targets()
def output(self):
makedir('citation_dict')
return luigi.L... | iwsmith/babel_datapipeline | babel_datapipeline/tasks/parsers.py | Python | agpl-3.0 | 768 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Module to search the SAO/NASA Astrophysics Data System
:author: Magnus Persson <magnusp@vilhelm.nu>
"""
import os
from astropy.table import Table
from urllib.parse import quote as urlencode
from ..query import BaseQuery
from ..utils import async_to... | ceb8/astroquery | astroquery/nasa_ads/core.py | Python | bsd-3-clause | 4,056 |
#!/usr/bin/env python
'''Ramachandran Plot in 3D by Ch. Fufezan 2009
usage: ramachandranPlot3D.py <bin size for angles> <pdb file>'''
import sys, os, time
from p3d import protein as protein
from collections import defaultdict as ddict
if (__name__ == '__main__'):
if (len(sys.argv) < 3):
print (__doc__)
sys.exit... | fu/p3d | exampleScripts/ramachandranPlot3D.py | Python | gpl-3.0 | 1,281 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Internal Codehosting API interfaces."""
__metaclass__ = type
__all__ = [
'BRANCH_ALIAS_PREFIX',
'branch_id_alias',
'BRANCH_ID_ALIAS_PREFIX',
'BRANCH_TRANSPORT',... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/interfaces/codehosting.py | Python | agpl-3.0 | 8,119 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def TaskFilterSpec(vim, *args, **kwargs):
'''This data object type defines the specificat... | xuru/pyvisdk | pyvisdk/do/task_filter_spec.py | Python | mit | 1,332 |
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_into_from_edit_page(0)
assert contact_from_home_page.homephone == clear(contact_from_edit_page.homephone)
assert contact_from_home_page.mobilephone == cl... | tankisleva/python_training | test/test_phones.py | Python | apache-2.0 | 1,114 |
from ..idea_base import IdeaBaseFinder
class AndroidStudioFinder(IdeaBaseFinder):
application_id = 'com.google.android.studio'
preferences_folder = 'AndroidStudioPreview'
xpath = "//component[@name='RecentProjectsManager']" \
"/option[@name='recentPaths']/list/option/@value" | wolfhechel/alfred-code | finders/androidstudio/__init__.py | Python | mit | 304 |
###
# Copyright (c) 2013, Nicolas Coevoet
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditio... | ncoevoet/ChanReg | test.py | Python | mit | 1,737 |
for i in [1,2,3]:
print(i)
if i == 2:
break
for i in [1,2,3]:
print(i)
for j in [3,4,5]:
print(i*j)
if i*j > 8:
print('youpla!')
break
| rcarmo/pythonium | tests/break-for-loop.py | Python | lgpl-2.1 | 200 |
# 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... | NECCSiPortal/NECCSPortal-dashboard | nec_portal/dashboards/admin/capacity/tests.py | Python | apache-2.0 | 4,009 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | vmturbo/nova | nova/policies/deferred_delete.py | Python | apache-2.0 | 1,462 |
#!/usr/bin/python
'''
Copyright (c) 2013-2014, Magnus Skjegstad / Forsvarets Forskningsinstitutt (FFI)
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 ... | MagnusS/p2p-dprd | python/p2pdprd.py | Python | bsd-2-clause | 6,539 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio-core | platformio/commands/test/helpers.py | Python | apache-2.0 | 1,029 |
from importlib import import_module
from django.conf import settings
# Default settings
BOOTSTRAP3_DEFAULTS = {
"css_url": {
"url": "https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css",
"integrity": "sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu",
... | dyve/django-bootstrap3 | src/bootstrap3/bootstrap.py | Python | bsd-3-clause | 2,894 |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/r... | hooram/ownphotos-backend | wideresnet.py | Python | mit | 6,597 |
# -*- coding: utf-8 -*-
# © 2013-2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Partner relations",
"version": "9.0.1.1.1",
"author": "Therp BV,Camptocamp,Odoo Community Association (OCA)",
"complexity": "normal",
"category": "Customer... | be-cloud-be/horizon-addons | partner-contact/partner_multi_relation/__openerp__.py | Python | agpl-3.0 | 726 |
# Copyright 2010-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/LICENSE-2.0
#
# Unless... | CMSS-BCRDB/RDSV1.0 | trove/extensions/account/models.py | Python | apache-2.0 | 2,015 |
#!/usr/bin/env python
from datetime import datetime
from ocad_primitives import *
class ocad_project:
def __init__(self, data, title):
self.data = data
self.lastChanged = ""
self.listIndex = 0
self.updateDate()
self.title = title # TODO : get only filename
self.ontology = ontology()
self.layout = la... | Victor-Haefner/ontocad | src/ocad_project.py | Python | gpl-3.0 | 1,067 |
import argparse
_ascii = None
_hex = None
_fn = None
def main():
global _ascii
global _hex
global _fn
print _ascii
print _hex
print _fn
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='convert HEX < === > ASCII')
parser.add_argument('-ascii', dest='ascii', help='ASCII')... | softtyphoon/tz | tools/hex2ascii.py | Python | gpl-2.0 | 697 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/ops/tensor_array_ops.py | Python | apache-2.0 | 19,978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.