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
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
"""
clang/llvm detection.
"""
import os, sys
from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_clang(conf):
"""
... | Gnomescroll/Gnomescroll | server/waflib/Tools/clang.py | Python | gpl-3.0 | 4,637 |
#!/usr/bin/env python
import subprocess
NUM_TESTS = 0
FAILED_TESTS = []
def debug(m):
sys.stderr.write('DEBUG: ')
sys.stderr.write(m)
sys.stderr.write('\n')
def error(m):
sys.stderr.write('ERROR: ')
sys.stderr.write(m)
sys.stderr.write('\n')
def test_invoc(tag, invocation, result_dir):
gl... | bredelings/otcetera | tools/test_otc_tools.py | Python | bsd-2-clause | 5,281 |
from gpaw.atom.aeatom import AllElectronAtom, c
from gpaw.test import equal
Z = 79 # gold atom
kwargs = dict(alpha2=150 * Z**2, ngauss=100)
# Test Schroedinger equation:
aea = AllElectronAtom(Z, log=None)
aea.initialize(**kwargs)
errors = []
for channel in aea.channels:
channel.solve(-Z)
for n in range(7):
... | qsnake/gpaw | gpaw/test/aeatom.py | Python | gpl-3.0 | 921 |
# Copyright 2016 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 writing,... | axbaretto/beam | sdks/python/.tox/py27gcp/lib/python2.7/site-packages/google/oauth2/flow.py | Python | apache-2.0 | 9,887 |
'''
NMF optimization for dynamic brain networks
Uses cross-validation to find the optimal parameter set for a collection of
network adjacency matrices.
Created by: Ankit Khambhati
Change Log
----------
2016/12/25 - Implemented consensus detection
'''
import numpy as np
import nmf
import nnls
import matrix_utils
imp... | akhambhati/Echobase | Echobase/Network/Partitioning/Subgraph/optimize_nmf.py | Python | gpl-3.0 | 14,076 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.translation impor... | arth-co/shoop | shoop/admin/modules/sales_units/views/list.py | Python | agpl-3.0 | 1,030 |
from cs231n.layers import *
from cs231n.fast_layers import *
def affine_relu_forward(x, w, b):
"""
Convenience layer that perorms an affine transform followed by a ReLU
Inputs:
- x: Input to the affine layer
- w, b: Weights for the affine layer
Returns a tuple of:
- out: Output from the ... | vermouth1992/tf-playground | analysis/cs231n/layer_utils.py | Python | apache-2.0 | 4,341 |
from metakernel.tests.utils import (get_kernel, get_log_text,
clear_log_text, EvalKernel, has_network)
import re
import os
from metakernel.config import get_local_magics_dir
import pytest
filename = get_local_magics_dir() + os.sep + "cd_magic.py"
@pytest.mark.skipif(not has_netw... | Calysto/metakernel | metakernel/magics/tests/test_install_magic_magic.py | Python | bsd-3-clause | 857 |
from setuptools import setup, find_packages
setup(
name='flask_truss',
version='0.0.1',
packages=find_packages(),
zip_safe=False,
include_package_data=True,
package_data={
'templates': 'flask_truss/templates/*',
'static': 'flask_truss/static/*'
},
install_requires=[
... | mjonescase/flask-truss | setup.py | Python | mit | 968 |
# -*- coding: utf-8 -*-
#
# PycURL documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 4 03:14:18 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | andrewleech/script.module.pycurl | lib/pycurl/pycurl-7.19.5.1/doc/conf.py | Python | lgpl-2.1 | 6,032 |
#!/usr/bin/env python
# encoding: utf-8
import io
import struct
class ByteBuffer(io.BytesIO):
def makefmt(self, width, littleEndian=False):
fmt = '<' if littleEndian else '>'
if width == 8: fmt += 'B'
elif width == 16: fmt += 'H'
elif width == 32: fmt += 'I'
else: fmt += ... | Yanjing123/myicons | fontbuilder/ttf2eot/bytebuffer.py | Python | bsd-2-clause | 1,339 |
# -*- coding: utf-8 -*-
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
def style(s, style):
return style + s + '\033[0m'
def green(s):
return style(s, '\033[92m')
def blue(s):
retur... | ccxt/ccxt | examples/py/symbols.py | Python | mit | 2,018 |
# coding: utf-8
"""
MIT License
Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
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 limit... | epeios-q37/epeios | other/exercises/Hangman/workshop/fr/b.py | Python | agpl-3.0 | 1,311 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from privagal.timeline.models import Timeline
from .models import Token
class AuthTokenMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
key = request.GET.get('token', None)
if key is None:
... | ychab/privagal | privagal/core/middleware.py | Python | bsd-3-clause | 748 |
#! /usr/bin/env python
'''
This file is part of RTSLib.
Copyright (c) 2011-2013 by Datera, 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... | agrover/rtslib-fb | setup.py | Python | apache-2.0 | 1,238 |
from django.conf.global_settings import MIDDLEWARE_CLASSES
from settings_default import INSTALLED_APPS
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = 'please-generate-your-secret-key'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'sqlite.db',
}
}
# FACEBOOK_APP... | teknolab/django.org.tr | project/local_settings-example.py | Python | bsd-3-clause | 1,149 |
#!/usr/bin/env python
import subprocess
import RPi.GPIO as GPIO
channel=24
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(channel, GPIO.FALLING)
subprocess.call(['/sbin/reboot']) | davidecaminati/Domotics-Raspberry | Software/utility/restart.py | Python | lgpl-3.0 | 239 |
import unittest
def fib(n):
if n==0: return 0
elif n==1: return 1
else: return fib(n-1) + fib(n-2)
class TestFib(unittest.TestCase):
def test_fib(self):
self.assertEqual(fib(0), 0)
self.assertEqual(fib(1), 1)
self.assertEqual(fib(2), 1)
self.assertEqual(fib(3), 2)
... | maxtangli/sonico | language/python/tutorial/test.py | Python | mit | 570 |
# -*- coding: UTF-8 -*-
# bp_v1
from .api_v1 import bp_v1
# bp_v2
from .api_v2 import bp_v2
__author__ = 'lpe234'
"""
Controller
"""
| lpe234/sanicDemo | controller/__init__.py | Python | gpl-3.0 | 137 |
def test_feed(client, release):
response = client.get('/feeds/releases/')
assert response.status_code == 200
def test_str(release):
assert str(release) == release.version
def test_absolute_url(release):
assert release.version, release.get_absolute_url()
def test_iso_url(release):
url = release... | archlinux/archweb | releng/tests/test_models.py | Python | gpl-2.0 | 1,204 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | andrewkaufman/gaffer | python/GafferArnoldTest/ArnoldRenderTest.py | Python | bsd-3-clause | 51,297 |
# 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 collections
PortPair = collections.namedtuple('PortPair', ['local_port', 'remote_port'])
PortPairs = collections.namedtuple('PortPairs', ['http', 'h... | Chilledheart/chromium | tools/telemetry/telemetry/internal/forwarders/__init__.py | Python | bsd-3-clause | 1,513 |
from django.db import connection
from collections import namedtuple
def fetch_assessment_info():
cursor = connection.cursor()
cursor.execute('DROP VIEW ASSESSMENT_VIEW')
cursor.execute('DROP VIEW FINAL_VIEW')
cursor.execute('CREATE VIEW ASSESSMENT_VIEW AS SELECT child_id_id, aiserverapp_skill.skill_nam... | PayPal-Opportunity-Hack-Chennai-2015/AID-India | server/aiserverproj/aiserverapp/assessment_info_fetcher.py | Python | apache-2.0 | 2,503 |
#!/usr/bin/env python
# coding=utf-8
class Node(object):
def __init__(self, data=None):
self.data = data
self.next_node = None
def get_data(self):
return self.data
def set_data(self, data):
self.data = data
def get_next(self):
return self.next_node
def s... | itsmecoder/cs_fundamentals | data_structures/single_linked_list.py | Python | mit | 3,333 |
import re
import string
import logging
import random
from autotest.client.shared import error, utils
from virttest import qemu_monitor, storage, utils_misc, env_process, data_dir
from virttest import qemu_qtree
def run_physical_resources_check(test, params, env):
"""
Check physical resources assigned to KVM v... | spiceqa/virt-test | qemu/tests/physical_resources_check.py | Python | gpl-2.0 | 13,300 |
# -*- coding: utf-8 -*-
"""
wakatime.session_cache
~~~~~~~~~~~~~~~~~~~~~~
Persist requests.Session for multiprocess SSL handshake pooling.
:copyright: (c) 2015 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import logging
import os
import pickle
import sys
import traceback
try:
... | Djabbz/wakatime | wakatime/session_cache.py | Python | bsd-3-clause | 2,731 |
# router-bot
# Copyright (C) 2017 quasiyoke
#
# You should have received a copy of the GNU Affero General Public License v3
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import asyncio
import logging
import re
import telepot
from .error import HumanSenderError
LOGGER = logging.getLogger('rou... | quasiyoke/router-bot | router_bot/human_sender.py | Python | agpl-3.0 | 2,468 |
#----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | GENI-NSF/gram | src/gram/am/gram/gen_metadata.py | Python | mit | 21,656 |
#!/usr/bin/env python
'''
python copy_and_post_process_bin.py source_bin_folder target_bin_folder
'''
import os
import sys
from glob import glob
import subprocess
# relative to this script
# TODO: use env?
RECIPE_DIR = os.getenv('RECIPE_DIR',
os.path.abspath(os.path.dirname(__file__) + '/../../'))
script_tem... | Amber-MD/ambertools-conda-build | outdated/recipe/scripts/patch_amberhome/copy_and_post_process_bin.py | Python | mit | 7,437 |
#-*- coding: utf-8 -*-
"""
This package is an implementation of the OpenID specification in
Python. It contains code for both server and consumer
implementations. For information on implementing an OpenID consumer,
see the C{L{openid.consumer.consumer}} module. For information on
implementing an OpenID server, see t... | arantebillywilson/python-snippets | microblog/flask/lib/python3.5/site-packages/openid/__init__.py | Python | mit | 1,371 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald sample client, for debugging purpose
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "Lic... | librallu/cohorte-herald | python/client.py | Python | apache-2.0 | 1,895 |
try:
from django.conf.urls import url
except ImportError:
# django 2.0
from django.urls import re_path as url
from drf_batch_requests import views
app_name = 'drt_batch_requests'
urlpatterns = [
url('^', views.BatchView.as_view())
]
| roman-karpovich/drf-batch-requests | drf_batch_requests/urls.py | Python | mit | 252 |
class StatisticsException(Exception):
pass
class NoCredentialsVariableException(StatisticsException):
pass
class NoCredentialsFileException(StatisticsException):
pass
| paramsingh/listenbrainz-server | listenbrainz/stats/exceptions.py | Python | gpl-2.0 | 182 |
import copy
import cpp
import cpp_file_parser
import util
def adjust_table_arguments_tokens(classname, arguments):
for arg in arguments:
in_arg = False
for token in arg.tokens:
if token.spelling == classname:
in_arg = True
break
if in_arg:
... | lubkoll/friendly-type-erasure | type_erasure/table_detail.py | Python | mit | 12,462 |
#!/usr/bin/env python2
# The MIT License (MIT)
#
# Copyright (c) 2015 Kyle Barlow
#
# 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 righ... | Kortemme-Lab/klab | klab/latex/latex_report.py | Python | mit | 14,819 |
"""Builds a DRAGNN graph for local training."""
from abc import ABCMeta
from abc import abstractmethod
import tensorflow as tf
from tensorflow.python.platform import tf_logging as logging
from dragnn.python import dragnn_ops
from dragnn.python import network_units
from syntaxnet.util import check
from syntaxnet.util... | hang-qi/models | syntaxnet/dragnn/python/component.py | Python | apache-2.0 | 23,212 |
import asyncio
import pytest
import websockets
from test_fixtures import root_uri
pytestmark = pytest.mark.asyncio
async def test_no_subprotocol_is_negotiated_by_default(root_uri):
uri = root_uri + "/echo"
subprotocols = ["my_protocol"]
async with websockets.connect(uri, subprotocols=subprotocols) as c... | jchampio/apache-websocket | test/pytest/test_subprotocol_negotiation.py | Python | apache-2.0 | 1,425 |
# Hangman Game
# The classic game of Hangman. The computer picks arandom word
# and the player wrong to guess it, one letter at a time. If the player
# can't gues the wor in time, the little stick figure gets hanged
# imports
import random
# constants
HANGMAN = (
"""
------
| |
|
|
|
|
|
|
|
---------
""",
"""
---... | rob-nn/python | first_book/hangman.py | Python | gpl-2.0 | 1,870 |
#!/opt/yinhe/venv1/bin/python
"""PILdriver, an image-processing calculator using PIL.
An instance of class PILDriver is essentially a software stack machine
(Polish-notation interpreter) for sequencing PIL image
transformations. The state of the instance is the interpreter stack.
The only method one will normally in... | yingshang/yinhe | venv1/bin/pildriver.py | Python | lgpl-3.0 | 15,521 |
# 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... | jbedorf/tensorflow | tensorflow/python/data/experimental/kernel_tests/parallel_interleave_test.py | Python | apache-2.0 | 28,891 |
from __future__ import division
import logging
import math
import os
import random
from collections import OrderedDict
from PIL import Image, ImageChops
from golem.core.fileshelper import has_ext
from golem.resource.dirmanager import get_test_task_path
from golem.task.taskstate import SubtaskStatus
from... | Radagast-red/golem | apps/blender/task/blenderrendertask.py | Python | gpl-3.0 | 24,885 |
"""
utilities.py
"""
from flask import url_for
def _get_project_path():
""" Return absolute path to planet_express, without trailing slash"""
# Assumes that the project folder is one up from here, at ./..
import sys, os
my_folder = os.path.dirname(os.path.realpath(__file__))
parent_folder = os.pa... | MarlboroCollegeComputerScience/flask_sql_planet_express | src/utilities.py | Python | mit | 503 |
#!/usr/bin/python
# TODO: issues with new oauth2 stuff. Keep using older version of Python for now.
# #!/usr/bin/env python
import subprocess
import praw
import datetime
import pyperclip
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringI... | foobarbazblarg/stayclean | stayclean-2017-may/serve-challenge-with-flask.py | Python | mit | 10,823 |
import string
def print_rangoli(size):
alpha = string.ascii_lowercase
li = []
for i in range(size):
s = '-'.join(alpha[i:size])
li.append((s[::-1]+ s[1:]).center(4*n - 3, '-'))
print('\n'.join(li[:0:-1] + li))
if __name__ == '__main__':
n = int(input())
print_ran... | MrinmoiHossain/HackerRank | Python/Strings/Alphabet Rangoli.py | Python | mit | 328 |
import json
from .metadata import wrap_dict, wrap_raw_json
class Property(object):
def __init__(self, type=str, name=None, default=None, enum=None,
required=False, validator=None, wrap=False, none=None):
self.name = name
self.type = enum if enum else type
self.enum = enum
... | eblade/images5 | images/types.py | Python | mit | 6,439 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Steve English <steve.english@navetas.com> #
# Copyright 2012 Vincent Jacques <vincent@vincent-ja... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/github/AuthenticatedUser.py | Python | apache-2.0 | 46,818 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import logging
import logging.config
import pprint
import proteindf_bridge as bridge
import proteindf_tools as pdf
import qclobot as qclo
def assign_charges(atomgroup, charges, charge_index=0):
assert(isinstance(atomgroup, bridge.AtomGroup... | ProteinDF/QCLObot | scripts/qc-frame-checkconv.py | Python | gpl-3.0 | 2,133 |
"""Defines the SMEFT class that provides the main API to smeftrunner."""
from . import rge
from . import io
from . import definitions
from . import beta
from . import smpar
import pylha
from collections import OrderedDict
from math import sqrt
import numpy as np
import ckmutil.phases, ckmutil.diag
class SMEFT(object)... | DsixTools/python-smeftrunner | smeftrunner/classes.py | Python | mit | 11,842 |
##########################################################################
#
# Copyright (c) 2010, Image Engine Design 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:
#
# * Redistribu... | lento/cortex | test/IECore/ops/classVectorParameterTest/classVectorParameterTest-2.py | Python | bsd-3-clause | 2,288 |
"""
The latest version of this package is available at:
<http://github.com/jantman/biweeklybudget>
################################################################################
Copyright 2017 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of biweeklybudget, also known as bi... | jantman/biweeklybudget | biweeklybudget/models/fuel.py | Python | agpl-3.0 | 6,945 |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | gluke77/rally | tests/unit/common/objects/test_credential.py | Python | apache-2.0 | 3,790 |
# Copyright 2015 Dell 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 agree... | dellstorage/storagecenter-flocker-driver | dell_storagecenter_driver/dell_storagecenter_blockdevice.py | Python | apache-2.0 | 14,970 |
from sklearn.ensemble import RandomForestClassifier
class RFClassificationModel(object):
def __init__(self,reg_model=None):
self.reg_model = RandomForestClassifier(n_estimators=100,n_jobs=2)
def Train(self,x,y):
self.reg_model.fit(x,y)
def GetClassifier(self):
return self.reg_mod... | imironica/Fraud-Detection-System | FraudDetection.ML/AI/classifican_models.py | Python | mit | 412 |
import logging
from typing import Sequence, Optional
import numpy as np
from qcodes import Parameter, ArrayParameter
from qcodes.instrument.channel import MultiChannelInstrumentParameter
logger = logging.getLogger(__name__)
class Alazar0DParameter(Parameter):
def __init__(self,
name: str,
... | qdev-dk/Majorana | alazar_controllers/alazar_multidim_parameters.py | Python | gpl-3.0 | 15,971 |
# -*- coding: utf-8 -*-
import arrow
import datetime
import ujson
import timeit
from flask.ext.login import login_required
from flask import (
Blueprint, render_template
)
from feedback.dashboard.vendorsurveys import (
get_rating_scale, get_surveys_by_role,
get_surveys_by_completion, get_surveys_by_pur... | codeforamerica/mdc-feedback | feedback/dashboard/views.py | Python | mit | 18,098 |
from rest_framework import generics, permissions as drf_permissions
from api.base.views import DeprecatedView
from framework.auth.oauth_scopes import CoreScopes
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
from api.base import permissions as base_permissions
from api.base.views import JSONAPIBase... | icereval/osf.io | api/metaschemas/views.py | Python | apache-2.0 | 2,756 |
#!../../../../../virtualenv/bin/python3
# -*- coding: utf-8 -*-
# NB: The shebang line above assumes you've installed a python virtual environment alongside your working copy of the
# <4most-4gp-scripts> git repository. It also only works if you invoke this python script from the directory where it
# is located. If th... | dcf21/4most-4gp-scripts | src/scripts/visualisation/stellar_parameters/report_label_coverage.py | Python | mit | 3,019 |
# Release information about calabro
version = "1.0"
# description = "Your plan to rule the world"
# long_description = "More description about your plan"
# author = "Your Name Here"
# email = "YourEmail@YourDomain"
# copyright = "Vintage 2006 - a good year indeed"
# if it's open source, you might want to specify the... | CarlosGabaldon/calabro | calabro/release.py | Python | mit | 422 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-03 04:21
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('reports', '0022_auto_20170503_1420'),
... | MartinPaulo/ReportsAlpha | reports/migrations/0023_auto_20170503_1421.py | Python | gpl-3.0 | 463 |
#########################################################################
#
# __init__
#
# Copyright (c) 2011 Daniel Berenguer <dberenguer@usapiens.com>
#
# This file is part of the panStamp project.
#
# panStamp is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | panStamp/python_tools | pyswap/swap/__init__.py | Python | gpl-2.0 | 1,099 |
from django.contrib import admin
from quiz_data.models import Test, Question, Answer, QuestionType
admin.site.register(Test)
class AnswerInline(admin.TabularInline):
model = Answer
extra = 1
class QuestionAdmin(admin.ModelAdmin):
inlines = [AnswerInline]
admin.site.register(Question, QuestionAdmin)
admin.site.r... | eminhalimovic/quiz | quiz_data/admin.py | Python | gpl-2.0 | 372 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# This code is part of the CityGML2OBJs package
# Copyright (c) 2014
# Filip Biljecki
# Delft University of Technology
# fbiljecki@gmail.com
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associ... | tudelft3d/CityGML2OBJs | generateMTL.py | Python | mit | 2,113 |
#!/usr/bin/env python
#
# Copyright 2011 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... | zenlambda/aeta | lib/gaedriver/gaedriver.py | Python | apache-2.0 | 24,163 |
"""Loopback tests for the GPIO pins
Topology:
- connect P2 to P3
- connect P4 to P5
- P0 and P1 are left free to be jumpered to the LED and button
- P6 and P7 are reserved for testing I2C and SPI interrupts
"""
from quick2wire.gpio import pins, pi_header_1, In, Out
from time import sleep
import pytest
def inve... | omegix/ML256-Door-Auth | lib/quick2wire/test_gpio_loopback.py | Python | gpl-2.0 | 1,206 |
#!/usr/bin/env python
"""***************************************************************************
**
** Copyright (C) 2005-2005 Trolltech AS. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** Licen... | cherry-wb/SideTools | examples/painting/basicdrawing/basicdrawing.py | Python | apache-2.0 | 14,784 |
#!/usr/bin/env python
__author__ = "Kishori M Konwar"
__copyright__ = "Copyright 2013, MetaPathways"
__credits__ = ["r"]
__version__ = "1.0"
__maintainer__ = "Kishori M Konwar"
__status__ = "Release"
"""Contains general utility code for the metapaths project"""
try:
from shutil import rmtree
from optparse i... | Koonkie/MetaPathways_Python_Koonkie.3.0 | libs/python_modules/diagnostics/tools.py | Python | mit | 5,463 |
from django.conf.urls import patterns, url
urlpatterns = patterns('widgy.contrib.widgy_mezzanine.views',
url('^preview/(?P<node_pk>[^/]+)/$', 'preview'), # undelete
url('^preview-page/(?P<node_pk>[^/]+)/(?P<page_pk>[^/]+)/$', 'preview'),
url('^form-page/(?P<form_node_pk>[^/]*)/(?P<page_pk>[^/]+)/$', 'hand... | j00bar/django-widgy | widgy/contrib/widgy_mezzanine/urls.py | Python | apache-2.0 | 542 |
# Standard imports
import numpy as np
import urllib,json,csv
import xml.etree.cElementTree as ET
import urllib2
import time
# Our imports
import emission.core.common as ec
import emission.core.get_database as edb
import emission.analysis.modelling.tour_model.trajectory_matching as eatm
def find_near(lst,pnt,radius):
... | joshzarrabi/e-mission-server | emission/analysis/modelling/tour_model/trajectory_matching/route_matching.py | Python | bsd-3-clause | 20,594 |
# -*- coding: utf-8 -*-
"""'toys, models' part of product categories dictionary.
Must hold subcategories of 'toys, models'
category in the form of python dictionary data type.
"""
toys_models = {('toys, models', 'игрушки, модели'): {
('dolls, accessories', 'куклы, аксессуары'): {
('accessories', 'аксессуа... | redmoo-info/proddict | ru/toys_models.py | Python | mit | 8,253 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Chart calculations.
"""
from decimal import Decimal
import swisseph as swe
from oroboros.core import cfg
from oroboros.core import db
from oroboros.core.chartdate import ChartDate
from oroboros.core.filters import Filter
from oroboros.core.planets import all_planet... | astrorigin/oroboros | oroboros/core/chartcalc.py | Python | gpl-3.0 | 19,090 |
from sqlalchemy.testing import eq_, is_, is_not_
from sqlalchemy import testing
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy import Integer, String, ForeignKey, bindparam, inspect
from sqlalchemy.orm import backref, subqueryload, subqueryload_all, \
mapper, relationship, clear_mappers, create... | rclmenezes/sqlalchemy | test/orm/test_subquery_relations.py | Python | mit | 59,217 |
import os
from sanic import Sanic
from sanic.log import log
from sanic import response
from sanic.exceptions import ServerError
app = Sanic(__name__)
@app.route("/")
async def test_async(request):
return response.json({"test": True})
@app.route("/sync", methods=['GET', 'POST'])
def test_sync(request):
ret... | Tim-Erwin/sanic | examples/try_everything.py | Python | mit | 2,556 |
import time
import math
global c,r
st = time.time()
def sumfact(i):
if i in c: return c[i]
sf = sum([math.factorial(int(x)) for x in str(i)])
c[i] = sf
return sf
c = {}
cnt = 0
for i in range(10**6):
n=i
l=[n]
while len(l)<61:
n = sumfact(n)
if sumfact(n)==n: break
... | shashankp/projecteuler | 74.py | Python | mit | 477 |
#!/usr/bin/env python3
import subprocess
import sys
import re
HEX_RE = re.compile(r"\(instr-addr [0-9a-fA-F]+\)")
LINE_RE = re.compile(r"\(line-num [0-9]+\)")
def sanitize(string):
return HEX_RE.sub("<addr>", LINE_RE.sub("line", string))
def compare_results(actual, expected):
# print("Comparing: {} and {}".fo... | uwplse/herbgrind | bench/test.py | Python | gpl-3.0 | 2,554 |
import unittest
class TestFunctions(unittest.TestCase):
def test_coerce_mongo_param(self):
from stubo.model.db import coerce_mongo_param
self.assertEqual(8001, coerce_mongo_param('port', '8001'))
self.assertEqual(8001, coerce_mongo_param('port', 8001))
self.assertEqual(10, coerce_... | rusenask/stubo-app | stubo/model/tests/test_db.py | Python | gpl-3.0 | 1,135 |
from BaseTasksProvider import BaseTasksProvider
import logging
import threading, os, time, shutil
from settingscron import PANDA_LOGGER_PATH
class PandaLogsStorageCleanUp(BaseTasksProvider):
lock = threading.RLock()
logger = logging.getLogger(__name__ + ' PandaLogsStorageCleanUp')
def processPayload(self)... | PanDAWMS/panda-bigmon-core | core/cachecontroller/schedinstances/PandaLogsStorageCleanUp.py | Python | apache-2.0 | 694 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'SSHCommand',
# list of one or more ... | adaptivethreat/EmPyre | lib/modules/lateral_movement/multi/ssh_command.py | Python | bsd-3-clause | 3,809 |
# Simple OpenSG benchmark
from osgbench import *
# Define the Window's parameters
win=TestWindow()
win.setSize(300,300)
win.open()
# Create the scene
scene=Group()
nc=8
scene=Group()
for i in range(-nc,nc):
inode=Group()
scene.addChild(inode)
for j in range(-nc,nc):
jnode=Group()
inode.... | jondo2010/OpenSG | Tools/osgBench/test_hnodes.py | Python | lgpl-2.1 | 1,034 |
## pythonFlu - Python wrapping for OpenFOAM C++ API
## Copyright (C) 2010- Alexey Petrov
## Copyright (C) 2009-2010 Pebble Bed Modular Reactor (Pty) Limited (PBMR)
##
## 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 F... | alexey4petrov/pythonFlu | Foam/helper.py | Python | gpl-3.0 | 2,152 |
import itertools
class KSPElement(object):
new_id = itertools.count(1) # start at 1 to account for treeview iid cannot be 0
def get_text(self):
return self.__text
def set_text(self, value):
self.__text = value
def del_text(self):
del self.__text
... | dan2082/KSPData | models/ksp_element.py | Python | gpl-3.0 | 700 |
import state
class Simulation(object):
"""
Model simulation class
- Runs simulations
- Stores and loads simulation data
"""
def __init__(self, processes, states, steps):
"""
Sets up simulation and links processes and states.
:type steps: int
:param processes: Li... | fugufisch/wholecell | simulation.py | Python | mit | 2,968 |
"""Functions that handle alignment, padding, widths, etc."""
import unicodedata
def string_width(string):
"""Get the visible width of a unicode string.
Some CJK unicode characters are more than one byte unlike ASCII and latin unicode characters.
From: https://github.com/Robpol86/terminaltables/pull/9
... | BillWang139967/zabbix_manager | ZabbixTool/lib_zabbix/w_lib/terminaltables/width_and_alignment.py | Python | apache-2.0 | 2,629 |
#Day 4: Class vs. Instance
class Person:
def __init__(self,initialAge):
# Add some more code to run some checks on initialAge
self.age = 0
if initialAge < 0:
print('Age is not valid, setting age to 0.')
else:
self.age = initialAge
... | JLJTECH/TutorialTesting | hackerrank/30 Days of Code/Day 4/classVsinstance.py | Python | mit | 744 |
#!/usr/bin/env python
__author__ = 'James Johnson'
__version__ = '1.0.0'
class DependencyBuilderException(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
class DependencyisNullorNoneException(DependencyBuilderException):
def __init__(self):
DependencyBuilderException.__init... | excellentingenuity/dependencybuilder | dependencybuilder/dependencybuilderexceptions.py | Python | bsd-3-clause | 561 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import pytest # type: ignore
from _pytest.monkeypatch import MonkeyPatch # type: ignore
import os
import tempfile
import hashlib
from zipfile import ZipFile
from monty.json import MontyDecode... | gVallverdu/pymatgen | pymatgen/io/vasp/tests/test_sets.py | Python | mit | 57,559 |
import argparse
import collections
import json
import logging
import pickle
import sys
# ModuleNotFoundError is new in 3.6; older versions will throw SystemError
if sys.version_info < (3, 6):
ModuleNotFoundError = SystemError
try:
from . import util
except (ModuleNotFoundError, ImportError) as e:
import u... | rsennrich/nematus | nematus/config.py | Python | bsd-3-clause | 61,929 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from ..model import ModelView, ModelSQL, ModelStorage, fields
from ..pool import Pool
from ..cache import Cache
class SafeURLs(ModelSQL, ModelView):
"SafeURLs"
_name = '... | mediafactory/tryton_core_daemon | trytond/ir/browser.py | Python | gpl-3.0 | 812 |
from litex.gen import *
from litex.gen.genlib.io import CRG
from litex.gen.genlib.resetsync import AsyncResetSynchronizer
from litex.gen.genlib.misc import timeline
from litex.soc.interconnect.csr import *
from litex.soc.interconnect import wishbone
from litex.soc.integration.soc_core import *
from litex.soc.cores.ua... | cr1901/HDMI2USB-litex-firmware | targets/netv2/bridge_pcie.py | Python | bsd-2-clause | 3,563 |
"""This file contains code used in "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import matplotlib.pyplot as pyplot
import thinkplot
import numpy
import csv
import r... | AllenDowney/ThinkBayes2 | scripts/species.py | Python | mit | 52,932 |
from json import load
# from lingv.index import index
from pymystem3 import Mystem
def _to_set(mystem_results):
rez = []
for analysis in mystem_results:
try:
rez += [analysis['analysis'][0]['lex']]
except IndexError:
pass
except KeyError:
pass
return set(rez)
def index(text, title, mystem = Mystem()... | daniel-kurushin/rpd-pnipu | database/subjects.py | Python | gpl-3.0 | 2,352 |
from behave import when, then
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
@when('we visit "{site}"')
def step1(context,... | raulpush/monitorizare-site | features/steps/steps.py | Python | apache-2.0 | 2,456 |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .fields import HexIntegerField
class Device(models.Model):
name = models.CharField(max_length=255, verbose_name=_("Name"), blank=True, null=True)
active = models.BooleanField(verbose_name=_("Is... | pcsforeducation/incrowd | incrowd/push_notifications/models.py | Python | apache-2.0 | 3,272 |
#!/usr/bin/python
# 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/.
from __future__ import unicode_literals
import subprocess
import sys
from os import path
from buildco... | eventql/eventql | deps/3rdparty/spidermonkey/mozjs/build/compare-mozconfig/compare-mozconfigs-wrapper.py | Python | agpl-3.0 | 2,576 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framework.test_framework import BitcoinTestFramework
from... | cryptoprojects/ultimateonlinecash | test/functional/rpcnamedargs.py | Python | mit | 1,206 |
from copy import deepcopy, copy
import os.path
import urllib.parse
import urllib.request
import hashlib
import json
import setuptools.archive_util
import shutil
import collections
import re
from functools import partial
from glob import glob
def addDefaults(config, defaults):
queue = [(config, defaults)]
whi... | torotil/dbuild.py | drupy/objects.py | Python | gpl-3.0 | 17,114 |
# -*- coding: utf-8 -*-
#
# S4 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 31 12:59:38 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | gevero/S4 | doc/source/conf.py | Python | gpl-2.0 | 9,400 |
# ext/declarative/api.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Public API functions and helpers for declarative."""
from ...schema impor... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/sqlalchemy/ext/declarative/api.py | Python | gpl-2.0 | 17,780 |
#!/usr/bin/env python
#The rapros package is a native ROS-Simulink package, that allows Rapid Prototyping
#task. Rapid Prototyping is the set of procedures which helps to design and to develop
#control algorithms for robotics applications, it is a general concept which includes
#both Processor in the Loop and Hardwa... | gionatacimini/rapros | examples/rapros_loopback/scripts/rapros_loopback.py | Python | bsd-3-clause | 5,202 |
from pdb import pm
from miasm2.analysis.sandbox import Sandbox_Win_x86_64
# Insert here user defined methods
# Parse arguments
parser = Sandbox_Win_x86_64.parser(description="PE sandboxer")
parser.add_argument("filename", help="PE Filename")
options = parser.parse_args()
# Create sandbox
sb = Sandbox_Win_x86_64(opti... | stephengroat/miasm | example/jitter/sandbox_pe_x86_64.py | Python | gpl-2.0 | 402 |
"""Tests for collect_types"""
from __future__ import (
absolute_import,
division,
print_function,
)
import contextlib
import json
import os
import sched
import sys
import time
import unittest
from collections import namedtuple
from threading import Thread
from six import PY2
from typing import (
Any,
... | dropbox/pyannotate | pyannotate_runtime/tests/test_collect_types.py | Python | apache-2.0 | 20,862 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.