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 |
|---|---|---|---|---|---|
# git-age Copyright (C) 2008 Kristoffer Gronlund
# This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see LICENSE for details.
#
# a git blame viewer
# shows the file with annotations
# on author... | krig/git-age | gitage/__init__.py | Python | gpl-3.0 | 15,036 |
#!/usr/bin/python
"""Test of Orca's presentation of Writer toolbar buttons."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
######################################################################
# Start Writer
#
sequence.append(WaitForWindowActivate("Untitled 1 - " + utils.getOOoName("Wri... | h4ck3rm1k3/orca-sonar | test/keystrokes/oowriter/toolbar-buttons.py | Python | lgpl-2.1 | 25,262 |
from GangaCore.GPIDev.Schema import *
from GangaCore.GPIDev.Lib.Tasks.common import *
from GangaCore.GPIDev.Lib.Tasks.ITransform import ITransform
from GangaCore.GPIDev.Lib.Job.Job import JobError
from GangaCore.GPIDev.Lib.Registry.JobRegistry import JobRegistrySlice, JobRegistrySliceProxy
from GangaCore.Core.exception... | ganga-devs/ganga | ganga/GangaND280/Tasks/ND280Transform_CSVEvtList.py | Python | gpl-3.0 | 4,112 |
from fuckery import constants
from fuckery import exc
from fuckery import memory
from fuckery import parser
from fuckery import vm
__version__ = "0.5.3"
__all__ = ['constants', 'exc', 'memory', 'parser', 'vm']
| williamgibb/pyFuckery | src/fuckery/__init__.py | Python | mit | 211 |
import math
import meshlabxml
import os
import tempfile
import plyfile
import numpy as np
import numba
import binvox_rw
import subprocess
def print_hausdorff(hausdorff_distance):
for key, value in hausdorff_distance.items():
print('{}: {}'.format(key, value))
@numba.njit
def minmax(array):
# Ravel t... | CRLab/curvox | src/curvox/mesh_comparisons.py | Python | mit | 5,606 |
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from pandas import Series,DataFrame
import seaborn as sns
# In[2]:
#https://www.kaggle.com/residentmario/bivariate-plotting-with-pandas/data
reviews = pd.read_csv("winemag-data_first150k.csv", index_col=0)
reviews.h... | muxiaobai/CourseExercises | python/kaggle/data-visual/plot%26seaborn.py | Python | gpl-2.0 | 2,005 |
"""
Tests for broadman.path module
Copyright 2015, Outernet Inc.
Some rights reserved.
This software is free software licensed under the terms of GPLv3. See COPYING
file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt.
"""
try:
from unittest import mock
except ImportError:
import mock... | Outernet-Project/outernet-broadman | tests/test_path.py | Python | gpl-3.0 | 5,666 |
#coding: utf-8
import os
from unittest import TestCase
import mock
from page_content_extractor.imgsz import *
from page_content_extractor.webimage import WebImage
class SvgSizeTestCase(TestCase):
def test_svg_with_no_px_and_floating_point_size(self):
fpath = os.path.join(os.path.dirname(__file__), 'fixtu... | polyrabbit/hacker-news-digest | test/test_image.py | Python | lgpl-3.0 | 1,306 |
#!/usr/bin/env python
import argparse
import bz2
import gzip
import os.path
import sys
from csvkit import CSVKitReader
from csvkit.exceptions import ColumnIdentifierError, RequiredHeaderError
def lazy_opener(fn):
def wrapped(self, *args, **kwargs):
self._lazy_open()
fn(*args, **kwargs)
return... | cypreess/csvkit | csvkit/cli.py | Python | mit | 15,243 |
"""
Test program for Data Bootcamp course.
Repository of materials (including this file):
* https://github.com/DaveBackus/Data_Bootcamp/
* https://github.com/DaveBackus/Data_Bootcamp/Code/Python
Written by Dave Backus, March 2015
Created with Python 3.4
"""
print('\nWelcome to Data Bootcamp!')
import datetime... | ky822/Data_Bootcamp | Code/Python/bootcamp_test.py | Python | mit | 968 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under th... | trunglq7/horizon | openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py | Python | apache-2.0 | 2,482 |
#!/usr/bin/env python
"""The setup and build script for the python-telegram-bot library."""
import codecs
import os
from setuptools import setup, find_packages
def requirements():
"""Build the requirements list for this project"""
requirements_list = []
with open('requirements.txt') as requirements:
... | Eldinnie/python-telegram-bot | setup.py | Python | gpl-3.0 | 2,113 |
import spacy
from sklearn.linear_model import Lasso
from sklearn.linear_model import LogisticRegression
from scattertext import SampleCorpora, sparse_explorer
from scattertext.CorpusFromPandas import CorpusFromPandas
nlp = spacy.load('en_core_web_sm')
convention_df = SampleCorpora.ConventionData2012.get_data()
corpus... | JasonKessler/scattertext | demo_sparse.py | Python | apache-2.0 | 1,121 |
# Copyright (C) 2010-2016 GRNET S.A.
#
# 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 program is distributed i... | dimara/synnefo | snf-cyclades-app/synnefo/api/tests/admin_views.py | Python | gpl-3.0 | 1,902 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-15 15:43
from __future__ import unicode_literals
from django.db import migrations
def populate_m2m(apps, schema_editor):
ScriptParser = apps.get_model('wooey', 'ScriptParser')
ScriptParameterGroup = apps.get_model('wooey', 'ScriptParameterGroup'... | wooey/Wooey | wooey/migrations/0030_populate-sv-m2m.py | Python | bsd-3-clause | 702 |
import sys
import os
cur_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(cur_dir, os.pardir))
import unittest
import logging
import unishark
from time import sleep
log = logging.getLogger(__name__)
class MyTestClass5(unittest.TestCase):
def test_11(self):
"""Here is test_1... | kaushik94/unishark | example/test_module3.py | Python | apache-2.0 | 1,907 |
#!/usr/bin/env python
"""
MAVProxy checklist, implemented in a child process
Created by Stephen Dade (stephen_dade@hotmail.com)
"""
class CheckItem():
'''Checklist item used for information transfer
between threads/processes/pipes'''
def __init__(self, name, state):
self.name = name
se... | jiusanzhou/mavelous | modules/lib/libchecklist.py | Python | mit | 19,061 |
"""
* Copyright 2009 Mark Renouf
*
* Licimport com.google.gwt.core.client.JavaScriptObject; cense"); 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... | minghuascode/pyj | library/pyjamas/media/TimeRanges.py | Python | apache-2.0 | 893 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/dialogs/company_editor.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright... | securestate/king-phisher | king_phisher/client/dialogs/company_editor.py | Python | bsd-3-clause | 7,385 |
"""
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
import datetime
import decimal
import sys
def _setup_environment(environ):
import platform
# Cygwin requires some special voodoo to set the environment variables
# properly so that Oracle will see them.
... | weidongxu84/info-gatherer | django/db/backends/oracle/base.py | Python | mit | 34,390 |
#~ # -*- coding: utf-8 -*-
from openerp.report import report_sxw
import time
from datetime import datetime, timedelta
import datetime as dt
class wh_src_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(wh_src_report, self).__init__(cr, uid, name, context)
s... | thinkasoft/ProyectoRD-dev | l10n_ve_withholding_src/report/wh_src_report.py | Python | agpl-3.0 | 1,332 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/tiw/v20190919/models.py | Python | mit | 97,675 |
# Copyright (c) 2014 Hitachi Data Systems, 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
#
# U... | saeki-masaki/cinder | cinder/tests/unit/test_hds_iscsi.py | Python | apache-2.0 | 16,404 |
#!/bin/python
class pcb_pcb(object):
def __init__(self, x=2500, y=2000, name=None):
self.units = "mil"
self.name = "python pcb" if name is None else name
self.x = x
self.y = y
self.grid = "Grid[1.00mil 0.0000 0.0000 1]"
self.poly_area = "PolyArea[3100]"
self.thermal = "Thermal[0.5]"
s... | bert/pcb | tests/tools/pcb.py | Python | gpl-2.0 | 4,847 |
# -*- coding: utf-8 -*-
# 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.
"""
bkr distros-edit-version: Edit the version... | jtoppins/beaker | Client/src/bkr/client/commands/cmd_distros_edit_version.py | Python | gpl-2.0 | 2,237 |
from .quality import Quality
class NodeInfo(object):
"""
Holds information about one node in the graph.
The dump() method on GraphManager returns a list of these objects, holding
one for each node in the graph.
"""
def __init__(self):
"""
The 'constructor'.
"""
... | richard-shepherd/calculation_graph | graph/node_info.py | Python | mit | 660 |
"""
Globals variables.
These are used by goaway methods invoked from application code
to get access to information that the goaway server has put here.
"""
import sys
import os
import uuid
import signal
import threading
# A config.ClusterConfig of the active config.
# Initialized by cmdserver.start_server.
# Initial... | anpere/goaway | goaway/globalvars.py | Python | mit | 3,227 |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
from __future__ import print_function
import sys
import os
import os.path
from fnmatch import fnmatch
from rez import __version__
from rez.utils.data_utils import cached_property
from rez.resolved_context import ResolvedContext
from re... | nerdvegas/rez | src/rez/status.py | Python | apache-2.0 | 12,472 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/cloud/kubevirt/kubevirt_pvc.py | Python | gpl-3.0 | 16,151 |
#!/usr/bin/env python
#
# Copyright 2007 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... | GoogleCloudPlatform/appengine-python-standard | src/google/appengine/api/apiproxy_stub_map.py | Python | apache-2.0 | 23,020 |
import textwrap
def dedent(text):
"""Equivalent of textwrap.dedent that ignores unindented first line.
This means it will still dedent strings like:
'''foo
is a bar
'''
For use in wrap_paragraphs.
Taken from https://github.com/ipython/ipython_genutils/text.py
"""
if text.start... | PLOS/allofplos | allofplos/utils.py | Python | mit | 717 |
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# networkd integration test
# This uses temporary configuration in /run and temporary veth devices, and
# does not write anything on disk or change any system configuration;
# but it assumes (and checks at the beginning) that networkd is not currentl... | endlessm/systemd | test/networkd-test.py | Python | gpl-2.0 | 44,697 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from SimPEG import Mesh, Maps, SolverLU, Utils
from SimPEG.Utils import ExtractCoreMesh
import numpy as np
from SimPEG.EM.Static import DC
import matplotlib
import matplotlib.pyplot as plt
import matplo... | geoscixyz/em_examples | em_examples/DCWidgetPlate_2D.py | Python | mit | 28,215 |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Scientific Package. This package holds all simulators, and
# analysers necessary to run brain-simulations. You can use it stand alone or
# in conjunction with TheVirtualBrain-Framework Package. See content of the
# documentation-folder for more details. See also http://www.... | stuart-knock/tvb-library | tvb/tests/library/simulator/history_test.py | Python | gpl-2.0 | 4,478 |
import json
class Engine:
def __init__(self,product_1_metadata, rec_type_id):
self.product_1_metadata = product_1_metadata
self.rec_type_id = rec_type_id
#assumes that we recieve JSON Data in this Manner
def parseMetaData(self, product_2_metadata):
try:
if (self.product_1_metadata!= "" and product_2_met... | devopsdelta/recommendations | app/engine.py | Python | apache-2.0 | 1,585 |
#########################################################################
#
# Copyright (c) 2012 Daniel Berenguer <dberenguer@usapiens.com>
#
# This file is part of the lagarto project.
#
# lagarto is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | oriolrius/lagarto-swap | lagarto/lagartomqtt/plugin.py | Python | gpl-2.0 | 4,773 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jendap/tensorflow | tensorflow/contrib/boosted_trees/python/kernel_tests/training_ops_test.py | Python | apache-2.0 | 83,501 |
# -*- coding: utf-8 -*-
# This file is part of KTBS <http://liris.cnrs.fr/sbt-dev/ktbs>
# Copyright (C) 2011-2012 Pierre-Antoine Champin <pchampin@liris.cnrs.fr> /
# Françoise Conil <francoise.conil@liris.cnrs.fr> /
# Universite de Lyon <http://www.universite-lyon.fr>
#
# KTBS is free software: you can ... | ktbs/ktbs | lib/ktbs/api/obsel.py | Python | lgpl-3.0 | 10,962 |
import json
import uuid
from collections import namedtuple
from datetime import datetime, timedelta
from unittest.mock import ANY
import pytest
from flask import current_app
from notifications_utils.recipients import validate_and_format_phone_number
from requests import HTTPError
import app
from app import firetext_c... | alphagov/notifications-api | tests/app/delivery/test_send_to_providers.py | Python | mit | 33,810 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import gettext
from bottle import request
class TranslatorNotInitializedError(Exception):
""" Exception raised if Translator is not initialized. """
class Translator:
""" Wrapper for gettext for translations.
Member:
translations -- Dict of gettext translat... | tea2code/recipe_manager | helper/translator.py | Python | mit | 1,302 |
#########################################################################
# This script is provided for
#
# Chen W and De Schutter E (2017) Parallel STEPS: Large Scale Stochastic Spatial Reaction-Diffusion Simulation with High Performance Computers. Front. Neuroinform. 11:13. doi: 10.3389/fninf.2017.00013
#
#########... | CNS-OIST/STEPS_Example | publication_models/API_1/Chen_FNeuroinf__2017/purkinje_model/ssa_branch_influx.py | Python | gpl-2.0 | 4,632 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | apps/oozie/src/oozie/utils.py | Python | apache-2.0 | 4,061 |
from django import template
register = template.Library()
@register.inclusion_tag('main/noice.html', name='noice')
def noice():
return {} | audiua/shkolyar_django | main/templatetags/noice.py | Python | mit | 143 |
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('albums/', include('albums.urls')),
path('photos/', include('photos.url... | asommer70/photolandia | photolandia/urls.py | Python | mit | 678 |
from __future__ import division, absolute_import
from time import time
from functools import wraps
from yunomi.compat import dict_item_iter
from yunomi.core.counter import Counter
from yunomi.core.histogram import Histogram
from yunomi.core.meter import Meter
from yunomi.core.timer import Timer
class MetricsRegistr... | dreid/yunomi | yunomi/core/metrics_registry.py | Python | mit | 7,890 |
'''
make_mdp.py
Utility for making MDP instances or distributions.
'''
# Python imports.
import itertools
import random
from collections import defaultdict
# Other imports.
from simple_rl.tasks import ChainMDP, GridWorldMDP, TaxiOOMDP, RandomMDP, FourRoomMDP, HanoiMDP
from simple_rl.tasks.grid_world.GridWorldMDPClas... | david-abel/simple_rl | simple_rl/utils/make_mdp.py | Python | apache-2.0 | 5,155 |
from datadog import initialize, api
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
# Find a host to unmute
hosts = api.Infrastructure.search(q='hosts:')
# Unmute host
api.Host.unmute(hosts['results']['hosts'][0])
| jhotta/documentation | code_snippets/api-host-unmute.py | Python | bsd-3-clause | 315 |
# -*- coding: utf-8 -*-
#
# escpos/helpers.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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
#
# ... | base4sistemas/pyescpos | escpos/helpers.py | Python | apache-2.0 | 5,701 |
from .box import Box
import numpy as np
from numba import jit
class Octree(object):
"""
Octree implementation to be used in particle dipole networks
"""
def __init__(self, max_level=3, p=0, n_particle_min=20, mac=0.0, cut=1000.0):
self.max_level = max_level
self.p = p
self.n_... | awlange/brainsparks | src/calrissian/layers/octree/octree.py | Python | mit | 10,430 |
# Copyright 2013 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.
"""Runs perf tests.
Our buildbot infrastructure requires each slave to run steps serially.
This is sub-optimal for android, where these steps can run indepe... | SaschaMester/delicium | build/android/pylib/perf/test_runner.py | Python | bsd-3-clause | 11,902 |
#!/usr/bin/python
#
# Simple script for simulating nodewatcher output on server nodes in
# order to use with the monitoring system. It should be put into cron
# to run every few minutes and redirect the output into the proper
# location.
#
# Sample netfilter configuration in use on wlan slovenia:
#
# iptables -I FORW... | wlanslovenija/serwatcher | serwatcher.py | Python | agpl-3.0 | 1,838 |
"""
Balanced Python client library.
See ``README.md`` for usage advice.
"""
import os
import re
try:
import setuptools
except ImportError:
import distutils.core
setup = distutils.core.setup
else:
setup = setuptools.setup
def _get_version():
path = os.path.join(PATH_TO_FILE, 'txbalanced', '__ini... | trenton42/txbalanced | setup.py | Python | mit | 2,195 |
# Monary - Copyright 2011-2014 David J. C. Beach
# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.
import pymongo
import monary
from test import db_err, unittest
NUM_TEST_RECORDS = 5000
@unittest.skipIf(db_err, db_err)
class TestQueryBasics(unittest.TestCase):
@classmethod
def... | aherlihy/Monary | test/test_query_basics.py | Python | apache-2.0 | 1,734 |
from gwt.chart.GChartUtil import (
AnnotationLocation,
DOM,
Double,
NAI,
htmlHeight,
htmlWidth,
indexOfBr,
setBackgroundColor,
setBorderColor,
setBorderStyle,
setBorderWidth,
setColor,
setFontFamily,
setFontSize,
setFontStyle,
setFontWeight,
setOverflo... | anandology/pyjamas | library/pyjamas/chart/GChartUtil.py | Python | apache-2.0 | 368 |
import os
#import pyfits
import MySQLdb
import time
import lzjutil as lzju
def insbokred (cur, fileid, mjd, fil, filename) :
baselist = {'u':'/data/red/bok/u/pass1/', 'v':'/data/red/bok/v/pass1/'}
if not baselist.has_key(fil) : return (0)
basepath = baselist[fil]
filepart = filename.split('/')
ba... | RapidLzj/201603 | bok_reduce.py | Python | apache-2.0 | 2,896 |
import unicodecsv
import sys
from pytz import timezone
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
from oioioi.contests.models import Contest, Submission
class Command(BaseCommand):
args = _("<co... | papedaniel/oioioi | oioioi/oi/management/commands/oi_timepres_data.py | Python | gpl-3.0 | 1,646 |
# -*- coding: utf-8 -*-
"""This code is a part of Hydra Toolkit
.. module:: hydratk.translation.lib.network.dbi.client.en.messages
:platform: Unix
:synopsis: English language translation for DB client messages
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>
"""
language = {
'name': 'English',
'ISO-6... | hydratk/hydratk-lib-network | src/hydratk/translation/lib/network/dbi/client/en/messages.py | Python | bsd-3-clause | 1,428 |
#!/bin/python2.7
def add_scalar_to_list(my_scalar, my_list=[]):
'''Given a scalar and a list, append the scalar to the list.
If no list is provided, return a new list containing just the scalar value.
'''
return my_list.append(my_scalar)
extra_credit = 0
# DO NOT CHANGE ANYTHING BELOW THIS LINE
# Te... | AnchorFree/python_example | example_code.py | Python | gpl-2.0 | 2,648 |
from flask_script import Command
from twoxy.database import db_ctx as db
from twoxy.database.models import APIAuthorized
class Command(Command):
"""Adds an API key to the list of valid API keys."""
def run(self):
db.session.add(APIAuthorized(input("Enter key:")))
db.session.commit()
| ableiten/twoxy | twoxy/commands/add_api_key.py | Python | gpl-2.0 | 310 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | hfp/tensorflow-xsmm | tensorflow/python/saved_model/signature_constants.py | Python | apache-2.0 | 4,893 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-09 18:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('elearning', '0006_auto_20160209_1818'),
]
operations = [
migrations.AlterFie... | tkupek/tkupek-elearning | tkupek_elearning/elearning/migrations/0007_auto_20160209_1819.py | Python | gpl-3.0 | 501 |
"""Test fixtures."""
from builtins import super
import pytest
from napalm.base.test import conftest as parent_conftest
from napalm.base.test.double import BaseTestDouble
from napalm.ios import ios
@pytest.fixture(scope="class")
def set_device_parameters(request):
"""Set up the class."""
def fin():
... | spotify/napalm | test/ios/conftest.py | Python | apache-2.0 | 1,521 |
# -*- coding: utf-8 -*-
# pylint: disable=E1101
import datetime as dt
import os
import struct
import sys
import warnings
from datetime import datetime
from distutils.version import LooseVersion
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
from pandas import compat
from pandas.... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/io/test_stata.py | Python | apache-2.0 | 56,067 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('billing', '0008_order_rfidcard'),
]
operations = [
migrations.AlterField(
model_name='order',
name='... | Inter-Actief/alexia | alexia/apps/billing/migrations/0009_alter_order_rfidcard.py | Python | bsd-3-clause | 484 |
# -*- coding: utf-8 -*-
"""update_slice_model_json
Revision ID: db0c65b146bd
Revises: f18570e03440
Create Date: 2017-01-24 12:31:06.541746
"""
# revision identifiers, used by Alembic.
revision = 'db0c65b146bd'
down_revision = 'f18570e03440'
from alembic import op
import json
from sqlalchemy.ext.declarative import d... | dmigo/incubator-superset | superset/migrations/versions/db0c65b146bd_update_slice_model_json.py | Python | apache-2.0 | 1,351 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-28 13:11
from __future__ import unicode_literals
from django.db import migrations
SUGG_REJECT_FLAG = 9
def drop_reject_suggestion_subs(apps, schema_editor):
subs = apps.get_model("pootle_statistics.Submission").objects.all()
subs.filter(type=S... | ta2-1/pootle | pootle/apps/pootle_statistics/migrations/0017_drop_reject_suggestion_subs.py | Python | gpl-3.0 | 564 |
from __future__ import unicode_literals
import os
import subprocess
import sys
miniconda64_envs = os.getenv('MINICONDA64_ENVS')
python_installations = [
r'%s/py27_64/bin/python' % miniconda64_envs,
r'%s/py35_64/bin/python' % miniconda64_envs,
r'%s/py36_64/bin/python' % miniconda64_envs,
r'%s/py37_64/... | leafclick/intellij-community | python/helpers/pydev/build_tools/build_binaries_osx.py | Python | apache-2.0 | 2,051 |
#!/usr/bin/env python
#
# 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.
#
# Written (C) 2012-2013 Heiko Strathmann
#
from ... | AzamYahya/shogun | examples/undocumented/python_modular/statistics_linear_time_mmd.py | Python | gpl-3.0 | 4,164 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | sysadminmatmoz/odoo-clearcorp | TODO-7.0/sneldev_magento/wizard/sneldev_magento_stock_init.py | Python | agpl-3.0 | 1,636 |
# Copyright (c) 2014 Rackspace, 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 wr... | obulpathi/poppy | poppy/model/common.py | Python | apache-2.0 | 1,962 |
"""CLI tests for Insights part of RH Cloud - Inventory plugin.
:Requirement: RH Cloud - Inventory
:CaseAutomation: Automated
:CaseLevel: System
:CaseComponent: RHCloud-Inventory
:Assignee: jpathan
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from broker.broker import VMBroker
fro... | lpramuk/robottelo | tests/foreman/cli/test_rhcloud_insights.py | Python | gpl-3.0 | 1,546 |
#!/usr/bin/python
import os
from StringIO import StringIO
import hatrac
import hatrac.core
import web
from webauthn2.manager import Context
import web
import hashlib
web.config.debug = False
FILESYSTEM = "filesystem"
AMAZON_S3 = "amazons3"
deployment = os.environ.get("HATRAC_DEPLOYMENT", FILESYSTEM)
if deployment... | informatics-isi-edu/hatrac | test/smoketest.py | Python | apache-2.0 | 6,627 |
import functools
class Cache(object):
"""
Provides easy methods to for setting edge caching, both via the browser and App Engine's
intermediate caching proxies.
"""
def __init__(self, controller):
self.controller = controller
def _get_default_expiration(self):
return self.con... | markEarvin/sl-contest-tracker | ferris/components/cache.py | Python | mit | 1,242 |
from __future__ import absolute_import
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.basecommand import Command
from pip._internal.exceptions import InstallationError
from pip._internal.req import InstallRequirement, parse_requirements
class UninstallCommand(Command):
""... | ncos/lisa | src/lisa_drive/scripts/venv/lib/python3.5/site-packages/pip-10.0.1-py3.5.egg/pip/_internal/commands/uninstall.py | Python | mit | 2,786 |
#! /usr/bin/python
import glob
import shutil
import sys
import subprocess
import os
def cpfile(src, target):
sys.stdout.write("Copying %s to %s\n" % (src, target))
shutil.copy(src, target)
# We only copy the armeabi version of the binary
archs = ["armeabi"]
for arch in archs:
try:
os.makedirs(".... | xdggplus/cryptonite | encfs-1.7.5/cplibs-static.py | Python | gpl-2.0 | 1,220 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v8/services/services/asset_service/transports/base.py | Python | apache-2.0 | 3,912 |
import os.path as op
import nipype.interfaces.io as nio # Data i/o
import nipype.interfaces.utility as util # utility
import nipype.interfaces.cmtk as cmtk
import nipype.algorithms.misc as misc
import nipype.pipeline.engine as pe # pypeline engine
from .connectivity_mapping import create_connecti... | JohnGriffiths/nipype | nipype/workflows/dmri/mrtrix/group_connectivity.py | Python | bsd-3-clause | 6,563 |
from rest_framework import serializers
from ..gro_api.serializers import BaseSerializer
from .models import (
ActuatorType, ControlProfile, ActuatorEffect, Actuator, ActuatorState
)
class ActuatorTypeSerializer(BaseSerializer):
class Meta:
model = ActuatorType
def validate(self, data):
ef... | OpenAgInitiative/gro-api | gro_api/actuators/serializers.py | Python | gpl-2.0 | 3,988 |
# media-service-demo
#
# Copyright (C) 2012 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is dist... | sanyaade-webdev/media-service-demo | src/msd/msd_utils.py | Python | lgpl-2.1 | 1,274 |
#
# This file is part of nmgr.
# Copyright (C) 2015 Leo Gaspard
#
# nmgr 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.
#
# nmgr is di... | Ekleog/nmgr | src/nmgr/ip.py | Python | agpl-3.0 | 1,243 |
"""
A simple VTK widget for PyQt or PySide.
See http://www.trolltech.com for Qt documentation,
http://www.riverbankcomputing.co.uk for PyQt, and
http://pyside.github.io for PySide.
This class is based on the vtkGenericRenderWindowInteractor and is
therefore fairly powerful. It should also play nicely with the
vtk3DWi... | chrisdjscott/Atoman | atoman/gui/QVTKRenderWindowInteractor.py | Python | mit | 20,727 |
from findatapy.market import Market, MarketDataRequest, MarketDataGenerator
market = Market(market_data_generator=MarketDataGenerator())
# choose run_example = 0 for everything
# run_example = 1 - download free tick data from DukasCopy example
# run_example = 2 - download free FX daily data from Quandl
# run_example ... | kalaytan/findatapy | findatapy/examples/fxspotdata_example.py | Python | apache-2.0 | 6,155 |
"""Tests for morph_net.framework.op_regularizer_decorator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from morph_net.framework import conv_source_op_handler
from morph_net.framework import generic_regularizers
from morph_net.framework import op_hand... | google-research/morph-net | morph_net/framework/op_handler_decorator_test.py | Python | apache-2.0 | 1,838 |
#sorting list of dictionaries
rows=[
{'fname': 'Brian', 'lname': 'Jones', 'uid': 1003},
{'fname': 'David', 'lname': 'Beazley', 'uid': 1002},
{'fname': 'John', 'lname': 'Cleese', 'uid': 1001},
{'fname': 'Big', 'lname': 'Jones', 'uid': 1004}
]
from operator import itemgetter
rows_by_fname= sorted(rows,ke... | ishank296/python-cookbook | Chapter_1/sorting_list_of_dict.py | Python | gpl-3.0 | 912 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | vikkyrk/incubator-beam | sdks/python/apache_beam/io/textio.py | Python | apache-2.0 | 18,658 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... | rbaumg/trac | trac/web/tests/api.py | Python | bsd-3-clause | 31,977 |
from nose.tools import assert_equal
from nose.tools import raises
class TestStacks(object):
@raises(Exception)
def test_pop_on_empty(self, num_stacks, stack_size):
print('Test: Pop on empty stack')
stacks = Stacks(num_stacks, stack_size)
stacks.pop(0)
@raises(Exception)
def t... | saashimi/code_guild | interactive-coding-challenges/stacks_queues/n_stacks/test_n_stacks.py | Python | mit | 1,320 |
# Copyright (C) 2005, 2006, 2008, 2009, 2012 Canonical Ltd
#
# 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.
#
# This pr... | aurex-linux/germinate | germinate/tsort.py | Python | gpl-2.0 | 7,531 |
#!/usr/bin/env python
import os
import sys
import SLRdata
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='SLRdata',
version = SLRdata.__version__,
description='SLR file format parsers',
long_description=open('README.md').read(),
author... | dronir/SLRdata | setup.py | Python | mit | 460 |
# Copyright (c) 2014 Mirantis, 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... | chenyujie/hybrid-murano | murano/db/catalog/api.py | Python | apache-2.0 | 18,508 |
from ModuleInput import input_and_check_opperand, input_math_function
from ModuleMath import math_operation
from ModuleWarning import input_math_function_warning
def operations(): #Проведение основных операций
power = 1
while power == 1: #Организовано бесконечное выполнение программы до изменения параметра
... | Dimk000/Labs | 2course/lab1/procedure/main.py | Python | mit | 2,137 |
# -*- coding: utf-8 -*-
# import PIL
# from PIL import Image
# from app.configparser import config
# def resize_images(images):
# for image in images:
# img = Image.open(image['path'])
# imgs = []
# sizes = config('IMAGE_SIZES')
#
# for size in calculate_sizes(img.size):
#
# img = img.resize(size, resam... | web-izmerenie/avto-lux161 | avto-lux/app/adm/imageprocessing/imageprepare.py | Python | agpl-3.0 | 651 |
import pulsar as psr
def load_ref_system():
""" Returns c84 as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
C 2.68579 -2.68579 0.81754
C 2.68579 -0.81754 2.68579
C ... | pulsar-chem/Pulsar-Core | lib/systems/c84.py | Python | bsd-3-clause | 4,833 |
import datetime
import decimal
from django.core.exceptions import ImproperlyConfigured
from django.utils import timezone
try:
from django.utils import importlib
except:
import importlib
def convert_tstamp(response, field_name=None):
try:
if field_name and response[field_name]:
return ... | jamespacileo/django-stripe-payments | payments/utils.py | Python | mit | 2,063 |
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.i18n import i18n_patterns
from django.views.generic import TemplateView, RedirectView
from django.utils.module_loading import import_string
import os.path
import zerver.forms
from zproject import dev_urls
from zproject.lega... | dawran6/zulip | zproject/urls.py | Python | apache-2.0 | 22,072 |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.urls
~~~~~~~~~~~~~~~~~~~~~~~
URL helper tests.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
from werkzeug.testsuite import WerkzeugTestCase
from werkzeug.datastructures import OrderedMultiD... | michaelgugino/web_keyer | werkzeug/testsuite/urls.py | Python | gpl-3.0 | 14,874 |
import math
from stdutils import prettyFunction, inputAsDict
vals = inputAsDict(('degree','minute','second','arc'))
vals['de'] = vals['degree'] + (vals['minute']/60) + (vals['second']/3600)
vals['ra'] = vals['de']/180
vals['rap'] = vals['ra']*math.pi
vals['len'] = vals['arc']/vals['ra']
vals['lenp'] = vals['arc']/val... | meta1203/Trigonometry-Programlets | arcradius_dms.py | Python | apache-2.0 | 560 |
#!/usr/bin/env python
# Nezhat_pants.py
# PatternMaker: Susan Spencer Conklin
# pants shell pattern
from tmtpl.constants import *
from tmtpl.pattern import *
from tmtpl.document import *
from tmtpl.client import Client
#Project specific
#from math import sin, cos, radians
from math import sqrt
from pysvg.filter impo... | mikma/tmtp | standalone/Nezhat_pants.py | Python | gpl-3.0 | 10,198 |
from flask_wtf import Form
from wtforms import TextField, PasswordField, StringField
from wtforms.validators import DataRequired, Length, ValidationError
import phonenumbers as pn
"""
validate_phone
--------------
Custom validator. Validates that a StringField
that represents a phone number is in the correct format
""... | SteerClearWM/Steer-Clear-Backend | steerclear/login/forms.py | Python | mit | 1,519 |
#!/usr/bin/python
#
# created by ray on 2016-04-09
#
import numpy as np
from hmmlearn import hmm
class HmmModel(object):
def __init__(self, nhs):
self.tag2idx = {}
self.idx2tag = {}
self.model = None
self.n_state = -1
self.n_hidden_state = nhs
return
def load_samples(self, datapath, upd... | raybrshen/robot_sds | SLU/hmm_model.py | Python | apache-2.0 | 2,489 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.