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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import peewee
from flask import current_app,abort
from flask.ext.login import AnonymousUserMixin, UserMixin
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from peewee import Model, IntegerField, CharField,PrimaryKeyField
from website.app import db_wr... | alexli0707/pyforum | website/models/user.py | Python | apache-2.0 | 3,011 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
class _Getch(object):
"""
Gets a single character from standard input. Does not echo to
the screen (reference: http://code.activestate.com/recipes/134892/)
""... | glaudsonml/kurgan-ai | tools/sqlmap/lib/utils/getch.py | Python | apache-2.0 | 2,305 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="colorsrc",
parent_name="sankey.node.hoverlabel.font",
**kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=pl... | plotly/plotly.py | packages/python/plotly/plotly/validators/sankey/node/hoverlabel/font/_colorsrc.py | Python | mit | 454 |
# Copyright (c) 2011, Willow Garage, Inc.
# 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 co... | sorki/rosdep | test/test_rosdep_source.py | Python | bsd-3-clause | 11,143 |
# -*- Mode: Python; test-case-name: flumotion.test.test_ui_fgtk -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public ... | ylatuya/Flumotion | flumotion/test/test_ui_fgtk.py | Python | gpl-2.0 | 2,724 |
import logging
import math
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import View
from experiments_ma... | MOOCworkbench/MOOCworkbench | user_manager/views.py | Python | mit | 7,680 |
# -*- coding: utf-8 -*-
# This Module is taken in part from the click project and expanded
# see https://github.com/pallets/click/blob/6cafd32/click/_winconsole.py
# Copyright © 2014 by the Pallets team.
# Some rights reserved.
# Redistribution and use in source and binary forms of the software as well as
# document... | kennethreitz/pipenv | pipenv/vendor/vistir/_winconsole.py | Python | mit | 15,863 |
# Copyright 2015 Rackspace
#
# 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 t... | huntxu/neutron | neutron/tests/unit/extensions/test_dns.py | Python | apache-2.0 | 24,979 |
" fuel tank "
from gpkit import Model, Variable
class FuelTank(Model):
"""
Returns the weight of the fuel tank. Assumes a cylinder shape with some
fineness ratio
"""
def setup(self, Wfueltot):
W = Variable("W", "lbf", "fuel tank weight")
f = Variable("f", 0.03, "-", "fraction fuel... | convexengineering/gplibrary | gpkitmodels/GP/aircraft/fuselage/fuel_tank.py | Python | mit | 747 |
from re import compile
from django.conf import settings
from django.http import HttpResponseRedirect
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
class LoginRequiredMiddleware(object):
... | nborkowska/kpir | kpir/kpir/middleware.py | Python | gpl-3.0 | 755 |
# This script opens up all of the graphs from disk, and performs learning on
# them. This script is best run on the Rous cluster, where all of the graphs
# are located on disk (it occupies ~200GB of space, because pickling is
# not efficient.
from graphfp.layers import FingerprintLayer, LinearRegressionLayer,\
Gra... | ericmjl/protein-convolutional-nets | experiments/subsample/train.py | Python | mit | 8,395 |
from .authenticator import CarinaAuth
from .spawner import CarinaSpawner
| betatim/carina-jupyterhub | carinahub/__init__.py | Python | bsd-3-clause | 73 |
import unittest
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from google.appengine.datastore import datastore_stub_util
import gaeutils
class TestModel(ndb.Model):
"""A model class used for testing."""
number = ndb.IntegerProperty(default=42)
text = ndb.StringProperty()
... | jaybaker/gaeutils | test/tests.py | Python | mit | 1,127 |
# coding: utf-8
from __future__ import unicode_literals
from io import StringIO, BytesIO
from pathlib import Path
import pytest
from .util import load_test_model
from ..tokens import Doc
from ..strings import StringStore
from .. import util
# These languages are used for generic tokenizer tests – only add a languag... | aikramer2/spaCy | spacy/tests/conftest.py | Python | mit | 6,590 |
from website.settings import DOMAIN as OSF_DOMAIN
from website.project.model import User
from furl import furl
def serialize_comment(comment, full=False):
reports = serialize_reports(comment.reports)
author_abs_url = furl(OSF_DOMAIN)
author_abs_url.path.add(comment.user.url)
return {
'id': co... | billyhunt/osf.io | admin/spam/serializers.py | Python | apache-2.0 | 1,215 |
from sympy import Piecewise, lambdify, Equality, Unequality, Sum, Mod
from sympy.abc import x, i, j, a, b, c, d
from sympy.printing.lambdarepr import NumPyPrinter
import numpy as np
def test_numpy_piecewise_regression():
"""
NumPyPrinter needs to print Piecewise()'s choicelist as a list to avoid
breaking ... | Shaswat27/sympy | sympy/printing/tests/test_numpy.py | Python | bsd-3-clause | 2,530 |
import glob, sys, os.path
import MergeBowtie
import Mapping2
# this is needed to account for the fact that the maternal, paternal, and ref genomes all have different coordinates now
# that indels are handled
def makeMappers(maptmplt):
mappers={}
cs=['chr%s' % str(c) for c in range(1,23)] + ['chrX', 'chrY', '... | gersteinlab/AlleleDB | alleledb_pipeline/MergeDriver.py | Python | cc0-1.0 | 980 |
from django.template.defaultfilters import slugify
from smartmin.models import SmartModel
from django.db import models
"""
Full description of the landmark type
"""
class LandmarkType(models.Model):
name = models.CharField(max_length=128, help_text="Name describing the landmark type e.g. Popular name")
slug = ... | nyaruka/motome | motome/landmarks/models.py | Python | bsd-3-clause | 1,367 |
from geoalchemy2 import WKBElement, shape as ga_shape
from geomet import wkb
from shapely.geometry import LineString, MultiLineString, shape
from sqlalchemy.dialects import postgresql
import sqlalchemy as sa
from sqlalchemy.sql.expression import and_
from sqlalchemy.sql.functions import func
import re
def copy_attrib... | c2corg/v6_api | c2corg_api/models/utils.py | Python | agpl-3.0 | 5,447 |
#!/usr/bin/env python
# coding:utf-8
from __future__ import unicode_literals
import json
import time
import api_funcs as af
def end(gen):
if gen['instance_id']:
print('@@@ 注意: 如果实例在启动中, 指令发送了也删不掉哟~ @@@')
af.Instance.stop(gen['instance_id'])
# 1.1 等待实例停止
print('等待实例停止...(先等1s)...')... | boisde/Greed_Island | aliyuncli_ecs/3_stop.py | Python | mit | 1,446 |
# -*- 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 'Resource'
db.create_table('inventory_resource', (
('id', self.gf('django.db.mode... | SYNHAK/spiff | spiff/inventory/migrations/0001_initial.py | Python | agpl-3.0 | 9,068 |
"""
This effectively walks through module import statements recursively to find
all modules that a given one depends on.
It furthermore manages the packaging of newly found dependencies when requested
ISSUES: For speed, this does not use pathhooks unless imp.find_module fails.
Consequently, if modules can be found in... | jpzk/evopy | evopy/external/playdoh/codehandler/codedependency.py | Python | gpl-3.0 | 20,711 |
# Copyright 2016:
# * Jim Unroe KC9HI, <rock.unroe@gmail.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 version 2 of the License, or
# (at your option) any later version.
#
# This... | mach327/chirp_fork | chirp/drivers/lt725uv.py | Python | gpl-3.0 | 22,684 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# BFRES Tool
# Version 5.1
# Copyright © 2017-2018 AboodXD
# This file is part of BFRES Tool.
# BFRES Tool 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, eith... | aboood40091/BFRES-Tool | structs.py | Python | gpl-3.0 | 1,321 |
def collatz_generator(n):
yield n
while n > 1:
if n%2 == 0:
n = n/2
yield n
else:
n = 3*n + 1
yield n
i = 1000000
max_chain = 0
max_num = 0
while i > 1:
n = len(list(collatz_generator(i)))
if n > max_chain:
max_chain = n
max_num = i
i -= 1
print max_num, max_chain | cmaron/Project-Euler | 14-longestCollatzSequence.py | Python | mit | 291 |
# -*- coding: utf-8 -*-
import time
from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtGui import QCursor
from PyQt5.QtTest import QTest
from PyQt5.QtWidgets import QApplication
from . import event_loop
from .gestures import Automaton, MIN_TIME_TO_AVOID_DOUBLE_CLICK
ONE_SECOND_IN_MILLIS = 1000
class KeyboardLayout:
... | Iconoclasteinc/tgit | cute/robot.py | Python | gpl-3.0 | 4,559 |
# Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft 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 b... | andyliuliming/WALinuxAgent | azurelinuxagent/common/protocol/metadata.py | Python | apache-2.0 | 16,146 |
# 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 in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | changsimon/trove | trove/extensions/security_group/models.py | Python | apache-2.0 | 9,284 |
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | pair-code/lit | lit_nlp/lib/wsgi_serving.py | Python | apache-2.0 | 4,652 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | tectronics/secure-gappproxy | uploader/uploader.py | Python | gpl-3.0 | 15,597 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-03-09 16:54
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parliament', '0002_person_clean_name'),
]
ope... | mcallaghan/tmv | BasicBrowser/parliament/migrations/0003_auto_20180309_1654.py | Python | gpl-3.0 | 723 |
__author__ = 'jiataogu'
| MingyuanXie/CopyNet | emolga/models/__init__.py | Python | mit | 24 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import F, Q
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
f... | samuelmaudo/yepes | yepes/contrib/newsletters/abstract_models.py | Python | bsd-3-clause | 24,266 |
"""
MultiVolumeVisualization
:Authors:
Berend Klein Haneveld
"""
from PySide.QtCore import QObject
from PySide.QtCore import Signal
from vtk import vtkColorTransferFunction
from vtk import vtkPiecewiseFunction
# Define render types for multi render
MultiVisualizationTypeMix = "Default mix"
MultiVisualizationTypeMIP ... | berendkleinhaneveld/Registrationshop | ui/visualizations/MultiVolumeVisualization.py | Python | mit | 2,648 |
import unittest
from dgvm.data_structures import Heap
class HeapTests(unittest.TestCase):
def test_history(self):
t = Heap(128)
t.checkpoint()
t[0] = 1
assert t.get(0) == 1
t.revert()
assert t.get(0) is None
t[0] = 'abcde'
assert t[0] == 'abc... | matheus2740/alpha_empire | dgvm/tests/heap_tests.py | Python | gpl-3.0 | 518 |
#!/usr/bin/env python
# cardinal_pythonlib/sizeformatter.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.... | RudolfCardinal/pythonlib | cardinal_pythonlib/sizeformatter.py | Python | apache-2.0 | 5,274 |
#
# This file is part of Scalable COncurrent Operations in Python (SCOOP).
#
# SCOOP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option)... | IGITUGraz/scoop | examples/tree_traversal.py | Python | lgpl-3.0 | 4,364 |
#
# 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... | wooga/airflow | tests/providers/google/cloud/operators/test_dataflow.py | Python | apache-2.0 | 11,898 |
""" base on http://www.ibm.com/developerworks/cn/opensource/os-cn-pythonwith/index.html
contextlib:closing demo
"""
class closing(object):
def __init__(self, thing):
self.thing = thing
def __enter__(self):
return self.thing
def __exit__(self, *exc_info):
self.thing.close()
class C... | nwinds/py-with-study | contextlib_closing_demo.py | Python | mit | 744 |
import tensorflow as tf
def python_run():
"""
Pythonic way of getting the ``new width`` and ``new height``
"""
input_shape = [32, 32, 3] # HxWxD
filter_shape = [20, 8, 8, 3] # number_of_filtersxHxWxD
stride = 2 # S
valid_padding = 1 # P
new_height = (input_shape[0] - filter_shape[... | akshaybabloo/Car-ND | Term_1/CNN_5/output_shape_1.py | Python | mit | 1,273 |
#TODO: Make work with new post_types
import datetime
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext as _
from django.utils.html import escap... | maxwward/SCOPEBak | askbot/models/repute.py | Python | gpl-3.0 | 9,241 |
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=["camera_node"],
package_dir={'': 'include'},
)
setup(**setup_args)
| Spookz0r/Temporal_Insanity | Gabriel/Code/ros_workspace/src/camera_node/setup.py | Python | mit | 306 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: 周日 四月 21 02:39:05 2013
# by: The Resource Compiler for PyQt (Qt v4.8.3)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x01\x57\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x... | vivalivezhang/projectvfx | lib/darkorangeStylesheet/resource.py | Python | gpl-2.0 | 18,974 |
################################################################################
#
# File: cryostatclass.py
# Author: Anna Zovaro
# Email: anna.zovaro@anu.edu.au
#
# Description:
# A class for a cryostat.
#
# Copyright (C) 2016 Anna Zovaro
#
##########################################################################... | azov3902/linguinesim | cryostatclass.py | Python | gpl-3.0 | 1,415 |
#coding: utf-8
#This file is part of Ficlatté.
#Copyright © 2015-2017 Paul Robertson, Jim Stitzel and Shu Sam Chen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of version 3 of the GNU Affero General Public
# License as published by the Free Software Foundation
... | ficlatte/main | castle/mail.py | Python | agpl-3.0 | 8,920 |
# -*- coding: utf-8 -*-
from parameterized import parameterized
from tests.unittests.utils.base_test_case import BaseTestCase, request_context
from tests.unittests.utils.payload.news import NewsPayload
class TestNewsCollection(BaseTestCase):
"""Test News collection"""
@parameterized.expand([
[None,... | geokrety/geokrety-api | tests/unittests/api/news/test_news_collection.py | Python | gpl-3.0 | 933 |
#
# Copyright 2010-2014 Hat, Inc. and/or its affiliates.
#
# 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... | Seitanas/kvm-vdi | guest_agent/ovirt-guest-agent/GuestAgentLinux2.py | Python | mit | 17,581 |
from __future__ import print_function
from random import randint
from .utils import clear_screen
from . import colors
class Board(object):
def __init__(self, size_x, size_y, color_range):
self.size_x = size_x
self.size_y = size_y
self.area = size_x * size_y
self.board = [[randint(... | CSZakides/colors | src/board.py | Python | gpl-2.0 | 966 |
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... | ProjectQ-Framework/ProjectQ | projectq/tests/__init__.py | Python | apache-2.0 | 644 |
import numpy as np
from sklearn.cluster import KMeans, AffinityPropagation, SpectralClustering
from sklearn.manifold import Isomap, MDS
from plotting import plot_clusters
__all__ = [ 'Manifold' ]
class Manifold(object):
def __init__(self, dismat, labels=None, cls=[], pos=[]):
self.dismat = np.asarray(di... | iSumitG/vsm | vsm/extensions/clustering/manifold.py | Python | mit | 4,501 |
"""
========================
Cycle finding algorithms
========================
"""
# Copyright (C) 2010-2012 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
from networkx.utils import *
... | jtorrents/networkx | networkx/algorithms/cycles.py | Python | bsd-3-clause | 6,479 |
from lib.checker import Checker
from parameterizedtestcase import ParameterizedTestCase
class TestPrivateKeyChecker(ParameterizedTestCase):
def test_provider(self):
err1 = "\"PRIVATE KEY\" found, but not allowed (privatekey)."
err2 = "\"ssh-rsa\" found, but not allowed (privatekey)."
retu... | artburkart/gitpatrol | tests/TestPrivateKeyChecker.py | Python | mit | 1,017 |
"""Tests for the cryptolib library"""
import unittest
import cryptolib
class TestNoSet(unittest.TestCase):
"""No set tests"""
def test_hex_to_bytes(self):
"""No challenge"""
test = cryptolib.hex_to_bytes('42')
result = b'B'
self.assertEqual(test, result)
def test_bytes_t... | MagicTrucy/cryptolib | src/cryptotest.py | Python | mit | 4,897 |
# Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models
from ..tools import misc
class Nbm(models.Model):
_name = 'l10n_br_fiscal.nbm'
_inherit = 'l10n_br_fiscal.data.product.abstract'
... | kmee/l10n-brazil | l10n_br_fiscal/models/nbm.py | Python | agpl-3.0 | 1,671 |
"""
Django settings for boarding_school_2 project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
im... | schinckel/django-boardinghouse | examples/boarding_school/boarding_school/settings.py | Python | bsd-3-clause | 3,496 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | titusfortner/selenium | py/selenium/webdriver/support/event_firing_webdriver.py | Python | apache-2.0 | 16,700 |
# Copyright 2014 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.
import json
import logging
import os
import threading
import time
logger = logging.getLogger(__name__)
class Blacklist(object):
def __init__(self, path)... | endlessm/chromium-browser | third_party/catapult/devil/devil/android/device_blacklist.py | Python | bsd-3-clause | 2,246 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Infrastructure Toolkit}.
"""
import os
import sys
import argparse
from entropy.i18n import _, ngettext
from entropy.output import bold, purpl... | Sabayon/entropy | server/eit/commands/branch.py | Python | gpl-2.0 | 7,185 |
import sys
import pytest
from flask import current_app
from unifispot.core.models import Wifisite,Device,Guesttrack
from unifispot.core.guestutils import validate_track,redirect_guest
from .test_baseviews import TestView
##keep all fixtures here which need to register a view or something
#-------------------------... | Spotipo/spotipo | tests/core/conftest.py | Python | agpl-3.0 | 1,419 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("delft3dworker", "0072_auto_20160830_2334"),
]
operations = [
migrations.AlterField(
model_name="container",
... | openearth/delft3d-gt-server | delft3dworker/migrations/0073_auto_20160907_1301.py | Python | gpl-3.0 | 819 |
# Created by Benjamin J. Thompson <bjt@rabidquill.com>
from os.path import dirname
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
from datetime import datetime, timedelta
from time import mktime
import parsedatetime
import re
import requests... | JarbasAI/jarbas-core | mycroft/jarbas-skills/skill_next_rocket_launch/__init__.py | Python | gpl-3.0 | 3,779 |
#!/usr/bin/python
# Copyright 2016 Google Inc.
#
# 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 vers... | grimmjow8/ansible | lib/ansible/modules/cloud/google/gcpubsub.py | Python | gpl-3.0 | 11,841 |
'''
Created on May 9, 2013
@author: Bartosz Alchimowicz
'''
import copy
import clone
import format.model
def actor(target, source):
target.name = source.name
target.identifier = source.identifier
target.type = source.type
target.communication = source.communication
target.description = source.description
targ... | wafaast/afefuc-project | src/utils/update.py | Python | mit | 1,700 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# line_follower.py
#
# Copyright 2010 Manuel Martín Ortiz <manuel.martin@itrblabs.eu>
#
# 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
# ... | RL-LDV-TUM/epucklib | examples/photo_taker.py | Python | gpl-3.0 | 3,531 |
import re
bold = re.compile(r'\*{2}(.*?)\*{2}')
text = 'Make this **bold**. This **too**.'
print('Text:', text)
print('Bold:', bold.sub(r'<b>\1</b>', text))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_text/re_sub.py | Python | apache-2.0 | 162 |
'''OpenGL extension OES.required_internalformat
This module customises the behaviour of the
OpenGL.raw.GLES1.OES.required_internalformat to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/OES/required_internalformat.txt
'''
from Op... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GLES1/OES/required_internalformat.py | Python | lgpl-3.0 | 822 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-20 08:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('chat', '0003_pezoneschat'),
]
operations = [
migrations.RenameModel(
ol... | AtenrevCode/scChat | chat/migrations/0004_auto_20170420_1028.py | Python | mit | 394 |
""" """
# Standard library modules.
import unittest
import logging
# Third party modules.
import numpy as np
# Local modules.
from pyhmsa.spec.datum.analysislist import \
AnalysisList0D, AnalysisList1D, AnalysisList2D
from pyhmsa.spec.condition.condition import _Condition
# Globals and constants variables.
cla... | pyhmsa/pyhmsa | pyhmsa/spec/datum/test_analysislist.py | Python | mit | 3,730 |
from django.contrib import admin
from ..models.foo import Foo
admin.site.register(Foo)
| yephper/django | tests/admin_scripts/complex_app/admin/foo.py | Python | bsd-3-clause | 94 |
from __future__ import absolute_import
from . import submodule
# Just Dummy class for testing
class TestClassInSubPkg:
pass
| asmodehn/filefinder2 | tests/test_filefinder2/pkg/__init__.py | Python | mit | 130 |
import os
import numpy as np
from scipy.optimize import curve_fit
def gauss(x, A, mu, sigma):
return A * np.exp(-(x - mu)**2 / (2. * sigma**2))
scriptmode = True
SDM_name = 'test' # The prefix to use for all output files
# SDM_name = '13A-213.sb20685305.eb20706999.56398.113012800924'
# Set up some useful var... | e-koch/canfar_scripts | img_pipe/casanfar_image.py | Python | mit | 7,517 |
# python
# This file is generated by a program (mib2py).
import CISCO_ISDNU_IF_MIB
OIDMAP = {
'1.3.6.1.4.1.9.9.18': CISCO_ISDNU_IF_MIB.ciscoIsdnuIfMIB,
'1.3.6.1.4.1.9.9.18.1': CISCO_ISDNU_IF_MIB.ciuIfObjects,
'1.3.6.1.4.1.9.9.18.1.1': CISCO_ISDNU_IF_MIB.ciuInterface,
'1.3.6.1.4.1.9.9.18.1.2': CISCO_ISDNU_IF_MIB.ciuI... | xiangke/pycopia | mibs/pycopia/mibs/CISCO_ISDNU_IF_MIB_OID.py | Python | lgpl-2.1 | 1,588 |
# $Id$
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 --dis-codec=pcma --auto-answer=200"]
PJSUA_EXPECTS = []
| asterisk/pjproject | tests/pjsua/scripts-sipp/uac-ticket-1866-reinv-after-failed-nego.py | Python | gpl-2.0 | 130 |
import copy
cards = [[0, 'Q'], [2, '6'], [1, 'K'],
[1, '8'], [2, '10'], [2, '4'],
[3, '4'], [0, '4'], [1, '3'],
[2, '5'], [0, 'K'], [3, 'A'],
[1, 'J'], [0, '3'], [0, '9']]
def cardTypeAsInt( card ):
if card[1].isdigit():
return int(card[1])
if card[1] == "J":
... | malja/cvut-python | cviceni08/01_trideni_karet.py | Python | mit | 1,202 |
# -*- coding: utf-8 -*-
"""All prompters registered in this module must have a function signature of
(prompt, *args, **kwargs), and must return an answer. If a back event occurs, the
prompter should raise `QuestionnaireGoBack`.
Extending questionnaire is as simple writing your own prompter and passing it to
`add`.
"""... | kylebebak/questionnaire | questionnaire/prompters.py | Python | mit | 5,931 |
from django.contrib import admin
from .models import ProjectStatus, ProjectStatusAdmin, Gallery, GalleryAdmin, ProgramLinks,ProgramLinksAdmin, Link, LinkAdmin
class GalleryAdmin(admin.ModelAdmin):
change_form_template = 'customdashboard/admin/change_form.html'
admin.site.register(ProjectStatus, ProjectStatusAdm... | mercycorps/tola-activity | htdocs/customdashboard/admin.py | Python | gpl-2.0 | 464 |
import unittest
from openmdao.main.api import VariableTree, Component, Assembly, set_as_top
from openmdao.lib.datatypes.api import VarTree, Float, List
class RegionVT(VariableTree):
c0 = Float()
c1 = Float()
class SectionVT(VariableTree):
s0 = Float()
s1 = Float()
regions = List()
def add_... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.main-0.13.0-py2.7.egg/openmdao/main/test/test_vartree_copy.py | Python | gpl-2.0 | 2,557 |
from mock import Mock
import pytest
@pytest.fixture
def dummy_input_layer():
from lasagne.layers.input import InputLayer
input_layer = InputLayer((2, 3, 4))
mock = Mock(input_layer)
mock.shape = input_layer.shape
mock.input_var = input_layer.input_var
mock.output_shape = input_layer.output_sha... | jordipons/EUSIPCO2017 | src/lasagne/tests/layers/conftest.py | Python | mit | 339 |
from pyqtgraph.Qt import QtGui, QtCore
__all__ = ['JoystickButton']
class JoystickButton(QtGui.QPushButton):
sigStateChanged = QtCore.Signal(object, object) ## self, state
def __init__(self, parent=None):
QtGui.QPushButton.__init__(self, parent)
self.radius = 200
self.setCheckab... | ibressler/pyqtgraph | pyqtgraph/widgets/JoystickButton.py | Python | mit | 2,468 |
#!/usr/bin/env python
"""
Select only the longest transcript for each gene in a GFF file.
Usage:
select_longest_mrna.py -i <input_GFF_file> -o <output_GFF_file>
Options:
-h --help Show this screen.
--version Show version.
-i <input_GFF_file> Input GFF file.
-o <output_GFF_file> O... | sidorov-si/ngser | select_longest_mrna.py | Python | gpl-2.0 | 4,346 |
"""client: basic interaction with a daemon"""
| RoPython/jarvis | jarvis/worker/client.py | Python | mit | 46 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | nagyistoce/netzob | src/netzob/UI/TraceManager/Views/ApplicativeDataManagerView.py | Python | gpl-3.0 | 4,007 |
"""Extract reference documentation from the NumPy source tree.
Adapted from example here:
https://github.com/richford/cloudknot/tree/master/doc/sphinxext/docscrape.py
Authors
-------
* richford
* arokem
"""
#
# Original Copyright (c) 2017 Adam Richie-Halford, Ariel Rokem. All rights reserved.
#
from __future__ impo... | ccurtis7/brain-diffusion | docs/source/sphinxext/docscrape.py | Python | bsd-2-clause | 17,797 |
__author__ = 'Francesco Infante'
import ujson
from dpath import util
class Configuration(dict):
def __init__(self, *args, **kwargs):
super(Configuration, self).__init__(*args, **kwargs)
class Path(str):
def __init__(self, *args, **kwargs):
super(Path, self).__init__(*args, **kwargs)
def ... | francescoinfante/identity | identity/common.py | Python | lgpl-3.0 | 1,124 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-11-28 15:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20171121_2210'),
]
operations = [
migrations.AlterField(
... | overture-stack/enrolment | enrolment-service/enrol/core/migrations/0003_auto_20171128_1516.py | Python | agpl-3.0 | 510 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
from django.contrib.contenttypes.models import ContentType
from django.core import urlresolvers
from django.db import models
DEFAULT_WIDTH = 300
DEFAULT_MAX_HEIGHT = 600
class DjangoAdminDialog(models.Model):
class ... | quiqueporta/django-admin-dialog | django_admin_dialog/models.py | Python | gpl-2.0 | 1,297 |
# BSD 3-Clause License
#
# Copyright (c) 2016-21, University of Liverpool
# 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 notic... | rigdenlab/conkit | conkit/io/_cache.py | Python | bsd-3-clause | 5,592 |
# -*- coding: utf-8 -*-
import unittest
import phandim
class TestPhanDim(unittest.TestCase):
"""
Unit tests to check phantom dimensions
"""
def test_constructor1(self):
bx = [1,2,3,4,5]
by = [3,2,5,1,6]
bz = [8,5,23,9,4,3]
pd = phandim.phandim(bx, by, bz)
... | Iwan-Zotow/runEGS | XcMCCore_Tests/test_phandim.py | Python | apache-2.0 | 1,516 |
"""
Universidad Nacional de La Matanza
Catedra Lenguajes y Compiladores - 2013
Mariano Francischini, Alejandro Giorgi, Roberto Bravo
TP Compilador - Analizador Lexico
"""
# coding=utf8
import re
from ctypes import c_float
tokens = [
'ID',
'OP_AS',
'OP_SUMA',
'PR_WHILE',
'OP_DISTINTO',
'CTE_ENT',
'... | xbx/compilador_yacc | lexer.py | Python | mit | 10,492 |
#####################################################################################
# #
# Script to update Hostname #
# ... | davidcurrie/ci.docker.websphere-traditional | network-deployment/appserver/updateHostName.py | Python | apache-2.0 | 1,804 |
from .iview import IView, IViewModel
import asyncio
import websockets
import subprocess
import os
from .model import Model
import json
from collections import OrderedDict
class WebView(IView):
"""
Web-based browser window.
"""
def __init__(self, address, port):
super(WebView, self).__init__()... | pdyban/dicombrowser | dicomviewer/webview.py | Python | apache-2.0 | 2,327 |
'''
SAMPLE INPUT
Hello World
PESSE ACM
Good Day
OUTPUT
World Hello
ACM PESSE
Day Good
'''
import sys
for line in sys.stdin:
line=line.strip("\n")
s=list(line.split(' '))
s.reverse()
for x in s:
print x,
print | yusufshakeel/Python-Project | example/commanLine_read_file.py | Python | mit | 219 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
from math import *
TESTPREAMBLE()
try:
# DEFAULT CONSTRUCTOR AND STRING CONVERTER
print("test 0 : default constructor and string converter")
# Default constructor
matrix0 = ComplexMatrix()
# String converter
... | dubourg/openturns | python/test/t_ComplexMatrix_std.py | Python | gpl-3.0 | 4,896 |
import numpy as np
import json
from query import *
def timeline_json(events, dates, query):
"""
"""
tl_json = { "events": [] }
num = 0
for event in events:
num = num+1
d_start = dates[event[0]-1]
d_end = dates[event[1]-1]
# Ajout de l'article marquant de l'interv... | jcrouzet/temporal-search-engine | src/timeline_json.py | Python | gpl-3.0 | 1,218 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/boundary/__init__.py | Python | lgpl-3.0 | 1,503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import find_packages
from setuptools import setup
install_requires = [
'GitPython >= 2.0.8, < 2.1',
'MarkupSafe >= 0.23, < 1.0',
'PyYAML >= 3.11, < 4.0',
'decora... | silverbp/master-builder | setup.py | Python | apache-2.0 | 1,465 |
# Copyright (c) 2013 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 ... | blueboxgroup/neutron | neutron/plugins/ml2/driver_api.py | Python | apache-2.0 | 35,825 |
# Copyright 2017 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... | googlecodelabs/tensorflow-for-poets-2 | scripts/label_image.py | Python | apache-2.0 | 4,889 |
from __future__ import print_function
#from unzip import unzip
import os, pdb, glob
def unpack_dir( extns=[ 'tgz', 'tar' ] ):
"""
Unpacks all the archives in the current directory with
the extensions listed in the keyword argument list.
This is routine currently fairly experimental and I tend
to us... | tomevans/utils | unpack_dir.py | Python | gpl-2.0 | 1,435 |
import sys
from aaProbSolver import *
import re
import glob
import math
#'L' is the reference codon
aaList = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y']
#coef file and folders
firstOrderCoefFile = '/home/kwang2/scripts/aaCodonProbPred/coefs/aa_sa_coef.txt'
firstCondSecondFiles = ... | learking/aaCodonProbPred | predAAprob/predAAprob_hpc_TD10.py | Python | gpl-2.0 | 5,647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.