code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import numpy as np
# ===== Patch normalization by mean intensity ========================
def mean_intensity_norm(patch):
mu = np(np.sum(patch))*1.0/(patch.shape[0]*shape[1])
return (patch - mu[np.newaxis,np.newaxis])
# ===== Patch normalization by mean intensity ========================
| tntrung/pyCVML | misc/patch_norm.py | Python | gpl-2.0 | 294 |
# This file is part of the dionaea honeypot
#
# SPDX-FileCopyrightText: 2009 Paul Baecher & Markus Koetter & Mark Schloesser
# SPDX-FileCopyrightText: 2010 Markus Koetter & Tan Kean Siong
# SPDX-FileCopyrightText: 2015 Katarina Durechova
# SPDX-FileCopyrightText: 2017 Tan Kean Siong
# SPDX-FileCopyrightText: 2016-2017 ... | dionaea-honeypot/dionaea | modules/python/dionaea/smb/rpcservices.py | Python | gpl-2.0 | 133,752 |
#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public L... | franciscod/python-telegram-bot | telegram/parsemode.py | Python | gpl-2.0 | 1,054 |
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (... | dahaic/outerspace | server/lib/ige/ospace/Rules/__init__.py | Python | gpl-2.0 | 11,626 |
#!/usr/bin/env python
#
# api.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; witho... | certego/pcapoptikon | main/api.py | Python | gpl-2.0 | 2,785 |
from libraries import JSONDictionary
holdingsData = {
'defense': {
'superiorCastle': 50,
'castle': 40,
'smallCastle': 30,
'hall': 20,
'tower': 10
},
'influence': {
'firstBorn': 20,
'secondBorn': 10,
'otherChildren': 5
},
'lands': {
... | ondoheer/GOT-english | holdings.py | Python | gpl-2.0 | 7,657 |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 3 02:10:23 2011
@author: IxxI
@version: v1.0
"""
import sys
import logging
from optparse import OptionParser
from commands import Commands, CLIENT, SERVER
from mcp import getchangedsrc_side
def main():
parser = OptionParser(version='MCP %s' % Commands.fullversion... | mviitanen/marsmod | mcp/runtime/getchangedsrc.py | Python | gpl-2.0 | 1,420 |
#! /usr/bin/env python
from distutils.core import setup, Extension
from distutils.util import get_platform
import shutil
import os, sys
def buil_all():
packages=['miasm2',
'miasm2/arch',
'miasm2/arch/x86',
'miasm2/arch/arm',
'miasm2/arch/aarch64',
... | chubbymaggie/miasm | setup.py | Python | gpl-2.0 | 6,252 |
# -*- coding: UTF-8 -*-
from __future__ import with_statement
from __future__ import division
import pyejdb
import os.path
from datetime import datetime
from datetime import timedelta
from datetime import date as pydate
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
# ==================== basic ... | xunkai55/lifenote | lifenote.py | Python | gpl-2.0 | 14,796 |
# -*- coding: utf-8 -*-
import logging as _logging
import sys
__author__ = 'luckydonald'
__all__ = ["logging", "ColoredFormatter", "ColoredStreamHandler", "LevelByNameFilter"]
DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
class ColoredFormatter(_logging.Formatter):
class Color(object):
"""
utility... | luckydonald/python-utils | luckydonaldUtils/logger/__init__.py | Python | gpl-2.0 | 17,417 |
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _
from django.utils.translation import get_language
from partners.models import Partner
class PartnersPlugin(CMSPluginBase):
name = _... | gitsimon/tq_website | partners/cms_plugins/partners_plugin.py | Python | gpl-2.0 | 859 |
# -*- Mode: Python; test-case-name: flumotion.test.test_dialogs -*-
# -*- coding: UTF-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms... | flyapen/UgFlu | flumotion/admin/gtk/dialogs.py | Python | gpl-2.0 | 7,734 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from yali.storage import StorageError
class LibraryError(StorageError):
pass
| akuster/yali | yali/storage/library/__init__.py | Python | gpl-2.0 | 125 |
# framework/core.py
#
# Copyright 2011 Spencer J. McIntyre <SMcIntyre [at] SecureState [dot] net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... | firebitsbr/termineter | framework/core.py | Python | gpl-3.0 | 18,028 |
#!/usr/bin/env python
# -*- coding: utf-8
import sys
import argparse
import anvio.db as db
import anvio.utils as utils
import anvio.terminal as terminal
from anvio.errors import ConfigError
run = terminal.Run()
progress = terminal.Progress()
current_version, next_version = [x[1:] for x in __name__.split('_to_')]
... | meren/anvio | anvio/migrations/profile/v28_to_v29.py | Python | gpl-3.0 | 1,741 |
# urllib3/util.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from base64 import b64encode
from collections import namedtuple
from socket import error as Socke... | mattesno1/Sick-Beard | lib/requests/packages/urllib3/util.py | Python | gpl-3.0 | 11,326 |
#
# Copyright 2012 Markus Pielmeier
#
# This file is part of tagfs.
#
# tagfs 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.
#
# tagfs... | rowhit/tagfs | src/test/tagfs_test_small/test_freebase_support_query.py | Python | gpl-3.0 | 1,239 |
# -*- coding: utf-8 -*-
# enzyme - Video metadata parser
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
# Copyright 2003-2006 Dirk Meyer <dischi@freevo.org>
#
# This file is part of enzyme.
#
# enzyme is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public Lice... | SickGear/SickGear | lib/enzyme/language.py | Python | gpl-3.0 | 15,177 |
#
# Copyright (C) 2012-2014, Quarkslab.
#
# This file is part of qb-sync.
#
# qb-sync 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.
#... | quarkslab/qb-sync | ext_ida/dispatcher.py | Python | gpl-3.0 | 14,364 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
... | digris/openbroadcast.org | website/apps/actstream/migrations/0001_initial.py | Python | gpl-3.0 | 3,585 |
# Copyright 2007, 2008, 2009 VIFF Development Team.
#
# This file is part of VIFF, the Virtual Ideal Functionality Framework.
#
# VIFF is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License (LGPL) as
# published by the Free Software Foundation, either versi... | kljensen/viff | viff/test/__init__.py | Python | gpl-3.0 | 764 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | frippe12573/geonode | geonode/maps/urls.py | Python | gpl-3.0 | 2,230 |
#!/usr/lib/python2.7
##########################################################################
#
# Copyright (C) 2015-2016 Sam Westreich
#
# 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;
#
# T... | transcript/samsa_v2 | python_scripts/DIAMOND_results_filter.py | Python | gpl-3.0 | 5,358 |
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | ezequielpereira/Time-Line | timelinelib/wxgui/dialogs/editevent/view.py | Python | gpl-3.0 | 12,695 |
"""
:synopsis: user-centric views for askbot
This module includes all views that are specific to a given user - his or her profile,
and other views showing profile-related information.
Also this module includes the view listing all forum users.
"""
import calendar
import collections
import functools
import datetime
i... | openpgh/askpgh | askbot/views/users.py | Python | gpl-3.0 | 47,077 |
# -*- coding: utf8 -*-
"""
File Operations
"""
from __future__ import with_statement
import os
import io
import shutil
import hashlib
import zlib
import base64
import tempfile
import time
import struct
import sympy
import mpmath
import math
from mathics.core.expression import (Expression, Real, Complex, String, Symb... | benley/Mathics | mathics/builtin/files.py | Python | gpl-3.0 | 138,763 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil.
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundat... | MauHernandez/cyclope | cyclope/apps/medialibrary/admin.py | Python | gpl-3.0 | 6,248 |
"""
Copyright (C) 2009,2014
Andreas Engelbredt Dalsgaard <andreas.dalsgaard@gmail.com>
Martin Toft <mt@martintoft.dk>
Mads Chr. Olesen <mchro@cs.aau.dk>
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
... | yzh89/pyuppaal | pyuppaal/ulp/util.py | Python | gpl-3.0 | 2,478 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 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... | paour/weblate | weblate/trans/tests/test_commands.py | Python | gpl-3.0 | 8,853 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Team:
# J Phani Mahesh <phanimahesh@gmail.com>
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
# Amith KK <amithkumaran@gmail.com>
# Georgi Karavasilev <motorslav@gmail.com>
# Sam Tran <samvtran@gmail.com>
# Sam Hewitt <hewittsamuel@gmail.com>
# Angel Ar... | jokerdino/unity-tweak-tool | UnityTweakTool/section/appearance.py | Python | gpl-3.0 | 5,247 |
from requests import request, ConnectionError
from social.utils import module_member, parse_qs
from social.exceptions import AuthFailed
class BaseAuth(object):
"""A django.contrib.auth backend that authenticates the user based on
a authentication provider response"""
name = '' # provider name, it's stor... | HackerEcology/SuggestU | suggestu/social/backends/base.py | Python | gpl-3.0 | 8,286 |
# Bzrflag
# Copyright 2008-2011 Brigham Young University
#
# This file is part of Bzrflag.
#
# Bzrflag 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... | andrewls/bzrflag | bzrflag/constants.py | Python | gpl-3.0 | 2,312 |
# This module is a very stripped down version of the dateutil
# package for when dateutil has not been installed. As a replacement
# for dateutil.parser.parse, the parsing methods from
# http://blog.mfabrik.com/2008/06/30/relativity-of-time-shortcomings-in-python-datetime-and-workaround/
#As such, the following copyri... | TheGurke/Progenitus | sleekxmpp/thirdparty/mini_dateutil.py | Python | gpl-3.0 | 9,155 |
# A Magento 2 module generator library
# Copyright (C) 2016 Maikel Martens
#
# This file is part of Mage2Gen.
#
# Mage2Gen 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
# ... | krukas/Mage2Gen | mage2gen/utils.py | Python | gpl-3.0 | 1,144 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('experiment', '0004_auto_20150727_1405'),
]
operations = [
migrations.AlterField(
model_name='customerexperiment'... | CentechMTL/TableauDeBord | app/experiment/migrations/0005_auto_20160330_1625.py | Python | gpl-3.0 | 919 |
"""Provides some useful utilities for the Discord bot, mostly to do with cleaning."""
import re
import discord
__all__ = ['clean', 'is_clean']
mass_mention = re.compile('@(everyone|here)')
member_mention = re.compile(r'<@\!?(\d+)>')
role_mention = re.compile(r'<@&(\d+)>')
channel_mention = re.compile(r'<#(\d+)>')
... | guineawheek/Dozer | dozer/utils.py | Python | gpl-3.0 | 2,868 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from bang import VERSION
import os.path
ETC = os.path.join(os.path.dirname(__file__), 'etc')
with open(os.path.join(ETC, 'requirements.pip')) as f:
reqs = [l.strip() for l in f if '://' not in l]
reqs.append('distribute')
setup(
name='ban... | fr33jc/bang-unstable | setup.py | Python | gpl-3.0 | 751 |
import pytest
from chandere.errors import ChandereError
from chandere.loader import load_scraper
scraper = load_scraper("8chan")
VALID_CROSSLINK_TARGETS = [
("/tech/589254", ("tech", "589254")),
("/tech/ 589254", ("tech", "589254")),
("tech/589254", ("tech", "589254")),
("/tech 589254", ("tech", "589... | TsarFox/chandere2 | tests/websites/test_8chan.py | Python | gpl-3.0 | 1,671 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | tiancj/emesene | emesene/gui/qt4ui/widgets/StatusButton.py | Python | gpl-3.0 | 2,828 |
import sys
from ocelot.adaptors.genesis import *
from ocelot.cpbd.elements import Element, Quadrupole, RBend, Drift, Undulator
from ocelot import MagneticLattice
from ocelot.cpbd.beam import Beam
from ocelot.cpbd.optics import *
import numpy.fft as fft
from sim_info import SimInfo, RunInfo
#params = {'backend': 'ps... | sserkez/ocelot | utils/sim_plot.py | Python | gpl-3.0 | 4,107 |
import random
from io import StringIO
from gi.repository import Gtk
from pychess.compat import create_task
from pychess.System.prefix import addDataPrefix
from pychess.Utils.const import WHITE, BLACK, LOCAL, NORMALCHESS, ARTIFICIAL, chr2Sign, chrU2Sign, FAN_PIECES, HINT, ENDGAME
from pychess.Utils.LearnModel import L... | leogregianin/pychess | lib/pychess/perspectives/learn/EndgamesPanel.py | Python | gpl-3.0 | 6,976 |
# 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/.
import re
import sys
if len(sys.argv) != 2:
print "usage: ./%s PATH/TO/OBJDIR" % sys.argv[0]
objdir_path = sys.argv... | fduraffourg/servo | ports/geckolib/string_cache/regen_atom_macro.py | Python | mpl-2.0 | 1,335 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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... | blckshrk/Weboob | weboob/tools/application/qt/qt.py | Python | agpl-3.0 | 13,100 |
# -*- coding: utf-8 -*-
import json
import logging
import sys
from intelmq.lib.bot import Bot
from intelmq.lib.message import Report
from sdk.blueliv_api import BluelivAPI
class BluelivCrimeserverCollectorBot(Bot):
def process(self):
self.logger.info("Downloading report through API")
http_proxy ... | robcza/intelmq | intelmq/bots/collectors/blueliv/collector_crimeserver.py | Python | agpl-3.0 | 1,233 |
#
# Copyright (C) 2017 Maha Farhat
#
# 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 option) any later version.
#
# This program is distribu... | IQSS/gentb-site | tb_website/urls.py | Python | agpl-3.0 | 2,636 |
# Copyright (c) 2008, 2012 testtools developers. See LICENSE for details.
from testtools import TestCase
from testtools.matchers import Equals, MatchesException, Raises
from testtools.content_type import (
ContentType,
JSON,
UTF8_TEXT,
)
class TestContentType(TestCase):
def test___init___None_er... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/testtools/tests/test_content_type.py | Python | agpl-3.0 | 2,543 |
import pkg_resources
from datetime import datetime
import re
from inbox.api.validation import (
get_recipients, get_attachments, get_thread, get_message)
from inbox.api.err import InputError
from inbox.contacts.process_mail import update_contacts_from_message
from inbox.models import Message, Part
from inbox.model... | nylas/sync-engine | inbox/sendmail/base.py | Python | agpl-3.0 | 13,544 |
# uso dizionario come cache per evitare di calcolare sempre
PEOPLE = []
def main():
"""
devo far inserire name, city, salary come input e salvarli nel dizionario
# 1.finche utente non smette.
# 2.l'utente inserisce il nome
usa raw_input per chiedere le info all'utente
# 3.l'utente inserisce la ci... | feroda/lessons-python4beginners | students/2016-09-04/pnatile/usodiz.py | Python | agpl-3.0 | 1,771 |
"""
API for initiating and tracking requests for credit from a provider.
"""
from __future__ import absolute_import
import datetime
import logging
import uuid
import pytz
import six
from django.db import transaction
from edx_proctoring.api import get_last_exam_completion_date
from openedx.core.djangoapps.credit.exc... | ESOedX/edx-platform | openedx/core/djangoapps/credit/api/provider.py | Python | agpl-3.0 | 16,234 |
'''
Created on August 19, 2013
@package: livedesk-sync
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Martin Saturka
Content for icons of collaborators of chained blogs.
'''
import socket
import logging
from urllib.request import urlopen
from ally.api.model import Con... | superdesk/Live-Blog | plugins/livedesk-sync/livedesk/core/impl/icon_content.py | Python | agpl-3.0 | 3,125 |
# coding=utf-8
__author__ = "Daniel Arroyo <daniel@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
from astroprint.network import NetworkManager as NetworkManagerBase
class MacDevNetworkManager(NetworkManagerBase):
def __init__(self):
... | abinashk-inf/AstroBox | src/astroprint/network/mac_dev.py | Python | agpl-3.0 | 1,674 |
import os
import functools
import logging
import six
from pelican.utils import (slugify, python_2_unicode_compatible)
logger = logging.getLogger(__name__)
@python_2_unicode_compatible
@functools.total_ordering
class URLWrapper(object):
def __init__(self, name, settings):
# next 2 lines are redundant wi... | 0xMF/pelican | pelican/urlwrappers.py | Python | agpl-3.0 | 2,731 |
"""Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: Simplified BSD
import os
from os.path import join, exists
import re
import numpy as np
import scipy as sp
from scipy import io
from shutil import copyfileobj
import urllib2
from .base import get_data_home, Bunch
MLDATA_BASE_... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sklearn/datasets/mldata.py | Python | agpl-3.0 | 6,651 |
#
# Copyright (c) 2014 ThoughtWorks Deutschland GmbH
#
# Pixelated 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 option) any later version.
#
# Pixelated... | pixelated-project/pixelated-dispatcher | pixelated/test/integration/smoke_test.py | Python | agpl-3.0 | 7,956 |
from unittest.mock import patch
from superdesk.tests import TestCase
from apps.publish.enqueue.enqueue_service import EnqueueService
class NoTakesEnqueueTestCase(TestCase):
def setUp(self):
super().setUp()
self.product_ids = self.app.data.insert(
"products",
[
... | superdesk/superdesk-core | tests/enqueue_test.py | Python | agpl-3.0 | 1,353 |
# -*- coding: utf-8 -*-
import re
from django import forms
from django.contrib.auth.models import User
from django.forms import formset_factory
from django.forms.widgets import TextInput
from django.utils import timezone
from dal import autocomplete
from tagging.fields import TagField
import accounts.utils
from bulb... | enjaz/enjaz | bulb/forms.py | Python | agpl-3.0 | 15,723 |
#!/usr/bin/python2
from pypixel import *
show()
h = 0
while True:
x = random(WIDTH)
y = random(HEIGHT)
r = random(50, 100)
h += 1
h %= 360
s = 100
v = 100
c = hsv2rgb((h, s, v))
circle(c, (x, y), r)
update()
| saikobee/pypixel | examples/rainbow_random_circles.py | Python | lgpl-2.1 | 257 |
"""Check if SOCKS5 relays are disabled in muc"""
import os
if os.name != 'posix':
# skipped on non-Unix for now, because it uses a Unix socket
raise SystemExit(77)
import dbus
from servicetest import call_async, EventPattern, EventProtocolClientFactory
from gabbletest import acknowledge_iq, make_muc_presenc... | Ziemin/telepathy-gabble | tests/twisted/tubes/test-socks5-muc.py | Python | lgpl-2.1 | 2,964 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform as py_platform
from spack.architecture import OperatingSystem
from spack.version import Version
from spac... | iulian787/spack | lib/spack/spack/operating_systems/mac_os.py | Python | lgpl-2.1 | 2,263 |
#!/usr/bin/env python3
import vtktools
import sys
import math
import re
import matplotlib.pyplot as plt
import getopt
from scipy.special import erf
from numpy import poly1d
from matplotlib.pyplot import figure, show
from numpy import pi, sin, linspace
from matplotlib.mlab import stineman_interp
from numpy import exp... | FluidityStokes/fluidity | tests/wetting_and_drying_balzano1_cg/plotfs_detec.py | Python | lgpl-2.1 | 5,325 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libgcrypt(AutotoolsPackage):
"""Cryptographic library based on the code from GnuPG."""
... | LLNL/spack | var/spack/repos/builtin/packages/libgcrypt/package.py | Python | lgpl-2.1 | 2,211 |
##! /usr/bin/env python
# _*_ coding: latin-1 _*_
import jtutil
import jtsocket
import jtdom
def jtexec(cmd):
jtsocket.send("<jtexec>"+jtutil.cdataif(cmd)+"</jtexec>")
# <exitvalue>value</exitvalue>
# vagy
# <execerror>error</execerror>
while 1:
rsp=jtsocket.recv()
if r... | mrev11/ccc3 | jt/jtpython/jtlib/jtexec.py | Python | lgpl-2.1 | 653 |
# -*- python -*-
# Package : omniidl
# template.py Created on: 2000/01/18
# Author : David Scott (djs)
#
# Copyright (C) 2003-2008 Apasphere Ltd
# Copyright (C) 1999 AT&T Laboratories Cambridge
#
# This file is part of omniidl.
#
# omniidl is free software; you... | ogata-lab/rtmsdk-mac | x86_64/lib/python2.7/site-packages/omniidl_be/cxx/header/template.py | Python | lgpl-2.1 | 39,776 |
## \file
## \ingroup tutorial_dataframe
## \notebook -draw
## \brief An example of complex analysis with RDataFrame: reconstructing the Higgs boson.
##
## This tutorial is a simplified but yet complex example of an analysis reconstructing the Higgs boson decaying to two Z
## bosons from events with four leptons. The da... | karies/root | tutorials/dataframe/df103_NanoAODHiggsAnalysis.py | Python | lgpl-2.1 | 17,701 |
import gettext
import __builtin__
import math
__builtin__._ = gettext.gettext
from shadowcraft.core import exceptions
from shadowcraft.calcs import armor_mitigation
from shadowcraft.objects import class_data
from shadowcraft.objects import talents
from shadowcraft.objects import procs
from shadowcraft.objects.procs i... | Pathal/ShadowCraft-Engine | shadowcraft/calcs/__init__.py | Python | lgpl-3.0 | 31,557 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI_RigDisplay.ui'
#
# Created: Wed Mar 21 21:43:33 2018
# by: pyside-uic 0.2.14 running on PySide 1.2.0
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Form(object):
def setupUi(s... | rendermotion/RMPY | Tools/QT4/ui/FormRigDisplay.py | Python | lgpl-3.0 | 1,331 |
""" Implementaiton of a population for maintaining a GA population and
proposing structures to pair. """
from random import randrange, random
from math import tanh, sqrt, exp
from operator import itemgetter
import numpy as np
from ase.db.core import now
def count_looks_like(a, all_cand, comp):
"""Utility method ... | suttond/MODOI | ase/ga/population.py | Python | lgpl-3.0 | 15,749 |
"""This module provides graph theory functionality."""
from heapq import heapify, heappop, heappush
def dijkstra(nodes, edges, startNode, directed):
"""Finds the length between each node in the graph and the startNode.
Arguments:
nodes - the set of nodes in the graph.
edges - the set of edges ... | peterstace/project-euler | OLD_PY_CODE/project_euler_old_old/Resources/graph_theory.py | Python | unlicense | 3,807 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | DavidNorman/tensorflow | tensorflow/python/ops/linalg/linear_operator_test_util.py | Python | apache-2.0 | 33,683 |
# -*- encoding: utf-8 -*-
# Copyright (c) 2017 ZTE
#
# 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 agre... | openstack/watcher | watcher/tests/decision_engine/strategy/strategies/test_saving_energy.py | Python | apache-2.0 | 8,589 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana 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.o... | jfsantos/neon | conftest.py | Python | apache-2.0 | 3,983 |
#! /usr/bin/env python
# Copyright 2014 Uri Laserson
#
# 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... | churchlab/vdj | bin/imgt2fasta.py | Python | apache-2.0 | 1,206 |
from __future__ import unicode_literals
from datetime import datetime
import json
import boto.cloudformation
from moto.core import BaseBackend
from .parsing import ResourceMap, OutputMap
from .utils import generate_stack_id
from .exceptions import ValidationError
class FakeStack(object):
def __init__(self, stac... | tootedom/moto | moto/cloudformation/models.py | Python | apache-2.0 | 6,905 |
from flask import Flask
from flask import make_response
from flask import request
from flask import render_template
from flask import redirect
from flask import url_for
import logging
from logging.handlers import RotatingFileHandler
app = Flask(__name__)
@app.route('/')
def index():
app.logger.info('index')
... | CoderDojoSG/todo | todo1/application.py | Python | apache-2.0 | 1,472 |
__author__ = 'Arunkumar Eli'
__email__ = "elrarun@gmail.com"
from selenium.webdriver.common.by import By
class DigitalOceanLocators(object):
ACCESS_KEY_INPUT = (By.ID, 'accessKey')
SECRET_KEY_INPUT = (By.ID, 'secretKey')
NEXT_BTN = (By.CSS_SELECTOR, "button.btn.btn-primary")
AVAILABILITY_ZONE = (By.XP... | aruneli/rancher-test | ui-selenium-tests/locators/RackspaceLocators.py | Python | apache-2.0 | 1,212 |
import argparse
import json
import os
import shutil
from .model import train_and_evaluate
if __name__ == "__main__":
parser = argparse.ArgumentParser()
# File arguments
parser.add_argument(
"--train_file_pattern",
help="GCS location to read training data.",
required=True
)
parser.add_argu... | GoogleCloudPlatform/training-data-analyst | blogs/gcp_forecasting/tf_module/trainer/task.py | Python | apache-2.0 | 2,729 |
import sys
import pickle
##########################################################
# usage
# pypy find_2g.py xid_train.p ../../data/train
# xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify
# the order of samples in traing data
# ../../data/train is the path of original train data
##############... | bikash/kaggleCompetition | microsoft malware/Malware_Say_No_To_Overfitting/kaggle_Microsoft_malware_small/find_2g.py | Python | apache-2.0 | 1,327 |
from django import forms
from .widgets import MarkdownxWidget
class MarkdownxFormField(forms.CharField):
"""
Used in FormFields as a Markdown enabled replacement for ``CharField``.
"""
def __init__(self, *args, **kwargs):
"""
Arguments are similar to Django's default ``CharField``.
... | wuga214/Django-Wuga | env/lib/python2.7/site-packages/markdownx/fields.py | Python | apache-2.0 | 1,070 |
# Copyright 2012 Grid Dynamics
# 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... | cernops/nova | nova/virt/libvirt/imagebackend.py | Python | apache-2.0 | 45,765 |
#!/usr/bin/env vpython
# Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import logging
import sys
import unittest
import test_env
test_env.setup_test_env()
from proto import realms_config_pb2
f... | luci/luci-py | appengine/auth_service/realms/permissions_test.py | Python | apache-2.0 | 3,254 |
import matplotlib.pyplot as plt
import numpy as np
import sklearn
from sklearn import svm, datasets
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import average_precision_score
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import label_binarize
from sklearn.m... | JamesWo/cs194-16-data_manatees | precision_recall.py | Python | apache-2.0 | 4,204 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from ..azure_common import BaseTest, arm_template
class IoTHubTest(BaseTest):
def setUp(self):
super(IoTHubTest, self).setUp()
def test_iot_hub_schema_validate(self):
with self.sign_out_patch():
p = sel... | thisisshi/cloud-custodian | tools/c7n_azure/tests_azure/tests_resources/test_iot_hub.py | Python | apache-2.0 | 921 |
"""Support for RainMachine devices."""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_BINARY_SENSORS, CONF_IP_ADDRESS, CONF_PASSWORD,
CONF_PORT, CONF_SCAN_INTERVAL, CONF_SENS... | HydrelioxGitHub/home-assistant | homeassistant/components/rainmachine/__init__.py | Python | apache-2.0 | 10,913 |
# Copyright (c) 2011 OpenStack Foundation
# Copyright (c) 2012 Cloudscaling
# 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/l... | orbitfp7/nova | nova/scheduler/filters/ram_filter.py | Python | apache-2.0 | 3,894 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | shakamunyi/neutron-vrrp | neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | Python | apache-2.0 | 71,665 |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | chengduoZH/Paddle | python/paddle/fluid/contrib/slim/nas/lock.py | Python | apache-2.0 | 1,215 |
# 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... | jiaphuan/models | research/object_detection/builders/hyperparams_builder.py | Python | apache-2.0 | 6,261 |
from plenum.test.spy_helpers import get_count
def sum_of_request_propagates(node):
return get_count(node.replicas[0]._ordering_service,
node.replicas[0]._ordering_service._request_propagates_if_needed) + \
get_count(node.replicas[1]._ordering_service,
node.repl... | evernym/zeno | plenum/test/node_request/test_propagate/helper.py | Python | apache-2.0 | 377 |
#-
# Copyright (c) 2011 Steven J. Murdoch
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed ... | 8l/beri | cheritest/trunk/tests/branch/test_raw_bltzall_lt_back.py | Python | apache-2.0 | 1,853 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | jamielennox/tempest | tempest/auth.py | Python | apache-2.0 | 24,953 |
# -*- coding: utf-8 -*-
import pytest
import time
import sys
import cPickle as pickle
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
sys.exit(1)
class TestAppend(object):
... | arthurprs/aerospike-client-python | test/test_append.py | Python | apache-2.0 | 12,313 |
"""
Definition of views.
"""
from app.models import Choice, Poll
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpRequest, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from dja... | DinoV/PTVS | Python/Templates/Samples/ProjectTemplates/Python/Samples/PollsDjango/app/views.py | Python | apache-2.0 | 3,472 |
import sys
import json
import os
import re
import argparse
def get_file_locations():
parser = argparse.ArgumentParser()
parser.add_argument('input', help='Input AVPR filename(s)', nargs='+')
parser.add_argument('output', help='Output directory')
args = parser.parse_args()
return (args.input, args.output)
d... | pcingola/schemas | tools/sphinx/avpr2rest.py | Python | apache-2.0 | 5,874 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | thoraxe/openshift-ansible | roles/lib_openshift/library/oc_project.py | Python | apache-2.0 | 58,493 |
# 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... | alistairlow/tensorflow | tensorflow/contrib/summary/summary_test_internal.py | Python | apache-2.0 | 1,837 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Jarob22/selenium | py/selenium/webdriver/__init__.py | Python | apache-2.0 | 1,735 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from pants.base.exce... | square/pants | tests/python/pants_test/engine/test_engine.py | Python | apache-2.0 | 2,994 |
"""This component provides basic support for Foscam IP cameras."""
import asyncio
from libpyfoscam import FoscamCamera
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
... | partofthething/home-assistant | homeassistant/components/foscam/camera.py | Python | apache-2.0 | 8,589 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * R... | nicememory/pie | pyglet/pyglet/media/drivers/directsound/adaptation.py | Python | apache-2.0 | 17,118 |
# Copyright (c) 2010-2012 OpenStack, 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 ... | citrix-openstack-build/swift | test/unit/container/test_server.py | Python | apache-2.0 | 75,820 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.