code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Unit tests for behavior that is specific to the api methods (vs. the view methods).
Most of the functionality is covered in test_views.py.
"""
import re
import ddt
from dateutil.parser import parse as parse_datetime
from mock import Mock, patch
from django.test import TestCase
from nose.too... | adoosii/edx-platform | openedx/core/djangoapps/user_api/accounts/tests/test_api.py | Python | agpl-3.0 | 18,244 |
import Image
import base64
import StringIO
from wand.image import Image as WandImage
from wand.color import Color
def _open_image(filename):
try:
im = Image.open(filename)
except IOError, e:
im = None
return im
def get_thumbnail_size(height, width, max_height, max_width):
if (width /... | CaliopeProject/CaliopeServer | src/cid/utils/thumbnails.py | Python | agpl-3.0 | 1,682 |
from __future__ import unicode_literals
import factory
from factory.mongoengine import MongoEngineFactory
from .models import Issue
class IssueFactory(MongoEngineFactory):
class Meta:
model = Issue
title = factory.Faker('sentence')
| jphnoel/udata | udata/core/issues/factories.py | Python | agpl-3.0 | 254 |
from bok_choy.page_object import PageObject
from . import BASE_URL
class SignupPage(PageObject):
"""
Signup page for Studio.
"""
name = "studio.signup"
def url(self):
return BASE_URL + "/signup"
def is_browser_on_page(self):
return self.is_css_present('body.view-signup')
| pelikanchik/edx-platform | common/test/acceptance/edxapp_pages/studio/signup.py | Python | agpl-3.0 | 317 |
# -*- coding:Utf-8 -*-
from tastypie import fields as base_fields
from tastypie_mongoengine import fields
from timeline.api.resources.base import TimelineEntryBaseResource
from timeline.api.doc import HELP_TEXT
from timeline.models import invoicing_entries
__all__ = (
'QuotationChangedStateResource',
'Purch... | Naeka/vosae-app | www/timeline/api/resources/invoicing_entries/invoicebase_changed_state.py | Python | agpl-3.0 | 4,124 |
import sys
from lxml import etree
def fast_iter(source,func):
context = etree.iterparse(source, events=('end','start'))
context = iter(context)
event, root = context.next()
for event, elem in context:
if event == 'end':
func(elem)
root.clear()
del context
def parseelem(elem):
print ... | bigr/map1 | osm/parseosm.py | Python | agpl-3.0 | 363 |
from . import mail_mass_mailing_list
from . import mail_mass_mailing_contact
from . import education_group
| oihane/odoo-addons | education_group_mail_list/models/__init__.py | Python | agpl-3.0 | 107 |
from bok_choy.page_object import PageObject
from selenium.webdriver.common.keys import Keys
from common.test.acceptance.pages.common.utils import click_css
from common.test.acceptance.tests.helpers import select_option_by_text, get_selected_option_text
from selenium.webdriver.support.ui import Select
class BaseCompon... | romain-li/edx-platform | common/test/acceptance/pages/studio/component_editor.py | Python | agpl-3.0 | 6,854 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | spadae22/odoo | addons/account_voucher/partner.py | Python | agpl-3.0 | 1,722 |
# Primitive function: Min
# Chooses the smaller from two numbers
__author__="Gonzalo"
from Greaterthan import Greaterthan
from If import If
def Min (a, b):
return If(Greaterthan(b,a),a,b)
if __name__ == "__main__":
print(Min(1, 3))
| gcobos/rft | app/primitives/Min.py | Python | agpl-3.0 | 248 |
# -*- coding: utf-8 -*-
import os
import uuid
import codecs
import django.contrib.gis.db.models.fields
from django.core import management
from django.contrib.postgres.fields import JSONField
from django.db import migrations, models
from arches.db.migration_operations.extras import CreateExtension, CreateAutoPopulateU... | archesproject/arches | arches/app/models/migrations/0001_initial.py | Python | agpl-3.0 | 36,390 |
"""
Testing factories for the communication app
"""
# Django
from django.utils import timezone
# Standard Library
from datetime import timedelta
# Third Party
import factory
import faker.providers.phone_number.en_US as faker_phone
# MuckRock
from muckrock.communication.models import (
Address,
EmailAddress,... | MuckRock/muckrock | muckrock/communication/factories.py | Python | agpl-3.0 | 2,077 |
import io
import logging
import sys
import time
import traceback
from tkinter import Listbox, LEFT, BOTH, Label, \
StringVar, NW, BooleanVar, DISABLED, NORMAL, X, NE
import krpc
from ttk import Checkbutton, Entry
from krcc_module import KRCCModule
# DECLARE_KRCC_MODULE
def load(root):
return AvionicsLogger(root... | jsartisohn/krpc_scripts | avionics.py | Python | agpl-3.0 | 5,250 |
from datetime import timedelta
from django.core.exceptions import ValidationError
from django.db import connection
from django.template.defaultfilters import floatformat
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation... | DMOJ/site | judge/contest_format/icpc.py | Python | agpl-3.0 | 5,572 |
"""
Django settings for chat 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, ...)
from ... | bufke/chat-experiment | chat/settings.py | Python | agpl-3.0 | 3,651 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.translation impor... | akx/shoop | shoop/admin/modules/manufacturers/__init__.py | Python | agpl-3.0 | 1,356 |
"""
Functionality for generating grade reports.
"""
from __future__ import absolute_import
import logging
import re
from collections import OrderedDict, defaultdict
from datetime import datetime
from itertools import chain
from time import time
import six
from django.conf import settings
from django.contrib.auth impo... | jolyonb/edx-platform | lms/djangoapps/instructor_task/tasks_helper/grades.py | Python | agpl-3.0 | 33,207 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | vnsofthe/odoo-dev | addons/plm/installer.py | Python | agpl-3.0 | 2,871 |
from .models import Event, EventAdminRoles, Job, Helper
# This is the central file that defines and manages the different permissions for events, jobs and users.
# Global permissions like creating events, users or sending newsletters are managed in the accounts app.
# There are different roles, defined in registratio... | helfertool/helfertool | src/registration/permissions.py | Python | agpl-3.0 | 11,569 |
"""
Tests for smart_referral helpers
"""
from ddt import ddt, file_data
from django.test import TestCase
from lms.djangoapps.onboarding.tests.factories import OrganizationFactory, UserFactory
from openedx.features.smart_referral import helpers as filter_contacts_helpers
from openedx.features.smart_referral.tests.facto... | philanthropy-u/edx-platform | openedx/features/smart_referral/tests/test_helpers.py | Python | agpl-3.0 | 7,514 |
# -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_medical_pharmacy
| laslabs/vertical-medical | medical_pharmacy/tests/__init__.py | Python | agpl-3.0 | 152 |
# -*- coding: utf-8 -*-
"""
country
Country
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited
:license: AGPLv3, see LICENSE for more details.
"""
from openerp.osv import osv
from openerp.tools.translate import _
import pycountry
class Country(osv.osv):
"Country"
_inherit... | jmesteve/openerpseda | openerp/addons_extra/magento_integration/country.py | Python | agpl-3.0 | 4,292 |
"""SCons.Tool.c++
Tool-specific initialization for generic Posix C++ compilers.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby gran... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/c++.py | Python | lgpl-2.1 | 3,432 |
from os import name as __name
from sys import modules as __modules
from warnings import warn
if __name == 'java':
warn("%s is not yet supported on jython"%__modules[__name__])
else:
from reporter_metabolites import *
del __name, __modules
| jerkos/cobrapy | cobra/topology/__init__.py | Python | lgpl-2.1 | 248 |
# -*- coding: utf-8 -*-
#
# gensim documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 17 13:42:21 2010.
#
# 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 ... | macks22/gensim | docs/src/conf.py | Python | lgpl-2.1 | 7,323 |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
from lxml.builder import ElementMaker
def EventMaker():
"""
Returns the event skeleton obj... | gonicus/gosa | common/src/gosa/common/event.py | Python | lgpl-2.1 | 506 |
"""
Infrastructure code for testing connection managers.
"""
from twisted.internet import glib2reactor
from twisted.internet.protocol import Protocol, Factory, ClientFactory
glib2reactor.install()
import sys
import pprint
import unittest
import dbus.glib
from twisted.internet import reactor
import constants as cs... | community-ssu/telepathy-gabble | tests/twisted/servicetest.py | Python | lgpl-2.1 | 15,082 |
from setuptools import setup, find_packages
import pbs
setup(
name = pbs.__projectname__,
version = pbs.__release__,
packages = find_packages(),
author = pbs.__authors__,
author_email = pbs.__authoremails__,
description = pbs.__description__,
license = "GPLv2",
keywords = pbs.__keyword... | demis001/pbs | setup.py | Python | lgpl-2.1 | 517 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Matt Jeffery <matt@clan.se>
# This library 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 2.1 of the License, or ... | mattjeffery/semetric-python | semetric/apiclient/util.py | Python | lgpl-2.1 | 3,202 |
import re, struct, socket, select, traceback, time
if not globals().get('skip_imports'):
import ssnet, helpers, hostwatch
import compat.ssubprocess as ssubprocess
from ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
from helpers import *
def _ipmatch(ipstr):
if ipstr == 'default':
... | brianmay/sshuttle | src/server.py | Python | lgpl-2.1 | 10,097 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from io import open
from os.path import abspath, dirname, join
from setuptools import setup
PROJECT_ROOT = abspath(dirname(__file__))
with open(join(PROJECT_ROOT, 'README.rst'), encoding='utf-8') as f:
readme = f.read()
vers... | nameoftherose/python-zeroconf | setup.py | Python | lgpl-2.1 | 1,982 |
"""Cull removed rules
Revision ID: 2136a1f22f1f
Revises: 2ea9623b21fa
Create Date: 2015-01-08 12:23:51.829172
"""
from __future__ import print_function
# revision identifiers, used by Alembic.
revision = '2136a1f22f1f'
down_revision = '2ea9623b21fa'
from alembic import op
import sqlalchemy as sa
import fmn.lib.mod... | fedora-infra/fmn | alembic/versions/2136a1f22f1f_cull_removed_rules.py | Python | lgpl-2.1 | 1,355 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/Animation/A1.py | Python | lgpl-2.1 | 2,899 |
# 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)
from __future__ import print_function
from __future__ import division
import argparse
import fnmatch
import os
import re
... | rspavel/spack | lib/spack/spack/cmd/list.py | Python | lgpl-2.1 | 9,244 |
# Orca
#
# Copyright 2004-2009 Sun Microsystems Inc.
# Copyright 2010 Joanmarie Diggs
#
# This library 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 2.1 of the License, or (at your op... | pvagner/orca | src/orca/scripts/default.py | Python | lgpl-2.1 | 175,590 |
#!/usr/bin/env python
"""A command-line tool for simulating various dice throw situations.
Copyright (C) 2014-2018 Simon Muller
This library 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... | samuller/dice | dice.py | Python | lgpl-2.1 | 12,835 |
# Copyright 2017-2018 The Tangram Developers. See the AUTHORS file at the
# top-level directory of this distribution and at
# https://github.com/renatoGarcia/tangram/blob/master/AUTHORS.
#
# This file is part of Tangram.
#
# Tangram is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | renatoGarcia/tangram | tangram/recipes/imshow.py | Python | lgpl-3.0 | 5,231 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/eve_obj/attribute/factory.py | Python | lgpl-3.0 | 1,354 |
#!/usr/bin/env python3
########################################################################
# File name: xmpp_bridge.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by... | horazont/aioxmpp | examples/xmpp_bridge.py | Python | lgpl-3.0 | 5,377 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 vers... | gph82/PyEMMA | pyemma/coordinates/clustering/regspace.py | Python | lgpl-3.0 | 6,265 |
"""Test module for the XIA MCAs."""
import pytest
from bliss.controllers.mca import Brand, DetectorType, Stats
from bliss.controllers.mca import PresetMode, TriggerMode
from bliss.controllers.mca import XIA, XMAP
@pytest.fixture(
params=['xia', 'mercury', 'xmap', 'falconx'])
def xia(request, beacon, mocker):
... | tiagocoutinho/bliss | tests/mca/test_xia.py | Python | lgpl-3.0 | 8,209 |
# pylint: disable=C0103,R0902,R0904,R0914,C0111
"""
All bush elements are defined in this file. This includes:
* CBUSH
* CBUSH1D
* CBUSH2D
All bush elements are BushElement and Element objects.
"""
from __future__ import (nested_scopes, generators, division, absolute_import,
pri... | saullocastro/pyNastran | pyNastran/bdf/cards/elements/bush.py | Python | lgpl-3.0 | 15,256 |
#!/usr/bin/python
from PreprocessScope import PreprocessScope
from PreprocessScopeParser import PreprocessScopeParser
from Useless import Useless
from Phase1Result import *
from Message import *
class ElemParser:
#######################################################
def __init__(self, file, parser, containe... | aprovy/test-ng-pp | scripts/testngppgen/ElemParser.py | Python | lgpl-3.0 | 3,611 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
test_data
Test for visualization class
@author: baihan
"""
import unittest
import numpy as np
import pyrsa.vis as rsv
import pyrsa.rdm as rsr
from scipy.spatial.distance import pdist
class TestVIS(unittest.TestCase):
def test_vis_mds_output_shape_corresponds_to_... | ilogue/pyrsa | tests/test_vis.py | Python | lgpl-3.0 | 4,262 |
""" the ldapadaptor module handles low-level LDAP operations """
from functools import wraps
import operator
import re
import logging
LOG = logging.getLogger(__name__)
import ldap
import ldap.filter
import ldap.dn
from ldap.controls import SimplePagedResultsControl as PagedCtrl
from plow.errors import LdapAdaptorEr... | veloutin/plow | plow/ldapadaptor.py | Python | lgpl-3.0 | 15,616 |
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
#
# This library 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) any later version. This lib... | krathjen/studiolibrary | src/studiolibrary/widgets/sidebarwidget/sidebarwidget.py | Python | lgpl-3.0 | 32,909 |
from email.utils import formatdate
from traceback import format_exc
from urllib import unquote as url_unquote
from requests import Response
from requests.adapters import BaseAdapter
from requests.exceptions import RequestException, InvalidURL
from requests.hooks import dispatch_hook
from binascii import a2b_base64
from... | jvantuyl/requests-data | requests_data/adapters.py | Python | lgpl-3.0 | 2,822 |
class tunel:
def __init__(self, tn_id, name=None, cnt=0):
self.tn_id = tn_id
if name:
self.name = name
else:
self.name = 'tunel '+str(tn_id)[1:]
self.cnt = cnt
class tunel_pool:
def __init__(self):
self.pool = {}
self.pool['t0'] = tunel('... | laxect/tellnet | tunel_struct.py | Python | lgpl-3.0 | 990 |
#!/usr/bin/env python3
import math
import os
import random
import re
import sys
# Complete the isBalanced function below.
def isBalanced(s):
opn = []
enc = []
enclosing = False
for c in s:
if '{' == c or '[' == c or '(' == c:
opn.append(c)
enclosing = False
eli... | williamlagos/chess | solving/stacks/brackets.py | Python | lgpl-3.0 | 905 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
import inspect
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QUrl, QCoreApplication, pyqtSlot
from PyQt5.QtQml import QJSValue
# from UM.FlameProfiler import pyqtSlot
from UM.i18n import i18nCatalog
clas... | thopiekar/Uranium | UM/Qt/Bindings/i18nCatalogProxy.py | Python | lgpl-3.0 | 4,546 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/layer/ui.py | Python | lgpl-3.0 | 4,363 |
from twisted.web import resource
from Tribler.Core.Modules.restapi.market.asks_bids_endpoint import AsksEndpoint, BidsEndpoint
from Tribler.Core.Modules.restapi.market.orders_endpoint import OrdersEndpoint
from Tribler.Core.Modules.restapi.market.transactions_endpoint import TransactionsEndpoint
class MarketEndpoint... | vandenheuvel/tribler | Tribler/Core/Modules/restapi/market_endpoint.py | Python | lgpl-3.0 | 851 |
#!/usr/bin/env python
import sys
import string
import subprocess
import binascii
import random
import datetime
sc_dir = "./shellcode"
vers_dir = "./versions"
sys.path.insert(0, '..')
from Mexeggs.all import *
from Mexeggs import *
from scapy.all import *
##
##
##
class ExtrabaconInfoSubcommand(sploit.InfoSubcomman... | DarthMaulware/EquationGroupLeaks | Leak #1 - Equation Group Cyber Weapons Auction - Invitation/EQGRP-Free-File/Firewall/EXPLOITS/EXBA/extrabacon_1.1.0.1.py | Python | unlicense | 14,497 |
import asyncio
from aiohttp import web
async def handle(request):
index = open("index.html", 'rb')
content = index.read()
return web.Response(body=content, content_type='text/html')
async def wshandler(request):
app = request.app
ws = web.WebSocketResponse()
await ws.prepare(request)
app[... | 7WebPages/snakepit-game | simple/game_loop_basic.py | Python | unlicense | 1,070 |
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE
)
date_of_birth = models.DateField(blank=True, null=True)
photo = model... | ch1huizong/dj | bookmarks/account/models.py | Python | unlicense | 1,147 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: fix_methodattrs.py
"""Fix bound method attributes (method.im_? -> method.__?__).
"""
from .. import fixer_base
from ..fixer_util import Name
MAP = {'... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/lib2to3/fixes/fix_methodattrs.py | Python | unlicense | 746 |
#!/usr/bin/env python
from efl import evas
import unittest
class TestLineBasics(unittest.TestCase):
def setUp(self):
self.canvas = evas.Canvas(method="buffer",
size=(400, 500),
viewport=(0, 0, 400, 500))
self.canvas.engine_info_s... | maikodaraine/EnlightenmentUbuntu | bindings/python/python-efl/tests/evas/test_07_object_line.py | Python | unlicense | 752 |
import unittest
from typing import List
import utils
# O(len(nums1) * len(nums2)) time. O(1) space. Monotone stack, hash table.
class Solution:
def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:
result = []
for num in nums1:
index = nums2.index(num)
... | chrisxue815/leetcode_python | problems/test_0496_brute_force.py | Python | unlicense | 903 |
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5)
# 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... | keyhom/avm2pluscc_avm2 | avmplus/build/buildscripts/utils/avm_mirror.py | Python | unlicense | 13,613 |
"""
Recently I have seen this article http://habrahabr.ru/post/200190/
so I have decided to find the solution of this task by myself.
Short description of this task for a case if the link above will be broken:
1. we have a two-dimensional positive integer numbers array
2. if we will display this data in the manner o... | tigeral/polygon | python/habra_task/habratask_main.py | Python | unlicense | 5,696 |
# encoding: utf-8
'''
Created on 2015年3月15日
@author: Sunday
'''
from twisted.web.resource import Resource
root = Resource()
if __name__ == '__main__':
pass
else:
__all__ = ['factory', ] | alexsunday/pyvpn | src/webconsole.py | Python | unlicense | 217 |
#!/usr/bin/python
# coding: utf-8
try:
from bs4 import BeautifulSoup
import ConfigParser as cp
import requests, re, sys
import MySQLdb as sql
except Val:
print "Error importing modules, exiting."
exit()
# Import database credentials from secured config file
config = cp.RawConfigParser()
c... | vkotek/PriceDog | core.py | Python | unlicense | 4,867 |
from ctypes import cdll
lib = cdll.LoadLibrary("target/release/libembed.dylib")
lib.process()
print("done!")
| amitsaha/learning | rust/embed/embed.py | Python | unlicense | 112 |
"""Note: Keep in sync with changes to VTraceTFPolicy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.utils.explained_variance import explained_variance
from ray.rllib.evalua... | atumanov/ray | python/ray/rllib/agents/a3c/a3c_tf_policy.py | Python | apache-2.0 | 4,762 |
#! /usr/bin/python
#
# Delete all content from an ICAT.
#
# This is surprisingly involved to do it reliably. See the comments
# below for the issues that need to be taken into account.
import logging
import time
from warnings import warn
import icat
import icat.config
from icat.ids import DataSelection
from icat.quer... | icatproject/python-icat | wipeicat.py | Python | apache-2.0 | 6,331 |
from django.db import models
import settings
AUTO_PRUNE_MODES = (
('None', 'None'),
('Conservative', 'Conservative'),
('Normal', 'Normal'),
('Aggressive', 'Aggressive'),
)
class GwoExperiment(models.Model):
"""An experiment or test in Google Website Optimizer"""
title = models.CharField(max_... | callowayproject/django-gwo | gwo/models.py | Python | apache-2.0 | 9,424 |
#!/usr/bin/env python
# Copyright 2015 Stanford University
#
# 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 applicabl... | SKA-ScienceDataProcessor/legion-sdp-clone | tools/spy_parser.py | Python | apache-2.0 | 16,815 |
# Copyright 2019 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... | tensorflow/model-optimization | tensorflow_model_optimization/python/core/api/sparsity/__init__.py | Python | apache-2.0 | 805 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | mapr/hue | desktop/libs/hadoop/src/hadoop/yarn/clients.py | Python | apache-2.0 | 2,439 |
# Copyright 2013 Rackspace Hosting
#
# 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 ... | dklyle/trove-dashboard | trove_dashboard/content/databases/workflows/create_instance.py | Python | apache-2.0 | 16,628 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | iagcl/data_pipeline | data_pipeline/db/query_results.py | Python | apache-2.0 | 1,482 |
import pytest
from lemur.tests.vectors import VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN
from lemur.logs.views import * # noqa
def test_private_key_audit(client, certificate):
from lemur.certificates.views import CertificatePrivateKey, api
assert len(certificate.logs) == 0
client.get(api.url_for(... | nevins-b/lemur | lemur/tests/test_logs.py | Python | apache-2.0 | 706 |
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.db.models import Q
from django.template.loader import render_to_string
from structure.models import Structure
from common import... | cmunk/protwis | tools/management/commands/pdbs_with_icl3_helix.py | Python | apache-2.0 | 1,253 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Populate development database with Institution fixtures."""
import logging
import sys
import urllib
from modularodm import Q
from framework.transactions.context import TokuTransaction
from website import settings
from website.app import init_app
from website.models i... | samchrisinger/osf.io | scripts/populate_institutions.py | Python | apache-2.0 | 20,582 |
from flask import (
jsonify,
request,
render_template
)
from flask_login import (
current_user,
login_required
)
from app.agency.api import agency_api_blueprint
from app.agency.api.utils import (
get_active_users_as_choices,
get_letter_templates,
get_reasons
)
from app.models import Agen... | CityOfNewYork/NYCOpenRecords | app/agency/api/views.py | Python | apache-2.0 | 8,238 |
from . import AbstractIndicator
# tracker for dynamic indicators
# it's purpose is tracking mix and max values of upstream indicators at the given time slot
# for static indicators: min and max will have the same value all the time
# (the value at the given time won't change)
class MinMaxTracker(AbstractIndicator):
... | quantwizard-com/pythonbacktest | pythonbacktest/indicator/minmaxtracker.py | Python | apache-2.0 | 2,081 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# 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 appl... | tensorflow/datasets | tensorflow_datasets/rl_unplugged/rlu_locomotion/rlu_locomotion_test.py | Python | apache-2.0 | 1,304 |
import math
from synapse.tests.common import *
import synapse.lib.gis as s_gis
# earth mean radius in mm
r = 6371008800
ratios = {
'cm': 10.0,
'm': 1000.0,
'km': 1000000.0,
}
km = 1000000.0 # using mm as base units
gchq = (51.8994, -2.0783)
class GisTest(SynTest):
def test_lib_gis_haversine(self):... | vivisect/synapse | synapse/tests/test_lib_gis.py | Python | apache-2.0 | 3,170 |
#!/usr/bin/python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you... | cestella/incubator-metron | metron-platform/metron-common/src/main/scripts/cluster_info.py | Python | apache-2.0 | 17,320 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | cschnei3/forseti-security | deployment-templates/forseti-instance.py | Python | apache-2.0 | 6,784 |
from telnetlib import Telnet
from telnetlib import IAC, NOP
import socket
import re
from string import split
__all__ = ["FlightGear"]
CRLF = '\r\n'
class FGTelnet(Telnet):
def __init__(self, host, port):
Telnet.__init__(self, host, port)
self.prompt = []
self.sock.sendall(IAC + NOP)
... | niranjan94/flightgear-cc | flightgear-cc-bridge/libs/FlightGear.py | Python | apache-2.0 | 3,992 |
# Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | stackforge/ec2-api | ec2api/context.py | Python | apache-2.0 | 5,158 |
from setuptools import setup
with open('README.md') as readme:
long_description = readme.read()
setup(
name='girder-monkeybrains',
version='1.0.5',
description='Displays monkey neurodevelopmental data.',
long_description=long_description,
long_description_content_type='text/markdown',
url=... | girder/monkeybrains | setup.py | Python | apache-2.0 | 672 |
#!/usr/bin/env python
# Chris Riederer
# 2014-08-13
"""This script is to look at the data coming from Physics Toolbox Magnetometer.
It's to help debug the magnet button on Google Cardboard.
"""
import test_detect as t
import sys
if len(sys.argv) < 2:
print "Please provide the name of the file you'd like to ana... | dodger487/MIST | data/analyzePhysicsToolbox.py | Python | apache-2.0 | 906 |
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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... | tensorflow/probability | tensorflow_probability/python/distributions/gaussian_process_test.py | Python | apache-2.0 | 15,953 |
#!/usr/bin/python
#
# The contents of this file are subject to 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
# from the file named COPYING and from http://www.apache.org/licenses/.
#
# Unless required by... | navicore/oescript_c | products/server/python/oeserver.py | Python | apache-2.0 | 1,967 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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... | dpanth3r/biggraphite | biggraphite/cli/command_read.py | Python | apache-2.0 | 4,047 |
import hashlib
import os
import pytest
from funcy import first
from dvc.exceptions import DvcException
from dvc.utils.fs import remove
def digest(text):
return hashlib.md5(bytes(text, "utf-8")).hexdigest()
def test_no_scm(tmp_dir, dvc):
from dvc.scm import NoSCMError
tmp_dir.dvc_gen("file", "text")
... | efiop/dvc | tests/func/test_diff.py | Python | apache-2.0 | 16,935 |
#
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | NervanaSystems/coach | rl_coach/architectures/mxnet_components/general_network.py | Python | apache-2.0 | 24,307 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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... | ityaptin/ceilometer | ceilometer/publisher/messaging.py | Python | apache-2.0 | 8,270 |
# -*- coding: utf-8 -*-
# Copyright 2017 Janko Hoener
#
# 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 ... | jankohoener/asknow-UI | asknow-UI/api.py | Python | apache-2.0 | 6,797 |
from django.db import models as django_models
from project.models import Project
# Create your models here.
class SupportProject(django_models.Model):
project = django_models.OneToOneField(Project, on_delete=django_models.PROTECT, related_name = "for_support_purposes", unique=True )
| postpdm/ich_bau | support/models.py | Python | apache-2.0 | 294 |
from fabric.api import *
from fabric.context_managers import *
from fabric.contrib.console import confirm
import os, subprocess, sys, json
lib_path = os.path.abspath(os.path.join('./util'))
sys.path.append(lib_path)
from md_utils import *
local_dir = os.getcwd()
@task
def unittest():
local("python test/md_u... | walterfan/snippets | python/fabfile.py | Python | apache-2.0 | 337 |
import sys
import pytest
import salt.utils.data
def test_get_value_simple_path():
data = {"a": {"b": {"c": "foo"}}}
assert [{"value": "foo"}] == salt.utils.data.get_value(data, "a:b:c")
@pytest.mark.skipif(
sys.version_info < (3, 6),
reason="Test will randomly fail since Python3.5 does not have ord... | saltstack/salt | tests/pytests/unit/utils/test_data.py | Python | apache-2.0 | 2,449 |
import pytest
import mock
from mock import call
import pendulum
from django.utils import timezone
from fit4school.core.models import Tracker, Program, School, Student, Classroom
TZ = pendulum.timezone(timezone.get_current_timezone_name())
@pytest.mark.django_db
@mock.patch("fit4school.core.models.notify_tracker_c... | goodes/fit4school | fit4school/core/tests/test_save.py | Python | apache-2.0 | 1,638 |
import sys,time,functions,getpass # Imports
from random import randint
from config import *
from player import Player
from enemies import *
from states import States
# runs the game
def runGame():
playerClasses = ['Fighter', 'Thief'] # possible player classes
enemyClasses = ['HOF','LOF','DEW','DEC','DEA'] # po... | FireElementalNE/AI-Final-Project | src/game.py | Python | apache-2.0 | 5,609 |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='v2gcalendar',
version=get_version('v2... | felixb/v2gcalendar | setup.py | Python | apache-2.0 | 1,044 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
setup(name='cardisco',
version='1.0',
description='HTML Autodiscovery Library',
author='Mark Lee',
packages=find_packages(),
install_requires=[
'html5lib',
'httplib2',
])
| devhub/cardisco | setup.py | Python | apache-2.0 | 319 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
im... | skuda/client-python | kubernetes/client/apis/settings_v1alpha1_api.py | Python | apache-2.0 | 58,259 |
from rest_framework.test import APITestCase, APIRequestFactory,\
force_authenticate
from api.v2.views import SizeViewSet
from api.tests.factories import ProviderFactory, UserFactory,\
AnonymousUserFactory, SizeFactory, IdentityFactory
from django.core.urlresolvers import reverse
from core.models import Size
... | CCI-MOC/GUI-Backend | api/tests/v2/test_sizes.py | Python | apache-2.0 | 2,409 |