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 |
|---|---|---|---|---|---|
# Copyright (c) 2016, Jeffrey Maggio and Joseph Bartelmo
#
# 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, ... | JoeBartelmo/goddard | mars/Jetson.py | Python | mit | 17,769 |
#!/usr/bin/env python3
from __future__ import print_function
import pexpect
from pexpect import EOF, TIMEOUT, fdpexpect
import sys
import os
import time
import argparse
import serial
import subprocess
import imp
try:
from configparser import ConfigParser
except:
from ConfigParser import ConfigParser
import iter... | sticilface/Arduino | tests/device/libraries/BSTest/runner.py | Python | lgpl-2.1 | 10,436 |
"""
Base file for Grades tests
"""
from crum import set_current_request
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from common.djan... | eduNEXT/edx-platform | lms/djangoapps/grades/tests/base.py | Python | agpl-3.0 | 4,453 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2013, University of Amsterdam. This program is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later ... | semanticize/semanticizer | semanticizer/processors/stringUtils.py | Python | gpl-3.0 | 3,015 |
"""passlib.exc -- exceptions & warnings raised by passlib"""
#=============================================================================
# exceptions
#=============================================================================
class MissingBackendError(RuntimeError):
"""Error raised if multi-backend handl... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/support/passlib/exc.py | Python | mit | 7,667 |
def eq2(x):
'y = 1/x'
try:
return 1/x
except:
return None
| alcemirfernandes/pynguin | doc/examples_src/descartes_pynd/00003.py | Python | gpl-3.0 | 86 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-25 20:00
''' opdate автоматически не заполняется '''
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
''' Нельзя сделать автоматически заполняемое поле и при этом редактируемое в адми... | DronMDF/laweb | lawe/migrations/0010_auto_20170425_2000.py | Python | apache-2.0 | 665 |
from ztag.annotation import *
class VerisE51C3(Annotation):
protocol = protocols.MODBUS
subprotocol = protocols.MODBUS.DEVICE_ID
port = None
def process(self, obj, meta):
vendor = obj["mei_response"]["objects"]["vendor"].lower()
product = obj["mei_response"]["objects"]["product_code"... | zmap/ztag | ztag/annotations/veris_e51c3.py | Python | apache-2.0 | 591 |
#!/usr/bin/env python
from lxml import objectify
import argparse
import os
import codecs
import gzip
# init constants and vars
RAWDATADIR = 'opengov.cat/rawdata/xml/' # use 'wget -r -np http://opengov.cat/rawdata/xml/ to download files'
start = {}
end = {}
entity = {}
# load entities
def read():
files = [ f for f... | opengovcat/seismometer | scripts/reload.py | Python | mit | 1,800 |
import pyximport; pyximport.install()
import math
from numpy import *
import numpy as np
import numpy.linalg as la
from rlscore.learner.abstract_learner import AbstractLearner
from rlscore import model
from rlscore.utilities import array_tools
from rlscore.utilities import decomposition
from rlscore.utilities impo... | max291/RLScore | rlscore/learner/kron_rls.py | Python | mit | 20,859 |
import contextlib
from link import Wrapper
from link.utils import list_to_dataframe
from datetime import datetime
from .dbwrappers import DBConnectionWrapper, DBCursorWrapper
class HiveCursorWrapper(Wrapper):
"""
Wraps a select and makes it easier to tranform the data
"""
def __init__(self, cursor, qu... | dhrod5/link | link/wrappers/hivewrappers.py | Python | apache-2.0 | 8,245 |
#
# 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... | mtagle/airflow | airflow/contrib/operators/redis_publish_operator.py | Python | apache-2.0 | 1,172 |
import json
from io import BytesIO
from tempfile import TemporaryFile
import qrcode
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.utils import timezone
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.platypus import P... | c3cashdesk/c6sh | src/postix/backoffice/report.py | Python | agpl-3.0 | 15,278 |
#Section 1: Terminology
# 1) What is a recursive function?
# A recursive function is a function that calls itself.
#
#
# 2) What happens if there is no base case defined in a recursive function?
# The program would keep recursing itself.
#
#
# 3) What is the first thing to consider when designing a recursive function?... | tonsom1592-cmis/tonsom1592-cmis-cs2 | cs3quiz.py | Python | cc0-1.0 | 1,537 |
import os
import pandas as pd
import openmatrix as omx
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='check activitysim raw_data')
parser.add_argument('raw_data_directory', metavar='raw_data_directory', type=str, nargs=1,
help=f"path to raw data directory")
pars... | synthicity/activitysim | activitysim/examples/example_psrc/scripts/integrity.py | Python | agpl-3.0 | 5,189 |
import components
from itertools import cycle
def LinkTraversalScaling(size):
firewalls = ['f0', 'f1', 'f2', 'f3']
fw_addresses = ['ip_f0', 'ip_f1', 'ip_f2', 'ip_f3']
assert(size > 2)
hosts = ['e%d'%(n) for n in xrange(size)]
host_addresses = ['ip_%s'%(h) for h in hosts]
nodes = list(firewalls)
nodes.exte... | apanda/modeling | tests/examples/LinkTraversalScaling.py | Python | bsd-3-clause | 1,831 |
#!/usr/bin/env python
from clusto import script_helper
import clusto
import simplejson as json
import bottle
import sys
import os
@bottle.get('/attributes/:name.json')
def get_attributes(name):
obj = clusto.get_by_name(name)
results = {}
for attr in obj.attrs(merge_container_attrs=True):
if not a... | simplegeo/clusto-sgext | sgext/commands/chef.py | Python | bsd-2-clause | 987 |
from django.core.management.base import NoArgsCommand, BaseCommand
from optparse import make_option
from txqueue.models import QueuedTier
from datetime import datetime
import random
import string
class Command(BaseCommand):
args = "<name url start_date start_time max_tickets cap>"
help = "Create a new queued t... | bsarsgard/blackrocktickets | txqueue/management/commands/txqueue_create_tier.py | Python | apache-2.0 | 682 |
from PIL import Image
from django.contrib.auth.models import User
from django.db import models
from dnd.utilities import update_html_cache_attributes
class DndEdition(models.Model):
name = models.CharField(
max_length=32,
db_index=True,
)
system = models.CharField(
max_length=16,
... | dndtoolsnet/dndtools | dndtools/dnd/models.py | Python | mit | 55,418 |
import im_livechat_report | addition-it-solutions/project-all | addons/im_livechat/report/__init__.py | Python | agpl-3.0 | 25 |
import django
import hashlib
import urllib
import urlparse
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import conditional_escape
try:
from commons.urlresolvers import reverse
except ImportError:
from django.core.urlresolvers import reverse
im... | donberna/django-badger | badger/helpers.py | Python | bsd-3-clause | 2,554 |
from __future__ import print_function, division
import os
import argparse
from pprint import pprint
from utils import read_txt_into_list, dump_json, load_json
def sum_adjoint_misfits(filelist):
misfits = {}
for _file in filelist:
_misfit = load_json(_file)
for period, period_info in _misfit.i... | wjlei1990/pypaw | pypaw/sum_adjoint_misfit.py | Python | lgpl-3.0 | 1,578 |
"""Module for setting up different types of reactions."""
import numpy
from chemkinlib.reactions import ReactionRateCoeffs
class ReactionError(Exception):
"""Class for Reaction-related errors."""
pass
class ElementaryReaction(object):
"""Base class for an elementary reaction.
NOTE: This class is m... | hsim13372/cs207-FinalProject | src/chemkinlib/reactions/Reactions.py | Python | mit | 15,847 |
import re
import time
from streamlink import StreamError
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HLSStream
class FilmOnHLS(HLSStream):
__shortname__ = "hls-filmon"
def __init__(self, session_, channel=None, vod_id=None, quality="hi... | mmetak/streamlink | src/streamlink/plugins/filmon.py | Python | bsd-2-clause | 4,520 |
# -*- coding: utf-8 -*-
'''
The cp module is used to execute the logic used by the salt-cp command
line application, salt-cp is NOT intended to broadcast large files, it is
intended to handle text files.
Salt-cp can be used to distribute configuration files
'''
# Import python libs
from __future__ import print_functio... | smallyear/linuxLearn | salt/salt/cli/cp.py | Python | apache-2.0 | 3,046 |
from setuptools import setup
setup(
name='nbserver',
version='0.1',
description='Configurable way to serve IPytohn Notebook (ipynb) and static files',
url='https://github.com/yuvipanda/nbserve',
author='Yuvi Panda',
author_email='yuvipanda@riseup.net',
license='3 Clause BSD',
packages=[... | yuvipanda/nbserve | setup.py | Python | bsd-3-clause | 364 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************
import sys, traceback, Ice
Ice.loadSlice('Throughput.ice')
import Demo
class Throughpu... | lejingw/ice-java | python/Ice/throughput/Server.py | Python | gpl-2.0 | 3,311 |
"""
raven.utils.compat
~~~~~~~~~~~~~~~~~~~~~~~~~~
: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
try:
from urllib.error import HTTPError
except ImportError:
from urllib2 import HTTPError # NO... | Goldmund-Wyldebeast-Wunderliebe/raven-python | raven/utils/compat.py | Python | bsd-3-clause | 904 |
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""
class APIDictWrapper(object):
""" Simple wrapper for api dictionaries
Some api calls return dictionaries. This class provides identical
behavior as APIResourceWrapper, except that it will also behave as a
... | fogbow/fogbow-dashboard | openstack_dashboard/dashboards/fogbow/members/models.py | Python | apache-2.0 | 1,494 |
#!/usr/bin/env python
# multiple1902 <multiple1902@gmail.com>
# Released under MIT License
#
# pdf2png.py:
# Convers a PDF file to a set of PNG's
#
# Usage:
# pdf2png.py PDF_File [Density]
#
# Note:
# Density defaults to 100
import sys, os
if len(sys.argv)<=1:
print "need an argument indicating the PDF fi... | multiple1902/scripts | pdf2png.py | Python | mit | 818 |
# Cheroke 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 Software Foundation.
#
# This pro... | mdavid/cherokee-webserver-svnclone | admin/plugins/extensions.py | Python | gpl-2.0 | 2,529 |
'''
create a summary of the climate data
'''
import numpy as np
import pandas as pd
import glob
import sys
from datetime import date
climate_fn = glob.glob('../../data/india/climate/climate_data_*.csv')
#climate_fn = ['../../data/india/climate/climate_data_1.csv']
states_fn = '../../data/india/csv_daily/regions.csv'
... | FAB4D/humanitas | prediction/data/climate-data-summary.py | Python | bsd-3-clause | 3,939 |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval
from . import DefaultTable
hheaFormat = """
> # big endian
tableVersion: 16.16F
ascent: h
descent: ... | googlei18n/fontuley | src/third_party/fontTools/Lib/fontTools/ttLib/tables/_h_h_e_a.py | Python | apache-2.0 | 2,656 |
import json
import os
import logging
from boxmaker import base_dir
logger = logging.getLogger(__name__)
# load ads from config file
ad_config_file_path = os.path.join(base_dir, 'config', 'ads.json')
ad_config = []
with open(ad_config_file_path, 'r') as f:
ad_config = json.load(f)
logging.info("Loaded {} ads".fo... | rahulbot/box-designer-website | boxmaker/ads.py | Python | agpl-3.0 | 516 |
"""To play Tic-Tac-Toe-Py you just have to type: python3 TicTacToe.py
Enjoy!
Created by: JSch"""
# Creating the Tic Tac Toe table registor. I am using dictionaries to keep track of the plays.
# Each slot will have a key for the column and a key for the line. This way will be easy to verify
# victory or draw.
#
# ... | IoT-Grupo4/git-learning | python/TicTacToe.py | Python | gpl-3.0 | 5,614 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
from testing import *
from pyecs import *
from pycompupipe.other import Event
from pycompupipe.components import GuiElement,GuiManager,Selectable, FetchMouseCallbacksWhileSelected
import mock
class TestFetchMouseCallbacksWhileSelected():... | xaedes/PyCompuPipe | tests/components/gui/interaction/test_fetch_mouse_callbacks_while_selected.py | Python | mit | 1,271 |
"""
Component to offer a way to select an option from a list.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_select/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.const import ATTR_ENTITY_ID, CONF_ICON, CONF_NAME
... | open-homeautomation/home-assistant | homeassistant/components/input_select.py | Python | apache-2.0 | 7,939 |
from models import Base
class UserCard(Base):
@classmethod
def table(cls):
return super().table()('user_cards')
| gyfis/pkmntcgdatabase | models/user_card.py | Python | mit | 130 |
# Copyright (c) 2002 Nicolas Chauvat <nicolas.chauvat@logilab.fr>
#
# 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.... | tLDP/lampadas | pylib/sqlgen.py | Python | gpl-2.0 | 5,253 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/client/configuration/scag_dm/built_form/scag_dm_land_use_definition.py | Python | gpl-3.0 | 1,218 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 5, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_MovingAverage/cycle_5/ar_/test_artificial_1024_Anscombe_MovingAverage_5__100.py | Python | bsd-3-clause | 269 |
# coding: utf8
# skwin.py
# 10/5/2012 jichi
# Windows only
import skos
if skos.WIN:
import os
from datetime import datetime
import ctypes
import pythoncom
import win32api, win32con, win32gui, win32process
from win32com.shell import shell, shellcon
import pywintypes
from skdebug import dprint, dwarn
... | Dangetsu/vnr | Frameworks/Sakura/py/libs/sakurakit/skwin.py | Python | gpl-3.0 | 32,750 |
from functools import wraps
def InstanceDecorator(outerFunction):
'''
The decorated class method itself becomes a decorator
that is aware of the class instance's methods and attributes.
The second parameter after self must be the function you are
ultimately decorating.
Usage:
@InstanceDec... | christopher-henderson/Experiments | misc/instanceDecorator.py | Python | mit | 2,085 |
from __future__ import absolute_import
import os
import sys
import lit.Test
import lit.TestRunner
import lit.util
from .base import TestFormat
kIsWindows = sys.platform in ['win32', 'cygwin']
class GoogleTest(TestFormat):
def __init__(self, test_sub_dir, test_suffix):
self.test_sub_dir = os.path.normcase... | JianpingZeng/xcc | xcc/java/utils/lit/lit/formats/googletest.py | Python | bsd-3-clause | 5,303 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2015-2018 Johann A. Briffa
#
# This file is part of CR2_Scripts.
#
# CR2_Scripts 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... | jbresearch/cr2_scripts | cr2_replace.py | Python | gpl-3.0 | 3,536 |
"""MSAView - Substitution matrix support.
Copyright (c) 2011 Joel Hedlund.
Contact: Joel Hedlund <yohell@ifm.liu.se>
MSAView is a modular, configurable and extensible package for analysing and
visualising multiple sequence alignments and sequence features.
This package provides basic support for substitution matr... | yohell/msaview | msaview_plugin_substitution_matrix/__init__.py | Python | mit | 5,945 |
#!/usr/bin/env python
'''
'''
from subtl import UdpTrackerClient
HASHES = [
'089184ED52AA37F71801391C451C5D5ADD0D9501',
'AFFF79E471EFF468C7F66DA6C91B90C6E89343CF',
]
def connect(utc):
print('Connecting')
utc.connect()
if utc.poll_once():
print('Success!')
else:
raise Exception... | packetloop/subtl | demo.py | Python | bsd-3-clause | 938 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.report import render_report
from odoo.tools import config, test_reports
from odoo.addons.hr_payroll.tests.common import ... | chienlieu2017/it_management | odoo/addons/hr_payroll/tests/test_payslip_flow.py | Python | gpl-3.0 | 3,873 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'CmGradebook.gb_type'
db.delete_column('cm_plugin_cmgradebook', 'gb_type')
def backwa... | edcast-inc/edx-platform-edcast | common/djangoapps/cm_plugin/migrations/0002_auto__del_field_cmgradebook_gb_type.py | Python | agpl-3.0 | 6,911 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
=============
TAP plus
=============
@author: Juan Carlos Segovia
@contact: juan.carlos.segovia@sciops.esa.int
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
Created on 30 jun. 2016
"""
class TapTableMeta:
... | ceb8/astroquery | astroquery/utils/tap/model/taptable.py | Python | bsd-3-clause | 1,246 |
#!/usr/bin/env python
import sys
import math, re
from PIL import Image as PImage
import brotli, zlib
import bencoder
VERSION = 1
# Abstraction for the header (a bencoded string)
class Header:
START_DELIMETER = ';'
END_DELIMETER = ';\t\t\t'
def __init__(self, raw=None, data=None):
self.mode = "RGB... | Cryptoc1/pngify | pngify/__init__.py | Python | mit | 7,627 |
from . import terrariumRelay, terrariumRelayDimmer, terrariumRelayLoadingException
from terrariumUtils import terrariumUtils
class terrariumRelayRemote(terrariumRelay):
HARDWARE = 'remote'
NAME = 'Remote power switch (API)'
def _load_hardware(self):
if terrariumUtils.parse_url(self.address):
return se... | theyosh/TerrariumPI | hardware/relay/remote_relay.py | Python | gpl-3.0 | 1,365 |
# -*- coding: utf-8 -*-
"""Test for LTI Xmodule functional logic."""
import datetime
import textwrap
import unittest
from copy import copy
import pytest
import six
from lxml import etree
from mock import Mock, PropertyMock, patch
from opaque_keys.edx.locator import BlockUsageLocator
from pytz import UTC
from six imp... | stvstnfrd/edx-platform | common/lib/xmodule/xmodule/tests/test_lti_unit.py | Python | agpl-3.0 | 22,534 |
"""
Support for Decora dimmers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.decora/
"""
import logging
import time
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
from homeassistant.components.lig... | alexmogavero/home-assistant | homeassistant/components/light/decora.py | Python | apache-2.0 | 4,620 |
import pytest
from UM.Scene.SceneNode import SceneNode
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
from unittest.mock import MagicMock
class TheAmazingTestDecorator(SceneNodeDecorator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def theAmazingDecoration(self... | thopiekar/Uranium | tests/Scene/TestSceneNodeDecorator.py | Python | lgpl-3.0 | 3,963 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import kindlepush
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
with open('README.md') as f:
long_description = f.read()
setup(
name='kindlepush',
versi... | wogong/kindledxpush | setup.py | Python | mit | 1,263 |
from django.http import HttpResponse, HttpResponseRedirect
from django.template import Template, Context, RequestContext
from tmv_app.models import *
from django.db.models import Q
from django.shortcuts import *
from django.forms import ModelForm
import random, sys, datetime
import urllib2
# the following line will ne... | ajbc/tmv | BasicBrowser/tmv_app/views.py | Python | gpl-3.0 | 11,985 |
import ctypes
import sys
import os
import time
from numpy import *
import cv2
class Svo(object):
def __init__(self):
if sys.platform == 'darwin':
self.bin = ctypes.CDLL('../svo_slam_no_ros/rpg_svo/svo/lib/libsvo.dylib')
else:
self.bin = ctypes.CDLL('../svo_slam_no_ros/rpg_s... | y-j-n/pyFastfusion | modeler/bin_if.py | Python | gpl-2.0 | 11,796 |
# Copyright (c) 2014 IBM Corp.
# 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... | hanlind/nova | nova/tests/unit/api/test_compute_req_id.py | Python | apache-2.0 | 1,433 |
"""
Created on 24/gen/2014
@author: Marco Pompili
"""
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name=str('django-facebook-social-plugins'),
version=... | marcopompili/django-facebook-social-plugins | setup.py | Python | mit | 1,228 |
# -*- coding: utf-8 -*-
"""
tests.deprecations
~~~~~~~~~~~~~~~~~~
Tests deprecation support. Not used currently.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
| iFighting/flask | tests/test_deprecations.py | Python | bsd-3-clause | 224 |
from scrapy.selector import Selector
from PriceMonitor.items import ProductDetails
from PriceMonitor.BaseSpider import BaseSpider
class emag_roSpider(BaseSpider):
name = "emag.ro"
allowed_domains = ["www.emag.ro"]
def parse(self, response):
hxs = Selector(response)
product = Produc... | quamis/PriceMonitor | PriceMonitor/PriceMonitor/spiders/emag_ro.py | Python | gpl-2.0 | 1,082 |
#!/usr/bin/env python
try:
from collections import OrderedDict
import json
except ImportError:
from ordereddict import OrderedDict
import simplejson as json
import six
from csvkit import CSVKitWriter
def geojson2csv(f, key=None, **kwargs):
"""
Convert a GeoJSON document into CSV format.
... | unpingco/csvkit | csvkit/convert/geojs.py | Python | mit | 1,869 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import super... | petrjasek/superdesk-core | content_api/items/__init__.py | Python | agpl-3.0 | 703 |
#!/usr/bin/env python
import os
import yaml
from pkg_resources import Requirement, resource_filename
# prefer settings file in system-installed location
if os.path.exists("/etc/mediator/settings.yaml"):
config_file = "/etc/mediator/settings.yaml"
# otherwise, look in package
else:
config_file = resource_filena... | blaketmiller/mediator | mediator/config.py | Python | gpl-2.0 | 479 |
# 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/.
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
class... | lonnen/socorro | socorro/lib/requestslib.py | Python | mpl-2.0 | 2,558 |
from datetime import datetime, timedelta
from humanize.time import naturaldelta
class CardReview:
def __init__(self, card, grade):
self.card = card
self.grade = grade
self._review_applied = False
def apply_review(self):
self.card.review(self.grade)
self._review_applie... | aehlke/manabi | manabi/apps/flashcards/models/card_review.py | Python | mit | 907 |
"""Settings for the third-party auth module.
The flow for settings registration is:
The base settings file contains a boolean, ENABLE_THIRD_PARTY_AUTH, indicating
whether this module is enabled. startup.py probes the ENABLE_THIRD_PARTY_AUTH.
If true, it:
a) loads this module.
b) calls apply_settings(), passi... | philanthropy-u/edx-platform | common/djangoapps/third_party_auth/settings.py | Python | agpl-3.0 | 4,713 |
"""Create/validate/save a package based on a directory and a metadata file."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import os
import re
import sys
THIS_FILE = os.path.... | tanium/pytan | EXAMPLES/POC/package_validator/package_validator.py | Python | mit | 9,735 |
import re
import datetime
import time
#niru's git commit
while True:
#open the file for reading
file = open("test.txt")
content = file.read()
#Get timestamp
ts = time.time()
ist = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
#open file for read and close it nea... | cloud-engineering/Torpid | main.py | Python | mit | 777 |
# -*- coding: utf-8 -*-
import unittest
import os
import os.path
import tempfile
import yaml
import passlib.hash
import string
import StringIO
import copy
from nose.plugins.skip import SkipTest
from ansible.utils import string_functions
import ansible.errors
import ansible.constants as C
import ansible.utils.templat... | axilleas/ansible | v1/tests/TestUtilsStringFunctions.py | Python | gpl-3.0 | 843 |
"""Tests for the notebook kernel and session manager."""
from subprocess import PIPE
import time
from unittest import TestCase
from IPython.testing import decorators as dec
from IPython.config.loader import Config
from IPython.utils.localinterfaces import localhost
from IPython.kernel import KernelManager
from IPyth... | mattvonrocketstein/smash | smashlib/ipy3x/kernel/tests/test_multikernelmanager.py | Python | mit | 2,441 |
# -*- coding: UTF-8 -*-
class CodeDate(object):
def __init__(self, code, date):
self.code = code
self.date = date
| bejondshao/grape | org/bejond/basic/datamodel/code_date.py | Python | gpl-3.0 | 136 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | west2554/fofix | src/Menu.py | Python | gpl-2.0 | 19,823 |
#!/usr/bin/env python3
"""
Author: Thomas Laurenson
Email: thomas@thomaslaurenson.com
Website: thomaslaurenson.com
Date: 2016/01/04
Description:
The APXMLIntersection.py Python module takes an APXML document as input
and normalises FileObjects and CellObjects properties.
Copyright (c) 2016, Thomas ... | thomaslaurenson/apxml | APXMLIntersection.py | Python | gpl-2.0 | 13,507 |
'''Extract sticky notes and side-bar notes from documents in Mendeley.
# Copyright 2016 Guang-zhi XU
#
# This file is distributed under the terms of the
# GPLv3 licence. See the LICENSE file for details.
# You may use, distribute and modify this code under the
# terms of the GPLv3 license.
Update time: 2016-04-12 22... | Xunius/Menotexport | lib/extractnt.py | Python | gpl-3.0 | 4,355 |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
from libvirt import libvirtError
from libvirttestapi.src import sharedmod
from libvirttestapi.utils import utils
from libvirttestapi.utils import process
required_params = ('ifacename',)
optional_params = {}
def display_cu... | libvirt/libvirt-test-API | libvirttestapi/repos/interface/destroy.py | Python | gpl-2.0 | 2,640 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# pyeq2 is a collection of equations expressed as Python classes
#
# Copyright (C) 2013 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
#
# email: zunzun@zunzun.com
#
... | burkesquires/pyeq2 | Services/DataConverterService.py | Python | bsd-2-clause | 7,425 |
"""
=====================
SGD: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
"""
print(__doc__)
import numpy as np
import pylab as pl
from sklearn import linear_model
# we create 20 points
np.random.seed(0)
X = np.r_[np.ra... | depet/scikit-learn | examples/linear_model/plot_sgd_weighted_samples.py | Python | bsd-3-clause | 1,434 |
import random
import re
import requests
import smokesignal
from requests.auth import HTTPBasicAuth
from twisted.internet import reactor
from helga import log, settings
from helga.db import db
from helga.plugins import command, match, ACKS, ResponseNotReady
from helga.util.encodings import to_unicode
logger = log.g... | shaunduncan/helga-jira | helga_jira.py | Python | mit | 6,515 |
# Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | mariusvniekerk/impyla | conftest.py | Python | apache-2.0 | 1,368 |
#!/usr/bin/env python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import pickle
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # a... | hattenator/blackboard-selenium-python | BbGateway.py | Python | bsd-2-clause | 3,040 |
from flask import Flask, redirect, render_template, request, url_for
from flask.ext.pymongo import PyMongo
import markdown2
import re
app = Flask(__name__)
mongo = PyMongo(app)
WIKIPART = re.compile(r'([A-Z][a-z0-9_]+)')
WIKIWORD = re.compile(r'([A-Z][a-z0-9_]+(?:[A-Z][a-z0-9_]+)+)')
@app.template_filter()
def totit... | xebitstudios/flask-pymongo | examples/wiki/wiki.py | Python | bsd-2-clause | 2,342 |
"""A set of helper functions to work with the astropy module."""
import functools
import random
import string
import tempfile
import subprocess
import collections
from itertools import cycle, islice, chain, combinations, zip_longest
import scipy
import numpy as np
from astropy.table import Table, join
from astropy.coo... | cactaur/astropy-utils | astropy_util.py | Python | bsd-3-clause | 26,719 |
from functools import lru_cache
from faker import Faker
from jinja2 import Template
class StringGenerator:
"""Sometimes in templates you want a reference to a variable to
call a function.
For example:
>>> x = template_utils.StringGenerator(datetime.today().isoformat)
>>> print(f"{x}")
2019-... | SalesforceFoundation/CumulusCI | cumulusci/core/template_utils.py | Python | bsd-3-clause | 1,409 |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
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... | kageurufu/pgoapi | pgoapi/auth_google.py | Python | mit | 3,978 |
#!/usr/bin/env python3
import sys
import pandas as pd
import numpy as np
"""Scrape output of bench_times.sh and bench_all.sh to produce a nice LaTeX
table. Usage:
$ ./bench_all.sh
$ ./bench_times.sh | tee times.txt
$ ./scrape_table.py < times.txt > report/table.tex
The script will scrape traces and particle count... | qxcv/comp2550 | project/scrape_table.py | Python | apache-2.0 | 4,328 |
config = [{
'name': 'torrent_providers',
'groups': [
{
'label': 'Torrent Providers',
'description': 'Providers searching torrent sites for new releases',
'wizard': True,
'type': 'list',
'name': 'torrent_providers',
'tab': 'searcher'... | entomb/CouchPotatoServer | couchpotato/core/providers/torrent/__init__.py | Python | gpl-3.0 | 370 |
#!/usr/bin/env python
'''
Created on Mar 5, 2014
@author: davidg@boundary.com
'''
import requests
import json
import platform
from datetime import datetime
def main():
"""
Example Python function that shows to create an event using the Boundary Event API
"""
#
# Your API key and Organization I... | boundary/boundary-event-plugins | examples/createevent.py | Python | apache-2.0 | 2,305 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
"""
import os
import tempfile
import pytest
from micropsi_core.config import ConfigurationManager
__author__ = 'joscha'
__date__ = '29.10.12'
@pytest.fixture(scope="session")
def path():
return os.path.join(tempfile.gettempdir(), "configs.json")
@pytest.fi... | ianupright/micropsi2 | micropsi_core/tests/test_configurationManager.py | Python | mit | 1,629 |
# -*- coding: utf-8 -*-
# errors.py
# Copyright (C) 2015 LEAP
#
# 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 option) any later version.
#
# This... | andrejb/leap_mail | src/leap/mail/errors.py | Python | gpl-3.0 | 828 |
from flask.ext.restful import reqparse
posts_parser = reqparse.RequestParser()
posts_parser.add_argument('title', type=unicode, help='Post title')
posts_parser.add_argument('body', type=unicode, help='Post body')
new_post_parser = reqparse.RequestParser()
new_post_parser.add_argument('title', type=unicode, help='Pos... | ah450/blog | server/app/parser.py | Python | mit | 1,392 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | Rademade/taiga-back | taiga/timeline/timeline_implementations.py | Python | agpl-3.0 | 4,438 |
#
# 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... | PaulWay/spacewalk | proxy/installer/rhn_proxy_activate.py | Python | gpl-2.0 | 20,818 |
"""repr() printing tests."""
import pytest
from diofant import (FF, QQ, ZZ, Abs, Catalan, Dummy, E, EulerGamma, Float,
Function, GoldenRatio, I, ImmutableMatrix, Integer,
Matrix, Rational, Symbol, Wild, WildFunction, false,
field, grlex, nan, ones, oo, pi... | skirpichev/omg | diofant/tests/printing/test_repr.py | Python | bsd-3-clause | 8,009 |
"""
Includes objects used to create and manipulate vCards.
Based on the vCard 4.0 specification in RFC 6350.
"""
from .functions import is_label_valid, escape
from .NameValueMixin import NameValueMixin
from .VCard import VCard
| Crosse/vcard4 | vcard4/__init__.py | Python | bsd-2-clause | 228 |
import sys, os, trace, multiprocessing, time
from multiprocessing import Pool, Lock
import numpy as np
import pandas as pd
from numpy.linalg import norm
import pickle, urllib
from functools import partial
import calculate_orbits as co
database_url = "http://www.ianww.com/latest_fulldb.csv"
database_path = ".... | nomad-vagabond/asterion | read_database.py | Python | mit | 6,167 |
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
# import frappe
import unittest
class TestEnergyPointSettings(unittest.TestCase):
pass
| frappe/frappe | frappe/social/doctype/energy_point_settings/test_energy_point_settings.py | Python | mit | 167 |
"""
Tests the logic of the "targeted-feedback" attribute for MultipleChoice questions,
i.e. those with the <multiplechoiceresponse> element
"""
import unittest
import textwrap
# Changes formatting of empty elements; import here to avoid test order dependence
import xmodule.modulestore.xml # pylint: disable=unused-imp... | BehavioralInsightsTeam/edx-platform | common/lib/capa/capa/tests/test_targeted_feedback.py | Python | agpl-3.0 | 27,102 |
#!/usr/bin/env python
##############################################
# Author: Ruben Izquierdo Bevia #
# VU University of Amsterdam #
# Mail: ruben.izquierdobevia@vu.nl #
# rubensanvi@gmail.com #
# Webpage: http://rubenizquierdobevia.com #
# Version: 1.... | cltl/vua-wsd-sem2015 | python_scripts/generate_background_corpus.py | Python | gpl-3.0 | 11,237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.