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 |
|---|---|---|---|---|---|
"""
Smoke testing--just see if the system runs.
"""
# These tests are quick and crude.
# TODO: extend the tests by cycling through various combinations
# of configuration and data input.
from __future__ import (absolute_import, division, print_function)
import numpy as np
from utide import ut_constants
from ... | efiring/UTide | tests/test_solve.py | Python | mit | 5,010 |
"""Unit tests for jobs endpoint."""
import json
import tornado.testing
from ndscheduler import utils
from ndscheduler.core import scheduler_manager
from ndscheduler.server import server
from ndscheduler.server.handlers import jobs
def mock_get_jobs_yield(self):
return_json = self._get_jobs()
self.finish(re... | DurgaChowdary/ndscheduler | ndscheduler/server/handlers/jobs_test.py | Python | bsd-2-clause | 7,281 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class StockWarnInsufficientQtyRepair(models.TransientModel):
_name = 'stock.warn.insufficient.qty.repair'
_inherit = 'stock.warn.insufficient.qty'
_description = 'Warn Insuffi... | t3dev/odoo | addons/repair/wizard/stock_warn_insufficient_qty.py | Python | gpl-3.0 | 517 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | jacky-young/crosswalk-test-suite | usecase/usecase-wrt-auto-tests/samples/ApkBuildTemporary/projectonly.py | Python | bsd-3-clause | 2,962 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-08-02 02:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('laboratory', '0039_auto_20180630_1924'),
]
operations = [
migrations.AlterF... | solvo/organilab | src/laboratory/migrations/0040_auto_20180801_2050.py | Python | gpl-3.0 | 496 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | calexil/FightstickDisplay | pyglet/media/drivers/openal/lib_openal.py | Python | gpl-3.0 | 28,468 |
"""
Tool run for galaxy clustering interfacte
Date: January 2013
Author: James Boocock
"""
""" This class prepares everything related to a tool run in the galaxy clustering interface """
import os
import sys
import logging
import util
log =logging.getLogger(__name__)
class ToolRun(object):
""" Tool ... | smilefreak/NesiGridSelection | grid_selection/clustering/tool_run.py | Python | mit | 6,409 |
'''
Combine data sources on fuzzy-matched titles to create final data set
'''
from multiprocessing import Pool, cpu_count
from functools import partial
import pandas as pd
import numpy as np
from fuzzywuzzy import process
from src.my_aws import S3
KEY_OMDB_TOR = 'OMDB_Torrents.csv'
KEY_NUM = 'TheNumbers_budgets.... | bryantbiggs/movie_torrents | src/aggregate.py | Python | mit | 7,563 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | kvar/ansible | lib/ansible/modules/cloud/google/gcp_compute_http_health_check_info.py | Python | gpl-3.0 | 7,102 |
#!/usr/bin/env python
'''
Simple example of watermarking using form xobjects (pdfrw).
usage: watermark.py my.pdf single_page.pdf
Creates watermark.my.pdf, with every page overlaid with
first page from single_page.pdf
'''
import sys
import os
import find_pdfrw
from pdfrw import (PdfReader, PdfWriter, PdfDict, Pdf... | mzweilin/pdfrw | examples/watermark.py | Python | mit | 4,050 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
class AccountDiscount(models.Model):
_inherit = 'account.tax'
is_discount = fields.Boolean('Is Discount', default=False)
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@... | kholioeg/account_discount | models.py | Python | agpl-3.0 | 963 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The astropy.utils.iers package provides access to the tables provided by
the International Earth Rotation and Reference Systems Service, in
particular allowing interpolation of published UT1-UTC values for given
times. These are used in `astropy.time`... | mhvk/astropy | astropy/utils/iers/iers.py | Python | bsd-3-clause | 46,906 |
# -*- coding: utf-8 -*-
# ==================================================================
# ROCS - Toolkit for Robots Comprehending Space
# Copyright (C) 2011 André Susano Pinto
#
# This file is part of ROCS.
#
# ROCS is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser Gen... | pronobis/rocs | src/data/python/rocs/data/databases/COLD.py | Python | bsd-2-clause | 2,626 |
#!/usr/bin/env python3
"""
Reference analyzer script for NetFlow Python package.
This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd.
Copyright 2016-2020 Dominik Pataky <software+pynetflow@dpataky.eu>
Licensed under MIT License. See LICENSE.
"""
import argparse
import contextlib
import functo... | cooox/python-netflow-v9-softflowd | netflow/analyzer.py | Python | mit | 13,519 |
#!/usr/bin/env python
from collections import namedtuple
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.inventory.manager import InventoryManager
from ansible.parsing.dataloader import DataLoader
from ansible.playbook.play import Play
from ansible.plugins.callback import CallbackBase
fr... | alexlo03/ansible | examples/scripts/uptime.py | Python | gpl-3.0 | 3,524 |
@make(inputs=[0], outputs=[], handler=Output.STORE)
def remove_size_ingested_avu(ctx, path):
"""
Set the ACL of a given collection
Parameters
----------
ctx : Context
Combined type of a callback and rei struct.
mode : str
'default', 'recursive' expected values
access : str
... | MaastrichtUniversity/irods-ruleset | python/remove_size_ingested_avu.py | Python | gpl-3.0 | 967 |
# challenge_31.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# A chapter of the story
from linux_story.StepTemplate import StepTemplate
from linux_story.step_helper_functions import unblock_cd_commands
from linux_story.sound_manager import SoundManage... | KanoComputing/terminal-quest | linux_story/story/challenges/challenge_31.py | Python | gpl-2.0 | 3,267 |
#!/usr/bin/env python
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
setup(
name='multipart-reader',
version=open(os.path.join(here, 'VERSION')).read().strip(),
description='Multipart/* reader extracted from awsome `aiohttp` project, cf.: http://aiohttp.readthe... | novafloss/multipart-reader | setup.py | Python | apache-2.0 | 1,190 |
import os
def check(cmd, mf):
m = mf.findNode('pygame')
if m is None or m.filename is None:
return None
def addpath(f):
return os.path.join(os.path.dirname(m.filename), f)
RESOURCES = ['freesansbold.ttf', 'pygame_icon.tiff', 'pygame_icon.icns']
return dict(
loader_files = [
... | kamitchell/py2app | py2app/recipes/pygame.py | Python | mit | 385 |
"""Cache util functions for ReSDKTables."""
import os
import pickle
import sys
from shutil import rmtree
from typing import Any
from resdk.__about__ import __version__
def _default_cache_dir() -> str:
"""Return default cache directory specific for the current OS.
Code originally from Orange3.misc.environ.
... | genialis/resolwe-bio-py | src/resdk/utils/table_cache.py | Python | apache-2.0 | 2,205 |
import os as o
import subprocess as subp
# Vulnerable to wildcard injection
o.system("/bin/tar xvzf *")
o.system('/bin/chown *')
o.popen2('/bin/chmod *')
subp.Popen('/bin/chown *', shell=True)
# Not vulnerable to wildcard injection
subp.Popen('/bin/rsync *')
subp.Popen("/bin/chmod *")
subp.Popen(['/bin/chown', '*'])
... | austin987/bandit | examples/wildcard-injection.py | Python | apache-2.0 | 479 |
from xbmcswift2 import Plugin
from resources.lib import nos
plugin = Plugin()
def resolve_paths(items):
for item in items:
item['path'] = plugin.url_for(**item['path'])
return items
@plugin.route('/')
def index():
return resolve_paths(nos.index())
@plugin.route('/show_category/<category_url>... | ErwinJunge/XBMC-plugin.video.nos | addon.py | Python | gpl-2.0 | 679 |
from copy import deepcopy
from intelmq.lib.bot import Bot, sys
from intelmq.lib.cache import Cache
from intelmq.lib.message import Event
class DeduplicatorBot(Bot):
def init(self):
self.cache = Cache(
self.parameters.redis_cache_host,
self.param... | Phantasus/intelmq | intelmq/bots/experts/deduplicator/deduplicator.py | Python | agpl-3.0 | 1,207 |
# module baseline.py
#
# Copyright (c) 2015 Rafael Reis
#
"""
baseline module - Functions to produce the Baseline System's features.
"""
__version__="1.0"
__author__ = "Rafael Reis <rafael2reis@gmail.com>"
import re
#import globoquotes
def boundedChunk(s):
"""Indetifies the Bounded Chunk.
Assigns a 1 to the... | rafael2reis/iqextractor | qextractor/preprocessing/baseline.py | Python | gpl-3.0 | 8,010 |
from flask import jsonify, request
from .. import db
from ..models import Event
from . import api
# Get event
@api.route('/event/<int:id>')
def get_event(id):
event = Event.query.get_or_404(id)
# TODO: Implement when the model updates
attendees_count = 1
json_post = event.to_json()
# TODO: Change when new m... | foodsnag/foodsnag-web | app/api/events.py | Python | mit | 576 |
"""
Module contains tools for collecting data from various remote sources
"""
import warnings
import tempfile
import datetime as dt
import time
from collections import defaultdict
import numpy as np
from pandas.compat import(
StringIO, bytes_to_str, range, lmap, zip
)
import pandas.compat as compat
from pandas... | webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/io/data.py | Python | gpl-2.0 | 44,585 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | shakamunyi/nova | nova/api/openstack/compute/plugins/v3/tenant_networks.py | Python | apache-2.0 | 8,183 |
"""SCons.Tool.gnulink
Tool-specific initialization for the gnu linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, fre... | xiaohaidao007/pandoraBox-SDK-mt7620 | staging_dir/host/lib/scons-2.5.0/SCons/Tool/gnulink.py | Python | gpl-2.0 | 2,929 |
from django.conf.urls import include, url
from django.contrib import admin
from Poller import views
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='resu... | zzeleznick/zDjango | Poller/urls.py | Python | mit | 396 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software you can redistribute it and/or modify
# it under... | numenta/nupic.research | projects/dendrites/permutedMNIST/experiments/prototype.py | Python | agpl-3.0 | 6,628 |
"""Constants for the Smart Meter Texas integration."""
from datetime import timedelta
SCAN_INTERVAL = timedelta(hours=1)
DEBOUNCE_COOLDOWN = 1800 # Seconds
DATA_COORDINATOR = "coordinator"
DATA_SMART_METER = "smart_meter_data"
DOMAIN = "smart_meter_texas"
METER_NUMBER = "meter_number"
ESIID = "electric_service_ide... | jawilson/home-assistant | homeassistant/components/smart_meter_texas/const.py | Python | apache-2.0 | 392 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
"""
cd /Users/brunoflaven/Documents/02_copy/_random_is_all_about
python file_3.py
"""
import random
file='file_3.py'
# print('\n')
# print('You are in: ', file)
# print('\n')
def get_random_choice(input_array):
return random.choice(input_array)
print('\n')
print(f... | bflaven/BlogArticlesExamples | python_random_is_all_about/test_platform/e2e/file_3.py | Python | mit | 409 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('characters', '0011_auto_20160212_1144'),
]
operations = [
migrations.CreateModel(
name='CharacterSpells',
... | svamp/rp_management | characters/migrations/0012_auto_20160212_1210.py | Python | gpl-3.0 | 1,712 |
# Copyright (c) 2014 Dell 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 a... | saeki-masaki/cinder | cinder/tests/unit/test_dellfc.py | Python | apache-2.0 | 31,526 |
# after executing doweathclass to make data then:
#exec(open("./doweathclass_naivebayes.py").read())
#
#
from pyspark.mllib.classification import NaiveBayes
#execute model, it can go in a single pass
my_nbmodel = NaiveBayes.train(datax_rdd)
#Some info on model
print (my_nbmodel)
#some checks,get some of training dat... | mirjalil/DataScience | datasets/data/weather/doweathclass_naivebayes.py | Python | gpl-2.0 | 1,275 |
# Copyright (c) 2012 OpenStack Foundation.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | mattt416/neutron | neutron/extensions/portbindings.py | Python | apache-2.0 | 5,198 |
#!/usr/bin/env py.test
"""Unit tests for the FunctionSpace class"""
# Copyright (C) 2011 Johan Hake
#
# This file is part of DOLFIN.
#
# DOLFIN 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 v... | MiroK/dolfin | test/unit/python/function/test_function_space.py | Python | gpl-3.0 | 4,713 |
import datetime
import json
from nose.tools import ok_, eq_, assert_raises
import mock
from django.conf import settings
from django.utils import timezone
from django.core.exceptions import ImproperlyConfigured
from funfactory.urlresolvers import reverse
from airmozilla.base.tests.testbase import Response
from airmo... | tannishk/airmozilla | airmozilla/manage/tests/test_autocompeter.py | Python | bsd-3-clause | 9,999 |
# These are not the droids you are looking for. | mcroydon/django-tumbleweed | tumbleweed/models.py | Python | bsd-3-clause | 47 |
#!/usr/bin/python
######################################################################
# Cloud Routes Bridge
# -------------------------------------------------------------------
# Actions Module
######################################################################
import rethinkdb as r
from rethinkdb.errors import... | codecakes/cloudroutes-service | src/actions/actions/logit-reaction/__init__.py | Python | agpl-3.0 | 2,612 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cityhallmonitor', '0003_matterattachment_link_obtained_at'),
]
operations = [
migrations.AlterField(
model_name=... | NUKnightLab/cityhallmonitor | cityhallmonitor/migrations/0004_auto_20150714_1603.py | Python | mit | 430 |
from __future__ import division, with_statement
__all__ = ( 'DefineRulesTo_CreateSimulationParams', 'DefineRulesTo_runSims' )
from Operations.IDotData import IDotData
from Operations.Ilya_Operations.PipeRun.python.PipeRun import PipeRun
from Operations.MiscUtil import SystemSucceed, Dict, cross, Str, DumpFile, Slurp... | broadinstitute/cms | old/Operations/Ilya_Operations/sim/sfs/working/pardis2/RunSimulations.py | Python | bsd-2-clause | 10,217 |
#!/usr/bin/env python
import bottle # pip install bottle
import requests
import socket
import json
from datetime import datetime, timedelta
import hashlib
import config
app = application = bottle.Bottle()
lastaction = datetime.now() - timedelta(hours=1)
@app.route('/', method='POST')
def slack_post():
body = b... | ecapuano/slack-integrations | slash-md5/slashmd5.py | Python | mit | 3,996 |
#!/opt/python/bin/python3
# use the API instead of xdusage
# https://xsede-xdcdb-api.xsede.org/
import os
import re
import sys
import datetime
import argparse
import urllib.request
#import ast
import json
import math
CHARGE_NUMBERS = ['TG-MCB170058',]
def getdatetime(datestring):
# API date format: 2020-03-30T09:... | leschzinerlab/COSMIC-CryoEM-Gateway | remote_scripts/ctj.py | Python | gpl-3.0 | 7,317 |
#!/usr/bin/python
# -*- coding: utf-8 -*-import random
import tweepy
from secrets import *
# secrets define keys and secrets
# CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET
# setup authentication protocols
# use 'from TwitterSetup import api' to use api
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_S... | kayliedehart/OutweighHemingway | TwitterSetup.py | Python | mit | 398 |
# -*- coding: utf-8 -*-
from django.test import Client
from django.urls import reverse
from nmkapp import views
from .nmk_unit_test_case import NmkUnitTestCase
class ResultsTests(NmkUnitTestCase):
def test_anon_user(self):
"""
Test result view with anonymous user
"""
self.client ... | stalker314314/nasa_mala_kladionica | tests/unit/tests_view_results.py | Python | gpl-3.0 | 772 |
###############################################################################
##
## Copyright (C) 2014 Greg Fausak
##
## 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:... | lgfausak/sqlbridge | sqlbridge/__init__.py | Python | apache-2.0 | 794 |
import spacy
import tensorflow as tf
import math
import numpy as np
from rnnlab import config
from rnnlab.graphutils import DirectLSTMCell
from rnnlab.graphutils import DirectMultLSTMCell
from rnnlab.graphutils import DirectRNNCell
from rnnlab.graphutils import DirectDeltaRNNCell
from rnnlab.graphutils import DirectFa... | phueb/rnnlab | rnnlab/directgraph.py | Python | mit | 7,083 |
#!/usr/bin/env python
# generate Python Manifest for the OpenEmbedded build system
# (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
# (C) 2007 Jeremy Laine
# licensed under MIT, see COPYING.MIT
#
# June 22, 2011 -- Mark Hatle <mark.hatle@windriver.com>
# * Updated to no longer generate special -dbg pa... | jaimeantena4040/MiSitioWeb | scripts/contrib/python/generate-manifest-3.4.py | Python | gpl-2.0 | 16,515 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from datetime import datetime
from freezegun import freeze_time
from ggrc import db
from ggrc_workflows.models import Cycle
from ggrc_workflows.models import CycleTaskGroupObjectTask
from ggrc_workflows.mod... | edofic/ggrc-core | test/integration/ggrc_workflows/test_basic_workflow_actions.py | Python | apache-2.0 | 10,007 |
import csv
from django.http import HttpResponse
from .models import Payment
def download_donor_report(modeladmin, request, queryset):
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="donor-report.csv"'
writer = csv.writer(response)
writer.writ... | django/djangoproject.com | fundraising/admin_views.py | Python | bsd-3-clause | 1,519 |
import glob
import os
import shutil
from ua.core.utils.isfirst import IsFirst
# Renamed Methods:
#
# dir_file_names -> read_dir_file_names
# dir_file_paths -> read_dir_file_paths
# get_dir_file_names -> read_dir_file_names
# get_dir_file_paths -> read_dir_file_paths
# latest_file -> read_latest_fil... | toconn/Python3-Core | Source/ua/core/utils/fileutils.py | Python | gpl-3.0 | 4,659 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Plugins.Plugin import PluginDescriptor
from Components.Label import Label
from Components.ActionMap import ActionMap
from Components.NimManager import nimmanager
from Components.MenuList import MenuList
from Components.config import confi... | popazerty/SDG-e2 | lib/python/Plugins/SystemPlugins/CableScan/plugin.py | Python | gpl-2.0 | 10,348 |
# Copyright 2018 The Kubeflow 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... | kubeflow/pipelines | sdk/python/tests/dsl/pipeline_param_tests.py | Python | apache-2.0 | 4,209 |
# stdlib
from typing import Any
# third party
from kombu import serialization
# syft absolute
import syft as sy
from syft.logger import error
def loads(data: bytes) -> Any:
# original payload might have nested bytes in the args
org_payload = sy.deserialize(data, from_bytes=True).upcast()
# original payl... | OpenMined/PySyft | packages/grid/backend/grid/core/celery_serde.py | Python | apache-2.0 | 1,314 |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
class BaseWebServer(object):
"""
Abstract base class for web server api
"""
__metaclass__ = ABCMeta
@abstractmethod
def get_directories(self, site_name, virt_path):
pass
@abstractmethod
def get_server_node(self... | helicontech/zoo | Zoocmd/core/api/webservers/base.py | Python | apache-2.0 | 662 |
########################################################################
# File : JobWrapper.py
# Author : Stuart Paterson
########################################################################
""" The Job Wrapper Class is instantiated with arguments tailored for running
a particular job. The JobWrapper starts ... | petricm/DIRAC | WorkloadManagementSystem/JobWrapper/JobWrapper.py | Python | gpl-3.0 | 62,887 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | eino-makitalo/odoo | openerp/tools/convert.py | Python | agpl-3.0 | 41,276 |
import copy
import yaml
class StyleOption(object):
def __init__(self, name, options):
self.name = name
self.options = options
class Style(object):
def __init__(self, base=None, style=None, hidden_base_style=None):
if style is None:
if base is not None:
style = {'BasedOnSty... | jaredgrubb/fit-clang-format | styles.py | Python | mit | 6,607 |
from __future__ import (absolute_import, division, print_function)
import unittest
import os
import shutil
import sys
import mantid.kernel.plugins as plugins
from mantid.api import AlgorithmFactory, AlgorithmManager
__TESTALG__ = \
"""from mantid.api import PythonAlgorithm, AlgorithmFactory
class TestPyAlg(PythonAl... | dymkowsk/mantid | Framework/PythonInterface/test/python/mantid/kernel/PythonPluginsTest.py | Python | gpl-3.0 | 1,990 |
"""
These tests only check url parsing for now.
We don't want to require the 'network' resource.
"""
import os, unittest
from SimpleHTTPServer import SimpleHTTPRequestHandler
from test import test_support
class SocketlessRequestHandler (SimpleHTTPRequestHandler):
def __init__(self):
pass
class SimpleHTT... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_SimpleHTTPServer.py | Python | gpl-2.0 | 1,345 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | openstack/octavia | octavia/tests/unit/controller/healthmanager/test_health_manager.py | Python | apache-2.0 | 6,217 |
params_flatmap_lateral_medial = {
"figsize": [16, 9],
"panels": [
{
"extent": [0.000, 0.200, 1.000, 0.800],
"view": {"angle": "flatmap", "surface": "flatmap"},
},
{
"extent": [0.300, 0.000, 0.200, 0.200],
"view": {
"hemisphe... | gallantlab/pycortex | cortex/export/_default_params.py | Python | bsd-2-clause | 6,206 |
#
# 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 ... | obulpathi/cloud-translator | transformer/hot/tosca/tosca_block_storage_attachment.py | Python | apache-2.0 | 1,993 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
#in this file, we mostly add the tag translate=True on existing fields that we now want to be translated
class AccountAccountTag(models.Model):
_inherit = 'account.account.tag'
... | t3dev/odoo | addons/l10n_multilang/models/account.py | Python | gpl-3.0 | 2,081 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | mwytock/cvxpy | cvxpy/problems/problem_data/sym_data.py | Python | gpl-3.0 | 8,004 |
import os
import sys
import site
import site_utils
def test_site_dir_exists():
result = site_utils.site_dir_exists("test")
def test_create_site_dir():
site_utils.create_site_dir("test")
tdir = os.path.join(site.getuserbase(), "test")
#print "tdir: %s" % str(tdir)
assert os.path.exists(tdir)
s... | CospanDesign/python | site/test_site_utils.py | Python | mit | 415 |
from datetime import (
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas._libs.tslibs import period as libperiod
from pandas.errors import InvalidIndexError
import pandas as pd
from pandas import (
DatetimeIndex,
NaT,
Period,
PeriodIndex,
Series,
Timedelta,... | pandas-dev/pandas | pandas/tests/indexes/period/test_indexing.py | Python | bsd-3-clause | 32,453 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | gfsa/training/simple_train.py | Python | apache-2.0 | 2,588 |
from oncall import db
from datetime import date
class Cron(db.Model):
""" Manages pseudo-cron """
__tablename__ = 'cron'
name = db.Column(db.String(200), primary_key=True)
date_updated = db.Column(db.Date)
_hide_command = []
_search_on = 'name'
def __init__(self, name):
self.name ... | kincl/oncall | oncall_old/models/cron.py | Python | gpl-3.0 | 457 |
__author__ = 'george'
from baseclass import Plugin
import time
from apscheduler.scheduler import Scheduler
class AreWeDone(Plugin):
def __init__(self, skype):
super(AreWeDone, self).__init__(skype)
self.command = "arewedoneyet"
self.sched = Scheduler()
self.sched.start()
sel... | jvlomax/Beaker-bot | plugins/arewedone.py | Python | gpl-2.0 | 1,837 |
import pytest
from dvc.fs.s3 import S3FileSystem
from dvc.objects.db import _get_odb
remotes = [pytest.lazy_fixture(fix) for fix in ["gs", "s3"]]
FILE_WITH_CONTENTS = {
"data1.txt": "",
# "empty_dir/": "",
"empty_file": "",
"foo": "foo",
"data/alice": "alice",
"data/alpha": "alpha",
"da... | dmpetrov/dataversioncontrol | tests/unit/remote/test_remote_tree.py | Python | apache-2.0 | 1,162 |
# -*- 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, software
... | jhsenjaliya/incubator-airflow | airflow/executors/local_executor.py | Python | apache-2.0 | 2,991 |
# -*- coding: utf-8 -*-
import datetime
import json
from flask import request
from .log_store import ESStore
__version__ = '0.1'
__versionfull__ = __version__
def parse_meta_info_from_req(real_request):
log_dict = {}
log_dict["host"] = real_request.headers.get('Host')
log_dict["remote_addr"] = re... | nava45/flask-routelogger | flask_routelogger/__init__.py | Python | mit | 4,716 |
"""
Shim to maintain backwards compatibility with old IPython.parallel imports.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
from warnings import warn
from IPython.utils.shimmodule import ShimModule, ShimWarning
warn("The `IPython.parallel` packa... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/IPython/parallel.py | Python | artistic-2.0 | 634 |
# Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved.
#
# Licensed under the Simplified BSD License (the "License");
# you may not use this file except in compliance with the License.
"""Application factory."""
import asyncio
from aiohttp.web import Application
from aiohttp.log import web_logger
from hypr... | project-hypr/hypr2 | hypr/app.py | Python | bsd-2-clause | 6,307 |
import os
import random
import time
from contextlib import contextmanager
MOCK_LOUCSTFILE_CONTENT = '''
"""This is a mock locust file for unit testing"""
from locust import HttpUser, TaskSet, task, between, LoadTestShape
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
clas... | mbeacom/locust | locust/test/mock_locustfile.py | Python | mit | 1,256 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import subprocess
import sys
# This script executes libool and filters out logspam lines like:
# '/path/to/libtool: file: foo.o has n... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/build/toolchain/mac/filter_libtool.py | Python | gpl-3.0 | 1,592 |
##
# Copyright (c) 2008-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | macosforge/ccs-calendarserver | txdav/caldav/datastore/scheduling/imip/test/test_outbound.py | Python | apache-2.0 | 28,974 |
import pickle
import numpy as np
import pysixtrack
import sixtracktools
# Load machine
with open('line.pkl', 'rb') as fid:
line = pysixtrack.Line.from_dict(pickle.load(fid))
# Load particle on CO
with open('particle_on_CO.pkl', 'rb') as fid:
part_on_CO = pysixtrack.Particles.from_dict(
pickle._load(f... | SixTrack/SixTrackLib | examples/python/test_footprint_from_sixtrack_input/001_checks_against_sixtrack.py | Python | lgpl-2.1 | 3,715 |
from django.conf.urls import patterns, url
urlpatterns = patterns('djmemts.views',
url(r'0/$', 'test0', name='0'),
)
| max-posedon/djmemd | djmemd/djmemts/urls.py | Python | mit | 122 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 21 11:17:51 2017
@author: dhingratul
"""
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
# %matplotlib inline
from __future__ import print_function
import collections
import math
import n... | dhingratul/Deep-Learning | 5_word2vec.py | Python | mit | 7,189 |
# -*- coding: utf-8 -*-
#
# 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
#... | r39132/airflow | airflow/contrib/hooks/snowflake_hook.py | Python | apache-2.0 | 5,080 |
# -*- coding: utf-8 -*-
"""
Command line interface to orchestrion
"""
from __future__ import print_function
import argparse
from orcoursetrion import actions
def run_create_export_repo(args):
"""Run the create_export_repo action using args"""
repo = actions.create_export_repo(args.course, args.term, args.de... | mitodl/orcoursetrion | orcoursetrion/cmd.py | Python | bsd-2-clause | 6,931 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that includes classes and functions used by fuzzers."""
def FillInParameter(parameter, func, template):
"""Replaces occurrences of a paramete... | danakj/chromium | third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py | Python | bsd-3-clause | 923 |
"""Produce contact map for Figure 5D from the PySB publication"""
from __future__ import print_function
import pysb.integrate
import pysb.util
import numpy as np
import scipy.optimize
import scipy.interpolate
import matplotlib.pyplot as plt
import os
import sys
import inspect
from earm.lopez_embedded import model
#... | LoLab-VU/pysb | pysb/examples/paper_figures/fig6.py | Python | bsd-2-clause | 9,204 |
import base64
import os
import unittest
from app import settings
from app.authentication.invalid_token_exception import InvalidTokenException
from app.authentication.jwt_decoder import JWTDecryptor
from tests.app.authentication import TEST_DO_NOT_USE_SR_PRIVATE_PEM
# public key from jwt.io
TEST_DO_NOT_USE_PUBLIC_KEY... | qateam123/eq | tests/app/authentication/test_jwt.py | Python | mit | 17,225 |
'''
color code of points:
- black: outside R2 or inside R1 (check);
- colored: inside R2 and outside R1 (check);
- magenta: outside R2 or inside R1 (check) but wronlgy labelled as inside;
- white: inside R2 and outside R1 (check) but wronlgy labelled as outside;
'''
import matplotlib.pyplot as plt
import numpy as np
... | SixTrack/SixTrack | test/chebythin6d/cheby_plot_map.py | Python | lgpl-2.1 | 3,183 |
import mimetypes
import os
from .api_resource import ApiResource
class DocumentType():
Passport = "passport"
NationalIdentityCard = "national_identity_card"
WorkPermit = "work_permit"
DrivingLicense = "driving_licence"
NationalInsurance = "national_insurance"
BirthCertificate = "birth_certific... | smcl/pyonfido | onfido/documents.py | Python | mit | 913 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pfss', '0006_auto_20150509_2150'),
]
operations = [
migrations.AddField(
model_name='creature',
name... | qu0zl/pfss | pfss/migrations/0007_creature_cmbtext.py | Python | mit | 448 |
import os
from Cython.Build import cythonize
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
import numpy
libraries = []
if os.name == 'posix':
libraries.append('m')
config = Configuration('pulse2percept', parent_package, top_path)... | uwescience/pulse2percept | pulse2percept/setup.py | Python | bsd-3-clause | 1,881 |
# coding=utf-8
# Copyright 2022 The Deeplab2 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 ... | google-research/deeplab2 | model/post_processor/post_processor_builder_test.py | Python | apache-2.0 | 2,537 |
"""-"""
SETTINGS = {
'logging': {
'level': 'INFO'
}
}
| blueraster/land-rights | polyIntersect/config/prod.py | Python | mit | 71 |
# 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.
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
import gyp.common
import gyp.easy_xml as easy_xml
import gyp.generator... | hkernbach/arangodb | 3rdParty/V8/v5.7.492.77/tools/gyp/pylib/gyp/generator/msvs.py | Python | apache-2.0 | 133,929 |
#!/usr/bin/env python
import datetime
import logging
from github import GithubObject
def timeobj_from_timestamp(timestamp):
"""Parse a timestamp with pygithub"""
dt = GithubObject.GithubObject._makeDatetimeAttribute(timestamp)
return dt.value
def strip_time_safely(tstring):
"""Try various formats t... | pilou-/ansibullbot | ansibullbot/utils/timetools.py | Python | gpl-3.0 | 837 |
from PyQt5 import QtWidgets, QtCore
import os.path
import logging
from Wolke import Wolke
import lxml.etree as etree
from EinstellungenWrapper import EinstellungenWrapper
from EventBus import EventBus
from CharakterAssistent.CharakterMerger import CharakterMerger
from Hilfsmethoden import Hilfsmethoden
class Regeln(ob... | Aeolitus/Sephrasto | src/Sephrasto/CharakterAssistent/WizardWrapper.py | Python | mit | 9,839 |
import os
from angular_flask import app
def runserver():
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
if __name__ == '__main__':
runserver()
| sanopa/youpin | runserver.py | Python | mit | 177 |
# Copyright 2016 Uri Laserson
#
# 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,... | laserson/phip-stat | phip/cli.py | Python | apache-2.0 | 31,221 |
from __future__ import division
from __future__ import print_function
from scipy.stats import norm, gaussian_kde, rankdata
import numpy as np
from . import common_args
from ..util import read_param_file
# Perform Delta moment-independent Analysis on file of model results
# Returns a dictionary with key... | t2abdulg/SALib | SALib/analyze/delta.py | Python | mit | 3,936 |
"""Helper module for build_manager with function to get exp or package from request"""
from build_manager.travis_ci_helper import TravisCiHelper
from git_manager.helpers.github_helper import get_github_helper
from helpers.helper import get_package_or_experiment
def get_exp_or_package_from_request(request):
"""Get... | MOOCworkbench/MOOCworkbench | build_manager/helper.py | Python | mit | 1,001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.