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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (c) 2009, 2010, 2011 Andrey Golovizin
#
# 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 ... | rybesh/pybtex | pybtex/docgen/__init__.py | Python | mit | 1,560 |
from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/views/generic/__init__.py | Python | mit | 897 |
from django.contrib import admin
from AccountPickup.models import OAMStatusTracker
class OAMStatusTrackerAdmin(admin.ModelAdmin):
search_fields = ['^psu_uuid']
list_display = ['psu_uuid', 'select_odin_username', 'select_email_alias', 'set_contact_info', 'set_password',
'set_directory', 'pr... | hhauer/myinfo | AccountPickup/admin.py | Python | mit | 430 |
#!/usr/bin/env python
__author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>"
__version__ = "0.2"
__license__ = "GNU Lesser General Public License"
__package__ = "lastfm"
from lastfm.base import LastfmBase
from lastfm.mixin import chartable, mixin
import lastfm.playlist
from lastfm.decorators import (
cached_pr... | rishirajsinghjhelumi/Entity-Mining | lastfm/user.py | Python | gpl-2.0 | 31,810 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './acq4/devices/MockClamp/devTemplate.ui'
#
# Created: Thu May 29 10:20:36 2014
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QS... | tropp/acq4 | acq4/devices/MockClamp/devTemplate.py | Python | mit | 8,286 |
import math
#A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
#Find the largest palindrome made from the product of two 3-digit numbers.
def checkIfPal(num):
#in more robust program would check if the number is an integer he... | GT-IDEaS/SkillsWorkshop2017 | Week01/Problem04/awillats_04.py | Python | bsd-3-clause | 1,200 |
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xblock.fields import Scope, String
import textwrap
log = logging.getLogger(__name__)
# Make '_' a no-op so we can scrape strings. Using lambda instea... | TheMOOCAgency/edx-platform | common/lib/xmodule/xmodule/annotatable_module.py | Python | agpl-3.0 | 7,057 |
#
# 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 ... | rdo-management/tuskar | tuskar/tests/db/test_models.py | Python | apache-2.0 | 3,591 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/appservice/appservice_domains.py | Python | mit | 17,323 |
# Copyright 2013 Huawei Technologies Co.,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
#
# Unl... | dkalashnik/tempest | tempest/api/compute/admin/test_hypervisor_negative.py | Python | apache-2.0 | 5,267 |
"""
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
import datetime
import operator
import warnings
import pytest
import tempfile
import re
import sys
import numpy as np
from numpy.testing import (
assert_raises, assert_warns... | mhvk/numpy | numpy/core/tests/test_deprecations.py | Python | bsd-3-clause | 44,586 |
# Copyright (c) 2014 GigaSpaces Technologies 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 ... | vmware/tosca-vcloud-plugin | tests/unittests/test_mock_network_plugin_public_nat.py | Python | apache-2.0 | 36,286 |
import sys; sys.path.append('..')
from conf import *
project = 'Software Architecture, Cloud, Microservices'
author = 'Matt Harasymczuk'
email = 'matt@astrotech.io'
language = 'en'
todo_emit_warnings = False
todo_include_todos = True
html_static_path = ['../_static']
html_favicon = '../_static/favicon.png'
| AstroTech/workshop-devops | architecture/conf.py | Python | mit | 311 |
# This file is part of puppet-panel.
#
# puppet-panel is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# puppet-panel is distributed i... | ybulach/puppet-panel | puppet/admin.py | Python | lgpl-3.0 | 3,118 |
import wx
from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fitRemoveImplant import FitRemoveImplantCommand
from .calc.fitAddImplant import FitAddImplantCommand
from .calc.fitRemoveBooster import FitRemoveBoosterCommand
from .calc.fitAddBooster import FitAddBoosterCommand
f... | blitzmann/Pyfa | gui/fitCommands/guiMetaSwap.py | Python | gpl-3.0 | 2,845 |
# -*- coding: utf-8 -*-
import unittest
from datetime import datetime, timedelta
from copy import deepcopy
from iso8601 import parse_date
from time import sleep
from logging import getLogger
from openprocurement.chronograph import TZ
from openprocurement.chronograph.scheduler import planning_auction, free_slot
from op... | openprocurement/openprocurement.chronograph | openprocurement/chronograph/tests/test.py | Python | apache-2.0 | 29,247 |
"""
Support for statistics for sensor values.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.statistics/
"""
import asyncio
import logging
import statistics
from collections import deque
import voluptuous as vol
import homeassistant.helpers.conf... | stefan-jonasson/home-assistant | homeassistant/components/sensor/statistics.py | Python | mit | 7,829 |
from july.models import User
from django import forms
from django.contrib.auth.forms import UserCreationForm
class RegistrationForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = User
fields = ('username',)
def clean_username(self):
# Since User.username is unique, thi... | ChimeraCoder/GOctober | july/forms.py | Python | mit | 808 |
#!/usr/bin/env python
__author__ = 'EGFABT'
__revision__ = "$Id: test_datatypes.py,v 1.1 2003/02/27 22:12:18 myers_carpenter Exp $"
import unittest
from egtp.DataTypes import *
class DataTypesTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_not_on_... | zooko/egtp_new | egtp/test/test_datatypes.py | Python | lgpl-2.1 | 5,782 |
"""
Pre-process a syllabus (class schedule) file.
my change for this file is at line 25, 26 and area from line 45
"""
import arrow # Dates and times
import logging
logging.basicConfig(format='%(levelname)s:%(message)s',
level=logging.INFO)
log = logging.getLogger(__name__)
def process(raw):
... | xzpjerry/proj2-flask | syllabus/pre.py | Python | artistic-2.0 | 2,481 |
#!/usr/bin/python
"""
Create Y matrix for Canopy. This is the connection between the SNAs and CNVs
"""
import sys
Wm = open(sys.argv[1])
Wm.readline()
cnvs = list()
header = list()
header.append("non-cna_region")
for i in Wm:
region = i.split()[0]
(chrx, start, end) = region.split("_")
cnvs.append((chrx, int(s... | TravisCG/SI_scripts | canpyY.py | Python | gpl-3.0 | 803 |
import os
WAGTAIL_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'test-media')
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
'NAME': os.... | inonit/wagtail | wagtail/tests/settings.py | Python | bsd-3-clause | 4,667 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for
# more details.
#
# You should have re... | nitmir/irc-email-notifier | notifier.py | Python | gpl-2.0 | 9,289 |
import numpy as np
import scipy.optimize
from msmbuilder.msm._markovstatemodel import _transmat_mle_prinz
random = np.random.RandomState(0)
def reference_mle(Counts, NumIter=10000000, TerminationEpsilon=1E-10):
# "Boxer method", from Equation (A4) in Bowman et al.
# J. Chem. Phys. 131, 124101 2009g
if no... | rmcgibbo/msmbuilder | msmbuilder/tests/test_transmat_mle_prinz.py | Python | lgpl-2.1 | 3,105 |
import socket
import pytest
from mock import patch, call
from adbpy.adb_process import AdbProcess
from adbpy.socket import Socket
ADB_PATH = "adb"
DEFAULT_ADDRESS = ("localhost", 5037)
@pytest.fixture
def adb_proc():
return AdbProcess(ADB_PATH, DEFAULT_ADDRESS)
def test_start(adb_proc):
with patch("subpro... | noahgoldman/adbpy | tests/test_adb_process.py | Python | mit | 947 |
import logging
import re
import sys
import time
from streamlink.plugin import Plugin, PluginArgument, PluginArguments
from streamlink.plugin.api import validate
from streamlink.stream import DASHStream, HDSStream, HLSStream, HTTPStream
from streamlink.stream.ffmpegmux import MuxedStream
log = logging.getLogger(__name... | beardypig/streamlink | src/streamlink/plugins/pluzz.py | Python | bsd-2-clause | 8,723 |
try:
import json
except ImportError:
import simplejson as json
import urllib2
import urllib
import codecs
import time
import datetime
import os
import random
import time
import tweepy
from tweepy.parsers import RawParser
import sys
#import cld
fhLog = codecs.open("LOG.txt",'a','UTF-8')
def lo... | YixuanLi/geo-tweet | twitter-collect/search_generic.py | Python | gpl-2.0 | 2,093 |
from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('app.views',
# language switcher
url(r'^i18n/setlang/(?P<language>[a-z]+)', 'switch_language'),... | enigmagroup/enigmabox-openwrt | webinterface/files/root/opt/enigmabox/webinterface/urls.py | Python | gpl-3.0 | 3,155 |
import base64
import pickle
import re
from os import path
from py12306.cluster.cluster import Cluster
from py12306.helpers.api import *
from py12306.app import *
from py12306.helpers.auth_code import AuthCode
from py12306.helpers.event import Event
from py12306.helpers.func import *
from py12306.helpers.request import... | pjialin/py12306 | py12306/user/job.py | Python | apache-2.0 | 19,823 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
sys.path.append('/corpus/python')
from Annotation import AnnotationEditor
CONFIG_PATH = "/corpus/config.json"
def merge(dbh, id1_, id2_):
""" id1_ is primary uid """
id1 = int(id1_)
id2 = int(id2_)
dbh.execute("SELECT user_id FROM users WHERE ... | OpenCorpora/opencorpora | scripts/merge_accounts.py | Python | gpl-2.0 | 2,518 |
from swampdragon.pubsub_providers.data_publisher import publish_data
import kronos
#@kronos.register('*:5 * * * *')
def mytask():
print("123")
f = open('/Users/johnnytsai/PythonProjects/Python-Django-AdminLTE2/SwampdragonTest/console.txt', 'a')
f.write("123")
data = {'name': 'name', 'message': 'messag... | mmmaaaxxx77/Python-Django-AdminLTE2 | SwampdragonTest/Test/cron.py | Python | gpl-2.0 | 372 |
"""
Internationalization support.
"""
import warnings
from os import path
from django.utils.encoding import force_unicode
from django.utils.functional import lazy
from django.utils.importlib import import_module
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_all',
'get_language', 'get_languag... | mitsuhiko/django | django/utils/translation/__init__.py | Python | bsd-3-clause | 5,570 |
# -*- coding: utf-8 -*-
""" Auto Encoder Example.
Using an auto encoder on MNIST handwritten digits.
References:
Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. "Gradient-based
learning applied to document recognition." Proceedings of the IEEE,
86(11):2278-2324, November 1998.
Links:
[MNIST Dataset] ht... | trhongbinwang/data_science_journey | deep_learning/tensorflow/tutorials/tutorial3/examples/3_NeuralNetworks/autoencoder.py | Python | apache-2.0 | 4,651 |
from org.jfree.data.general import DefaultPieDataset
from org.jfree.chart import ChartFactory
from geoscript.plot.chart import Chart
def pie(data, name='', trid=False):
"""
Creates a pie chart.
*data* is a ``dict`` whose keys are category names and values are numeric
values.
Setting *trid* to ``True`` r... | geoscript/geoscript-py | geoscript/plot/pie.py | Python | mit | 650 |
class AntelopeV1Server(object):
"""
The antelope server.
"""
| bkuczenski/lca-tools | antelope_v1_server/server/server.py | Python | gpl-2.0 | 75 |
TACKLE_READER_FORMAT = 'foo'
def reader(f, options):
return [{'foo': 'bar'}]
| mattikl/tackle | tests/plugindir/plugins/fooformat.py | Python | mit | 82 |
# Copyright 2018 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 applicab... | derekjchow/models | research/deeplab/core/nas_network.py | Python | apache-2.0 | 10,756 |
# Copyright(c) 2007-2010 by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of PyCha.
#
# PyCha is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | timesong/pycha | examples/barchart.py | Python | lgpl-3.0 | 2,184 |
# -*- coding: utf-8 -*-
#
# Rosa documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 27 20:57:41 2015.
#
# 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 ... | OctavianLee/Rosa | docs/conf.py | Python | mit | 11,608 |
# -*- coding: utf-8 -*-
"""
Minimum cost flow algorithms on directed connected graphs.
"""
__author__ = """Loïc Séguin-C. <loicseguin@gmail.com>"""
# Copyright (C) 2010 Loïc Séguin-C. <loicseguin@gmail.com>
# All rights reserved.
# BSD license.
__all__ = ['network_simplex']
from itertools import chain, islice, repea... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/flow/networksimplex.py | Python | bsd-2-clause | 20,993 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | our-city-app/oca-backend | src/shop/view.py | Python | apache-2.0 | 34,847 |
import re
from ..regdefs import regmagic
_presets = set(["$l0"])
def grouper(items):
"""
Group function code together (when applicable).
Produce a generator of (type, code, comment).
For functions, emit a single item with type == "fun". In this case
code is a dictionary with keys:
- "name" : n... | knz/slcore | slc/tools/slc/mt/mtalpha/asmproc/base.py | Python | gpl-3.0 | 34,035 |
#----------------------------------------------------------------------
# I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA.
#
# I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated
# to scientific acoustic simulations.
# Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicol... | Ifsttar/I-Simpa | src/python_bindings/samples/spps_conversion_resultats.py | Python | gpl-3.0 | 2,657 |
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"VisualScriptBasicTypeConstant",
"VisualScriptBuiltinFunc",
"VisualScriptClassConstant",
"VisualScriptComment",
"VisualScriptCondition",
"VisualScriptConstant"... | mcanders/godot | modules/visual_script/config.py | Python | mit | 1,655 |
import os
import sys
sys.path.append('./BCI_Framework')
import Configuration_BCI
import Main
import Single_Job_runner as SJR
import numpy as np
import Data_Preprocessor as Data_Proc
import matplotlib.pyplot as plt
def calc_power(sig_mat, window_size):
pass
sig_mat_pow = np.exp2(sig_mat)
pow_sig_mat = np... | lol/BCI-BO-old | plot_eeg.py | Python | gpl-3.0 | 3,956 |
import glob
import os
import random
from string import ascii_lowercase, digits
import cv2
"""
Flip image and bounding box for computer vision task
https://paperswithcode.com/method/randomhorizontalflip
"""
# Params
LABEL_DIR = ""
IMAGE_DIR = ""
OUTPUT_DIR = ""
FLIP_TYPE = 1 # (0 is vertical, 1 is horizontal)
def ... | TheAlgorithms/Python | computer_vision/flip_augmentation.py | Python | mit | 4,509 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Code to validate and convert settings of the Microsoft build tools.
This file contains code to validate and convert settings of the Microsoft
build tools. The... | teeple/pns_server | work/install/node-v0.10.25/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py | Python | gpl-2.0 | 43,627 |
from verbs.baseforms import forms
class PourOffForm(forms.VerbForm):
name = "Pour Off"
slug = "pour-off"
duration_in_seconds = forms.IntegerField()
edit_what_remark = forms.CharField()
| Bionetbook/bionetbook | bnbapp/bionetbook/_old/verbs/forms/pour_off.py | Python | mit | 205 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mlperf/training_results_v0.7 | Google/benchmarks/bert/implementations/bert-cloud-TF2.0-tpu-v3-32/modeling/networks/masked_lm.py | Python | apache-2.0 | 7,412 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011 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... | labordoc/labordoc-next | modules/bibrank/lib/bibrank_tag_based_indexer_unit_tests.py | Python | gpl-2.0 | 1,743 |
# standard imports
# third-party imports
import numpy as np
# local imports
import pyoptools.misc.frft as frft
def test_frft():
# frft(x,alpha)
expected = np.array(
[
4.44089210e-17 - 1.77635684e-16j,
-4.83717564e-01 - 2.16493490e-15j,
-2.28136623e-01 + 3.14003123... | cihologramas/pyoptools | tests/misc/test_frft.py | Python | gpl-3.0 | 4,401 |
from odoo import models, _
from odoo.addons.portal.wizard.portal_wizard import extract_email
from odoo.tools import ustr
import re
import unicodedata
class PortalWizardUser(models.TransientModel):
_inherit = 'portal.wizard.user'
def _clean_and_make_unique(self, name):
# when an alias name appears to ... | ingadhoc/odoo-academic | academic/wizards/portal_wizard_user.py | Python | agpl-3.0 | 2,608 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToSibling, NavigateToAttribute
from widgetastic_manageiq import (
Accordion,
BaseEntitiesView,
BreadCrumb,
ItemsToolBarViewSelector,
ManageIQTree,
SummaryTable,
)
from widgetastic_patternfly import Button, Dropdown
from widgetast... | lkhomenk/integration_tests | cfme/storage/object_store_container.py | Python | gpl-2.0 | 5,581 |
"""Problem ?: ???"""
import unittest
from functools import reduce
def solution():
frac = ""
n = 1
while len(frac) < 1000000:
frac += str(n)
n += 1
return reduce(lambda x, y: x*y, [int(frac[d-1])
for d in [1, 10, 100, 1000, 10000, 100000, 1000000]])
class TestFun... | mattrid93/ProjectEuler | probs/prob40.py | Python | mit | 425 |
"""
Provide the service module for the dummy proxy used in integration tests
"""
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
__func_alias__ = {"list_": "list"}
# Define the module's virtual name
__virtualname__ = "service"
def __virtual__():
"""
Only work on systems that ... | saltstack/salt | salt/modules/dummyproxy_service.py | Python | apache-2.0 | 2,979 |
# Under MIT License, see LICENSE.txt
from RULEngine.Communication.protobuf import grSim_Packet_pb2 as grSim_Packet
from RULEngine.Communication.util.udp_socket import udp_socket
class GrSimCommandSender(object):
""" Service qui envoie les commandes de mouvements aux robots. """
def __init__(self, host, port... | Gagnon06/StrategyIA | RULEngine/Communication/sender/grsim_command_sender.py | Python | mit | 1,496 |
#!/usr/bin/env python
"""A registry of all available Databases."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_server.databases import mem
from grr_response_server.databases import mysql
# All available databases go into this registr... | dunkhong/grr | grr/server/grr_response_server/databases/registry_init.py | Python | apache-2.0 | 414 |
from stew.core import Sort, Attribute, generator, operation
from stew.matching import var
from ADT.types.bool import Bool
from ADT.types.string import String
from ADT.types.block import Block
class String_list(Sort):
""" String_list sort represents the list of parameters name of a function"""
@generator
... | mencattini/ideal-pancake | ADT/types/func_list.py | Python | apache-2.0 | 1,940 |
from orbitfm.helpers import *
def assert_exception(func, exception, *args, **kwargs):
try:
func(*args, **kwargs)
except exception:
return True
return False
def test_parse():
assert parse_message('f ') == ('f', '')
#assert assert_exception(parse_message, ValueError, 'f')
... | eeue56/orbit-fm | server/orbitfm/tests/helpers.py | Python | bsd-3-clause | 519 |
# 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 agreed to in... | openstack/rally | tests/unit/task/test_task_cfg.py | Python | apache-2.0 | 11,894 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import pytest
from pants.backend.python.goals.lockfile import (
AmbiguousResolveNamesError,
PythonLockfileRequest,
PythonToolLockfileSentin... | patricklaw/pants | src/python/pants/backend/python/goals/lockfile_test.py | Python | apache-2.0 | 4,023 |
# -*- coding: utf-8 -*-
# <markment - markdown-based documentation generator for python>
# Copyright (C) <2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fou... | grahamc/markment | tests/unit/fs/test_cloner.py | Python | mit | 2,324 |
def solution(A):
# when p = 0, left element is left sum
leftSum = A[0]
# sum of all element in list - left sum gives right sum
rightSum = sum(A) - leftSum
# get the difference
minDiff = abs(leftSum - rightSum)
# iterate through list starting from second element
for i in range(1, len(A) ... | geekgugi/tape-equilibrium | TapeEquilibrium.py | Python | mit | 652 |
"""
Exponential Integrate-and-Fire model.
See Neuronal Dynamics, `Chapter 5 Section 2 <http://neuronaldynamics.epfl.ch/online/Ch5.S2.html>`_
"""
# This file is part of the exercise code repository accompanying
# the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch)
# located at http://github.com/EPFL-LCN/n... | EPFL-LCN/neuronaldynamics-exercises | neurodynex3/exponential_integrate_fire/exp_IF.py | Python | gpl-2.0 | 4,520 |
# Copyright (c) 2007 Ruben Reifenberg.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions... | shful/python-rrlog | rrlog/test/test_stackindent.py | Python | mit | 3,718 |
# Copyright 2020 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/keras/saving/saved_model/metric_serialization.py | Python | apache-2.0 | 1,974 |
from ..osid import managers as osid_managers
from ..osid import sessions as osid_sessions
class IdProfile(osid_managers.OsidProfile):
"""The ``IdProfile`` describes the interoperability among id services."""
class IdManager(osid_managers.OsidManager, osid_sessions.OsidSession, IdProfile):
"""This manager... | birdland/dlkit-doc | dlkit/id/managers.py | Python | mit | 2,317 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | AlexaProjects/Alexa2 | ALEXA-IDE/core/ninja_ide/gui/dialogs/preferences.py | Python | gpl-3.0 | 87,907 |
#!/usr/bin/python3
import time
import zmq
import random
# def producer():
# context = zmq.Context()
# zmq_socket = context.socket(zmq.PUSH)
# zmq_socket.bind("tcp://127.0.0.1:5557")
# print("PUSH bound ")
# # Start your result manager and workers before you start your producers
# for num in xra... | jaromrax/myservice | version2/zmq_tests/zmq_push.py | Python | gpl-2.0 | 1,245 |
__author__ = 'Liu'
class Noh():
def __init__(self, proximo=None):
self.proximo = proximo
def get_proximo(self): ## verifica se o proximo noh eh "nulo", se nao, vai para proximo.
if self.proximo is not None:
return self.proximo
def tem_proximo(self): ## verifica se tem o ... | liu88620/POO-Python | Tarefa4/noh.py | Python | mit | 592 |
#(c) 2004-2008 Thunderstone Media, LLC
#Creative Commons Attribution-Noncommercial 3.0 United States License
#
#Python Developyment By:
#
#Ray Slakinski
#August Trometer
import iPXSettings
import iPXClass
from iPXTools import *
def usage():
printMSG('\r\n%s' % iPXSettings.USER_AGENT)
printMSG('-help\r\nPrints this ... | rays/ipodderx-core | iPXAgent.py | Python | mit | 5,734 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from .. import base
from .record import Record
# Module API
def parse_record(res):
fields_to_remove = [... | opentrials/collectors | collectors/jprn/parser.py | Python | mit | 2,132 |
"""TODO URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-based ... | ysh329/Django-TODO | TODO/urls.py | Python | apache-2.0 | 805 |
from extract_len import *
def test_extract_video_len():
t = extract_video_len('mms://193.191.129.52/Archive/20131219-1_bb_pl.wmv')
assert (str(t) == '5:43:17.820000')
t = extract_video_len('http://wmv.politu.be/20131219-1_bb_pl.wmv')
assert (str(t) == '5:46:57.020000')
| gdesmott/politube | videos_tools/test_extract_len.py | Python | agpl-3.0 | 288 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from datetime import datetime, timedelta
from sqlalchemy import Table, Column, Integer, Float, String, Unicode, Boolean, DateTime
from sqlalchemy.schema import F... | oxc/Flexget | flexget/plugins/metainfo/imdb_lookup.py | Python | mit | 16,976 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | faizan-barmawer/openstack_ironic | ironic/tests/api/test_base.py | Python | apache-2.0 | 1,150 |
# How much pocket change do you have
# From https://www.maketecheasier.com/a-basic-introduction-to-python-3/ by Josh Price
# Typer: Ginny C Ghezzo
# What I learned: So little :(
total = input("Enter cash amount in dollar: $")
# Get amount in pennies
pennies = float(total) * 100
# Change purse (a dictionary of co... | gghezzo/prettypython | PythonEveryDay2015/changepurse.py | Python | mit | 1,057 |
#!/usr/bin/python
#######################################################################
# AllMyServos - Fun with PWM
# Copyright (C) 2015 Donate BTC:14rVTppdYQzLrqay5fp2FwP3AXvn3VSZxQ
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | allmyservos/allmyservos | contrib/AllMyServos/Data/JsonBlob.py | Python | gpl-2.0 | 5,999 |
# 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... | jistr/rejviz | rejviz/tests/cmd/test_builder.py | Python | apache-2.0 | 1,137 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017 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 later... | PaulinaLach/invenio-accounts-rest | invenio_accounts_rest/serializers.py | Python | gpl-2.0 | 5,974 |
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers, exceptions, validators
from rest_framework.fields import empty
from django_countries.serializer_fields import CountryField
from django.core.exceptions import ObjectDoesNotExist
class NullAsBlankMixin:
"""Field mixin th... | lafranceinsoumise/api-django | agir/lib/serializers.py | Python | agpl-3.0 | 9,035 |
__author__ = 'zhujie'
from re import search
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from douban_movies.items import DoubanMoviesItem
class MovieSpider(CrawlSpider):
name = 'douban_movies'
allowed_domains = ['movie.douban.com']
url_head... | PaprikaZ/crawler | douban_movies/douban_movies/spiders/movie_spider.py | Python | gpl-2.0 | 2,793 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('commerce', '0018_auto_20150118_1433'),
]
operations = [
migrations.RemoveField(
model_name='order',
... | jtraulle/django-ecommerce | commerce/migrations/0019_auto_20150118_1448.py | Python | agpl-3.0 | 609 |
import os
import sys
import struct
import signal
import string
def read_data(fmt, data):
size = struct.calcsize(fmt)
struct_buf = data[:size]
data = data[size:]
ret = [data]
t = struct.unpack(fmt, struct_buf)
ret.extend(list(t))
return tuple(ret)
class StoragePage:
def __init__(self):
self.offset = 0
self... | timoc/scaliendb | script/db.py | Python | agpl-3.0 | 4,913 |
# -*- encoding: utf-8 -*-
import unittest
import tempfile
import shutil
import json
import yaml
import os
import sys
import stat
from mock import patch
from zkfarmer import conf
class TempDirectoryTestCase(unittest.TestCase):
def _compat_assertIn(self, a, b):
# Python 2.6 compat
self.assertTrue(... | rs/zkfarmer | tests/test_conf.py | Python | mit | 11,301 |
"""
Configuration management using Augeas
.. versionadded:: 0.17.0
This state requires the ``augeas`` Python module.
.. _Augeas: http://augeas.net/
Augeas_ can be used to manage configuration files.
.. warning::
Minimal installations of Debian and Ubuntu have been seen to have packaging
bugs with python-a... | saltstack/salt | salt/states/augeas.py | Python | apache-2.0 | 10,821 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-11 11:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | EricZaporzan/evention | evention/events/migrations/0010_ignoredevent.py | Python | mit | 1,007 |
"""
Django settings for detest project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | tahpee/detest | detest/detest/settings.py | Python | mit | 2,968 |
#!/usr/bin/env python
#
# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of IoT orchestrator
#
# IoT orchestrator 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, eith... | telefonicaid/orchestrator | src/orchestrator/commands/removeServiceUser.py | Python | agpl-3.0 | 3,532 |
# For copyright and license notices, see __manifest__.py file in module root
from . import export_arba | jobiols/odoo-addons | l10n_ar_export_arba/models/__init__.py | Python | agpl-3.0 | 103 |
"""Test the file multipart.py
Classes:
TestContentHelpers -- test the three content-header helper functions
TestBodyGenerator -- test the BodyGenerator helper class
TestBufferedGenerator -- test the BufferedGenerator helper class
TestFileStream -- test the FileStream generator class
TestDirectoryStream -- test the Dir... | ipfs/python-ipfs-api | test/unit/test_multipart.py | Python | mit | 15,431 |
# -*- coding: utf-8 -*-
import googlemaps
from django.conf import settings
def get_geo_coords(*args):
gmaps = googlemaps.Client(key=settings.GOOGLE_MAPS_API_KEY)
address_data = ' '.join(args)
# print("address_data: {}".format(address_data))
geocode_result = gmaps.geocode(address_data)
if not geoc... | thoreg/raus-mit-den-kids | rmdk/location/services.py | Python | mit | 592 |
default_app_config = 'hs_app_netCDF.apps.NetCDFAppConfig'
| ResearchSoftwareInstitute/MyHPOM | hs_app_netCDF/__init__.py | Python | bsd-3-clause | 58 |
# -*- coding: utf-8 -*-
'''
Module for running arbitrary tests
'''
from __future__ import absolute_import
__virtualname__ = 'test'
def __virtual__():
return __virtualname__
def recho(text):
'''
Return a reversed string
CLI Example:
.. code-block:: bash
salt '*' test.recho 'foo bar ba... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/integration/files/file/base/_modules/override_test.py | Python | apache-2.0 | 361 |
#!/usr/bin/python
# Copyright: (c) 2018, Itential <opensource@itential.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
This module provides the ability to start a workflow from Itential Automation Platform
"""
from __future__ import absolute_import, division, print... | 2ndQuadrant/ansible | lib/ansible/modules/network/itential/iap_start_workflow.py | Python | gpl-3.0 | 5,481 |
from .AD9361 import *
| ivanovev/sg | gui/AD9361/__init__.py | Python | gpl-3.0 | 23 |
from __future__ import absolute_import
import logging
from tornado import web
from ..views import BaseHandler
from ..models import WorkersModel
class ControlHandler(BaseHandler):
def is_worker(self, name):
return WorkersModel.is_worker(self.application, name)
class WorkerShutDown(ControlHandler):
... | kony-solutions/flower | flower/api/control.py | Python | bsd-3-clause | 9,703 |
# 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 agreed to in writing, s... | googleapis/python-kms | samples/snippets/encrypt_asymmetric.py | Python | apache-2.0 | 2,641 |
"""Background tasks. References to Django not permitted (yet).
see http://code.google.com/appengine/articles/deferred.html
see http://code.google.com/appengine/docs/python/taskqueue/
"""
# Python imports
import logging
# Google imports
from google.appengine.runtime.apiproxy_errors \
import OverQuotaErro... | avastjohn/maventy_new | tasks.py | Python | bsd-3-clause | 1,336 |
#!/usr/bin/env python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# 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
# witho... | stefan-andritoiu/upm | examples/python/bh1750.py | Python | mit | 2,110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.