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 |
|---|---|---|---|---|---|
import bcrypt
from hashlib import sha512
from helptux import db, login_manager
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
role = db.Column(db.String(255), index=True, unique=True)
def __repr__(self):
return '<Role {0}>'.format(self.role)
de... | pieterdp/helptux | helptux/models/user.py | Python | gpl-2.0 | 2,613 |
# FCE: feature confidence extimator
import math
import heapq
import sklearn
import sklearn.kernel_ridge
import sklearn.svm
import numpy as np
import sklearn.cross_validation as cv
import sklearn.gaussian_process as gp
from sklearn.base import BaseEstimator
import scipy.special
from joblib import Parallel, delayed
impo... | adrinjalali/Network-Classifier | common/FCE.py | Python | gpl-3.0 | 8,343 |
# coding: utf-8
from django.db import migrations, models
import kpi.fields
class Migration(migrations.Migration):
dependencies = [
('kpi', '0020_add_validate_submissions_permission_to_asset'),
]
operations = [
migrations.AddField(
model_name='asset',
name='map_cus... | onaio/kpi | kpi/migrations/0021_map-custom-styles.py | Python | agpl-3.0 | 578 |
with open('./input.txt') as f:
program = [int(x) for x in f.read().split(',')]
def run(program):
program = program[:]
i = 0
while True:
operation = program[i:i+4]
op = operation[0]
if op == 99:
return program[0]
_ , a, b, to = operation
if op == 1:
... | marcosfede/algorithms | adventofcode/2019/d2/d2.py | Python | gpl-3.0 | 730 |
# 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... | kobejean/tensorflow | tensorflow/python/kernel_tests/cast_op_test.py | Python | apache-2.0 | 9,083 |
__author__ = 'rohe0002'
import json
import logging
from urlparse import urlparse
from bs4 import BeautifulSoup
from mechanize import ParseResponseEx
from mechanize._form import ControlNotFoundError, AmbiguityError
from mechanize._form import ListControl
logger = logging.getLogger(__name__)
NO_CTRL = "No submit con... | rohe/saml2test | src/saml2test/interaction.py | Python | bsd-2-clause | 13,079 |
from kernel.output import Output, OutputResult
from io import StringIO
import sys
# @url: http://stackoverflow.com/a/16571630
# STDOUT capture class
class Capturing(list):
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
return self
def __exit__(se... | vdjagilev/desefu | tests/output_test.py | Python | mit | 1,065 |
# Copyright (C) 2010 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 agreed to in writ... | MapofLife/MOL | earthengine/google-api-python-client/setup.py | Python | bsd-3-clause | 2,777 |
# Copyright 2020 PerfKitBenchmarker 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 appli... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/xgboost.py | Python | apache-2.0 | 2,700 |
from app.extensions import db, bcrypt
from app.core.models import CRUDMixin
from datetime import datetime
class Users(CRUDMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False)
email = db.Column(db.String(200), unique=True, nullable=Fals... | lwalter/flask-angular-starter | app/user/models.py | Python | mit | 1,026 |
from mock import patch
from base import ClientTests, Response
from pulp_node import constants
from pulp_node.extensions.consumer import commands
NODE_ID = 'test_node'
REPOSITORY_ID = 'test_repository'
LOAD_CONSUMER_API = 'pulp_node.extensions.consumer.commands.load_consumer_id'
NODE_ACTIVATED_CHECK = 'pulp_node.e... | ulif/pulp | nodes/test/nodes_tests/test_consumer_extensions.py | Python | gpl-2.0 | 7,438 |
from __future__ import absolute_import, print_function, division
import theano
from theano import tensor
from theano.gof.opt import check_stack_trace
from theano.tensor.nnet.blocksparse import (
sparse_block_dot, sparse_block_gemv_inplace, sparse_block_outer_inplace,
sparse_block_gemv, sparse_block_outer)
def... | JazzeYoung/VeryDeepAutoEncoder | theano/tensor/nnet/tests/test_opt.py | Python | bsd-3-clause | 1,557 |
# 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 u... | Acehaidrey/incubator-airflow | airflow/providers/grpc/hooks/grpc.py | Python | apache-2.0 | 6,659 |
import ctypes
from ..codeprinter import CodePrinter
from .. import expression as e
from .. import functions as f
import expresso.visitor as visitor
from mpmath import mp
class c_complex(ctypes.Structure):
_fields_ = [('real',ctypes.c_double),('imag',ctypes.c_double)]
def __str__(self):
return str(sel... | TheLartians/Expresso | expresso/pycas/compilers/c_compiler.py | Python | mit | 17,186 |
"""
Author: Zhang Chengsheng, @2018.01.29
test in python 3.6
Input: gene name list (symbol or any id format)
Output: 'gene name /t search name /t Also known as id list /n'
input example:
HLA-A
TAS2R43
PRSS3
RBMXL1
DDX11
ZNF469
SLC35G5
GOLGA6L6
PRB2
"""
import os,sys,time
from urllib.request import urlopen
from urll... | captorr/ngs | scripts/ncbi_symbol_used_to_be.py | Python | gpl-3.0 | 4,534 |
# Modified from function.py ---
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import moose
simtime = 1.0
def test_example():
moose.Neutral('/model')
function = moose.Function('/model/function')
function.c['c0'] = 1.0
function.c['c1'] = 2.0
#function.x... | dilawar/moose-core | tests/core/test_function_example.py | Python | gpl-3.0 | 3,483 |
# Modules
import gc
import getpass
import logging
import paramiko
from contextlib import suppress, closing
from paramiko import SSHException
# Variables
CMDLIST = '/home/local-adm/LG_Installation/minho/CR/commands.txt'
SYSLIST = '/home/local-adm/LG_Installation/minho/CR/systems.txt'
# Classes and Functions
class In... | minhouse/python-lesson | auto-ssh_v5.py | Python | mit | 2,143 |
from seleniumbase import BaseCase
class VisualLayoutTests(BaseCase):
def test_xkcd_layout_change(self):
self.open("https://xkcd.com/554/")
print('\nCreating baseline in "visual_baseline" folder.')
self.check_window(name="xkcd_554", baseline=True)
# Change height: (83 -> 130) , Chan... | seleniumbase/SeleniumBase | examples/visual_testing/xkcd_visual_test.py | Python | mit | 532 |
""" The mako """
import logging
import os
import projex
logger = logging.getLogger(__name__)
try:
import mako
import mako.template
import mako.lookup
except ImportError:
logger.warning('The projex.makotext package requires mako to be installed.')
mako = None
# import useful modules for the temp... | bitesofcode/projex | projex/makotext.py | Python | mit | 6,007 |
#!/usr/bin/python
#
# Problem: Saving the Universe
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
# Comments: Inefficient O(SQ)-time algorithm. Can be solved in O(S+Q) time.
MAX = 1000000000
def compute():
ns = input()
ses = [raw_input() for j in range(ns)]
nq ... | KirarinSnow/Google-Code-Jam | Qualification Round 2008/A.py | Python | gpl-3.0 | 1,077 |
#!/usr/bin/python
#
# Original Copyright (C) 2006 Google Inc.
# Refactored in 2009 to work for Google Analytics by Sal Uryasev at Juice 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
#
... | boxed/CMi | web_frontend/gdata/analytics/__init__.py | Python | mit | 6,995 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
class task(osv.osv):
_inherit = "project.task"
# Compute: effective_hours, total_hours, progress
def _hours_get(self, cr, uid, ids, field_names, args, context=None):
... | orchidinfosys/odoo | addons/hr_timesheet/project_timesheet.py | Python | gpl-3.0 | 4,417 |
# -*- coding: utf-8 -*-
#
# This file is part of the VecNet OpenMalaria Portal.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/vecnet/om
#
# This Source Code Form is subject to the terms of t... | vecnet/om | sim_services_local/dispatcher.py | Python | mpl-2.0 | 1,944 |
# Generated by Django 2.1.7 on 2019-04-17 13:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tmv_app', '0110_auto_20190417_0944'),
]
operations = [
migrations.AddField(
model_name='topicterm',
name='alltopic_s... | mcallaghan/tmv | BasicBrowser/tmv_app/migrations/0111_topicterm_alltopic_score.py | Python | gpl-3.0 | 392 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from pyramid.view import view_config
from substanced.util import Batch
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from dace.objectofcollaborat... | ecreall/nova-ideo | novaideo/views/novaideo_view_manager/see_reported_contents.py | Python | agpl-3.0 | 4,728 |
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
"""
pida.core.log
~~~~~~~~~~~~~
sets up the core logging
:copyright: 2007 the Pida Project
:license: GPL2 or later
"""
import logbook.compat
logbook.compat.redirect_logging()
from pida.core.environment import is_de... | fermat618/pida | pida/core/log.py | Python | gpl-2.0 | 2,390 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (c) 2016 Cédric Clerget - HPC Center of Franche-Comté University
#
# This file is part of Janua-SMS
#
# http://github.com/mesocentrefc/Janua-SMS
#
# This program is free software: you can redistribute it and/or modify
# it under th... | mesocentrefc/Janua-SMS | janua/actions/log.py | Python | gpl-2.0 | 4,569 |
# Copyright 2017 the authors.
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
from hy.importer import (import_file_to_module, import_buffer_to_ast,
MetaLoader, get_bytecode_path)
from hy.errors import HyTypeError
import os
import ast
impor... | Tritlo/hy | tests/importer/test_importer.py | Python | mit | 1,808 |
# 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 it will be useful,
# bu... | mathstuf/bodhi | bodhi/services/releases.py | Python | gpl-2.0 | 6,860 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
new_default = orm.Extension._meta.get_field_by_name('icon')[0].default
for ... | magcius/sweettooth | sweettooth/extensions/migrations/0008_new_icon_default.py | Python | agpl-3.0 | 6,118 |
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
#
# 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 th... | mysql/mysql-utilities | mysql-test/t/meta_grep_parameters.py | Python | gpl-2.0 | 3,293 |
#import re, os, locale, HTMLParser
#from decimal import *
from django import template
from django.template import RequestContext, Context
from django.core.urlresolvers import reverse
from django.utils.importlib import import_module
from frontadmin.conf import settings
#from django.core.urlresolvers import RegexURLReso... | h3/django-frontadmin | frontadmin/templatetags/frontadmin_tags.py | Python | bsd-3-clause | 4,843 |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.VSPHERE)
driver = cls(url='https://192.168.1.100:8080/sdk/',
username='admin', password='admin')
print(driver.list_nodes())
# ...
| dcorbacho/libcloud | docs/examples/compute/vsphere/connect_url_custom_port.py | Python | apache-2.0 | 264 |
# -*- coding: utf-8 -*-
from pyload.plugin.internal.XFSAccount import XFSAccount
class LinestorageCom(XFSAccount):
__name = "LinestorageCom"
__type = "account"
__version = "0.03"
__description = """Linestorage.com account plugin"""
__license = "GPLv3"
__authors = [("Walter Purc... | ardi69/pyload-0.4.10 | pyload/plugin/account/LinestorageCom.py | Python | gpl-3.0 | 434 |
################################
# IMPORTS #
################################
from flask import Flask, render_template, Response, request
import time
import wave
from robotDebug import Robot
#*****************************#
# CONSTANTS & CONFIG #
#*****************************#... | erreur404/Gnubiquity | robot/app.py | Python | gpl-2.0 | 3,139 |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import DataMigration
from django.db import connection
class Migration(DataMigration):
old_table = 'cmsplugin_subscriptionplugin'
new_table = 'aldryn_mailchimp_subscriptionplugin'
def forwards(self, orm):
table_names = connection.intro... | CT-Data-Collaborative/ctdata-mailchimp | ctdata_mailchimp/migrations/0005_fix_old_cmsplugin_tables.py | Python | bsd-3-clause | 3,407 |
# 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 u... | zhouyao1994/incubator-superset | tests/dataframe_test.py | Python | apache-2.0 | 6,316 |
import threading
from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER
from django.contrib.gis import memoryview
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_stri... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/geos/prototypes/io.py | Python | gpl-2.0 | 9,452 |
import json
from unit.http import TestHTTP
from unit.option import option
http = TestHTTP()
def check_chroot():
available = option.available
resp = http.put(
url='/config',
sock_type='unix',
addr=option.temp_dir + '/control.unit.sock',
body=json.dumps(
{
... | nginx/unit | test/unit/check/chroot.py | Python | apache-2.0 | 748 |
from __future__ import absolute_import
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
import os
import glob
import sys
import time
import math
import re
import traceback
import threading
import platform
import Queue as queue
import serial
from Cura.avr_isp import stk500... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/Cura/util/machineCom.py | Python | agpl-3.0 | 19,071 |
#
# 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... | kgiusti/qpid-proton | tools/python/mllib/parsers.py | Python | apache-2.0 | 2,719 |
# coding=utf-8
# Author: Paul Wollaston
# Contributions: Luke Mullan
#
# This client script allows connection to Deluge Daemon directly, completely
# circumventing the requirement to use the WebUI.
from __future__ import print_function, unicode_literals
from base64 import b64encode
import sickbeard
from sickbeard im... | nopjmp/SickRage | sickbeard/clients/deluged_client.py | Python | gpl-3.0 | 7,649 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright (C) 2015 Luiz Fernando Oliveira, Carlos Oliveira, Matheus Fernandes
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 th... | SpaceWars/spacewars | src/layers/base_layers.py | Python | gpl-3.0 | 1,054 |
# 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... | tellesnobrega/storm_plugin | sahara/service/trusts.py | Python | apache-2.0 | 1,897 |
'''Particle Swarm Optimization Algorithm for Minimization'''
from threading import Thread, Event
import numpy as _np
class PSO:
"""."""
DEFAULT_COEFF_INERTIA = 0.7984
DEFAULT_COEFF_INDIVIDUAL = 1.49618
DEFAULT_COEFF_COLLECTIVE = 1.49618
def __init__(self, save=False):
"""."""
# ... | lnls-fac/apsuite | apsuite/optimization/pso.py | Python | mit | 10,292 |
"""
VexFlow / TabDiv Build Script
Requires: SCons, Git, and Google Closure Compiler
Copyright Mohit Cheppudira 2010
"""
import os
from datetime import datetime
from SCons.Script import *
"""
Make the default zip action use the external zip command. Also
add -j (--junk-paths) to the command to store only the name of ... | georgedrummond/vexflow | site_scons/vexflow_scons.py | Python | mit | 2,838 |
# Copyright (c) 2017 Huawei Technologies Co., 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/LICENSE-2.0
#
# ... | phenoxim/cinder | cinder/policies/workers.py | Python | apache-2.0 | 1,100 |
#!/usr/bin/env python
# coding: utf-8
'''
BACON
Copyright (C) 2017 Brett Pemberton
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 vers... | generica/bacon | bacon/modules/systemd/service.py | Python | gpl-3.0 | 2,073 |
import sys
import time
from datetime import date, datetime
from decimal import Decimal
from .otypes import OrientRecordLink, OrientRecord, OrientBinaryObject
from .exceptions import PyOrientBadMethodCallException
class OrientSerializationBinary(object):
def __init__(self):
self.className = None
se... | lebedov/pyorient | pyorient/serializations.py | Python | apache-2.0 | 17,017 |
# Copyright (C) 2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd... | vheon/ycmd | ycmd/tests/signature_help_test.py | Python | gpl-3.0 | 2,184 |
# -*- coding: utf-8 -*-
"""
npyscreen2 is mostly an experiment to see what I could do refactoring npyscreen
if backwards compatibility was not a concern.
A lot of the fundamental curses code, along with some of the base Form and
Widget methods come from the original npyscreen. Containers are my own
development (not t... | SavinaRoja/npyscreen2 | npyscreen2/__init__.py | Python | gpl-3.0 | 1,119 |
#Copyright 2017 The Snail Authors. All Rights Reserved.
#
#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, You can obtain one at http://mozilla.org/MPL/2.0/.
#Exhibit B is not attached; this software is compatible with the
#... | hexagrammidae/snail | src/StreamProcessors/MainSP.py | Python | mpl-2.0 | 1,535 |
"""
Installs and configures Keystone
"""
import logging
import uuid
from packstack.installer import validators
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be initialized f... | paramite/packstack | packstack/plugins/keystone_100.py | Python | apache-2.0 | 5,074 |
"""
Hacks on external libraries
"""
import ogrepkg.materialexport
from .material import RexMaterialExporter
ogrepkg.materialexport.GameEngineMaterial = RexMaterialExporter
| caedesvvv/b2rex | scripts/b2rexpkg/hacks.py | Python | lgpl-3.0 | 175 |
#
# Copyright (c) ,2010 Matteo Boscolo
#
# This file is part of PythonCAD.
#
# PythonCAD 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... | chiamingyen/PythonCAD_py3 | Interface/Entity/text.py | Python | gpl-2.0 | 1,767 |
# This file is part of Gajim.
#
# Gajim 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 3 only.
#
# Gajim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | gajim/gajim | gajim/gtk/conversation/plain_widget.py | Python | gpl-3.0 | 15,270 |
#
# 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 us... | lukecwik/incubator-beam | sdks/python/apache_beam/io/gcp/spanner.py | Python | apache-2.0 | 21,164 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
dnevnik = Table('dnevnik', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('ime_i_prezime', String(length=50)),
Column('razred', String(length=4)),
... | knadir/IIIgimnazija80 | db_repository/versions/024_migration.py | Python | bsd-3-clause | 887 |
from mock import patch
import jenkins
from tests.base import JenkinsTestBase
from tests.helper import build_response_mock
class JenkinsVersionTest(JenkinsTestBase):
@patch('jenkins.requests.Session.send', autospec=True)
def test_some_version(self, session_send_mock):
session_send_mock.return_value =... | stackforge/python-jenkins | tests/test_version.py | Python | bsd-3-clause | 1,993 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py | Python | mit | 14,365 |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape as escape
register = template.Library()
@register.filter
def panel_info(data):
if not data:
return mark_safe('<p class="empty">None</p>')
out = []
out.append('<dl class="panel-... | sfu-fas/coursys | coredata/templatetags/admin_panel_tags.py | Python | gpl-3.0 | 555 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/catalog-service | catalogService_test/mockedModules/mint/django_rest/rbuilder/manager/rbuildermanager.py | Python | apache-2.0 | 2,593 |
from six import iteritems
class Song:
"""
Song Attributes:
name (String)
track_id (Integer)
artist (String)
album_artist (String)
composer = None (String)
album = None (String)
genre = None (String)
kind = None (String)
size = None (Integer)
total_time = None (Integer)
... | liamks/pyitunes | libpytunes/Song.py | Python | mit | 2,391 |
import importlib
import inspect
import jabberbot
import pkgutil
import os
from jabberbot.mucbot import MUCBot
def run_command(msg, *args):
"""Returns a help string containing all commands"""
docs = {}
cmdpath = jabberbot.commands.__path__
for module_finder, name, ispkg in pkgutil.iter_modules(cmdpath)... | ScreenDriver/jabberbot | jabberbot/commands/help.py | Python | gpl-2.0 | 1,633 |
# -*- coding: utf-8 -*-
import random
import os
import string
import eve
from datetime import datetime
from unittest import TestCase
from sqlalchemy.sql.elements import BooleanClauseList
from operator import and_, or_
from eve.utils import str_to_date
from eve_sqlalchemy.tests.test_sql_tables import People
from eve_sq... | lingfish/eve-sqlalchemy | eve_sqlalchemy/tests/sql.py | Python | bsd-3-clause | 12,468 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__version__ = "0.2.1"
from .db import Database # noqa
from .models import TinyJsonModel # noqa
from jsonmodels import fields # Proxy to jsonmodels fields objects
| abnerjacobsen/tinydb-jsonorm | src/tinydb_jsonorm/__init__.py | Python | bsd-2-clause | 318 |
"""
Django template context processors.
"""
from django.conf import settings
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def configuration_context(request): # pylint: disable=unused-argument
"""
Configuration context for django templates.
"""
return {
... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/site_configuration/context_processors.py | Python | agpl-3.0 | 421 |
def extractNegaTranslations(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = {
'Glutton Berserker' : 'Glutton Berserker',
'Kaette Kita Motoyuusha' : 'Ka... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNegaTranslations.py | Python | bsd-3-clause | 1,589 |
# Copyright (c) 2016 RIPE NCC
#
# 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 is distributed in the h... | RIPE-NCC/ripe-atlas-tools | ripe/atlas/tools/commands/go.py | Python | gpl-3.0 | 1,462 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-03-28 17:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lotes', '0009_remove_modelotermica_receita'),
]
operations = [
migrations.C... | anselmobd/fo2 | src/lotes/migrations/0010_lote.py | Python | mit | 1,354 |
from models import BaseModel
class ApplicationAccessModel(BaseModel):
table = "applications_access"
db = "console"
fields={
"access_type":True,
"access_content":True,
"container_id":True,
"container_host":True,
"container_name":True,
"user_id":True,
... | liuhong1happy/DockerConsoleApp | models/application_access.py | Python | apache-2.0 | 445 |
"""SCons.Scanner
The Scanner package for the SCons software construction utility.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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 w... | loonycyborg/scons-plusplus | python_modules/Scanner/__init__.py | Python | lgpl-3.0 | 14,608 |
#
# 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
# ... | sebrandon1/neutron | neutron/db/models/tag.py | Python | apache-2.0 | 1,156 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class SomaticSniper(CMakePackage):
"""A tool to call somatic single nucleotide variants."""
... | LLNL/spack | var/spack/repos/builtin/packages/somatic-sniper/package.py | Python | lgpl-2.1 | 617 |
###############################################################################
#
# 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 as published
# by the ... | Micronaet/micronaet-product | product_speech_code_order/__openerp__.py | Python | agpl-3.0 | 1,491 |
##########################################################################
## # The Coq Proof Assistant / The Coq Development Team ##
## v # INRIA, CNRS and contributors - Copyright 1999-2019 ##
## <O___,, # (see CREDITS file for the list of authors) ##
## \VV/ #########... | Matafou/coq | doc/tools/coqrst/repl/ansicolors.py | Python | lgpl-2.1 | 3,288 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | romain-dartigues/ansible | lib/ansible/modules/network/nxos/nxos_static_route.py | Python | gpl-3.0 | 10,227 |
class KnownUsers:
"""
This deals with both the dedicated server log AND the xml "user" file, as related to the known users.
TODO: refactor this to have a distinct class for the dedicatedLog and the users.xml
"""
def __init__(self, existing_users_filename):
"""Setup init variables parsing t... | mccorkle/seds-utils | KnownUsers.py | Python | gpl-3.0 | 4,260 |
import atexit
from flask import Flask, jsonify, g, request, make_response
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies
from apscheduler.schedulers.background import Bac... | patklaey/ZermattReservationAPI | main.py | Python | mit | 1,957 |
import logging
from pyramid.interfaces import IRequest
from openprocurement.auctions.dgf.models import (
IDgfOtherAssetsAuction,
IDgfFinancialAssetsAuction,
DGFOtherAssets,
DGFFinancialAssets
)
from openprocurement.auctions.dgf.adapters import (
AuctionDGFOtherAssetsConfigurator,
AuctionDGFFina... | openprocurement/openprocurement.auctions.dgf | openprocurement/auctions/dgf/includeme.py | Python | apache-2.0 | 3,915 |
# Copyright 2014 Netflix, 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... | JaguarSecurity/SMG | security_monkey/exceptions.py | Python | apache-2.0 | 3,893 |
from .namespace import NamespaceDeclGenerator
from .classes import (CXXRecordDeclGenerator,
DefinitionDataGenerator,
DefaultConstructorGenerator,
CopyConstructorGenerator,
MoveConstructorGenerator,
CopyAssignme... | nak/pyllars | src/python/pyllars/cppparser/generation/clang/__init__.py | Python | apache-2.0 | 764 |
""" IO classes for Omnivor input file
Copyright (C) 2013 DTU Wind Energy
Author: Emmanuel Branlard
Email: [email protected]
Last revision: 25/11/2013
Namelist IO: badis functions to read and parse a fortran file into python dictonary and write it back to a file
The parser was adapted from: fortran-namelist on code.google... | DTUWindEnergy/Python4WindEnergy | py4we/fortran_namelist_io.py | Python | apache-2.0 | 8,294 |
# -*- test-case-name: foolscap.test.test_banana -*-
from twisted.internet import defer
from twisted.python import log
from foolscap.slicers.list import ListSlicer
from foolscap.slicers.tuple import TupleUnslicer
from foolscap.slicer import BaseUnslicer
from foolscap.tokens import Violation
from foolscap.constraint imp... | david415/foolscap | src/foolscap/slicers/set.py | Python | mit | 6,763 |
import unittest
from tfi.as_tensor import as_tensor
from functools import partialmethod
class ServeTest(unittest.TestCase):
pass
_FIXTURES = [
('zoo/torchvision/resnet.py:Resnet50', )
]
for (name, *rest) in _FIXTURES:
def do_model_test(self, path):
# TODO(adamb) Load the model
#... | ajbouh/tfi | tests/broken/serve_test.py | Python | mit | 1,028 |
#
# Copyright (c) 2013+ Anton Tyurin <[email protected]>
# Copyright (c) 2013+ Evgeny Safronov <[email protected]>
# Copyright (c) 2011-2014 Other contributors as noted in the AUTHORS file.
#
# This file is part of Cocaine-tools.
#
# Cocaine is free software; you can redistribute it and/or modify
# it under the ter... | antmat/cocaine-tools | cocaine/tools/actions/crashlog.py | Python | lgpl-3.0 | 8,706 |
import os
import json
import inspect
import numpy
from IPython.core.display import HTML, Javascript, display
from jinja2 import Template
from pywr.core import Node
from pywr.core import Model, Input, Output, Link, Storage, StorageInput, StorageOutput
from pywr.nodes import NodeMeta
from pywr._component import Component... | snorfalorpagus/pywr | pywr/notebook/__init__.py | Python | gpl-3.0 | 8,048 |
from __future__ import print_function, absolute_import
import os
import warnings
import numpy as np
import mdtraj as md
from ..utils.progressbar import ProgressBar, Percentage, Bar, ETA
from ..utils import verbosedump
from ..cmdline import NumpydocClassCommand, argument, exttype, stripquotestype
from ..dataset import... | dr-nate/msmbuilder | msmbuilder/commands/featurizer.py | Python | lgpl-2.1 | 7,658 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import logging
from .sites import foolSlide
from .sites import readcomicOnlineli
from .sites import comicNaver
from .sites import mangaHere
from .sites import rawSenManga
from ... | Xonshiz/comic-dl | comic_dl/honcho.py | Python | mit | 14,699 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | Dziolas/invenio-oaiserver | invenio_oaiserver/ext.py | Python | gpl-2.0 | 2,205 |
"""
Given a string, return the string made of its first two chars, so the String "Hello" yields\
"He". If the string is shorter than length 2, return whatever there is, so "X" yields \
"X", and the empty string "" yields the empty string "".
"""
def first_two(snip_string):
if len(snip_string) < 2:
snippe... | Baumelbi/IntroPython2016 | students/sheree/session_01/homework/coding_bat_string-6.py | Python | unlicense | 554 |
# 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... | HaebinShin/tensorflow | tensorflow/contrib/distributions/python/ops/inverse_gamma.py | Python | apache-2.0 | 13,335 |
# -*- encoding: UTF-8 -*-
'''Cartesian control: Torso and Foot trajectories'''
import sys
import motion
import almath
from naoqi import ALProxy
def StiffnessOn(proxy):
# We use the "Body" name to signify the collection of all joints
pNames = "Body"
pStiffnessLists = 1.0
pTimeLists = 1.0
proxy.s... | kwailamchan/programming-languages | python/aldebaran/hana/hana/motion/cartesian/motion_cartesianFoot.py | Python | mit | 1,913 |
import unittest
import os
import shutil
from hyo2.soundspeedmanager import AppInfo
from hyo2.soundspeed.atlas import atlases
from hyo2.soundspeed.soundspeed import SoundSpeedLibrary
class TestSoundSpeedAtlasAtlases(unittest.TestCase):
def setUp(self):
self.cur_dir = os.path.abspath(os.path.dirname(__fil... | hydroffice/hyo_soundspeed | tests/soundspeed/atlas/test_atlases.py | Python | lgpl-2.1 | 1,091 |
"""
Harvester for the Digital Commons @ CalPoly API for the SHARE project
More information at https://github.com/CenterForOpenScience/SHARE/blob/master/providers/edu.calpoly.md
Example API call: http://digitalcommons.calpoly.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc&from=2014-10-05T00:00:00Z
"""
from __fut... | jeffreyliu3230/scrapi | scrapi/harvesters/calpoly.py | Python | apache-2.0 | 2,863 |
import sys
import csv
reader = csv.reader(sys.stdin, delimiter='\t')
next(reader, None)
for line in reader:
if len(line) == 19:
author_id = line[3]
hour = int(line[8][11:13])
print "{0}\t{1}".format(author_id, hour)
# Reducer
import sys
oldKey = None
hours = {}
for i in range(24):
hours[i] = 0
for line i... | mi1980/projecthadoop3 | udacity/ud617-intro-hadoop/code/final-project/student_times.py | Python | mit | 699 |
""" Interface for generating an object describing geometry of mass spec acquisition process.
"""
def geometry_section(section_name):
""" Class decorator adding static property @section_name with the input value to a decorated class
"""
def modifier(cls):
cls.section_name = section_name
retu... | SpatialMetabolomics/SM_distributed | sm/engine/acq_geometry_factory.py | Python | apache-2.0 | 3,421 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# David Durieux, [email protected]
#
"""
Alignak - Arbiter, Scheduler and Broker modules for the Alignak backend
"""
# Package name
__pkg_name__ = u"alignak_module_backend"
# Module type for PyPI keywords
# Used for:
# - PyPI keyw... | Alignak-monitoring-contrib/alignak-module-backend | version.py | Python | agpl-3.0 | 1,262 |
# http://eli.thegreenplace.net/2014/02/15/programmatically-populating-a-django-database
from django.core.management.base import BaseCommand
from django.db import IntegrityError
import json
from maps.models import Permit, PermitOwner
from permits_redux.settings import BASE_DIR, GEOIP_PATH
from django.contrib.auth.models... | crashtack/permits_redux | maps/management/commands/populate_db.py | Python | mit | 3,567 |
import re
from argparse import ArgumentParser
# Parse arguments
parser = ArgumentParser(description="Transforming output to more concise version")
parser.add_argument('-f', '--file',
help="Input file for data, e.g.: -f output_raw.txt",
dest="infile",
required... | XianliangJ/collections | TCPCwnd/formatOutput.py | Python | gpl-3.0 | 1,446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.