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 |
|---|---|---|---|---|---|
__all__ = ['less', 'cosh', 'arcsinh', 'add', 'ceil', 'arctan2', 'floor_divide',
'fmod', 'hypot', 'logical_and', 'power', 'sinh', 'remainder', 'cos',
'equal', 'arccos', 'less_equal', 'divide', 'bitwise_or',
'bitwise_and', 'logical_xor', 'log', 'subtract', 'invert',
'negative... | graik/biskit | biskit/core/oldnumeric/ufuncs.py | Python | gpl-3.0 | 1,233 |
#!/usr/bin/python2.5
# Copyright 2010 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 ... | istevens/personfinder-search-api | app/atom.py | Python | apache-2.0 | 5,064 |
# -*- coding: utf-8 -*-
"""
Implement a PGN reader/writer.
See http://www.chessclub.com/help/PGN-spec
"""
__author__ = 'Robert Ancell <bob27@users.sourceforge.net>'
__license__ = 'GNU General Public License Version 2'
__copyright__ = 'Copyright 2005-2006 Robert Ancell'
import re
"""
; Example PGN file
[Event "F/S... | guillaumebel/nibbles-clutter | glchess/src/lib/chess/pgn.py | Python | gpl-2.0 | 18,947 |
"""Muffin-Jinja2 -- Jinja2 template engine for Muffin framework."""
import typing as t
import jinja2
from inspect import isawaitable
from muffin import Application
from muffin.plugins import BasePlugin, PluginException
__version__ = "1.3.1"
__project__ = "muffin-jinja2"
__author__ = "Kirill Klenov <horneds@gmail.com... | klen/muffin-jinja2 | muffin_jinja2/__init__.py | Python | mit | 3,904 |
# Copyright 2012 Anton Beloglazov
#
# 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 writ... | beloglazov/openstack-neat | neat/locals/overload/otf.py | Python | apache-2.0 | 3,624 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | jax/scipy/sparse/__init__.py | Python | apache-2.0 | 643 |
from __future__ import absolute_import
import torch.nn.functional as F
from torch import mean as torchmean
import torch.nn.init as init
from ..utils import *
from ..utils.visualize import*
from torch import nn
from torchvision.models import resnet18, resnet34, resnet50, resnet101, \
resnet152
class ResNet(nn.Mod... | dapengchen123/code_v1 | reid/models/resnet.py | Python | mit | 3,418 |
#!/usr/bin/env python
# Copyright (C) 2010 Rob Browning
#
# This code is covered under the terms of the GNU Library General
# Public License as described in the bup LICENSE file.
# TODO: Add tar-like -C option.
import sys
from bup import metadata
from bup import options
from bup.helpers import handle_ctrl_c, log, sa... | pombredanne/bup | cmd/meta-cmd.py | Python | lgpl-2.1 | 5,404 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import family_aux_mass_edit
from . import family_associate_to_family_aux
from . import family_aux_associate_to_address_aux
| CLVsol/clvsol_odoo_addons | clv_family_aux/wizard/__init__.py | Python | agpl-3.0 | 281 |
"""
EagleSense web application
===
EagleSense: Tracking People and Devices in Interactive Spaces using Real-Time Top-View Depth-Sensing
Copyright © 2016 Chi-Jui Wu
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 Softwa... | cjw-charleswu/eaglesense | eaglesense/server/app.py | Python | gpl-3.0 | 3,074 |
from __future__ import print_function
import rpc
import os
import sys
import json
import numpy as np
import cloudpickle
import mxnet as mx
import importlib
IMPORT_ERROR_RETURN_CODE = 3
MXNET_MODEL_RELATIVE_PATH = "mxnet_model"
def load_predict_func(file_path):
if sys.version_info < (3, 0):
with open(fi... | ucbrise/clipper | containers/python/mxnet_container.py | Python | apache-2.0 | 2,689 |
# -*- coding: utf-8 -*-
# ==== CryptoPaste
# AUTHOR: NyanKiyoshi
# COPYRIGHT: 2015 - NyanKiyoshi
# URL: https://github.com/NyanKiyoshi/CryptoPaste/
# LICENSE: https://github.com/NyanKiyoshi/CryptoPaste/master/LICENSE
#
# This file is part of CryptoPaste under the MIT license. Please take awareness about this latest bef... | NyanKiyoshi/CryptoPaste | cryptopaste/utils.py | Python | mit | 2,800 |
"""
Copyright (c) 2016 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from flexmock import flexmock
import pytest
import os.path
from atomic_reactor.build import BuildRe... | maxamillion/atomic-reactor | tests/plugins/test_tag_from_config.py | Python | bsd-3-clause | 5,924 |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
return haystack.find(needle) | civilian/competitive_programing | leetcode/0/28/28.py | Python | mit | 109 |
import asynctest
from asynctest.mock import patch
class TestLoadRundeckJobs(asynctest.TestCase):
def setUp(self):
patcher1 = patch('charlesbot_rundeck.rundeck_lock.RundeckLock.seed_job_list') # NOQA
self.addCleanup(patcher1.stop)
self.mock_seed_job_list = patcher1.start()
patche... | marvinpinto/charlesbot-rundeck | tests/test_load_rundeck_jobs.py | Python | mit | 4,478 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/tpu/bfloat16_test.py | Python | apache-2.0 | 3,199 |
from __future__ import unicode_literals
import os
import logging
from mopidy import ext
from mopidy import config
__version__ = '1.0.4'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-Grooveshark'
ext_name = 'grooveshark'
version = __version__
def get_de... | camilonova/mopidy-grooveshark | mopidy_grooveshark/__init__.py | Python | mit | 698 |
import android
import android.activity
from os import unlink
from jnius import autoclass, cast
from plyer_lach.facades import Camera
from plyer_lach.platforms.android import activity
Intent = autoclass('android.content.Intent')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
MediaStore = autoclass('andr... | locksmith47/turing-sim-kivy | src/plyer_lach/platforms/android/camera.py | Python | mit | 2,169 |
#!/usr/bin/env python3
"""
Copyright (c) 2018 The Hyve B.V.
This code is licensed under the GNU Affero General Public License (AGPL),
version 3, or (at your option) any later version.
"""
import argparse
import os
import traceback
import tempfile
import datetime
import sys
import subprocess
def main(args):
"""Pr... | n1zea144/cbioportal | core/src/main/scripts/importer/validateStudies.py | Python | agpl-3.0 | 9,575 |
import utils
import pandas as pd
import numpy as np
import scipy.optimize as spo
def get_data():
return utils.get_data(['SPY', 'MSFT', 'GOOG', 'AMD', 'TSLA', 'GLD'], pd.date_range('2011-01-01', '2017-01-01'))
def optimizer_error(allocs, data):
return 0
def test():
data = get_data()
n... | gietal/Stocker | sandbox/udacity/1-9.py | Python | mit | 472 |
# -*- coding: utf-8 -*-
"""
Common classes and methods for PyLTI module
"""
from __future__ import absolute_import
import logging
import oauth2
import oauth.oauth as oauth
from xml.etree import ElementTree as etree
log = logging.getLogger('pylti.common') # pylint: disable=invalid-name
LTI_PROPERTY_LIST = [
'oa... | layus/pylti | pylti/common.py | Python | bsd-2-clause | 10,350 |
# Copyright 2013 the Melange 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 or agreed to in wr... | rhyolight/nupic.son | app/soc/mapreduce/convert_sponsor_scoped_model.py | Python | apache-2.0 | 1,949 |
#!/usr/bin/env python
from HTMLParser import HTMLParser, HTMLParseError
import optparse
from urllib2 import urlopen, URLError
from searchengine.logger import Logging
class TagSelector(HTMLParser):
"""
Strip all HTML tags from a string.
"""
def __init__(self, *args, **kwargs):
self.reset()
... | binsina/python-searchengine | searchengine/scraper.py | Python | bsd-3-clause | 3,070 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-12-18 17:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('geral', '0009_informacaomodulo'),
]
operations = [
... | anselmobd/fo2 | src/geral/migrations/0010_painel_slug.py | Python | mit | 528 |
import pytest
import ulmo
import test_util
import filecmp
def test_get_attributes():
with test_util.mocked_urls('usgs/eros/attributes.json'):
attrs = ulmo.usgs.eros.get_attribute_list()
assert len(attrs) == 38
def test_get_themes():
with test_util.mocked_urls('usgs/eros/themes.json'):
themes = ulmo.usgs.eros... | nathanhilbert/ulmo | test/usgs_eros_test.py | Python | bsd-3-clause | 2,771 |
# -*- coding: utf-8 -*-
from pyknyx.tools.deviceRunner import *
import unittest
# Mute logger
from pyknyx.services.logger import logging
logger = logging.getLogger(__name__)
logging.getLogger("pyknyx").setLevel(logging.ERROR)
class DeviceRunnerTestCase(unittest.TestCase):
def setUp(self):
pass
def... | knxd/pKNyX | tests/tools/deviceRunner.py | Python | gpl-3.0 | 397 |
from django.urls import path
from restaurants.views import RestaurantListView, RestaurantCreateView, RestaurantUpdateView
app_name = 'restaurants'
urlpatterns = [
path('', RestaurantListView.as_view(), name="list"),
path('create/', RestaurantCreateView.as_view(), name="create"),
path('<slug:slug>/', Rest... | matija94/show-me-the-code | trydjango/restaurants/urls.py | Python | mit | 366 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# compute/__init__.py
"""
See |compute.subsystem|, |compute.network|, |compute.distance|, and
|compute.parallel| for documentation.
Attributes:
all_complexes: Alias for :func:`pyphi.compute.network.all_complexes`.
ces: Alias for :func:`pyphi.compute.subsystem.ces... | wmayner/pyphi | pyphi/compute/__init__.py | Python | gpl-3.0 | 1,545 |
from decimal import Decimal
from django.db.models import DecimalField
from django.db.models.functions import Sign
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import DecimalModel, FloatModel, IntegerModel
class SignTests(TestCase):
def test_null(self):
In... | wkschwartz/django | tests/db_functions/math/test_sign.py | Python | bsd-3-clause | 2,151 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importmulti RPC."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... | laudaa/bitcoin | test/functional/importmulti.py | Python | mit | 21,767 |
class NoSuchDbError(Exception):
pass
class NoSuchKeyError(Exception):
pass
class MaxTransactionRetriesError(Exception):
pass
class UnkownQueuedWriteFuncError(Exception):
pass
| df3n5/redact-py | redact/errors.py | Python | mit | 197 |
# ============================================================================
# FILE: member.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
from .base import Base
import re
from deoplete.util import \
... | omrisim210/dotfiles | .config/nvim/temp/26992/20161015065132/rplugin/python3/deoplete/source/member.py | Python | gpl-3.0 | 2,283 |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | Senseg/robotframework | src/robot/model/testsuite.py | Python | apache-2.0 | 3,455 |
# MIT License
# br0k3ns0und
"""Toruk module."""
__version__ = '0.1.6'
| brokensound77/toruk | toruk/__init__.py | Python | mit | 72 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('openfonacide', '0022_auto_20150403_1835'),
]
operations = [
migrations.DeleteModel(
name='Espacios',
),
... | diegocrzt/openfonacide | openfonacide/migrations/0023_delete_espacios.py | Python | lgpl-3.0 | 326 |
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011, 2012, 2014 CERN.
##
## Invenio 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 ... | egabancho/invenio | invenio/legacy/oaiharvest/web/admin/oaiharvestadmin.py | Python | gpl-2.0 | 29,631 |
# -*- coding: utf-8 -*-
import pytest
from pandas import interval_range
from pandas.util.testing import assert_interval_array_equal
@pytest.mark.parametrize("kwargs", [
dict(start=0, periods=4),
dict(start=1, periods=5),
dict(start=5, end=10, closed="left"),
])
def test_interval_array_equal(kwargs):
... | GuessWhoSamFoo/pandas | pandas/tests/util/test_assert_interval_array_equal.py | Python | bsd-3-clause | 2,378 |
#!/usr/bin/env python
# portable serial port access with python
#
# This is a module that gathers a list of serial ports including details on OSX
#
# code originally from https://github.com/makerbot/pyserial/tree/master/serial/tools
# with contributions from cibomahto, dgs3, FarMcKon, tedbrandston
# and modifi... | ThomasGerstenberg/serial_monitor | hardware/serial/tools/list_ports_osx.py | Python | bsd-3-clause | 6,816 |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# t... | chepazzo/ansible-eos | library/eos_vlan.py | Python | bsd-3-clause | 15,041 |
from .axiomtype import AxiomType
from .owlaxiomvisitor import OWLAxiomVisitor, OWLAxiomVisitorEx
from .owlnaryindividualaxiom import OWLNaryIndividualAxiom
from .owlobjectvisitor import OWLObjectVisitor, OWLObjectVisitorEx
from owlapy.util import accept_default, accept_default_ex
class OWLDifferentIndividualsAxiom(OW... | patrickwestphal/owlapy | owlapy/model/owldifferentindividualsaxiom.py | Python | gpl-3.0 | 1,047 |
"""Implements the GradingProtocol, which runs all specified tests
associated with an assignment.
The GradedTestCase interface should be implemented by TestCases that
are compatible with the GradingProtocol.
"""
from client.protocols.common import models
from client.utils import format
import logging
log = logging.ge... | jathak/ok-client | client/protocols/grading.py | Python | apache-2.0 | 2,492 |
"""830. Positions of Large Groups
https://leetcode.com/problems/positions-of-large-groups/
In a string s of lowercase letters, these letters form consecutive groups of the same character.
For example, a string like s = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z", and "yy".
A group is identified by an interval [... | isudox/leetcode-solution | python-algorithm/leetcode/problem_830.py | Python | mit | 1,651 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# LAYMAN SVN OVERLAY HANDLER
###############################################################################
# File: svn.py
#
# Handles subversion overlays
#
# Copyright:
# ... | jmesmon/layman | layman/overlays/svn.py | Python | gpl-2.0 | 4,855 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the prioritisetransaction mining RPC."""
from test_framework.test_framework import BitcoinTestFra... | gamecredits-project/GameCredits | test/functional/prioritise_transaction.py | Python | mit | 5,741 |
# -*- coding: utf-8 -*-
# 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, softw... | jsmartin/shade | shade/tests/unit/test_create_server.py | Python | apache-2.0 | 6,459 |
from test.test_json import PyTest, CTest
# from http://json.org/JSON_checker/test/pass1.json
JSON = r'''
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
[],
-42,
true,
false,
null,
{
"integer": 1234567890,
"real": ... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_json/test_pass1.py | Python | lgpl-3.0 | 1,912 |
"""Provide the WikiPage class."""
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.generator import ListingGenerator
from .base import RedditBase
from .redditor import Redditor
class WikiPage(RedditBase):
"""An individual WikiPage object.
**Typical Attributes**
This ... | leviroth/praw | praw/models/reddit/wikipage.py | Python | bsd-2-clause | 8,763 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2022 Daniele Simonetti
#
# 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 version.
#
... | OpenNingia/l5r-character-manager-3 | l5r/dialogs/managedatapack.py | Python | gpl-3.0 | 5,427 |
from django.contrib.sitemaps import Sitemap
from events.models import Event
class EventsSitemap(Sitemap):
changefreq = "never"
priority = 1.0
def items(self):
return Event.objects.public()
def lastmod(self, obj):
return obj.date_modified | asgardproject/asgard-calendar | events/sitemaps.py | Python | bsd-3-clause | 251 |
import json
import random
import string
import crypt
import os
import web
urls = (
'/', 'hello',
'/register', 'register',
'/activate/(.+)', 'activate',
'/session', 'session',
'/paste', 'paste',
'/copy', 'copy',
)
#------------- STATIC --------------
EMAIL_ROOT = 'globalclip.org'
ACTIVATION_EMAIL = 'activa... | mcnemesis/globalclipboard | clipserver/server.py | Python | gpl-3.0 | 13,049 |
"""
State Space Model
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from statsmodels.compat.python import long
import numpy as np
import pandas as pd
from scipy.stats import norm
from .simulation_smoother import SimulationSmoother
from .kalman_smooth... | bert9bert/statsmodels | statsmodels/tsa/statespace/mlemodel.py | Python | bsd-3-clause | 111,510 |
import sys
import os
dir = os.path.dirname(sys.argv[0])
scriptsdir = os.path.normpath(os.path.join(dir, os.pardir, 'scripts'))
sys.path.append(scriptsdir)
from test_support import *
print_test('Bug Fixes', 0)
print_test('From 1.0.0 to 1.0.1', 1)
print_test('Recursive assignment to list slices handled incorrec... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/test/bugs/bugs100.py | Python | gpl-3.0 | 3,234 |
from piliko import *
import math
# the successive numbers of this intial spread input
# will create numerators and denominators that are all perfect squares.
# note that 9/25 is the square of 3 over the square of 5.... the leg and
# hypoteneuse of a pythagorean triple.
sp=spread_polynomial
maxn=15
print 's(s,n) -> ... | donbright/piliko | experiment/spreadpolys/spoly1.py | Python | bsd-3-clause | 621 |
import os
import string
import random
import shutil
from st2tests.base import BaseSensorTestCase
from git_commit_sensor import GitCommitSensor
TEST_CONFIG = {
'repositories': [
{
'url': 'https://github.com/StackStorm/st2',
'branch': 'master',
'local_clone_path': '/tmp/... | StackStorm/st2contrib | archive/packs/git/tests/test_commit_sensor.py | Python | apache-2.0 | 1,944 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Adriano Monteiro Marques
#
# Author: Piotrek Wasilewski <wasilewski.piotrek@gmail.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 Sof... | umitproject/network-admin | netadmin/reportmeta/urls.py | Python | agpl-3.0 | 1,723 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/ENTSOE/StateVariables/__init__.py | Python | mit | 2,852 |
# vim: set fileencoding=utf-8 :
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. It was rewritten by Dave St.Germain for speed.
#
# The MIT License (MIT)
#·
# Copyright (c) 2013 Dave St.Germain
#·
# Permission is hereby granted, free of charge, to any person obtain... | tikitu/jsmin | jsmin/test.py | Python | mit | 22,537 |
# -*- coding: utf-8 -*-
import asyncio
import jmespath
import json
import logging
import requests
import signal
import time
from aiohttp import ClientSession
from .providers import providers
logger = logging.getLogger(__name__)
class ActivityCount(object):
"""Gather activity/share stats from social APIs"""
... | psolbach/metadoc | metadoc/social/activity.py | Python | mit | 1,539 |
from gbdxtools import Interface
gbdx = None
def go():
print(gbdx.task_registry.list())
print(gbdx.task_registry.get_definition('HelloGBDX'))
if __name__ == "__main__":
gbdx = Interface()
go()
| DigitalGlobe/gbdxtools | examples/basic_workflow_client.py | Python | mit | 211 |
#-*- coding: utf8 -*
#
# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | syhpoon/xyzcmd | libxyz/vfs/vfsobj.py | Python | gpl-3.0 | 8,497 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... | HybridF5/jacket | jacket/api/compute/openstack/compute/legacy_v2/contrib/console_auth_tokens.py | Python | apache-2.0 | 2,636 |
import logging
from django.apps import apps
from django.conf import settings
from elasticsearch import Elasticsearch
from bots.elasticsearch.tasks import IndexModelTask
from bots.elasticsearch.tasks import IndexSourceTask
from share.bot import Bot
logger = logging.getLogger(__name__)
def chunk(iterable, size):
... | zamattiac/SHARE | bots/elasticsearch/bot.py | Python | apache-2.0 | 3,689 |
#!/usr/bin/python
## generate the .pzs file for zoomquilt
import os
import urllib
path = os.path.abspath(os.path.dirname(__file__))
print "46.0\t128.0\t128.0"
for i in xrange(1,47):
print "TiledMediaObject\t%s\t%s\t%s\t%s" % \
(os.path.join(urllib.quote(path), str(i)+'.jpg'),
-1.0*i, -128.0/(2**... | davidar/pyzui | demo/zoomquilt/gen_pzs.py | Python | gpl-2.0 | 518 |
# coding: utf-8
from __future__ import unicode_literals
import os
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from rest_framework.test import APITestCase
import json
from escuelas import models
class UsuariosYPerfilesTests(APITestCase):
def test_tiene_depedencias(sel... | Dte-ba/suite-backend | escuelas/tests/tests_usuarios_y_perfiles.py | Python | gpl-3.0 | 5,373 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Base(object):
def __init__(self):
self.base_url = "https://swapi.co/api"
def get_base_url(self):
return self.base_url
| mgasiorowski/swapi_tests | python/api/base.py | Python | mit | 197 |
from main import GuessManager
def test_init_uppercase():
g = GuessManager('SOMEWORD')
assert g.word == 'SOMEWORD'
assert g.mask == [False]*8
def test_init_mask():
mask = [True, False, True, False, True, False, True, False]
g = GuessManager('SOMEWORD', mask=mask)
assert g.word == 'SOMEWORD'
... | lgiordani/slack_hangman | tests/test_guess_manager.py | Python | mit | 5,541 |
import numpy, array
import os
def load_images():
#relevant_path = "/media/zsombi/Raktar/vanhateren_images/"
relevant_path = "../../../10photos/"
file_names = [fn for fn in os.listdir(relevant_path) if [fn.endswith('.iml')]]
img = []
for filename in file_names:
with open(relevant_path+filename, 'rb... | zsomko/visualcortex | python/patches/load_images.py | Python | gpl-2.0 | 500 |
'''
Daniel Klein
Computer-Based Honors Program
The University of Alabama
5.8.2014
This file contains some key constants that are used throughout the
WordCloud system.
'''
# set these variables to match local paths where everything is/you want it to go
# path where case files from LEXIS live (for parser)
LEXIS_FILE_P... | dmarklein/WordCloud | src/python/WordCloudConstants.py | Python | apache-2.0 | 1,199 |
import curses
def main(screen):
"""screen is a curses screen passed from the wrapper"""
# It will do curses.cbreak(), curses.noecho() and curses_screen.keypad(1) on init
# and reverse them on exit, even if the exit was an exception.
if __name__ == '__main__':
curses.wrapper(main)
===================... | jabbalaci/PrimCom | data/python/curses_wrapper.py | Python | gpl-2.0 | 492 |
"""
Defines forms for providing validation of embargo admin details.
"""
from django import forms
from embargo.models import EmbargoedCourse, EmbargoedState, IPFilter
from embargo.fixtures.country_codes import COUNTRY_CODES
import ipaddr
from xmodule.modulestore.django import modulestore
from opaque_keys import Inv... | nanolearning/edx-platform | common/djangoapps/embargo/forms.py | Python | agpl-3.0 | 4,209 |
"""An interface for publishing rich data to frontends.
There are two components of the display system:
* Display formatters, which take a Python object and compute the
representation of the object in various formats (text, HTML, SVG, etc.).
* The display publisher that is used to send the representation data to the... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/IPython/core/displaypub.py | Python | artistic-2.0 | 4,092 |
#!/usr/bin/python
import os, sys
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vertaal.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_appl... | dahool/vertaal | wsgi.py | Python | gpl-3.0 | 330 |
#!/usr/bin/env python
#
# Wrapper script for launching Skylines as a FastCGI in lighttpd.
#
import os
import sys
import argparse
from config import to_envvar
parser = argparse.ArgumentParser(description='Run the SkyLines FastCGI daemon.')
parser.add_argument('config_file', nargs='?', metavar='config.ini',
... | shadowoneau/skylines | uwsgi/skylines.py | Python | agpl-3.0 | 634 |
# coding: utf-8
"""
Our City App
Our City App internal apis # noqa: E501
The version of the OpenAPI document: 0.0.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from oca.configuration import Configuration
class HomeScreenBottomSheet(object):... | our-city-app/oca-backend | src/oca/models/home_screen_bottom_sheet.py | Python | apache-2.0 | 4,336 |
date_dict={"January":1,"February":2,"March":3,"April":4,"May":5,"June":6,
"July":7,"August":8,"September":9,"October":10,"November":11,"December":12,
"Jan":1,"Feb":2,"Mar":3,"Apr":4,"May":5,"Jun":6,
"Jul":7,"Aug":8,"Sep":9,"Oct":10,"Nov":11,"Dec":12}
import os
BASE_DIR=os.path.dirname(... | OmnesRes/prepub | analyses/preprint_month_graph.py | Python | mit | 9,966 |
import datetime
import logging
from typing import Optional
from collections import defaultdict
from betfairlightweight.resources.bettingresources import MarketBook, MarketCatalogue
from .. import config
from .blotter import Blotter
from ..execution.transaction import Transaction
logger = logging.getLogger(__name__)
... | liampauling/flumine | flumine/markets/market.py | Python | mit | 7,248 |
#!/usr/bin/env python
#
# A Python AIVDM/AIVDO decoder
#
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
#
# This decoder works by defining a declarative pseudolanguage in which
# to describe the process of extracting packed bitfields f... | vyacht/carambola | package/vy-gpsd/src/devtools/ais.py | Python | gpl-2.0 | 50,545 |
#
# Copyright (c) 2008--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | backend/satellite_tools/disk_dumper/dumper.py | Python | gpl-2.0 | 34,623 |
# Copyright 2014 Roberto Brian Sarrionandia
#
# 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 t... | sarrionandia/tournatrack | toggleroom.py | Python | apache-2.0 | 1,395 |
import tasks
from collections import deque
from collections import namedtuple
import threading
import types
class NotFilled(object):
"""
A placeholder for a tasks requirement which is yet to be filled.
Internal use only.
"""
pass
class TaskData(object):
"""
Structure for necessary data to... | topfs2/heimdall | src/heimdall/taskqueues.py | Python | gpl-2.0 | 4,343 |
try:
raise NameError('Hi There! I am raising an error!')
except NameError:
print('An exception occured!')
raise | Code-by-practice/learning-python | codes/session_6/errorEg4.py | Python | mit | 117 |
# Copyright 2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
'''
Darcs plug-in module for layman.
'''
module_spec = {
'name': 'darcs',
'description': __doc__,
'provides':{
'darcs-module': {
'name': 'darcs',
'class': 'DarcsOverlay',
... | gentoo/layman | layman/overlays/modules/darcs/__init__.py | Python | gpl-2.0 | 706 |
import numpy as np
import pandas as pd
import pytest
from mathpy.numerical import differentiation as d
class TestDifferentiation(object):
x1, y1 = [0.5,0.6,0.7], [0.4794,0.5646,0.6442]
x2, y2 = [0.0, 0.2, 0.4], [0.00000, 0.74140, 1.3718]
x3, y3 = [1.1, 1.2, 1.3, 1.4], [9.025013, 11.02318, 1... | aschleg/mathpy | mathpy/numerical/tests/test_diff.py | Python | mit | 9,002 |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import numpy as np
import os
import PIL.Image
import PIL.ImageDraw
import digits
from digits.utils import subclass, override
from digits.extensions.view.interface import VisualizationInterface
from .forms import Con... | TimZaman/DIGITS | plugins/view/imageGradients/digitsViewPluginImageGradients/view.py | Python | bsd-3-clause | 4,243 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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 l... | eric-stanley/robotframework | src/robot/running/timeouts/timeoutwin.py | Python | apache-2.0 | 2,582 |
SIZE = 5 # must be greater than 5 to meet constraints of problem
board = [] # initialize board
def initializeBoard(board_size):
# create rows
for count in range(board_size):
board.append([])
# create columns, * represents a cell in the board
fo... | AbhishekShah212/School_Projects | CSC132/knightsTour.py | Python | mit | 1,641 |
# -*- coding: utf-8 -*-
import re
import calendar
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo.tools import float_com... | felipeunefa/tuconsejocomunal | addons/tcc_communal_council/models/notice.py | Python | gpl-3.0 | 3,462 |
##
# Copyright (c) 2005-2014 Apple Inc. All rights reserved.
#
# 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, mod... | trevor/calendarserver | txweb2/dav/test/test_options.py | Python | apache-2.0 | 2,162 |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
## don't do this unless you want a globally visible script
# scripts=['bin/myscript'],
packages=['hal'],
package_dir={'': 'src'}
)
setup(**d)
| peterheim1/hal | setup.py | Python | bsd-2-clause | 306 |
#!/usr/bin/python
#
# Urwid main loop code
# Copyright (C) 2004-2012 Ian Ward
# Copyright (C) 2008 Walter Mundt
# Copyright (C) 2009 Andrew Psaltis
#
# 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 ... | DarkPurpleShadow/ConnectFour | urwid/main_loop.py | Python | bsd-3-clause | 41,354 |
'''
Created on Feb 29, 2012
@author: chcorbato
@summary: based on http://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python
and syscall.py in this same package
'''
import sys, subprocess
from subprocess import PIPE, Popen
from threading import Thread
try:
from Queue ... | aslab/rct | higgs/branches/ros-fuerte/OMRosDrivers_py/src/ch_syscall.py | Python | gpl-3.0 | 1,576 |
#!/usr/bin/env python3
# coding=utf-8
"""
@version:0.1
@author: ysicing
@file: blog/__init__.py
@time: 2017/9/9 13:01
"""
import os
from flask import Flask
from jinja2 import FileSystemLoader
from sqlalchemy.engine.url import make_url
from sqlalchemy_utils import database_exists, create_database
from flask_debugtoo... | dc-project/blog | app/__init__.py | Python | agpl-3.0 | 2,483 |
#
# 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 us... | guoxiaolongzte/spark | python/pyspark/tests/test_context.py | Python | apache-2.0 | 10,189 |
def of(n):
factors = []
divisor = 2
while n > 1:
while n % divisor == 0:
factors.append(divisor)
n /= divisor
divisor += 1
if n > 1:
factors.append(n)
return factors
| madhuri2k/fantastic-spoon | calc/prime_factors.py | Python | mit | 236 |
#!/usr/bin/env python
#
# $File: dynamicLoci.py $
#
# This file is part of simuPOP, a forward-time population genetics
# simulation environment. Please visit http://simupop.sourceforge.net
# for details.
#
# Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org)
#
# This program is free software: you can redistribut... | BoPeng/simuPOP | docs/dynamicLoci.py | Python | gpl-2.0 | 1,769 |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Author: Hubert Kario - 2014
from __future__ import division, print_function
path = "./results/... | jvehent/cipherscan | top1m/parse_CAs.py | Python | mpl-2.0 | 11,097 |
"""EasyBlog Settings"""
from django.conf import settings
"""
This title will always show up in your title as the first part. If you want
a separator, add it here. Templates will automatically insert the post title
and other information into the title, as well. (this behavior can be
overridden in the templates themselv... | jmcclell/easyblog | easyblog/settings.py | Python | mit | 1,369 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from config import config
from common_functionexecutor import executor
from client_twitter import getTwitterNotifications
from client_facebook import getFacebookNotifications
from client_wordpress import getWordpressNotifications
from client_tumblr imp... | adaofeliz/papi | papi/delegate_social.py | Python | mit | 1,374 |
# coding=utf8
class Pickup:
'''
Classe repérant un point de ramassage de navette
Attributs publics:
- num : l'identifiant unique du point de ramassage (int)
- position : la position (Position.Position)
- idSite : l'id du site lié au pikcup
'''
def __init__(self, position=None, num=-1,... | gpierre42/optraj | vagrant/optraj.istic.univ-rennes1.fr/src/system/Pickup.py | Python | apache-2.0 | 2,618 |
__author__ = """Copyright Martin J. Bligh, 2006,
Copyright IBM Corp. 2006, Ryan Harper <ryanh@us.ibm.com>"""
import os
from autotest.client import kernel, os_dep
from autotest.client import utils
class xen(kernel.kernel):
def log(self, msg):
print msg
self.logfile.write('%s\n' % ... | nacc/autotest | client/xen.py | Python | gpl-2.0 | 7,479 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.