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 |
|---|---|---|---|---|---|
"""
The Kernel is a set of operations to be performed on a set of data.
"""
#Holds information about variables
class Variable:
#A unique variable identifier
index = 0
def __init__(self, name=None, is_arg=False, is_uniform=False, is_fuse=False, is_temp=False, is_mask=False, stride=1, value=None):
i... | undefx/vecpy | kernel.py | Python | mit | 8,255 |
# -*- coding: utf-8 -*-
class Person(object):
""" A simple class representing a person object.
"""
#initialize name, ID number, city
def __init__(self, fname, lname, ID, city):
self.__ID = ID
self.__first_name = fname
self.__last_name = lname
self.__city = city
d... | janusnic/21v-python | unit_08/4.py | Python | mit | 1,294 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-10 06:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tableaubord', '0061_auto_20170509_2255'),
('tableaubord', '0055_auto_20170509_2031'),
]
... | MLOrsini/ProjetWEB | INSport/tableaubord/migrations/0062_merge_20170510_0616.py | Python | gpl-3.0 | 344 |
# electronics.py ---
#
# Filename: electronics.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Wed Feb 22 00:53:38 2012 (+0530)
# Version:
# Last-Updated: Tue Jul 10 10:28:40 2012 (+0530)
# By: subha
# Update #: 221
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
... | BhallaLab/moose | moose-examples/squid/electronics.py | Python | gpl-3.0 | 3,885 |
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gobject
# TODOs
# * refresh is unstable
# * auto video embed is unstable (black contours ? lag ?)
class VideoWidget(gtk.DrawingArea):
def __init__(self):
gtk.DrawingArea.__init__(self)
self.imagesink = None
self.un... | luisbg/gst-introspection | gstgengui/gtk_controller.py | Python | lgpl-2.1 | 13,592 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from theano.compile import ViewOp
from theano.gradient import DisconnectedType
class DisconnectedGrad(ViewOp):
def grad(self, args, g_outs):
return [ DisconnectedType()() for g_out in g_outs]
def connection_pattern(self, node):
return [[False]]
... | zomux/deepy | deepy/core/disconnected_grad.py | Python | mit | 358 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: proxysql_manage_config
ver... | roadmapper/ansible | lib/ansible/modules/database/proxysql/proxysql_manage_config.py | Python | gpl-3.0 | 7,786 |
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "... | enigmamarketing/csf-allow-domains | usr/local/csf/bin/csf-allow-domains/dns/rdata.py | Python | mit | 15,713 |
import os
from PIL import Image
files = [];
for filename in os.listdir("./font_standard"):
if filename.endswith(".bmp"):
files.append(filename)
im = Image.new('RGB', (8 * len(files), 8), "#ffffff")
for index, file in enumerate(files):
bitmap_char = Image.open("./font_standard/" + file)
im.paste(... | rex64/unnamed-dungeon-crawler | tools/font_make.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 LambdaSoftware (<http://www.lambdasoftware.net>).
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | jaumemarti/l10n-spain-txerpa | __unported__/l10n_es_lopd/extension_hr.py | Python | agpl-3.0 | 1,896 |
import argparse
import sys
def main():
description = (
"Print instances in deploy_error/networking that never "
"went active"
)
parser = argparse.ArgumentParser(description=description)
args = parser.parse_args()
# Check environment
try:
import django
django.... | CCI-MOC/GUI-Backend | scripts/print_broken_instances.py | Python | apache-2.0 | 1,636 |
from django.test import SimpleTestCase
from ..utils import setup
class ListIndexTests(SimpleTestCase):
@setup({'list-index01': '{{ var.1 }}'})
def test_list_index01(self):
"""
List-index syntax allows a template to access a certain item of a
subscriptable object.
"""
... | DONIKAN/django | tests/template_tests/syntax_tests/test_list_index.py | Python | bsd-3-clause | 2,694 |
#! /usr/bin/env python
"""
Copyright [1999-2018] EMBL-European Bioinformatics Institute
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 requir... | Ensembl/cttv024 | lib/postgap/Utils.py | Python | apache-2.0 | 4,340 |
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type size: int
"""
self.__nums = nums
def reset(self):
"""
Resets the array to its original configuration and return it.
:rtype: List[int]
"""
return self... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/384_Shuffle_an_Array.py | Python | mit | 558 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | dochang/ansible | lib/ansible/plugins/callback/skippy.py | Python | gpl-3.0 | 1,319 |
#!/usr/bin/env python
import pprint
import re
import os, sys
import unittest
sys.path[0:0] = ['.', '..']
from pycparser import c_parser
from pycparser.c_ast import *
from pycparser.c_parser import CParser, Coord, ParseError
_c_parser = c_parser.CParser(
lex_optimize=False,
yacc_debug... | sideeffects/pycparser | tests/test_c_parser.py | Python | bsd-3-clause | 61,008 |
import base64
import functools
import platform
import sys
from . import file
from ..backend import KeyringBackend
from ..errors import PasswordDeleteError, ExceptionRaisedContext
from ..py27compat import unicode_str
from ..util import escape, properties
try:
# prefer pywin32-ctypes
from win32ctypes import pyw... | listamilton/supermilton.repository | plugin.video.supermiltonflix/lib/keyring/backends/Windows.py | Python | gpl-2.0 | 9,381 |
#!/usr/bin/python2
import kplugs
try:
kernel_func = r'''
STATIC("my_helper")
def my_function():
try:
my_helper()
print "OK"
except word as err:
print "Exception number: %d" % -err
raise err
def my_helper():
KERNEL_undefined_function()
'''
plug = kplugs.Plug(ip='127... | avielw/kplugs | examples/1.1/undefined_func_remote.py | Python | gpl-3.0 | 432 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003, 2004, 2005, 2006, 2007] [Juergen Hamel, D-32584 Loehne]
##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 yo... | CuonDeveloper/cuon | cuon_server/src/decodeutf-8.py | Python | gpl-3.0 | 1,877 |
import unittest
import io
class TestHTTPChannel(unittest.TestCase):
def _makeOne(self, sock, addr, adj, map=None):
from waitress.channel import HTTPChannel
server = DummyServer()
return HTTPChannel(server, sock, addr, adj=adj, map=map)
def _makeOneWithMap(self, adj=None):
if a... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/tests/test_channel.py | Python | apache-2.0 | 24,675 |
# Imports
import cv2
# Read image
img = cv2.imread("images/Moments/example.jpg")
# Convert to grayscale and apply thresholding
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret, th = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
# Find moments
M = cv2.moments(th, True)
print M
# Find Hu invariant ... | eyantrainternship/eYSIP_2015_Marker_based_Robot_Localisation | Task-4/src/moments.py | Python | cc0-1.0 | 364 |
from __future__ import print_function
import sys
import inspect
import importlib
import os.path as op
import json
from nipype2json import node2json
from nipype.interfaces.utility import Function
def custommodule2json(module_path, verbose, add_path):
sys.path.append(op.dirname(module_path))
module_to_import =... | TimVanMourik/Porcupine | utilities/parse_custom_module.py | Python | gpl-3.0 | 2,162 |
#!/usr/bin/env python
#
# generate-testbench.py - Generates a verilog testbench based on a provided
# verilog file. The testbench will require the inclusion of the "tb-macros.v"
# file included as part of this framework. This script will only work in a
# POSIX-like environment with standard shell tools.
#
# Veri... | pdear/verilib | pytools/generate_testbench.py | Python | lgpl-3.0 | 8,942 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Mayo Clinic
# 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 ... | cts2/rf2service | scripts/changeset.py | Python | bsd-3-clause | 3,597 |
# -*- coding: utf-8 -*-
#
# Cantera documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 12 11:43:09 2012.
#
# 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... | Cantera/cantera-svn | doc/sphinx/conf.py | Python | bsd-3-clause | 8,429 |
# -*- coding: utf-8 -*-
"""
sphinx.util.inspect
~~~~~~~~~~~~~~~~~~~
Helpers for inspecting Python modules.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
# this imports the standard library inspect module without resorting ... | SurfasJones/icecream-info | icecream/lib/python2.7/site-packages/sphinx/util/inspect.py | Python | mit | 5,184 |
#
# Copyright 2008-2014 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# Numina 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 l... | Pica4x6/numina | numina/array/tests/test_fowler_cy.py | Python | gpl-3.0 | 8,834 |
"""Tests for the kraken integration."""
from unittest.mock import patch
from pykrakenapi.pykrakenapi import CallRateLimitError, KrakenAPIError
from homeassistant.components.kraken.const import DOMAIN
from .const import TICKER_INFORMATION_RESPONSE, TRADEABLE_ASSET_PAIR_RESPONSE
from tests.common import MockConfigEnt... | jawilson/home-assistant | tests/components/kraken/test_init.py | Python | apache-2.0 | 2,203 |
from typing import Iterable, NamedTuple, List
from re import compile
from collections import namedtuple
from subprocess import getoutput
from pathlib import Path
from sys import exit
import logging
import click
SUFFIX = "g2sd"
RC_PARSE_ERR = 1
NAME_RE = compile("menuentry '(?P<name>[\w\d\W\D]*)' -")
KERNEL_RE = com... | thismachinechills/grub2systemd | g2sd/g2sd.py | Python | agpl-3.0 | 2,809 |
from flask import Flask
import flask_admin as admin
# Views
class FirstView(admin.BaseView):
@admin.expose('/')
def index(self):
return self.render('first.html')
class SecondView(admin.BaseView):
@admin.expose('/')
def index(self):
return self.render('second.html')
# Create flask ... | flask-admin/flask-admin | examples/multiple-admin-instances/app.py | Python | bsd-3-clause | 899 |
import pkg_resources
version = pkg_resources.require('predix')[0].version
| j12y/predixpy | predix/__init__.py | Python | bsd-3-clause | 74 |
"""This is the base receiver for the base model."""
from flask import request
from typing import Optional, Union, Dict, List
RequestData = Dict[str, Union[str, dict, List[dict]]]
class BaseReceiver:
"""This is the base receiver class for the base model."""
def __init__(self):
"""Use base model for ... | WheatonCS/Lexos | lexos/receivers/base_receiver.py | Python | mit | 1,956 |
import collections
import re
import sys
import textwrap
import yaml
from .error import PrintableError
from .module import Module
from .rule import Rule
from .scope import Scope
DEFAULT_PERU_FILE_NAME = 'peru.yaml'
class ParserError(PrintableError):
pass
def parse_file(file_path, name_prefix=""):
with ope... | oconnor663/peru | peru/parser.py | Python | mit | 8,888 |
# 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, ... | GoogleCloudPlatform/python-docs-samples | eventarc/audit-storage/main_test.py | Python | apache-2.0 | 1,223 |
#!/usr/bin/env python
import sys, argparse, logging
from brother_ql.reader import BrotherQLReader
def main():
parser = argparse.ArgumentParser()
parser.add_argument('file', help='The file to analyze', type=argparse.FileType('rb'))
parser.add_argument('--loglevel', type=lambda x: getattr(logging, x), def... | pklaus/brother_ql | brother_ql/brother_ql_analyse.py | Python | gpl-3.0 | 685 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | nexedi/dream | dream/simulation/Machine.py | Python | gpl-3.0 | 73,235 |
import sys
from PyQt4 import QtCore, QtGui
from PyQt4.Qsci import QsciScintilla
class Handle(QtGui.QFrame):
def __init__(self, parent):
QtGui.QLabel.__init__(self, parent)
self.minimap = parent
self.editor = parent.editor
self.setMouseTracking(True)
self.setCursor(Q... | fortharris/Pcode | Extensions/MiniMap.py | Python | gpl-3.0 | 5,170 |
"""
Tests of edX Studio runtime functionality
"""
from urlparse import urlparse
from mock import Mock
from unittest import TestCase
from cms.lib.xblock.runtime import handler_url
class TestHandlerUrl(TestCase):
"""Test the LMS handler_url"""
def setUp(self):
self.block = Mock()
def test_trailin... | huchoi/edx-platform | cms/lib/xblock/test/test_runtime.py | Python | agpl-3.0 | 2,194 |
import os.path
from setuptools import setup, find_packages
def read(fname):
'''Utility function to read the README file.'''
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='git-jira-worklog',
version='0.1.0',
packages=find_packages(),
author='Andrzej Pragacz',
... | szopu/git-jira-worklog | setup.py | Python | mit | 997 |
from __future__ import division
import multiprocessing
import os
import os.path
import sys
import yaml, collections
import numpy as np
from time import sleep
import math
import argparse
import itertools
from random import shuffle
import random
from datetime import datetime
counter_lock = multiprocessing.Lock()
cores =... | ikoryakovskiy/grlcfg | squat_rl_cost_functions_test.py | Python | gpl-3.0 | 6,725 |
# Generated by Django 2.0.13 on 2021-08-08 15:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("ddcz", "0102_letters_of_postal_service"),
]
operations = [
migrations.RenameField(
model_name="letters",
old_name="datum",
... | dracidoupe/graveyard | ddcz/migrations/0103_letters_col_rename.py | Python | mit | 800 |
#!/usr/bin/python
import os
from collections import defaultdict
#virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
#virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
#try:
# execfile(virtualenv, dict(__file__=virtualenv))
#except IOError:
# pass
#
# IMPORTANT: Put any additional includes below ... | xulesc/pytsa | wsgi.py | Python | gpl-3.0 | 3,538 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_authorizations_operations.py | Python | mit | 16,609 |
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import assignment2_helper as helper
from sklearn.decomposition import PCA
# Look pretty...
matplotlib.style.use('ggplot')
# Do * NOT * alter this line, until instructed!
scaleFeatures = True
# TODO: Load up the dataset and remove any and all
# ... | 7even7/DAT210x | Module4/assignment2.py | Python | mit | 3,442 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_watcher.py | Python | mit | 2,109 |
#!/afs/cs.wisc.edu/u/r/c/rchat/honeyencryption/honeyvenv/bin/python
import os, sys
import string
from Crypto.Random import random
A = string.ascii_uppercase
fact_map = [1, 2, 6, 24, 120, 720,
# 1, 2, 3, 4, 5, 6,
5040, 40320, 362880, 3628800, 39916800,
# 7, 8, 9, 10, ... | rchatterjee/nocrack | test_r/permute_map.py | Python | mit | 2,112 |
# Generated by Django 2.2.6 on 2019-12-30 23:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("podcasts", "0042_auto_20191230_2322"),
]
operations = [
migrations.AlterField(
model_name="episode",
name="language"... | gpodder/mygpo | mygpo/podcasts/migrations/0043_auto_20191230_2323.py | Python | agpl-3.0 | 622 |
#!/usr/bin/env python
import numpy
__author__ = "Justin Kuczynski"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Justin Kuczynski"] # remember to add yourself
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "justinak@gmail.com"
"""
provides function... | wasade/qiime | qiime/barcode.py | Python | gpl-2.0 | 3,688 |
"""
LiveJournal OpenID support.
This contribution adds support for LiveJournal OpenID service in the form
username.livejournal.com. Username is retrieved from the identity url.
"""
from social.p3 import urlsplit
from social.backends.open_id import OpenIdAuth
from social.exceptions import AuthMissingParameter
class L... | nvbn/python-social-auth | social/backends/livejournal.py | Python | bsd-3-clause | 1,064 |
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# Copyright (c) 2016 Dell 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 versi... | t0mk/ansible | lib/ansible/modules/network/dellos9/dellos9_config.py | Python | gpl-3.0 | 10,266 |
import collections
import operator
from django.core.urlresolvers import reverse
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .helpers import get_data_list_tags
from .menus import base_data_menu
from .models import DataFileSetPlugin
class CMSDataFileSetPlugin(CMSPluginBase)... | mfcovington/djangocms-lab-data | cms_lab_data/cms_plugins.py | Python | bsd-3-clause | 1,384 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Ecs20140526DescribeVpcsRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.PageNumber = None
self.PageSize = None
self.RegionId = None
self.VpcId = None
def getap... | francisar/rds_manager | aliyun/api/rest/Ecs20140526DescribeVpcsRequest.py | Python | mit | 385 |
#!/usr/bin/env python
import sys
def printUsage():
sys.stdout.write("Usage: python bedgraph_zeroBased2oneBased.py "
"<input_file> <output_file>\n")
sys.exit(2)
if len(sys.argv) != 3:
printUsage()
OUTPUT = open(sys.argv[2], "w")
with open(sys.argv[1]) as f:
for ... | lavenderca/TSScall | utils/bedgraph_oneBasedToZeroBased.py | Python | mit | 798 |
from hashlib import sha256
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import mail_admins
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render_to_response
from django.views.decorators.http import require_POST
from django.views.decorators.csrf i... | evstropov/django-webmoney-merchant | webmoney_merchant/views.py | Python | apache-2.0 | 5,141 |
#! /usr/bin/env ObitTalk
"""
The Linear (feed) Polarization Continuum Pipeline.
The pipeline can be invoked from the command line as, ::
$ LinPContPipe AipsSetupScript PipelineParamScript
where the required arguments are
* *AipsSetupScript* = an AIPS setup script (an example of this file is stored in
``O... | kernsuite-debian/obit | python/LinPContPipe.py | Python | gpl-2.0 | 43,130 |
"""
General utilities
"""
import version
import loaders
| rvbelefonte/Rockfish2 | rockfish2/utils/__init__.py | Python | gpl-2.0 | 56 |
import os
import sys
import unittest
from cStringIO import StringIO
from optparse import OptionParser
import nose.core
from nose.config import Config
from nose.tools import set_trace
from mock import Bucket, MockOptParser
class NullLoader:
def loadTestsFromNames(self, names):
return unittest.TestSuite()
... | DESHRAJ/fjord | vendor/packages/nose/unit_tests/test_core.py | Python | bsd-3-clause | 2,069 |
from multiprocessing import Pool
from time import time
# Import the same addNumbers function we use for the serial example.
from serie import addNumbers
# map requires a function to handle a single argument
def addNumConverter((low, high)):
return addNumbers(low, high)
def splitRange(low, high):
# take sub-... | javierip/parallel-code-examples | 03-multi-core-processors/02-python-multiprocessing/multiprocessing-example.py | Python | apache-2.0 | 892 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'kategori'
db.create_table(u'blog_kategori', (
... | gencelo/tlog | app/blog/migrations/0001_initial.py | Python | mit | 4,099 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from tx_highered.models import Admissions
class Command(BaseCommand):
help = 'Post-process data higher ed data. Safe to run multiple times.'
def handle(self, *args, **options):
# Back... | texastribune/the-dp | tx_highered/management/commands/tx_highered_process.py | Python | apache-2.0 | 1,226 |
# Copyright 2011 Ryan W Sims (rwsims@gmail.com)
#
# 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... | tectronics/engayged | sye_admin/models.py | Python | apache-2.0 | 1,497 |
from __future__ import division
from collections import OrderedDict, defaultdict
from numpy import median
from urllib import urlencode
from urllib2 import unquote
import cStringIO
import gzip
import re
import requests
import unicodecsv
from django.conf import settings
from django.contrib import messages
from django.co... | Code4SA/censusreporter | census/views.py | Python | mit | 29,431 |
#
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
#
from __future__ import print_function
import logging
import os
import pwd
import grp
import shutil
import stat
import ldap
from ipaserver import p11helper as _ipap11helper
from ipapython.dnsutil import DNSName
from ipaserver.install import servi... | apophys/freeipa | ipaserver/install/dnskeysyncinstance.py | Python | gpl-3.0 | 17,734 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# from winbase.h
STDOUT = -11
STDERR = -12
try:
import ctypes
from ctypes import LibraryLoader
windll = LibraryLoader(ctypes.WinDLL)
from ctypes import wintypes
except (AttributeError, ImportError):
windll = None
SetCon... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/pip/_vendor/colorama/win32.py | Python | apache-2.0 | 5,365 |
from django.views.generic import DetailView
from django.core.exceptions import PermissionDenied
from C4CApplication.views.utils import create_user
from C4CApplication.models.member import Member
class MemberDetailsView(DetailView):
model = Member
context_object_name = "member_shown"
templ... | dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/views/MemberDetailsView.py | Python | agpl-3.0 | 1,577 |
# Adapted from Daniel Birnbaum's histogram script
import argparse
import gzip
import pipes
import sys
from collections import Counter
import numpy
metrics = ['DP', 'GQ']
def main(args):
f = gzip.open(args.vcf) if args.vcf.endswith('.gz') else open(args.vcf)
if args.output is None: args.output = args.vcf.rep... | hms-dbmi/exac_browser | src/precompute_histogram.py | Python | mit | 3,502 |
"""
Tests for Shopping Cart views
"""
from collections import OrderedDict
import pytz
from urlparse import urlparse
from decimal import Decimal
import json
from django.http import HttpRequest
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.c... | kamalx/edx-platform | lms/djangoapps/shoppingcart/tests/test_views.py | Python | agpl-3.0 | 94,712 |
import sys
import matplotlib.pyplot as plt
import cv2
import numpy as np
import caffe
import scipy.io as sio
# Mean BGR values of input
mean_bgr = np.array([104, 117, 123], dtype=np.float)
def get_pad_multiple_32(shape):
# Get pad values for y and x axeses such that an image
# has a shape of multiple of 32 fo... | albertxavier001/graduation-project | caffe/3 deep supervision pure dense/test.py | Python | mit | 4,686 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/sound-separation | models/train/data_meeting_io.py | Python | apache-2.0 | 23,738 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | dstufft/pypi-debian | pypi_debian/__init__.py | Python | apache-2.0 | 821 |
#!/usr/bin/env python
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your ... | levelrf/level_basestation | gr-uhd/examples/python/usrp_wfm_rcv_nogui.py | Python | gpl-3.0 | 6,483 |
"""Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
ex... | mdpiper/topoflow-cmi-testing | tests/__init__.py | Python | mit | 585 |
from lib import *
#from keras.layers.merge import Concatenate
from keras.layers import Merge
import copy
from collections import Counter
from sklearn.metrics import confusion_matrix
from sklearn.metrics import f1_score
import math
word2topic = pickle.load(open("word2topic", "r"))
embedding = pickle.load(open("word2top... | ProjectsUCSC/NLP | User Modelling/rnn_class_5.py | Python | mit | 26,172 |
"""
Pymrio - A python module for automating io calculations and generating reports
==============================================================================
The classes and tools in this module should work with any symetric IO system.
The main class of the module (IOSystem) has attributes .A, .L, ...
correspondi... | konstantinstadler/pymrio | pymrio/__init__.py | Python | gpl-3.0 | 1,605 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : map_command.py
# Author : bssthu
# Project : L5MapEditor
# Creation date : 2015-09-24
# Description :
#
import copy
from PyQt5.QtCore import QObject, pyqtSignal
from dao.db_helper import DbHelper
COMMAND_UNRESOLVED = '无法解析的命令'
COMMAND_U... | bssthu/L5MapEditor | editor/map_command.py | Python | lgpl-3.0 | 9,565 |
from functools import reduce
from lisp.environment import default
from lisp.parser import parse
from lisp.evaluator import evaluate_expression, NIL
def compose(*fs):
"""
Helper for convinient function composition.
Example:
f(g(t(args))) <-> compose(f, g, t)(args)
"""
def compose2(f, g):
... | begor/lisp | lisp/interpreter.py | Python | mit | 640 |
# TODO inspect for Cython (see sagenb.misc.sageinspect)
from __future__ import print_function
from nose.plugins.skip import SkipTest
from nose.tools import assert_true
from os import path as op
import sys
import inspect
import warnings
import imp
from pkgutil import walk_packages
from inspect import getsource
import... | wronk/mne-python | mne/tests/test_docstring_parameters.py | Python | bsd-3-clause | 5,347 |
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit #
# ... | tschmorleiz/amcat | amcat/scripts/article_upload/upload.py | Python | agpl-3.0 | 9,855 |
#!/usr/bin/python3
from collections import defaultdict
from itertools import chain
import hashlib
import re
class Locus(object):
def __init__(
self, chrom, start, end=None, id=None, window=0, sub_loci=None, **kwargs
):
if id is None or str(id).startswith("<None>"):
self._id = None... | schae234/Camoco | camoco/Locus.py | Python | mit | 8,278 |
#
# Copyright (c) 2009 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
# $Revision: 233 $
# $Author: tkeffer $
# $Date: 2010-04-12 15:41:45 -0700 (Mon, 12 Apr 2010) $
#
| hoevenvd/weewx_poller | bin/weeutil/__init__.py | Python | gpl-3.0 | 220 |
import Leap
import math
import vmath
from collections import deque
from datetime import datetime
class FrameListener(Leap.Listener):
def on_frame(self, controller):
frame = controller.frame()
self.confidence = frame.hands[0].confidence
angle = 4*[None]
if self.confidence < 0.1:... | oflisback/leaphue | framelistener.py | Python | mit | 3,216 |
__author__ = 'rolandh'
EDUPERSON_OID = "urn:oid:1.3.6.1.4.1.5923.1.1.1."
X500ATTR_OID = "urn:oid:2.5.4."
NOREDUPERSON_OID = "urn:oid:1.3.6.1.4.1.2428.90.1."
NETSCAPE_LDAP = "urn:oid:2.16.840.1.113730.3.1."
UCL_DIR_PILOT = 'urn:oid:0.9.2342.19200300.100.1.'
PKCS_9 = "urn:oid:1.2.840.113549.1.9.1."
UMICH = "urn:oid:1.3.... | knaperek/djangosaml2 | djangosaml2/tests/attribute-maps/saml_uri.py | Python | apache-2.0 | 10,655 |
# 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/.
"""Manifest structure used to store paths that should be included in a test run.
The manifest is represented by a tree ... | meh/servo | tests/wpt/harness/wptrunner/manifestinclude.py | Python | mpl-2.0 | 4,804 |
# 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/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py | Python | mit | 7,388 |
flight_file=open("flight.txt","w")
flight_file.write("Hello")
text=flight_file.read()
flight_file.close()
flight_file.closed # Returns whether the file is closed or not. | pk-python/basics | basics/files.py | Python | mit | 169 |
# 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
# d... | mahak/nova | nova/db/api/models.py | Python | apache-2.0 | 17,284 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This experiment was created using PsychoPy2 Experiment Builder
If you publish work using this script please cite the relevant PsychoPy publications
Peirce (2007) Journal of Neuroscience Methods 162:8-1
Peirce (2009) Frontiers in Neuroinformatics, 2: 10"""
from numpy... | BrainTech/openbci | obci/logic/experiment_builder/imbir/kamil_oddball/kamil_oddball_17_05_2011.py | Python | gpl-3.0 | 22,756 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
def download_url(url, logger = None):
req = urllib2.Request(url)
downloaded = False
tries = 0
while not downloaded:
try:
tries += 1
resp = urllib2.urlopen(req)
downloaded = True
except urllib2.URLError as e:
if logger:
... | fcalo/bbqtv | crawler/tools.py | Python | gpl-3.0 | 690 |
__author__ = 'Per'
| Per-Starke/Visualizer | src/__init__.py | Python | apache-2.0 | 19 |
import pytest
from cfme.utils.appliance.implementations.ui import navigate_to
LANDING_PAGES = [
'Cloud Intel / Dashboard',
'Cloud Intel / Reports',
'Cloud Intel / Chargeback',
'Cloud Intel / Timelines',
'Cloud Intel / RSS',
'Services / My Services',
'Services / Catalogs',
'Services / ... | lkhomenk/integration_tests | cfme/tests/configure/test_landing_page.py | Python | gpl-2.0 | 5,588 |
"""SCons.Tool.rpmutils.py
RPM specific helper routines for general usage in the test framework
and SCons core modules.
Since we check for the RPM package target name in several places,
we have to know which machine/system name RPM will use for the current
hardware setup. The following dictionaries and functions try t... | Distrotech/scons | build/scons/engine/SCons/Tool/rpmutils.py | Python | mit | 16,694 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import time
import unittest
from mock import call
from mock import patch
from mock import MagicMock as Mock
import pyrax
from pyrax.manager import BaseManager
from pyrax.clouddns import assure_domain
from pyrax.clouddns import CloudDNSClient
from pyrax.clou... | rackerlabs/heat-pyrax | tests/unit/test_cloud_dns.py | Python | apache-2.0 | 33,599 |
# Based on info from
# http://thedesignocean.com/2015/07/12/which-train-door-do-i-enter/
'''
INPUT: Start station name, End destination
Given that: Closest end station name
Given that: Which exit to use at end station
Given that: Which car and door to be at when exiting (Xth car from the front/back, front/middle/back ... | barumonkey/mbta_exit_stations | mbta_exit_stations.py | Python | gpl-2.0 | 9,183 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class Test_ENTITY (unittest.TestCase):
def testValid (self):
valid = [ 'schema', '_Underscore', ... | CantemoInternal/pyxb | tests/datatypes/test-ENTITY.py | Python | apache-2.0 | 787 |
import _plotly_utils.basevalidators
class MinexponentValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="minexponent", parent_name="heatmap.colorbar", **kwargs
):
super(MinexponentValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmap/colorbar/_minexponent.py | Python | mit | 474 |
#!/usr/bin/env python
"""
meta-sweeper - for performing parametric sweeps of simulated
metagenomic sequencing experiments.
Copyright (C) 2016 "Matthew Z DeMaere"
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 F... | cerebis/meta-sweeper | bin/tree_scaler.py | Python | gpl-3.0 | 1,895 |
#!/usr/bin/env python
# -*- coding: latin-1; py-indent-offset:4 -*-
################################################################################
#
# Copyright (C) 2014 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... | mementum/tcmanager | src/model.py | Python | gpl-3.0 | 38,056 |
import math
from datetime import datetime
from bottle import jinja2_template as template, request, redirect
from models.cmsmodels import Posts
import admin.session as withsession
app = withsession.app
@withsession.app.app.get('/posts/<page:int>')
@withsession.app.app.get('/posts')
@withsession.issessionactive()
d... | unixxxx/simplecms | admin/controllers/postcontroller.py | Python | mit | 2,225 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | OpenPOWER-BigData/HDP-falcon | src/bin/prism_status.py | Python | apache-2.0 | 854 |
__all__=['pixiv_api','gelbooru_api','danbooru_api','shimmie2_danbooru_api'] | nateinu/awpss | resources/handlers/__init__.py | Python | mit | 75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.