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 |
|---|---|---|---|---|---|
"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from biz.djangoapps.ga_manager.models impo... | nttks/edx-platform | biz/djangoapps/gx_login/views.py | Python | agpl-3.0 | 3,215 |
# This file is part of VoltDB.
# Copyright (C) 2008-2018 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, c... | simonzhangsm/voltdb | tools/voter.d/voter.py | Python | agpl-3.0 | 2,792 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api, _
from op... | adrianpaesani/odoo-argentina | l10n_ar_invoice/models/afip.py | Python | agpl-3.0 | 6,822 |
"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_revision = '8f8419ebcf27'
branch_labels = None
depends_on = None
from alembic import op
import sq... | magfest/ubersystem | alembic/versions/bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py | Python | agpl-3.0 | 2,103 |
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
obj[last] = value
return g
def keygetter(key... | aureooms/sak | lib/nice/operator.py | Python | agpl-3.0 | 554 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class EventType(models.Model):
_inherit = "event.type"
community_menu = fields.Boolean(
"Community Menu", compute="_compute_community_menu",
readonly=False,... | ygol/odoo | addons/website_event_track_online/models/event_type.py | Python | agpl-3.0 | 551 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# 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 ver... | taigaio/taiga-back | tests/integration/test_watch_tasks.py | Python | agpl-3.0 | 4,832 |
import subprocess
def release():
subprocess.call(["python3", "setup.py", "sdist", "upload"])
| aureooms/sak | sak/pip3.py | Python | agpl-3.0 | 100 |
from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m)
else:
w =... | flowersteam/naminggamesal | naminggamesal/ngstrat/word_choice/word_preference.py | Python | agpl-3.0 | 997 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maposmatic', '0004_maprenderingjob_track'),
]
operations = [
migrations.AlterField(
model_name='maprenderingjob'... | hholzgra/maposmatic | www/maposmatic/migrations/0005_auto_20170521_0103.py | Python | agpl-3.0 | 453 |
"""
Base test case for the course API views.
"""
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from lms.djangoapps.courseware.tests.factories import StaffFactory
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPL... | cpennington/edx-platform | cms/djangoapps/contentstore/api/tests/base.py | Python | agpl-3.0 | 2,906 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Eduardo Robles Elvira <edulix AT gmail DOT com>
#
# 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 yo... | miaerbus/timebank | user/models.py | Python | agpl-3.0 | 4,968 |
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | ingadhoc/product | product_management_group/__manifest__.py | Python | agpl-3.0 | 1,296 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from math import isinf, isnan
from warnings import warn
NOT_MASS_BALANCED_TERMS = {"SBO:0000627", # EXCHANGE
"SBO:0000628", # DEMAND
"SBO:0000629", # BIOMASS
"SBO:0000631... | zakandrewking/cobrapy | cobra/manipulation/validate.py | Python | lgpl-2.1 | 2,116 |
import math, os
from bup import _helpers, helpers
from bup.helpers import sc_page_size
_fmincore = getattr(helpers, 'fmincore', None)
BLOB_MAX = 8192*4 # 8192 is the "typical" blob size for bupsplit
BLOB_READ_SIZE = 1024*1024
MAX_PER_TREE = 256
progress_callback = None
fanout = 16
GIT_MODE_FILE = 0100644
GIT_MODE... | jbaber/bup | lib/bup/hashsplit.py | Python | lgpl-2.1 | 7,757 |
#!/usr/bin/python
"""Test of ARIA horizontal sliders using Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(10000))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(utils.S... | GNOME/orca | test/keystrokes/firefox/aria_slider_tpg.py | Python | lgpl-2.1 | 8,352 |
# JoeTraffic - Web-Log Analysis Application utilizing the JoeAgent Framework.
# Copyright (C) 2004 Rhett Garber
# 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 th... | rhettg/JoeTraffic | LogReader/read_job.py | Python | lgpl-2.1 | 4,327 |
@app.route('/job/<name>')
def results(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists(job.get_path('output.pdb')):
template = 'results_ok.html'
... | salilab/saliweb | examples/frontend-results.py | Python | lgpl-2.1 | 440 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Name: Generic.py
# Purpose:
# Author: Fabien Marteau <fabien.marteau@armadeus.com>
# Created: 21/05/2008
#-----------------------------------------------------------------------------
# Co... | magyarm/periphondemand-code | src/bin/core/generic.py | Python | lgpl-2.1 | 4,911 |
import logging
from ..DataUploader import Plugin as DataUploaderPlugin
from .reader import AndroidReader, AndroidStatsReader
from ...common.interfaces import AbstractPlugin
try:
from volta.core.core import Core as VoltaCore
except Exception:
raise RuntimeError("Please install volta. https://github.com/yandex-... | yandex/yandex-tank | yandextank/plugins/Android/plugin.py | Python | lgpl-2.1 | 4,425 |
# Copyright (C) 2013-2017 Chris Lalancette <clalancette@gmail.com>
# 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;
# version 2.1 of the License.
# This library is distributed in the ho... | nullr0ute/oz | oz/Linux.py | Python | lgpl-2.1 | 16,373 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2019 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# ... | fifengine/fifengine | engine/python/fife/extensions/loaders.py | Python | lgpl-2.1 | 2,646 |
from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
fr... | oe-alliance/e2openplugin-CrossEPG | src/enigma2/python/crossepg_main.py | Python | lgpl-2.1 | 2,743 |
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------#
# This file is part of Py-cnotify. #
# #
# Copyright (C) 2007, 2008 Paul Pogonyshev. #
# ... | kived/py-cnotify | cnotify/__init__.py | Python | lgpl-2.1 | 8,208 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Backend.AI Library documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 1 21:26:20 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... | lablup/sorna | docs/conf.py | Python | lgpl-3.0 | 6,409 |
import math
import socket
import tempfile
import unittest
from contextlib import closing
import numpy as np
from shyft.api import (
Calendar, UtcPeriod,
DtsServer, DtsClient,
TimeAxis, TimeSeries, POINT_AVERAGE_VALUE, POINT_INSTANT_VALUE
)
from shyft.pyapi import fixed_tsv, windowed_percentiles_tsv, peri... | jfburkhart/shyft | shyft/tests/pyapi/test_selector_ts.py | Python | lgpl-3.0 | 7,317 |
#!/usr/bin/env python
"""
RSS Reader for C-Power 1200
Copyright 2010-2012 Michael Farrell <http://micolous.id.au/>
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 Lice... | micolous/ledsign | cpower1200_rss.py | Python | lgpl-3.0 | 1,615 |
# -*- coding: utf-8 -*-
from distutils.core import setup
import os.path
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Library or Lesser General Public Lice... | huyx/icall | setup.py | Python | lgpl-3.0 | 1,026 |
{
'name' : 'Signature templates for user emails',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
'category' : 'Social Network',
'website' : 'https://yelizariev.github.io',
'depends' : ['base'],
'data':[
'res_users_signature_views.xml',
... | iledarn/addons-yelizariev | res_users_signature/__openerp__.py | Python | lgpl-3.0 | 445 |
# -*- coding: utf-8 -*-
# Some utils
import hashlib
import uuid
def get_hash(data):
"""Returns hashed string"""
return hashlib.sha256(data).hexdigest()
def get_token():
return str(uuid.uuid4())
| aluminiumgeek/organic | utils.py | Python | lgpl-3.0 | 212 |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# Copyright 2015 Oeyvind Brandtsegg
#
# This file is part of the Signal Interaction Toolkit
#
# The Signal Interaction Toolkit is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3
# as publi... | Oeyvind/interprocessing | codeUtility.py | Python | lgpl-3.0 | 12,966 |
import unittest
from matching.cpe_sorter import *
unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'},
'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'},
{'wfn': {'version': '1.0.1.2', 'target_sw... | fkie-cad/iva | tests/test_cpe_matching/test_cpe_sorter.py | Python | lgpl-3.0 | 6,349 |
"""
# Copyright (c) 05 2015 | surya
# 18/05/15 nanang.ask@kubuskotak.com
# 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 (at your option) any later ve... | suryakencana/niimanga | niimanga/sites/__init__.py | Python | lgpl-3.0 | 2,259 |
import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the existence of them.
if sys.version_info.major > 2:
... | lablup/sorna-agent | src/ai/backend/kernel/python/sitecustomize.py | Python | lgpl-3.0 | 1,693 |
# Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | consultit/Ely | ely/direct/data_structures_and_algorithms/ch02/range.py | Python | lgpl-3.0 | 2,023 |
#!/usr/bin/env python3
"""
This script edits your backends conf file by replacing stuff like:
[bnporc21]
_module = bnporc
website = pp
login = 123456
password = 78910
with:
[bnporc21]
_module = bnporc
website = pp
login = 123456
password = `pass show weboob/bnporc21`
"""
from __future__ import print_function
impo... | vicnet/weboob | contrib/replace-backends-pass.py | Python | lgpl-3.0 | 2,065 |
# -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
class Request(WebObRequest):
"""The OAuth version of the WebOb Request.
Provides an easier way to obtain O... | karacos/karacos-wsgi | lib/wsgioauth/request.py | Python | lgpl-3.0 | 3,175 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module 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 Licens... | laurentb/weboob | modules/caissedepargne/cenet/pages.py | Python | lgpl-3.0 | 14,121 |
"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor 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.0 of the License, or (at your option) any later version.... | TechInvestLab/dot15926 | editor_qt/iso15926/common/testing.py | Python | lgpl-3.0 | 4,639 |
import os
import struct
from binascii import unhexlify
from shutil import copy as copyfile
from twisted.internet.defer import inlineCallbacks
from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler, MyPreferenceDBHandler, ChannelCastDBHandler
from Tribler.Core.CacheDB.sqlitecachedb import str2bin
from ... | Captain-Coder/tribler | Tribler/Test/Core/test_sqlitecachedbhandler_torrents.py | Python | lgpl-3.0 | 13,903 |
"""
Property reference docs:
- https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/mapping-canonical-property-names-to-mapi-names#tagged-properties
- https://interoperability.blob.core.windows.net/files/MS-OXPROPS/[MS-OXPROPS].pdf
- https://fossies.org/linux/libpst/xml/MAPI_definitions.pdf
- http... | koodaamo/tnefparse | tnefparse/properties.py | Python | lgpl-3.0 | 63,627 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Maxim Vasilyev <qwiglydee@gmail.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 Softwar... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/drawing/gizmos.py | Python | lgpl-3.0 | 18,534 |
# https://en.wikipedia.org/wiki/Treap
import random
import time
class Treap:
def __init__(self, key):
self.key = key
self.prio = random.randint(0, 1000000000)
self.size = 1
self.left = None
self.right = None
def update(self):
self.size = 1 + size(self.left) +... | indy256/codelibrary | python/treap_bst.py | Python | unlicense | 2,234 |
# coding: utf-8
#
# Copyright (C) 2015 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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... | netsamir/dotfiles | files/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/python/get_completions_test.py | Python | unlicense | 5,566 |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER FEC CMTE ID', 'number': '2'},
{'name': 'ENTITY TYPE', 'number': '3'},
{'n... | h4ck3rm1k3/FEC-Field-Documentation | fec/version/v3/F57.py | Python | unlicense | 1,916 |
#!/usr/bin/env python
"""
Largest product in a grid
Problem 11
Published on 22 February 2002 at 06:00 pm [Server Time]
In the 20x20 grid below, four numbers along a diagonal line have been marked in red.
The product of these numbers is 26 * 63 * 78 * 14 = 1788696.
What is the greatest product of four adjac... | slowkid/EulerProject | solutions/problem11.py | Python | unlicense | 5,822 |
"""
Your job is to write a function which increments a string, to create a new string. If the string already ends with a number, the number should be incremented by 1. If the string does not end with a number the number 1 should be appended to the new string.
Examples:
foo -> foo1
foobar23 -> foobar24
foo0042 -> fo... | aadithpm/code-a-day | py/String Incrementer.py | Python | unlicense | 744 |
from ..parsers.errors import ErrorResponse
from warnings import warn
def raise_for_error(f):
"""
Wrapper method to parse any error response and raise the ErrorResponse instance if an error is encountered.
:param f:
:return:
"""
def inner(*args, **kwargs):
warn('`raise_for_error` is de... | ziplokk1/python-amazon-mws-tools | mwstools/requesters/base.py | Python | unlicense | 920 |
#!/usr/bin/env python
# -.- coding: utf-8 -.-y
import random
import socket
import os
import time
import threading
import Queue
import sys
import argparse
from multiprocessing import Process
print """\33[91m
═════════════════════════════════════════════════════════
███████ ██████ ███████
... | YodaBytePrograming/ChatRoom | ChatRoom 1.0/ChatRoom1.0Doser.py | Python | unlicense | 8,273 |
#!/usr/bin/env python
"""
Assorted utilities for manipulating latitude and longitude values
"""
from __future__ import unicode_literals
__version__ = "1.4"
import math, struct
def signbit(value):
"""
Test whether the sign bit of the given floating-point value is
set. If it is set, this generally mean... | NOAA-ORR-ERD/hazpy.unit_conversion | hazpy/unit_conversion/lat_long.py | Python | unlicense | 11,710 |
from math import log
def num_prime_factors(upper_limit):
"""
Create an array whose entries are the number of not necessarily distinct
prime factors of the index. The upper bound is the first number not
included.
"""
factor_count = [0] * upper_limit
prime = 2 #start with the first prime, whic... | peterstace/project-euler | OLD_PY_CODE/project_euler_old_old/187/187.py | Python | unlicense | 813 |
# coding: utf-8
from __future__ import unicode_literals
import base64
import functools
import json
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_kwargs,
compat_HTTPError,
compat_str,
compat_urlparse,
)
from ..utils import (
clean_html,
determine_ext... | remitamine/youtube-dl | youtube_dl/extractor/vimeo.py | Python | unlicense | 46,520 |
__author__ = 'Alex'
from Movement import Movement
class BaseCommand:
def __init__(self, movement):
assert isinstance(movement, Movement)
self.name = 'unknown'
self.m = movement
def execute(selfself):pass
class Forward(BaseCommand):
def __init__(self, movement):
assert isi... | RobotTurtles/mid-level-routines | Apps/TurtleCommands.py | Python | apache-2.0 | 1,101 |
# -*- coding: utf-8 -*-
#
# yara documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 8 11:04:03 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | Masood-M/yalih | req/yara-3.9.0/docs/conf.py | Python | apache-2.0 | 8,265 |
# Copyright 2019, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/federated | utils/keras_metrics.py | Python | apache-2.0 | 2,516 |
# Copyright 2019 DeepMind Technologies Limited and 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 applic... | deepmind/deepmind-research | cs_gan/main_ode.py | Python | apache-2.0 | 12,654 |
# Copyright (c) 2014 Alcatel-Lucent Enterprise
# 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
#
# Un... | OpenTouch/python-facette | src/facette/v1/plot.py | Python | apache-2.0 | 2,559 |
#!/usr/bin/env python
"""
Set up the logging
"""
import logging
import tempfile
import os
def initialize_logging():
"""
Set up the screen and file logging.
:return: The log filename
"""
# set up DEBUG logging to file, INFO logging to STDERR
log_file = os.path.join(tempfile.gettempdir()... | superphy/backend | app/modules/loggingFunctions.py | Python | apache-2.0 | 1,056 |
import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Firefox(capabilities={"marionette": True})
#(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}})
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("ht... | byakatat/selenium-training | test_login.py | Python | apache-2.0 | 586 |
import numpy as np
def sigmoid(x):
"""
Compute the sigmoid function for the input here.
"""
x = 1. / (1. + np.exp(-x))
return x
def sigmoid_grad(f):
"""
Compute the gradient for the sigmoid function here. Note that
for this implementation, the input f should be the sigmoid
... | zhaojijet/CS224d | Assignment1/q2_sigmoid.py | Python | apache-2.0 | 1,343 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path = os.path.abspath('../utils')
sys.path.append(lib_pat... | kasundezoysa/senze | testpi/myDevice.py | Python | apache-2.0 | 4,355 |
# -*- coding: utf-8 -*-
"""
Tests.
"""
import unittest
from bruges.rockphysics import fluidsub
# Inputs... GAS case
vp_gas = 2429.0
vs_gas = 1462.4
rho_gas = 2080.
# Expected outputs... BRINE case
vp_brine = 2850.5
vs_brine = 1416.1
rho_brine = 2210.0
phi = 0.275 # Don't know this... reading from fig
rhoh... | agile-geoscience/agilegeo | bruges/rockphysics/test/fluidsub_test.py | Python | apache-2.0 | 2,698 |
# Copyright 2015 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 writi... | steinarvk/rigour | rigour/tests/test_secrecy.py | Python | apache-2.0 | 1,198 |
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# 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... | kdheepak89/pypdevs | pypdevs/schedulers/schedulerNA.py | Python | apache-2.0 | 7,125 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 Cidadania S. Coop. Galega
#
# 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.or... | cidadania/e-cidadania | src/core/spaces/models.py | Python | apache-2.0 | 8,796 |
# Copyright (C) 2015 Yahoo! 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 applicable law... | openstack/horizon | openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py | Python | apache-2.0 | 2,469 |
# Copyright 2014 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 law ... | zhhf/charging | charging/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py | Python | apache-2.0 | 4,178 |
from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserServiceException(Exception):
def __init__(self, message=None... | cackharot/geosnap-server | src/geosnap/service/UserService.py | Python | apache-2.0 | 2,611 |
from abc import ABCMeta, abstractmethod, abstractproperty
from contextlib import contextmanager
from functools import wraps
import gzip
from inspect import getargspec
from itertools import (
combinations,
count,
product,
)
import operator
import os
from os.path import abspath, dirname, join, realpath
import... | bartosh/zipline | zipline/testing/core.py | Python | apache-2.0 | 47,174 |
import socket
import re
from xii import error, util
# sample validator
# keys = Dict(
# [
# RequiredKey("foo", String(), desc="A string to manipulate something"),
# Key("bar", String(), desc="something usefull")
# ],
# desc="Implement this stuff as you want"
# )
class Validator():
d... | xii/xii | src/xii/validator.py | Python | apache-2.0 | 6,612 |
# Copyright 2018 Google 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | google/ctfscoreboard | scoreboard/mail.py | Python | apache-2.0 | 4,180 |
import pytest
from ray.train.callbacks.results_preprocessors import (
ExcludedKeysResultsPreprocessor,
IndexedResultsPreprocessor,
SequentialResultsPreprocessor,
AverageResultsPreprocessor,
MaxResultsPreprocessor,
WeightedAverageResultsPreprocessor,
)
def test_excluded_keys_results_preprocess... | ray-project/ray | python/ray/train/tests/test_results_preprocessors.py | Python | apache-2.0 | 7,269 |
#
# Copyright 2015-2019, Institute for Systems Biology
#
# 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 ... | isb-cgc/ISB-CGC-Webapp | bq_data_access/v2/seqpeek/seqpeek_view.py | Python | apache-2.0 | 7,709 |
import numpy as np
import xgboost as xgb
import pytest
try:
import shap
except ImportError:
shap = None
pass
pytestmark = pytest.mark.skipif(shap is None, reason="Requires shap package")
# Check integration is not broken from xgboost side
# Changes in binary format may cause problems
def test_with_shap(... | dmlc/xgboost | tests/python/test_with_shap.py | Python | apache-2.0 | 817 |
import pathlib
import importlib
import sys
__all__ = ['sample', 'sampleTxt', 'sampleBin']
this = pathlib.Path(__file__)
datadir = this.parent.parent / 'data'
loader = importlib.machinery.SourceFileLoader('sample', str(datadir / 'sample.py'))
sample = loader.load_module()
sampleTxt = datadir / 'sample.txt'
sampleBin ... | viridia/coda | test/python/finddata.py | Python | apache-2.0 | 345 |
# Copyright (C) 2014 Universidad Politecnica de Madrid
#
# 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 la... | ging/keystone | keystone/contrib/oauth2/validator.py | Python | apache-2.0 | 16,189 |
from zope.i18nmessageid import MessageFactory
PloneMessageFactory = MessageFactory('plone')
from Products.CMFCore.permissions import setDefaultRoles
setDefaultRoles('signature.portlets.gdsignature: Add GroupDocs Signature portlet',
('Manager', 'Site Administrator', 'Owner',))
| liosha2007/plone-groupdocs-signature-source | src/groupdocs/signature/portlets/__init__.py | Python | apache-2.0 | 294 |
# -*- coding: utf-8 -*-
#
# File: src/webframe/management/commands/pref.py
# Date: 2020-04-22 21:35
# Author: Kenson Man <kenson@kenson.idv.hk>
# Desc: Import / Create / Update / Delete preference
#
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.management.base import B... | kensonman/webframe | management/commands/pref.py | Python | apache-2.0 | 18,742 |
# -*- coding: UTF-8 -*-
import hashlib
import base64
import datetime
import urllib2
import json
class TemplateSMS:
account_sid = ''
account_token = ''
app_id = ''
server_ip = ''
server_port = ''
soft_version = ''
timestamp = ''
def set_account(self, account_sid, token):
self.a... | davidvon/pipa-pay-server | admin/sms/sdk.py | Python | apache-2.0 | 2,956 |
# python 3
# tensorflow 2.0
from __future__ import print_function, division, absolute_import
import os
import argparse
import random
import numpy as np
import datetime
# from numpy import linalg
import os.path as osp
import sys
cur_dir = osp.dirname(osp.abspath(__file__))
sys.path.insert(1, osp.join(cur_dir, '.'))
fr... | wangg12/IRLS_tf_pytorch | src/IRLS_tf_v2.py | Python | apache-2.0 | 6,061 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_vizier_service_delete_study_sync.py | Python | apache-2.0 | 1,389 |
import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_child
from sdb_dump_common import item_get_children
logging.b... | williballenthin/python-sdb | scripts/sdb_dump_patch.py | Python | apache-2.0 | 3,397 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | UTSA-ICS/keystone-kerberos | keystone/hacking/checks.py | Python | apache-2.0 | 15,958 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/chassis_1_0_0_chassis_actions.py | Python | apache-2.0 | 3,731 |
# -*- encoding: utf-8 -*-
"""
lunaport.dao.line
~~~~~~~~~~~~~~~~~
Storage interaction logic for line resource.
"""
import pprint
pp = pprint.PrettyPrinter(indent=4).pprint
from sqlalchemy import text, exc
from ..wsgi import app, db
from .. domain.line import LineBuilder, LineAdaptor
from exceptions impo... | greggyNapalm/lunaport_server | lunaport_server/dao/path.py | Python | apache-2.0 | 4,535 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | sileht/pifpaf | pifpaf/drivers/ceph.py | Python | apache-2.0 | 5,134 |
import unittest
import tagging
class TestRealizerArbitraryReordering(unittest.TestCase):
"""
Tests for the realizer with arbitrary reordering
enabled.
"""
def test_realize_output_in_order(self):
"""
Test for when source tokens occur
in the same relative orde... | googleinterns/contextual-query-rewrites | models/lasertagger/test_realizer_arbitrary_reordering.py | Python | apache-2.0 | 1,307 |
#!/usr/bin/env python3
#
# Copyright (c) 2022 Roberto Riggio
#
# 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... | 5g-empower/empower-runtime | empower/managers/alertsmanager/alertshandler.py | Python | apache-2.0 | 2,382 |
#### PATTERN | WEB #################################################################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
####################################... | decebel/dataAtom_alpha | bin/plug/py/external/pattern/web/__init__.py | Python | apache-2.0 | 115,157 |
#默认选择是0.家电类下面的所有商品
#选择你要购买的物品,要结算请在物品编号最后加j,例如(1,2,3,j) 不结算的就不加j
#购买多件商品按,(逗号)隔开,例如1,2,3,j(结算),不结算(1,2,3)
import os
shoop1=[
("家电类"),
("衣服类"),
("手机类"),
("车类"),
]
jiadianshoop=[
("电冰箱",20000),
("彩电",2000),
("洗衣机",400),
("脸盆",30),
("牙刷",50)
]
flag=True
long=len(jiadianshoop)
def f():
... | xiaoyongaa/ALL | python基础2周/购物车作业改进.py | Python | apache-2.0 | 38,553 |
#! /usr/bin/env python
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# a fully functional basic pytest script.
#
# Pyt... | pombredanne/pymaven | testsuite.py | Python | apache-2.0 | 260,904 |
# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | quantumlib/ReCirq | recirq/readout_scan/tasks.py | Python | apache-2.0 | 4,314 |
from symbol.builder import add_anchor_to_arg
from models.FPN.builder import MSRAResNet50V1FPN as Backbone
from models.FPN.builder import FPNNeck as Neck
from models.FPN.builder import FPNRoiAlign as RoiExtractor
from models.FPN.builder import FPNBbox2fcHead as BboxHead
from mxnext.complicate import normalizer_factory
... | TuSimple/simpledet | config/ms_r50v1_fpn_1x.py | Python | apache-2.0 | 10,314 |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM 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
#
#... | epam/DLab | infrastructure-provisioning/src/general/scripts/aws/jupyter_configure.py | Python | apache-2.0 | 15,517 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/conary | conary/build/packagepolicy.py | Python | apache-2.0 | 195,877 |
import unittest
import pytest
from libweasyl import ratings
from weasyl.test import db_utils
from weasyl import character
@pytest.mark.usefixtures('db')
class SelectCountTestCase(unittest.TestCase):
def setUp(self):
self.user1 = db_utils.create_user()
self.user2 = db_utils.create_user()
... | Weasyl/weasyl | weasyl/test/test_character.py | Python | apache-2.0 | 2,994 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import unittest
from mri import MriServer
from mri.dispatch import MriServerDispatch
class TestMr... | Mri-monitoring/Mri-python-client | tests/TestMriServer.py | Python | apache-2.0 | 750 |
from JumpScale import j
descr = """
This jumpscript returns network info
"""
category = "monitoring"
organization = "jumpscale"
author = "kristof@incubaid.com"
license = "bsd"
version = "1.0"
roles = []
def action():
return j.sal.nettools.getNetworkInfo()
if __name__ == "__main__":
print(action())
| Jumpscale/jumpscale_core8 | apps/agentcontroller/jumpscripts/jumpscale/network_info.py | Python | apache-2.0 | 312 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... | tswast/google-cloud-python | automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py | Python | apache-2.0 | 59,675 |
from rest_framework import status
from rest_framework.exceptions import APIException, ParseError
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
# Import inside method to avoid errors when the OSF is loaded without Django
from rest_fr... | arpitar/osf.io | api/base/exceptions.py | Python | apache-2.0 | 1,838 |