code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
raven.events
~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import sys
from raven.utils.encoding import to_unicode
from raven.utils.stacks import get_stack_info, iter_t... | Goldmund-Wyldebeast-Wunderliebe/raven-python | raven/events.py | Python | bsd-3-clause | 3,417 |
import os
import ast
from collectors.lib.collectorbase import CollectorBase
class ManualScript(CollectorBase):
def __init__(self, config, logger, readq):
super(ManualScript, self).__init__(config, logger, readq)
self.command = ast.literal_eval(self.get_config("command"))
def __call__(self):
... | wangy1931/tcollector | collectors/builtin/manual_script.py | Python | lgpl-3.0 | 534 |
#! /usr/bin/env python
#
import logging
from autopyfactory.interfaces import SchedInterface
class MaxToSubmit(SchedInterface):
"""
Keep the number of jobs submitted during the whole history
of the APFQueue below some limit
"""
id = 'maxtosubmit'
# TO BE IMPLEMENTED
| PanDAWMS/autopyfactory | autopyfactory/plugins/queue/sched/MaxToSubmit.py | Python | apache-2.0 | 295 |
"""This module contains constants used by the Lifemapper web services
"""
import os
from LmServer.base.utilities import get_mjd_time_from_iso_8601
from LmServer.common.lmconstants import SESSION_DIR
from LmServer.common.localconstants import SCRATCH_PATH, APP_PATH
from LmWebServer.common.localconstants import PACKAGIN... | lifemapper/core | LmWebServer/common/lmconstants.py | Python | gpl-3.0 | 13,281 |
# initializing pardon as a module
| Komish/pardon | pardon/__init__.py | Python | mit | 34 |
# Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | badock/nova | nova/pci/manager.py | Python | apache-2.0 | 11,380 |
"""Low-level MediaFire API Client"""
from __future__ import unicode_literals
import hashlib
import requests
import logging
import six
from six.moves.urllib.parse import urlencode
from requests_toolbelt import MultipartEncoder
from requests.adapters import HTTPAdapter
from requests.exceptions import RequestExcepti... | MediaFire/mediafire-python-open-sdk | mediafire/api.py | Python | bsd-2-clause | 25,118 |
#
# 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... | Fokko/incubator-airflow | airflow/migrations/versions/c1840b4bcf1a_increase_length_of_password_column_in_.py | Python | apache-2.0 | 1,498 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_details_py3.py | Python | mit | 1,841 |
from fabric.api import *
import subprocess
main_dir = subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip()
env.warn_only = True
# Testing
@task
def test_role(puppetrole='docker_test_role', image='centos-7') :
"""[local] Test a role on the specified OS on a Docker image"""
local( 'cd ' + ... | snesbittsea/psick | fabfile/docker.py | Python | apache-2.0 | 1,432 |
# Copyright: 2009 Nadia Alramli
# License: BSD
"""Terminal controller module
Example of usage:
print BG_BLUE + 'Text on blue background' + NORMAL
print BLUE + UNDERLINE + 'Blue underlined text' + NORMAL
print BLUE + BG_YELLOW + BOLD + 'text' + NORMAL
"""
import sys
# The current module
MODULE = sys.modules[__name... | borzole/borzole | bin/terminal.py | Python | lgpl-3.0 | 2,492 |
# Copied from https://github.com/ohmu/ohmu_common_py version.py version 0.0.1-0-unknown-fa54b44
"""
pglookout - version detection and version.py __version__ generation
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
import imp
import os
import subprocess
def save_version(new_ver, old_ver, version_file):
... | ohmu/pglookout | version.py | Python | apache-2.0 | 2,001 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-11-05 20:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_typ... | urfonline/api | api/home/migrations/0001_initial.py | Python | mit | 980 |
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2008 Johan Dahlin
# Copyright (C) 2008, 2009 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publish... | kerrickstaley/GObject-Introspection-Docutils | giscanner/girwriter.py | Python | gpl-2.0 | 24,554 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import vobject
from trytond.tools import reduce_ids, grouped_slice
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
__all__ = ['Event']
__... | tryton/calendar_classification | calendar_.py | Python | gpl-3.0 | 5,284 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Module: l10n_hr_fiskal_lazy
# Author: Davor Bojkić
# mail: bole@dajmi5.com
# Copyright (C) 2012- Daj Mi 5,
# http://www.dajmi5.com
#
#... | decodio/l10n_hr | l10n_hr_fiskal_lazy/account_invoice.py | Python | agpl-3.0 | 3,078 |
# -*- coding: utf-8 -*-
'''
Management of PostgreSQL databases.
=============================================
The postgres_database module is used to create and manage Postgres databases.
Databases can be set as either absent or present
.. code-block:: yaml
frank:
postgres_database.present
'''
# Import sa... | victorywang80/Maintenance | saltstack/src/salt/states/postgres_database.py | Python | apache-2.0 | 7,266 |
#!/usr/bin/env python
# (c) 2012 - Ryan M. Layer
# Hall Laboratory
# Quinlan Laboratory
# Department of Computer Science
# Department of Biochemistry and Molecular Genetics
# Department of Public Health Sciences and Center for Public Health Genomics,
# University of Virginia
# rl6sf@virginia.edu
import sys
imp... | glebkuznetsov/lumpy-sv | scripts/pairend_distro.py | Python | mit | 2,794 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('computing', '0008_auto_20141128_0958'),
]
operations = [
migrations.CreateModel(
name='Warranty',
fi... | tamasgal/rlogbook | rlogbook/computing/migrations/0009_auto_20141128_1121.py | Python | mit | 3,259 |
# Artshow Keeper: A support tool for keeping an Artshow running.
# Copyright (C) 2014 Ivo Hanak
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | hanak/artshow-keeper | artshowkeeper/common/authentication.py | Python | gpl-3.0 | 1,846 |
import fractions
import functools
import math
import itertools
import logging
logger = logging.getLogger('claripy.vsa.strided_interval')
from .decorators import expand_ifproxy
from ..backend_object import BackendObject
def normalize_types(f):
@functools.wraps(f)
def normalizer(self, o):
'''
C... | avain/claripy | claripy/vsa/strided_interval.py | Python | bsd-2-clause | 79,506 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'Said Sef'
| saidsef/cloudflare | lib/__init__.py | Python | mit | 67 |
import sys
import unittest
from .. import distribution, entry_points, files, PackageNotFoundError, version
try:
from importlib.resources import path
except ImportError:
from importlib_resources import path
try:
from contextlib import ExitStack
except ImportError:
from contextlib2 import ExitStack
c... | randyzingle/tools | kub/services/archive/cdk/python/sample-app/.env/lib/python3.6/site-packages/importlib_metadata/tests/test_zip.py | Python | apache-2.0 | 2,372 |
### KMP
def prefix_function(s):
'''Creates the prefix function array for the given string s, to be used in KMP or similar'''
pi = [0]
n = len(s)
for i in range(1, n):
j = pi[i - 1]
while j > 0 and s[i] != s[j]:
j = pi[j - 1]
if s[i] == s[j]:
j += 1
... | heffalump/sketches | algorithms/strings.py | Python | bsd-2-clause | 1,374 |
# Write a function named first_number that takes a string as an argument. The function should search, with a regular expression,
# the first number in the string and return the match object.
import re
def first_number(string):
return re.search(r'\d', string)
# Now, write a function named numbers() that t... | CaseyNord/Treehouse | Regular Expressions in Python/escapes.py | Python | mit | 587 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googlegenomics/gcp-variant-transforms | gcp_variant_transforms/libs/variant_merge/move_to_calls_strategy.py | Python | apache-2.0 | 9,013 |
"""Module to construct html data, shown on web page. TODO GREAT revision."""
import pp_utils
import lxml
from lxml.html import builder as E
class Saver():
"""returns objects to display at html page
can construct plain html too
"""
def __init__(self, beatmap_info):
self.beatmap_info = beatmap_... | slam3085/pp_strats | saver.py | Python | gpl-3.0 | 3,810 |
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b... | cloudify-cosmo/cloudify-azure-plugin | cloudify_azure/tests/resources/test_virtualmachine_utils.py | Python | apache-2.0 | 7,540 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, copy, modify, merge, publish,
... | azverkan/scons | test/QT/copied-env.py | Python | mit | 2,333 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from optionParser import OptionParser
from registration import registration
from urlparse import urlparse
import logging
import webbrowser
import httputils
import re
import wx
## OPTIONAL ##
# from usbkey import check_usb, move_on_key
SWN = 'MisuraInternet Speed Test'
l... | fondazionebordoni/nemesys-speedtest | mist/checkSoftware.py | Python | gpl-3.0 | 7,421 |
# 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 applicable ... | laosiaudi/tensorflow | tensorflow/contrib/slim/python/slim/nets/vgg_test.py | Python | apache-2.0 | 18,550 |
from django.db import models
class Escolaridade(models.Model):
"""
Description: Model Description
"""
escolaridade = models.CharField(max_length=45)
class Meta:
pass
| Bleno/sisgestor-django | escolaridade/models.py | Python | mit | 203 |
from church_app.core import db, logger
from sqlalchemy.exc import IntegrityError
from church_app.lib.helper import db_date_parse, valid_email, valid_number
def save_children(children):
"""
Inserts member's children in the database
:param children: member's children array
:return:[Boolean, object/none,... | euri16/church-manager | church_app/controllers/member_controller.py | Python | apache-2.0 | 5,384 |
import re
class Version(str):
""" This is NOT an implementation of semver, as users may use any pattern in their versions.
It is just a helper to parse .-, and compare taking into account integers when possible
"""
version_pattern = re.compile('[.-]')
def __new__(cls, content):
return str... | birsoyo/conan | conans/model/version.py | Python | mit | 4,890 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import render
from cStringIO import StringIO
import xml.dom.minidom
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table
from reportlab.lib.units import mm
from reportlab.lib.pagesizes import A4
i... | vileopratama/vitech | src/openerp/report/render/simple.py | Python | mit | 2,196 |
#isMaster = False
cluster_info = {#'3':('127.0.0.1', 8102,),
'1':('127.0.0.1', 8100,),
'2':('127.0.0.1', 8101,)
}
process_id = 1
#self_port = 8100
#self_IP = "127.0.0.1"
| SuperMass/distOS-lab3 | src/part1/frontend1/timeServer/time_config.py | Python | gpl-3.0 | 178 |
# -*- coding: utf-8 -*-
"""
.. module:: .exceptions.py
:synopsis: API Exceptions
.. moduleauthor:: Arthur Moore <arthur.moore85@gmail.com>
.. creation date:: 27-10-2017
.. licence::
"""
from __future__ import unicode_literals
__author__ = "arthur"
class ApiException(Exception):
"""
Base exception for a... | ArthurMoore85/pi_romulus | api/exceptions.py | Python | gpl-2.0 | 2,675 |
# 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... | tkingless/webtesting | venvs/dev/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py | Python | mit | 7,859 |
import blinker
frobnicated = blinker.signal('frobnicated')
class Receiver(object):
def __init__(self):
def handle_frobnicated(sender, **kwargs):
self.on_frobnicated(sender, **kwargs)
self.handle_frobnicated = handle_frobnicated
frobnicated.connect(handle_frobnicated)
def ... | voidabhi/python-scripts | blinker-example.py | Python | mit | 554 |
from .. import interface
from ..interfaces import IContext
class IRequest(interface.Interface):
""" web request """
class IResponse(interface.Interface):
""" response """
class IParameters(interface.Interface):
""" parameters """
class IWebContext(IContext):
"""Web handler context"""
params... | fafhrd91/mdl | mdl/web/interfaces.py | Python | apache-2.0 | 1,176 |
from __future__ import unicode_literals
from unittest import skipUnless
from django.db import connection
from django.db.models import Index
from django.db.utils import DatabaseError
from django.test import TransactionTestCase, mock, skipUnlessDBFeature
from django.test.utils import ignore_warnings
from django.utils.d... | cloudera/hue | desktop/core/ext-py/Django-1.11.29/tests/introspection/tests.py | Python | apache-2.0 | 10,863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Polina Morozova 16.11.2014
import sqlite3
import sys
import re
import datetime
def unescape(line):
line = line.replace(""", "\"")
line = line.replace("'", "'")
line = line.replace("&", "&")
line = line.replace("<", "<")
line = line.replace(">", ... | p0linka/AA_hmw | hmw_3/fox.py | Python | mit | 1,482 |
#Is a year a leap year
year = int(input("Enter a year: "))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year, yay!".format(year))
else:
print("{0} isnt a leap year".format(year))
else:
print("{0} is a leap year".format(year))
el... | JessicaGarson/ExercismSubmissions | leapsubmission.py | Python | unlicense | 370 |
from datetime import datetime, timedelta
import numpy as np
import pytest
from pandas._libs.tslibs import period as libperiod
import pandas as pd
from pandas import (
DatetimeIndex, Period, PeriodIndex, Series, notna, period_range)
from pandas.util import testing as tm
class TestGetItem:
def test_ellipsis(... | cbertinato/pandas | pandas/tests/indexes/period/test_indexing.py | Python | bsd-3-clause | 25,316 |
# Copyright (c) 2001-2019, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | xlqian/navitia | source/tyr/tests/integration/__init__.py | Python | agpl-3.0 | 1,308 |
"""Settings URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | traverseda/MfD-wiki | Settings/urls.py | Python | agpl-3.0 | 1,624 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
## @file info_j2k.py
# The size in bytes, and a codestream Kbps, even detailed subband
# level and neglecting headers, from a J2K codestream.
#
# @authors Jose Carmelo Maturana-Espinosa\n Vicente Gonzalez-Ruiz.
# @date Last modification: 2015, January 7.
#
## @packa... | vicente-gonzalez-ruiz/QSVC | trunk/src/info_j2k.py | Python | gpl-2.0 | 2,409 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_participants_analyze_content_async.py | Python | apache-2.0 | 1,679 |
# Copyright 2011 Joe Wreschnig, Christoph Reiter
# 2013-2020 Nick Boultbee
#
# 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... | quodlibet/quodlibet | quodlibet/browsers/iradio.py | Python | gpl-2.0 | 32,430 |
"""
Functions for generating several types of classic networks.
Functions:
build_star_network
build_chain_network
build_ring_network
build_random_network
build_clique_network
build_hypercube_network
build_grid_network
"""
import jbnetwork as jbn
def build_star_network(size):
"""Build a star network. Returns Netwo... | jbchouinard/jbnetwork | jbnetworkfactory.py | Python | mit | 2,645 |
from channels import route_class, route
from applications.server import ApplicationWebSocket
# The channel routing defines what channels get handled by what consumers,
# including optional matching on message attributes. In this example, we route
# all WebSocket connections to the class-based BindingConsumer (the cons... | jimmy201602/django-gateone | django_gateone/routing.py | Python | gpl-3.0 | 460 |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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, copy, modify... | charleswhchan/ansible-lint | test/TestLintRule.py | Python | mit | 1,975 |
from rest_framework import permissions as rest_permissions
from rest_framework import viewsets
from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView, UpdateView
from geotrek.flatpages.serializers import FlatPageSerializer
from geotrek.flatpages import models as flatpages_models... | mabhub/Geotrek | geotrek/flatpages/views.py | Python | bsd-2-clause | 1,088 |
import json
import getpass
import git
import os.path
import os
import sys
import signal
import subprocess
import tempfile
import logging
logging.basicConfig(format='%(message)s', level=logging.INFO)
# Silences Traceback on Ctrl-C
signal.signal(signal.SIGINT, lambda x,y: os._exit(1))
BOLD = '\033[1m'
ITALIC =... | dpup/git-workflow | util.py | Python | apache-2.0 | 4,588 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'in_shape': (10, 5), 'out_shape': (10,)},
{'in_shape'... | kiyukuta/chainer | tests/chainer_tests/functions_tests/array_tests/test_select_item.py | Python | mit | 3,311 |
#!/usr/bin/env python
from copy import deepcopy
from trainingobjs import (findLengths, TrainingDay, TrainingItem, toRunItem, Week,
REST, RACE)
from typing import Dict, List
# caloric estimates
# swim ~390 kcal / 1 mile
# bike ~650 kcal / 12.5 mile
# run ~450 kcal / 3.1 mile
# friendly nam... | peterfpeterson/musings | python/trainingplans.py | Python | mit | 35,242 |
#!/usr/bin/env python
import os
import sys
import dotenv
PROJECT_PATH = os.path.dirname(__file__)
dotenv.load_dotenv(os.path.join(PROJECT_PATH, ".env"))
dotenv.load_dotenv(os.path.join(PROJECT_PATH, ".env_defaults"))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eth_computation_mark... | pipermerriam/ethereum-computation-market-web | manage.py | Python | mit | 441 |
__author__ = 'Audrey Roy'
__email__ = 'audreyr@gmail.com'
__version__ = '0.3.0'
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/binaryornot/__init__.py | Python | agpl-3.0 | 80 |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of Resistencia Cadiz 1812. #
# #
# This program is free software: you can redistribute it... | pablorecio/resistencia-1812 | resistencia/gui/human_game_dialog.py | Python | gpl-3.0 | 6,924 |
#!/bin/python3
import bisect
def is_palindrome(n):
return str(n) == str(n)[::-1]
def generate_palindromes():
return [i * j
for i in range(100, 1000)
for j in range(100, 1000)
if is_palindrome(i * j)]
def find_lt(a, x):
'Find rightmost value less than x'
i = bis... | rootulp/hackerrank | python/euler004.py | Python | mit | 570 |
"""Functions for statistical analysis"""
from .parametric import (
f_threshold_twoway_rm, f_threshold_mway_rm, f_twoway_rm, f_mway_rm)
from .permutations import permutation_t_test
from .cluster_level import (permutation_cluster_test,
permutation_cluster_1samp_test,
... | trachelr/mne-python | mne/stats/__init__.py | Python | bsd-3-clause | 674 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# @author - Fekete Mihai <feketemihai@gmail.com>
# Copyright (C) 2011 TOTAL PC SYSTEMS (http://www.www.erpsystems.ro).
# Copyright (C) 2009 (<http://www.filsystem.ro>)
#
# This program is free softwa... | OpusVL/odoo | addons/l10n_ro/__openerp__.py | Python | agpl-3.0 | 1,982 |
# 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... | ikoula/cloudstack | test/selenium/cstests/smoketests/smokecfg.py | Python | gpl-2.0 | 2,928 |
# -*- coding: utf-8 -*-
#
# Input classes for fetching data via HTTP.
#
# Author: Just van den Broecke
#
import re
from urllib2 import Request, urlopen, URLError, HTTPError
import urllib
from stetl.component import Config
from stetl.input import Input
from stetl.util import Util
from stetl.packet import FORMAT
log = ... | sebastic/stetl | stetl/inputs/httpinput.py | Python | gpl-3.0 | 6,474 |
# -*- coding: utf-8 -*-
"""
oaepub clearcache
Clear out portions or all of OpenAccess_EPUB's cache
Usage:
clearcache [options] COMMAND
Options:
-h --help show this help message and exit
-v --version show program version and exit
Clearcache Specific Options:
-d --dry-run Will print out what i... | SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/commands/clearcache.py | Python | gpl-3.0 | 2,881 |
#
# 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/rollout_worker.py | Python | apache-2.0 | 3,063 |
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
import import_data
from django.contrib.auth.decorators import login_required
from django.utils import timezone
import time
# Create your views here.
from .models import Environmen... | inspectorbean/spat | outage/views.py | Python | gpl-3.0 | 4,101 |
"""
Views which allow users to create and activate accounts.
"""
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME, login as auth_login
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import get_current_site
from django.shortcuts import redir... | futurecolors/django-registration | registration/views.py | Python | bsd-3-clause | 7,994 |
__author__ = 'ryanplyler'
def sayhi(config):
error = None
try:
server_output = "Executing action 'sayhi()'"
response = "HI THERE!"
except:
error = 1
return server_output, response, error
| grplyler/netcmd | netcmd_actions.py | Python | gpl-2.0 | 231 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright 2014 José Manuel Abuín Mosquera <josemanuel.abuin@usc.es>
#
#This file is part of Perldoop.
#
#Perldoop 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... | citiususc/perldoop | src/Automata.py | Python | gpl-3.0 | 21,451 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("XGBRegressor" , "boston" , "postgresql")
| antoinecarme/sklearn2sql_heroku | tests/regression/boston/ws_boston_XGBRegressor_postgresql_code_gen.py | Python | bsd-3-clause | 130 |
import cv2
import numpy as np
import os
from math import sqrt
from constants import (
GROUND_TRUTH,
RAWDATA_FOLDER)
FONT = cv2.FONT_HERSHEY_SIMPLEX
WINDOW_NAME = "Labeling"
CTRL_PT_RADIUS = 10
class Boundary:
def __init__(self, width, height):
self.top = height
self.right = width
self.bottom = 0
self.lef... | trangnm58/idrec | localization_cnn/create_ground_truth.py | Python | mit | 5,533 |
"""Parse metrics json encoded protobuf list.
Decode json encoded form of a List of MetricRecord protobufs
Definition of record:
https://github.com/wandb/client/blob/master/wandb/proto/wandb_internal.proto
Encoder function:
https://github.com/wandb/client/blob/master/wandb/sdk/lib/proto_util.py
Example:
... | wandb/client | tests/utils/parse_metrics.py | Python | mit | 951 |
# pngsuite.py
# PngSuite Test PNGs.
"""After you import this module with "import pngsuite" use
``pngsuite.bai0g01`` to get the bytes for a particular PNG image, or
use ``pngsuite.png`` to get a dict() of them all.
"""
import binascii
import sys
def _dehex(hexbytes):
"""Liberally convert from hex string to binar... | Ratfink/micropython-png | pngsuite.py | Python | mit | 31,193 |
#@Author: Kyle Mede, kylemede@astron.s.u-tokyo.ac.jp or kylemede@gmail.com
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import copy
import KMlogger
from six.moves import range
## import from modules in ExoSOFT ##
from .cytools import orbit, model_input_pars
from .util... | kylemede/ExoSOFT | ExoSOFT/tools/model.py | Python | gpl-3.0 | 13,972 |
# flake8: noqa
from settings_shared import *
from ccnmtlsettings.staging import common
locals().update(
common(
project=project,
base=base,
INSTALLED_APPS=INSTALLED_APPS,
STATIC_ROOT=STATIC_ROOT,
cloudfront="d2pl7wm2o23pxj",
))
try:
from local_settings import *
exce... | ccnmtl/diabeaters | diabeaters/settings_staging.py | Python | gpl-2.0 | 345 |
from pyquery import PyQuery as pq
from nose.tools import eq_
from django.forms import ModelForm
import amo.tests
from translations import forms, fields
from translations.tests.testapp.models import TranslatedModel
class TestForm(forms.TranslationFormMixin, ModelForm):
name = fields.TransField()
class Meta:
... | robhudson/zamboni | apps/translations/tests/test_forms.py | Python | bsd-3-clause | 730 |
__author__ = 'victor'
from theano import tensor as T
def norm(A, axis=0, keepdims=False):
return T.sqrt(T.sum(T.sqr(A), axis=axis, keepdims=keepdims))
| vzhong/pystacks | pystacks/utils/theano_ext.py | Python | mit | 156 |
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 wr... | iriark01/greentea | test/__init__.py | Python | apache-2.0 | 658 |
"""
Unit tests for email feature flag in student dashboard. Additionally tests
that bulk email is always disabled for non-Mongo backed courses, regardless
of email feature flag, and that the view is conditionally available when
Course Auth is turned on.
"""
from django.test.utils import override_settings
from django.c... | geekaia/edx-platform | common/djangoapps/student/tests/test_bulk_email_settings.py | Python | agpl-3.0 | 5,937 |
# This file is part of Firemix.
#
# Copyright 2013-2016 Jonathan Evans <jon@craftyjon.com>
#
# Firemix 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... | Openlights/firemix | core/networking.py | Python | gpl-3.0 | 6,048 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/kernel_tests/scatter_ops_test.py | Python | apache-2.0 | 11,378 |
from __future__ import division
import os
import timeit
#folder hierarchy
#path = 'C:\Users\libpub\Desktop\SForkCrowFinal'
path=os.getcwd()
def fold(path, output=None):
writePath = str(path)+'\\foldStruct.txt'
file=open(writePath, 'w')
for root, dirs, files in os.walk(path):
level = root.replace(... | borchert/metadata-tools | file-analysis/mapLib_foldercheck.py | Python | mit | 10,472 |
'''
DMRG Engine.
'''
from numpy import *
from scipy.sparse.linalg import eigsh
from scipy.linalg import eigh,svd,eigvalsh
from numpy.linalg import norm
from numpy import kron as dkron
from matplotlib.pyplot import *
import scipy.sparse as sps
import copy,time,pdb,warnings,numbers
from blockmatrix.blocklib import eigb... | GiggleLiu/dmrg | dmrg.py | Python | gpl-2.0 | 37,043 |
#!/usr/bin/env python
import os
import sys
import yaml
import pprint
import moa.script
args = moa.script.getArgs()
def errex(message):
print message
sys.exit(-1)
statfiles = args['stats_files']
data = {}
for sf in statfiles:
with open(sf) as F:
d = yaml.load(F)
bn = os.path.basename(d['... | mfiers/Moa | moa/data/templates/fastainfo.finish.py | Python | gpl-3.0 | 2,769 |
#!/usr/bin/python3
# Copyright 2016-2018 Francisco Pina Martins <f.pinamartins@gmail.com>
# and Joao Baptista <baptista.joao33@gmail.com>
# This file is part of pyRona.
# pyRona 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 Soft... | StuntsPT/pyRona | tests/test_pyRona.py | Python | gpl-3.0 | 35,454 |
class AssignmentsBook:
def __init__(self, chapters):
self.chapters = chapters
# def __repr__(self):
# return self.__str__(self)
def get_chapters(self):
return self.chapters
# def __str__(self):
# rep = ""
# for chapter in self.chapters:
# rep += str(chapter)
# return rep
class Chapter:
def __ini... | varun-verma11/CodeDrill | djangoSRV/Views/exercise_data_structure.py | Python | bsd-2-clause | 1,232 |
# Module containing non-deprecated functions borrowed from Numeric.
__docformat__ = "restructuredtext en"
# functions that are now methods
__all__ = ['take', 'reshape', 'choose', 'repeat', 'put',
'swapaxes', 'transpose', 'sort', 'argsort', 'argmax', 'argmin',
'searchsorted', 'alen',
'r... | Ademan/NumPy-GSoC | numpy/core/fromnumeric.py | Python | bsd-3-clause | 71,769 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | yavwa/Shilling | contrib/seeds/generate-seeds.py | Python | mit | 4,351 |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Softwa... | chetan/cherokee | admin/plugins/plain.py | Python | gpl-2.0 | 1,703 |
from math import fabs
"""Kept these functions outside the class, since they are static
for the search and movement functions for board. The downside is it creates
an object for search purposes, which seems relatively heavy. I'll
optimize later if necessary
"""
def shift_up(pos):
"""returns new position... | aelkikhia/pyduel_engine | pyduel_engine/model/position.py | Python | apache-2.0 | 3,110 |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 ... | lmacken/moksha | moksha/tests/functional/__init__.py | Python | apache-2.0 | 710 |
"""
High-level functional tests for enc.
"""
import pytest
import enc
import django
import os
class TestFunctionalDumpToYAML():
"""
Various tests based on data manually entered into the admin,
and then dumped using the enc/fixtures/dump.sh then translated
to python object creation statements using en... | jantman/nodemeister | enc/tests/test_functional_dump2yaml.py | Python | apache-2.0 | 25,715 |
# coding: utf-8
#
# Copyright 2012 NAMD-EMAP-FGV
#
# This file is part of PyPLN. You can get more information at: http://pypln.org/.
#
# PyPLN 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 o... | fccoelho/pypln.backend | pypln/backend/workers/extractor.py | Python | gpl-3.0 | 8,419 |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 BigML
#
# 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 ... | jaor/python | bigml/tests/test_41_multidataset.py | Python | apache-2.0 | 6,851 |
from Client import Client
from fit.ColumnFixture import ColumnFixture
class CalculateFirstPhoneNumber(ColumnFixture):
client = Client()
phones = []
def first(self):
self.client.setPhones(self.phones)
return self.client.firstPhone()
| epronk/pyfit2 | examples/CalculateFirstPhoneNumber.py | Python | gpl-2.0 | 261 |
"""Spectral Embedding"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy.linalg import eigh
from scipy.sparse.linalg import lobpcg
from ..base import BaseEstimator
from ..exter... | meduz/scikit-learn | sklearn/manifold/spectral_embedding_.py | Python | bsd-3-clause | 20,837 |
import dbus
#
# Copyright (c) 2014-2022 The Voxie Authors
#
# 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, copy, modify... | voxie-viewer/voxie | pythonlib/voxie/dbusobject.py | Python | mit | 57,901 |
import numpy as np
#from scipy.special import sph_jn
# put best fit values of As and alpha from chi square analysis
or0 = 0.0000475
thetacmb = 2.728/2.7
def zeq(om0, h):
return 2.5*10**4.*om0*h**2.*thetacmb**(-4.)
def bb1(om0, h):
return 0.313*(om0*h**2.)**(-0.419)*(1.+0.607*(om0*h**2.)**0.674)
def bb2... | sum33it/scalpy | scalpy/transfer_func.py | Python | gpl-3.0 | 3,538 |
"""Constants for the NFAndroidTV integration."""
DOMAIN: str = "nfandroidtv"
CONF_DURATION = "duration"
CONF_FONTSIZE = "fontsize"
CONF_POSITION = "position"
CONF_TRANSPARENCY = "transparency"
CONF_COLOR = "color"
CONF_INTERRUPT = "interrupt"
DEFAULT_NAME = "Android TV / Fire TV"
DEFAULT_TIMEOUT = 5
ATTR_DURATION = "... | jawilson/home-assistant | homeassistant/components/nfandroidtv/const.py | Python | apache-2.0 | 1,018 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.