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 |
|---|---|---|---|---|---|
# Copyright 2010, 2011 Red Hat Inc.
#
# This file is part of StratoSource.
#
# StratoSource 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 opti... | StratoSource/StratoSource | stratosource/management/commands/syncrally.py | Python | gpl-3.0 | 1,067 |
# encoding= utf-8
# Copyright 2007-2009 QSpin - www.qspin.be
#
# This file is part of QTaste framework.
#
# QTaste 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... | remybaranx/qtaste | TestSuites/TestSuite_QTaste/EngineSuite/QTASTE_SCRIPT/QTASTE_SCRIPT_06/TestScript.py | Python | gpl-3.0 | 2,771 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will b... | jocelynj/weboob | weboob/backends/yahoo/backend.py | Python | gpl-3.0 | 2,399 |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Copyright (c) 2019 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
This checks if all command line args are documented.
Retu... | cculianu/bitcoin-abc | test/lint/check-doc.py | Python | mit | 2,906 |
import urllib.parse
import urllib.request
import urllib.response
import cv2
import numpy as np
import time
import h5py
import sys
if __name__ == '__main__':
args = sys.argv
if len(args) != 4:
print("Usage:", __file__, "[label] [number] [stride]")
sys.exit(1)
label, number, stride = ... | boschhackathon/BoschAmigoBot | computervision/capture.py | Python | bsd-2-clause | 1,830 |
from sparktk.propobj import PropertiesObject
class Histogram(PropertiesObject):
def __init__(self, cutoffs, hist, density):
self._cutoffs = cutoffs
self._hist = hist
self._density = density
@property
def cutoffs(self):
return self._cutoffs
@property
def density(sel... | shibanis1/spark-tk | python/sparktk/frame/ops/histogram.py | Python | apache-2.0 | 4,234 |
# -*- encoding: utf-8 -*-
"""API Tests for foreman discovery feature
:Requirement: Discoveredhost
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: API
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string, gen_ipaddr, gen_mac
from nailgun import entitie... | ares/robottelo | tests/foreman/api/test_discoveredhost.py | Python | gpl-3.0 | 12,951 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# OpServer Utils
#
# Utility functions for Operational State Server for VNC
#
from gevent import monkey
monkey.patch_all()
import datetime
import time
import requests
import pkg_resources
import xmltodict
import json
import gevent
import socket, s... | tcpcloud/contrail-controller | src/opserver/opserver_util.py | Python | apache-2.0 | 33,251 |
##
# Copyright 2015-2018 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | bartoldeman/easybuild-easyblocks | easybuild/easyblocks/generic/craytoolchain.py | Python | gpl-2.0 | 3,053 |
#!/bin/python
import sys
def lonely_integer(a):
result = 0
for n in a:
result ^= n
return result
n = int(raw_input().strip())
a = map(int,raw_input().strip().split(' '))
print lonely_integer(a) | migafgarcia/programming-challenges | hackerrank/cracking_the_coding_interview/lonely_integer.py | Python | mit | 221 |
from sqlalchemy import Column, Integer, String, Text, DateTime
from database import Base
from datetime import datetime
import re
class Entry(Base):
__tablename__ = 'entries'
id = Column(Integer, primary_key=True)
title = Column(String(100))
slug = Column(String(100))
summary = Column(String(250))
... | xorobabel/dagbok | dagbok/models.py | Python | gpl-2.0 | 810 |
# -*-coding:utf8;-*-
# war_pat_p
from timeit import default_timer as timer
import numpy as np
import os
import sqlite3
import pickle
from multiprocessing import Pool
# import pandasDataAnalysis
# import cProfile
class Battle:
def __init__(self):
self.nb_trick = 0
self.escarmoucheDep... | ZeeGabByte/War-cards-game-simulation | War/Main_MultiProcess.py | Python | gpl-3.0 | 5,216 |
import argparse
import os
from fontTools.ttLib import TTFont
def genCSS(font, base):
"""Generates a CSS snippet for webfont usage based on:
http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax"""
style = "normal"
if font["post"].italicAngle != 0:
style = "oblique"
weight = ... | bateni/qalam-tarash | tools/makecss.py | Python | mit | 1,643 |
#! /usr/bin/env python
# Gamebub - a GameBoy type platformer
# All code and assets are Copyright (C) 2009.
import sys
sys.path.insert(0, "..")
from retrogamelib import display
from retrogamelib import button
from retrogamelib import clock
from retrogamelib import font
from retrogamelib import dialog
from retrogameli... | bitcraft/retrogamelib | BubbMan/gamelib/menu.py | Python | lgpl-2.1 | 4,189 |
#
# author: Cosmin Basca
#
# Copyright 2010 University of Zurich
#
# 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 a... | cosminbasca/cysparql | cysparql/test/base.py | Python | apache-2.0 | 2,624 |
"""
Error handler registration.
"""
from requests import codes
from cheddar.exceptions import BadRequestError, ConflictError, NotFoundError
def create_errorhandlers(app):
@app.errorhandler(BadRequestError)
def bad_request(error):
return error.message, codes.bad_request
@app.errorhandler(Conflic... | jessemyers/cheddar | cheddar/errorhandlers.py | Python | apache-2.0 | 508 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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... | jonparrott/google-cloud-python | securitycenter/tests/unit/gapic/v1beta1/test_security_center_client_v1beta1.py | Python | apache-2.0 | 34,760 |
#!/usr/bin/env python
"""
Auxiliary functions for f2py2e.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) LICENSE.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RIS... | DailyActie/Surrogate-Model | 01-codes/numpy-master/numpy/f2py/auxfuncs.py | Python | mit | 21,916 |
from os.path import join, normpath
from configurations import Settings
from djset import config, secret
from .apps import Apps, AppsDebug
from .filepaths import SITE_ROOT
from .cache import LocalMemCache, DummyCache
from .db import PostgresDB, SqliteDB
from .email import EmailSMTP, EmailConsole, EmailInMemory
from .lo... | bretth/django-pavlova-project | djangoproject/djangoproject/settings/settings.py | Python | mit | 1,901 |
# -*- coding: utf-8 -*-
import pkg_resources
__version__ = "unknown"
try:
__version__ = pkg_resources.resource_string("period",
"RELEASE-VERSION").strip()
except IOError:
__version__ = "0.0.0"
from period.main import PeriodParser, PeriodSyntax, Stack, in_perio... | LinkCareServices/period | period/__init__.py | Python | artistic-2.0 | 334 |
#
# SPDX-FileCopyrightText: 2016 Dmytro Kolomoiets <amerlyq@gmail.com> and contributors.
#
# SPDX-License-Identifier: GPL-3.0-only
#
# RFC: pack/unpack will be the same for all streams/pipes/fifo
# BUT: for UDP unpack requires sending requests for repeating lost UDP packets
# DEV: periodically send 'heartbeat' data and... | miur/miur | OLD/miur/share/osi/segmentation.py | Python | gpl-3.0 | 1,754 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import support_backends
import json
class SupportResponse(BaseResponse):
SERVICE_NAME = "support"
@property
def support_backend(self):
return support_backends[self.region]
def describe_trusted_a... | william-richard/moto | moto/support/responses.py | Python | apache-2.0 | 3,039 |
"""
Creates hdf5 file with only the specified columns from the full dataset.
This is useful space saving measure as while the full dataset is quite large
only a few columns are of interest.
"""
import h5py
import numpy as np
def main():
columns = [
'#CMSSM_parameters @CMSSM::primary_parameters::A0',
... | idark-project/idark-ml | cmssm/extract_columns.py | Python | apache-2.0 | 2,322 |
from __future__ import division, print_function
from glob import glob
import os
import time
import numpy as np
import scipy.misc
from six.moves import xrange
import tensorflow as tf
import matplotlib.pyplot as plt
from PIL import Image
import lmdb
import io
import sys
from IPython.display import display
from model_m... | mbinkowski/opt-mmd | gan/model_gan.py | Python | bsd-3-clause | 1,558 |
#!/usr/bin/python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2015 Christian Bahati cbahati@luc.edu
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# b... | cbahati/FoxCatcher | tests/test_lint.py | Python | gpl-3.0 | 1,643 |
"""
Basic RNN for bAbI tasks using Tensorflow
"""
import sys
import re
import tarfile
from functools import reduce
import numpy as np
import os
import datetime
import tensorflow as tf
from tensorflow.core.framework import summary_pb2
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import variab... | yfletberliac/Mango | qrn.py | Python | mit | 26,224 |
#
# Copyright (C) 2011-2021 Greg Landrum and other RDKit contributors
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
import base64
import copy
i... | rdkit/rdkit | rdkit/Chem/Draw/IPythonConsole.py | Python | bsd-3-clause | 12,511 |
import decimal
import json
import logging
import re
import time
import uuid
from decimal import Decimal
from urllib.parse import urlparse, urlunparse
from threading import Thread
from django.contrib import messages
from django.contrib.sites.models import Site
from asgiref.sync import async_to_sync
from channels.layers ... | Puyb/inscriptions_roller | inscriptions/utils.py | Python | gpl-3.0 | 3,531 |
# Copyright 2018 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QKeySequence
from PyQt5... | brownnrl/moneyguru | qt/controller/lookup.py | Python | gpl-3.0 | 3,233 |
# Standard imports
import json
from random import randrange
from bottle import route, post, get, run, template, static_file, request, app, HTTPError, abort, BaseRequest, JSONPlugin
import bottle as bt
# To support dynamic loading of client-specific libraries
import sys
import os
import logging
from datetime import dat... | yw374cornell/e-mission-server | emission/net/api/cfc_webapp.py | Python | bsd-3-clause | 25,080 |
import os
import datetime
import sqlite3
CLOUD_PATH = u'/home/medcloud/webapps/ownphp70/data/Osama/files/Medical College/'
DB_PATH = '/home/medcloud/cloud_index/'
def index():
now = datetime.datetime.today()
timestamp = now.strftime('%Y%m%d%H')
db_filename = "medcloud_index-%s.sqlite" % timestamp
db_c... | osamak/medcloud-registration | cloudsearch/utils.py | Python | agpl-3.0 | 1,400 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/python/ops/sparse_grad.py | Python | bsd-2-clause | 10,174 |
#!/usr/bin/python3
# https://bugzilla.altlinux.org/show_bug.cgi?id=33532
#!/usr/bin/env -S python3 -u
# -*- coding: utf-8 -*-
#
# A simple message-sending script
# TODO: When error: No handlers could be found for logger "pyxmpp.Client"
import os, sys
# python-module-pyxmpp
from pyxmpp2.jid import JID
from pyxmpp2.ja... | vitlav/korinf | share/eterbuild/korinf/helpers/send_via_pyxmpp.py | Python | agpl-3.0 | 849 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, _
from odoo.addons.http_routing.models.ir_http import slug
class EventEvent(models.Model):
_inherit = "event.event"
community_menu = fields.Boolean(
"Community Men... | ygol/odoo | addons/website_event_track_online/models/event_event.py | Python | agpl-3.0 | 2,962 |
from nose.tools import raises
from rightscale.rightscale import Resource
def test_empty_linky_thing():
linky = Resource()
assert {} == linky.links
def test_resource_repr():
r = Resource()
assert r == eval(repr(r))
r = {
'a': '/path/to/a',
'mojo': '/somefingelse/blah/blah... | brantai/python-rightscale | tests/test_res_links.py | Python | mit | 2,176 |
#!/usr/bin/env python
from __future__ import division
from std_msgs.msg import Int32
import roslib; roslib.load_manifest('beep_imu')
import rospy
import smbus
import time
bus = smbus.SMBus(1)
irAddress = 0x55
#pub_mag_xsens = rospy.Publisher('imu/mag', Vector3Stamped)
def decFrom2Compl(val, bitlen):
if val & (1... | iti-luebeck/BEEP | Software/catkin_ws/src/beep_imu/ir_distance_zusmoro.py | Python | bsd-3-clause | 1,517 |
"""
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | MonkeyLeeT/SnapScout-Frontend | mysite/settings.py | Python | apache-2.0 | 2,154 |
"""
RGB Agglomerative Clustering
====================================
Segment an image with agglomerative clustering.
We start from a region adjacency graph.
"""
from __future__ import print_function
import numpy
import vigra
import urllib
import os.path
import pylab
import skimage.segmentation
# n... | DerThorsten/nifty | src/python/examples/graph/plot_agglomerative_clustering_size_regularizer.py | Python | mit | 2,793 |
class Solution:
# @param {integer[]} nums
# @return {integer}
def robaux(self, nums, aux):
i = len(nums) - 1
if i < 0:
return 0
if aux[i] > -1:
return aux[i]
if i == 0:
return nums[0]
aux[i] = max(nums[0] + self.robaux(nums[2:]... | Chasego/codi | leetcode/198-House-Robber/HouseRobber_002.py | Python | mit | 506 |
from distutils.core import Command
from setuptools import setup
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from django.conf import settings
settings.configure(
DATABASES... | hanuprateek/django-jsonfield | setup.py | Python | mit | 1,596 |
# -*- coding: utf-8 -*-
# Copyright 2014 The Arobito Project
#
# 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 applicab... | arobito/arobito | src/setup.py | Python | apache-2.0 | 1,121 |
import os
import sys
import logging
import threading
import mimetypes
import itertools
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
logger = logging.getLogger(__name__)
from cactus import mime
TEMPLATES = {}
class WebSocketHandler(tornado.websocket.WebSocketHandler):... | koenbok/Cactus | cactus/server.py | Python | bsd-3-clause | 5,809 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
from copy import copy
from .geral import TODAS_AS_UNIDADES, acha_unidade, calcula_dimensao, analisa_numero, dimensao_em_texto, fator_de_conversao_para_si, unidades_em_texto, converte_unidades, analisa_unidades, simplifica_unidades, gera_expoente, adimensional, ... | gjvnq/LabIFSC | LabIFSC/medida.py | Python | mit | 14,124 |
############################################################################
# Generic script applicable on any Operating Environments (Unix, Windows)
# ScriptName : wls_reset.py
# Properties : weblogic.properties
# Author : Kevin Yuan
#######################################################################... | RallySoftware/eclipselink.runtime | jpa/eclipselink.jpars.test/resource/weblogic/wls_reset.py | Python | epl-1.0 | 904 |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import logging
import re
import string
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from... | twz915/django | django/middleware/csrf.py | Python | bsd-3-clause | 13,478 |
"""
This file is part of FastPay.
Copyright (c) 2015 Yahoo Japan Corporation
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
"""
class FastPayError(Exception):
INCORRECT_NUMBER = "incorrect_number"
INVALID_NUMBER = "invalid_number"
... | yahoojapan/fastpay-python | fastpay/errors.py | Python | mit | 1,162 |
import glob
import serial
import logging
class serialPort():
""" Serial port wrapper """
port = '/dev/ttyACM0'
coms = None
connected = False
def isOpen(self):
return self.connected
def connect(self, port='/tmp/ttyS11'):
self.port = port
try:
self.coms = se... | olymk2/serJax | serjax/connect.py | Python | gpl-3.0 | 1,798 |
# Copyright (c) 2015 Czech National Corpus
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# dated June, 1991.
#
# This program is distributed in the hope that it will be useful,
# b... | tomachalek/kontext | lib/plugins/tree_corparch/__init__.py | Python | gpl-2.0 | 6,757 |
from __future__ import unicode_literals
from future.builtins import str
from future.builtins import zip
from collections import defaultdict
from datetime import datetime, timedelta
from django.db.models import Manager, Q
from django.utils.datastructures import SortedDict
from django.utils.timezone import now
from me... | Kniyl/cartridge | cartridge/shop/managers.py | Python | bsd-2-clause | 7,759 |
# -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | lamby/debian-devel-changes-bot | DebianDevelChangesBot/__init__.py | Python | agpl-3.0 | 4,473 |
'''
divxstage urlresolver plugin
Copyright (C) 2011 t0mm0, DragonWin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This prog... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.urlresolver/lib/urlresolver/plugins/divxstage.py | Python | gpl-2.0 | 3,630 |
"""
[2015-09-11] Challenge #231 [Hard] Eight Husbands for Eight Sisters
https://www.reddit.com/r/dailyprogrammer/comments/3kj1v9/20150911_challenge_231_hard_eight_husbands_for/
# Description
For a set of men {*A,B,...,Z*} and a set of women {*a,b,...,z*} they have a preference table - *A* would prefer to
marry *b*, b... | DayGitH/Python-Challenges | DailyProgrammer/DP20150911C.py | Python | mit | 2,172 |
from imhotep.tools import Tool
from collections import defaultdict
import json
import os
import logging
log = logging.getLogger(__name__)
class FoodCritic(Tool):
def invoke(self,
dirname,
filenames=set(),
linter_configs=set()):
retval = defaultdict(lambda: de... | scottjab/imhotep_foodcritic | imhotep_foodcritic/plugin.py | Python | mit | 1,551 |
#!/usr/bin/python3
import boto3
import json
if __name__ == '__main__':
ec2_client = boto3.client('ec2')
ec2_filter = [{'Name': 'tag:role', 'Values': ['ecs-cluster']}]
instances=ec2_client.describe_tags(Filters=ec2_filter)
#get only the instance_ids
instance_ids = []
for i in instances['Tags'... | justinwatkinson/ecs-weave-demo | inventory.py | Python | mit | 907 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-15 20:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annotator', '0008_video_labels'),
]
operations = [
migrations.AlterField(
... | antingshen/BeaverDam | annotator/migrations/0009_auto_20170815_1341.py | Python | bsd-2-clause | 469 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Animal',
fields=[
('id', models.AutoField(verbo... | DallasPetsAlive/ruff-portal | ruff_portal/rg_sync/migrations/0001_initial.py | Python | gpl-2.0 | 555 |
# Licensed under an MIT open source license - see LICENSE
'''
Test functions for SCF
'''
from unittest import TestCase
import numpy as np
import numpy.testing as npt
from ..statistics import SCF, SCF_Distance
from ._testing_data import \
dataset1, dataset2, computed_data, computed_distances
class testSCF(Tes... | keflavich/TurbuStat | turbustat/tests/test_scf.py | Python | mit | 900 |
## Copyright (C) 2011 Stellenbosch University
##
## This file is part of SUCEM.
##
## SUCEM 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 v... | cemagg/sucem-fem | sucemfem/Testing/Meshes.py | Python | gpl-3.0 | 2,223 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from pompadour_wiki.apps.tagging.models import Tag
class TagTest(TestCase):
def test_00_nothing(self):
""" Make sure there is no objects """
c = Tag.objects.count()
self.assertEqual(c, 0)
def test_01_create(self):
"""... | 9h37/pompadour-wiki | pompadour_wiki/pompadour_wiki/apps/tagging/tests.py | Python | mit | 1,036 |
"""
@author: J.W. Spaak
Contains all functions, that are needed to generate communities as well as
compute the EF of those communities
Contains the same functions as community_construction_coex, but does so for
the replacing community structure
"""
import numpy as np
import pickle
from numpy.random import uniform as ... | juergspaak/EF-at-invariant-richness | community_construction_repl.py | Python | mit | 16,416 |
#!/usr/bin/python3
'''
FONSA_WEBCLIENT.PY
Serve up the HTML-based user interface for the CLIENT side (port 80 or 443).
Fonsa_server.py calls me. It can't run me as a thread or whatever. That's because bottle (the
web server framework for Python 3) ends up getting its wires crossed. If I try to run the server
and the ... | HugoMMRabson/fonsa | old/fonsa_OLD_webclient.py | Python | gpl-3.0 | 20,472 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.core.db import db
from indico.util.string import form... | mvidalgarcia/indico | indico/modules/rb/models/room_features.py | Python | mit | 982 |
import unittest
from captaincloud.processes.task_runner import TaskRunner
from captaincloud.task import Task, TaskImpl, field
from captaincloud.task.registry import TaskRegistry
class TestTaskRunner(unittest.TestCase):
"""Test task runner"""
def setUp(self):
self.task_runner = TaskRunner()
... | bpsagar/captaincloud | tests/processes/task_runner/test_runner.py | Python | mit | 2,196 |
import random
def roll_dice(numbers=3, points=None):
print('<<<<< ROLL THE DICE! >>>>>')
if points is None:
points = []
while numbers > 0:
point = random.randrange(1,7)
points.append(point)
numbers = numbers - 1
return points
def roll_result(total):
isBig = 11 <=tot... | loveingenioustech/demo | python-demo/demo/RandomDemo.py | Python | mit | 925 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, 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/LICE... | salv-orlando/MyRepo | nova/virt/xenapi/volume_utils.py | Python | apache-2.0 | 16,202 |
"""Utility functions for PyNLPIR unit tests."""
import functools
from threading import Thread
def timeout(timeout):
"""Executes a function call or times out after *timeout* seconds.
Inspired by: http://stackoverflow.com/a/21861599.
Example:
func = timeout(timeout=1)(open)
try:
func('tes... | tsroten/pynlpir | tests/utilities.py | Python | mit | 1,150 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2015 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your opti... | ofer43211/unisubs | utils/test_utils/api.py | Python | agpl-3.0 | 1,455 |
#################################################################################################
# Playlist items
#################################################################################################
import xbmc
import xbmcgui
import xbmcaddon
import json
import threading
from datetime import datetime
im... | goofwear/MediaBrowser.Kodi | resources/lib/PlaylistItems.py | Python | gpl-2.0 | 18,221 |
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import get_connection
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_contact.secure import MD5Field
from django_contact import settings
class ContactConfig(models.Model):
sent_url_redi... | arkanister/django-contact-form-site | django_contact/models.py | Python | bsd-3-clause | 2,620 |
import logging
from django.views.decorators.csrf import csrf_exempt
from django.http import (
JsonResponse,
HttpResponseBadRequest,
)
from django.views.decorators.http import require_http_methods
from . import (
transactions,
forms,
)
LOGGER = logging.getLogger(__name__)
@csrf_exem... | brunousml/inbox | frontdesk/views.py | Python | bsd-2-clause | 925 |
# Copyright (c) 2012 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 logging
import pylib.android_commands
import pylib.device.device_utils
class FlagChanger(object):
"""Changes the flags Chrome runs with.
T... | xysec/xysec_adb | xysec_adb/pylib/flag_changer.py | Python | apache-2.0 | 5,712 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | quinox/weblate | weblate/trans/tests/test_chars_checks.py | Python | gpl-3.0 | 8,036 |
from PySide.QtGui import QGridLayout, QWidget
import koeppencolor
from sphereview import SphereView
def genshade():
g = 0
dg = 255
while True:
g += dg
dg /= -2
yield (255,g,0)
def genshades(n):
gen = genshade()
return [next(gen) for _ in range(n)]
def population(tile, populated, races, shades... | tps12/Tec-Nine | racinationdisplay.py | Python | gpl-3.0 | 1,425 |
# Domain properties
lx = 1.0
ly = 1.0
Nx = 512
Ny = 512
# Scheme execution options
T = 0.6
CFL = 0.5
gamma = 5./3.
BCtype = 'N'
BClayer = 1
quantityList = ['rho', 'rhou_x', 'rhou_y', 'rhoE']
| will-iam/Variant | casepy/eulerRuO2/nNoh512x512/chars.py | Python | mit | 195 |
import afnumpy
from asserts import *
import pytest
xfail = pytest.mark.xfail
def test_comparisons():
a = afnumpy.arange(10, dtype="float32") - 5.
b = afnumpy.ones((10), dtype="float32")
a.eval()
a_mask = a < 0.
a_sum = a_mask.sum()
a -= b
assert(a_sum == a_mask.sum())
a_mask = a > 0.
... | FilipeMaia/afnumpy | tests/test_jit.py | Python | bsd-2-clause | 2,106 |
# -*- coding: utf-8 -*-
import pymongo
from scrapy.http import Request
class CheckPointSpider(object):
"""record check point to mongo"""
collection_name = 'checkpoint'
def process_spider_output(self, response, result, spider):
"""record this page
"""
mongo_uri=spider.crawler.settin... | morefreeze/scrapy_projects | caoporn/caoporn/middlewares/spider.py | Python | mit | 870 |
import io
import os
import tempfile
import zipfile
from tests.utils import async, temp_files
from waterbutler.core import streams
class TestZipStreamReader:
@async
def test_single_file(self):
file = ('filename.extension', streams.StringStream('[File Content]'))
stream = streams.ZipStreamRea... | cosenal/waterbutler | tests/core/streams/test_zip.py | Python | apache-2.0 | 3,134 |
__author__ = 'cutylewiwi'
# -*- coding:utf-8 -*-
import urllib
import urllib2
import re
class Prof:
def __init__(self, name, photoUrl, pUrl, title, area, office, phone, email):
self.name = name
self.photoUrl = photoUrl
self.pUrl = pUrl
self.title = title
self.a... | doge-search/webdoge | wuyudong/UCF/UCF.py | Python | unlicense | 3,318 |
"""Write both pages of SDO SS
>>> See also tc 5.54 and 5.56
WG:
The WG can be set with rspctl --wg. A WG amplitude of 0.5 yields a CW
amplitude of 255 and a subband amplitude of 32582 so that just fits in
16 bit SDO data. With fsys = 160 M or 200 M and c_rsp_slice_size=124 the
WG frequen... | kernsuite-debian/lofar | LCU/StationTest/tc/write_sdo_ss.py | Python | gpl-3.0 | 3,326 |
# region gplv3preamble
# The Medical Simulation Markup Language (MSML) - Simplifying the biomechanical modeling workflow
#
# MSML has been developed in the framework of 'SFB TRR 125 Cognition-Guided Surgery'
#
# If you use this software in academic work, please cite the paper:
# S. Suwelack, M. Stoll, S. Schalck, N.S... | CognitionGuidedSurgery/msml | src/msml/ext/misc_ext.py | Python | gpl-3.0 | 1,827 |
#!/usr/bin/python
# Copyright 2011 Google 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 by appli... | fengyuanjs/catawampus | tr/api_test.py | Python | apache-2.0 | 2,310 |
# Generated by Django 3.2 on 2021-05-12 19:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("accounts", "0014_auto_20210506_1421"),
]
operations = [
migrations.AlterModelOptions(
name="auditlog",
options={
... | WeblateOrg/weblate | weblate/accounts/migrations/0015_auto_20210512_1955.py | Python | gpl-3.0 | 1,147 |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
# Copyright 2004-2008 eXe Project, http://eXeLearning.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | skython/eXe | exe/webui/wikipediablock.py | Python | gpl-2.0 | 11,465 |
"""Leetcode 796. Rotate String
Easy
URL: https://leetcode.com/problems/rotate-string/
We are given two strings, A and B.
A shift on A consists of taking string A and moving the leftmost character to
the rightmost position. For example, if A = 'abcde', then it will be 'bcdea'
after one shift on A. Return True if and ... | bowen0701/algorithms_data_structures | lc0796_rotate_string.py | Python | bsd-2-clause | 1,408 |
from decimal import Decimal
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import AreaField
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.core.exceptions import FieldError
from django.db.models i... | yephper/django | django/contrib/gis/db/models/functions.py | Python | bsd-3-clause | 16,825 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | jaggu303619/asylum | openerp/addons/crm_claim/crm_claim.py | Python | agpl-3.0 | 11,219 |
__all__ = ['preprocess', 'util'] | dedert/Brand2Vec | preprocess/__init__.py | Python | mit | 32 |
"""Generic Functions"""
def less_than(mine, yours):
return mine < yours
def less_than_equal(mine, yours):
return mine <= yours
def greater_than(mine, yours):
return mine > yours
def greater_than_equal(mine, yours):
return mine >= yours
def equal_to(mine, yours):
return mine == yours
def not_equ... | andrewseaman35/py_value_validator | py_value_validator/validation_functions.py | Python | mit | 365 |
# -*- coding: utf8 -*-
# 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, softwar... | redlink-gmbh/redlink-python-sdk | redlink/client.py | Python | apache-2.0 | 3,547 |
# -*- coding: utf-8 -*-
#
# libsaas documentation build configuration file, created by
# sphinx-quickstart on Sun May 20 14:45:58 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... | ducksboard/libsaas | doc/conf.py | Python | mit | 8,086 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | AndreasMadsen/tensorflow | tensorflow/python/ops/state_ops.py | Python | apache-2.0 | 7,711 |
import os
import posixpath as path
from ..src.bn_template import make_c_files
def test_make_c_files() -> None:
dirpath = os.path.join(os.path.dirname(__file__), "data/template_test/")
modules = ["test"]
test_input = os.path.join(dirpath, "test.c")
if os.path.exists(test_input):
os.remove(test... | kwgoodman/bottleneck | bottleneck/tests/test_template.py | Python | bsd-2-clause | 651 |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring, invalid-name
##############################################################################
#
# Copyright (c) 2011, Martín Raúl Villalba
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... | ramunasd/python-ant | src/ant/core/log.py | Python | mit | 3,847 |
"""
Imports and setup functionality
"""
import api.logger
import api.setup
import api.user
import api.team
import api.group
import api.annotations
import api.auth
import api.common
import api.cache
import api.problem
import api.stats
import api.utilities
import api.autogen
import api.autogen_tools
import api.admin
# ... | stuyCTF/stuyCTF-Platform | api/api/__init__.py | Python | mit | 376 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.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 Lice... | pheanex/ansible-modules-extras | notification/mail.py | Python | gpl-3.0 | 10,199 |
import copy
from itertools import chain
from django import forms
from django.db import models
from django.db.models.lookups import Lookup, Transform
from django.core.exceptions import ValidationError, ImproperlyConfigured
from djangae.forms.fields import ListFormField
from django.utils.text import capfirst
class _Fa... | Ali-aqrabawi/ezclinic | lib/djangae/fields/iterable.py | Python | mit | 12,953 |
"""Pascal VOC Segmenttion Generator."""
from __future__ import unicode_literals
import os
import numpy as np
from keras import backend as K
from keras.utils.np_utils import to_categorical
from keras.preprocessing.image import (
ImageDataGenerator,
Iterator,
load_img,
img_to_array,
pil_image,
arr... | JihongJu/keras-fcn | voc2011/voc_generator.py | Python | mit | 9,587 |
# (C) British Crown Copyright 2011 - 2014, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | ajdawson/cartopy | lib/cartopy/tests/mpl/test_ticks.py | Python | lgpl-3.0 | 4,976 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
# 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... | rcbops/glance-buildpackage | glance/api/policy.py | Python | apache-2.0 | 3,392 |
"""
pakbase module
This module contains the base package class from which
all of the other packages inherit from.
"""
from __future__ import print_function
import os
import webbrowser as wb
import numpy as np
from numpy.lib.recfunctions import stack_arrays
from .modflow.mfparbc import ModflowParBc as mfparbc
f... | bdestombe/flopy-1 | flopy/pakbase.py | Python | bsd-3-clause | 35,922 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.