code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
#!/usr/bin/python # interpolate scalar gradient onto nedelec space from dolfin import * import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc Print = PETSc.Sys.Print # from MatrixOperations import * import numpy as np #import matplotlib.pylab as plt import PETScIO as IO import common import ...
wathen/PhD
MHD/FEniCS/MHD/CG/PicardIter_Direct/DecoupleTest/KappaChange/CDmu.py
Python
mit
12,379
#!/bin/python import datetime class message(): def __init__(self, msg_id=0, channel_id=0, source_id=0, source_chat_id='',\ msg=''): curr_datetime = datetime.datetime.now() self.date = curr_datetime.strftime("%Y%m%d") self.time = curr_datetime.strftime("%H:%M:%S.%f %z") ...
gavincyi/Telex
src/message.py
Python
apache-2.0
2,393
# Generated by Django 2.0.2 on 2018-02-06 15:57 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('account', '0016_auto_20180108_0814'), ] operations = [ migrations.AlterModelTable( name='address', table=None, ), ...
UITools/saleor
saleor/account/migrations/0017_auto_20180206_0957.py
Python
bsd-3-clause
420
"""Room.is_active -> is_deleted Revision ID: ad0625914645 Revises: 8521bce91242 Create Date: 2019-04-23 09:20:49.877823 """ from alembic import op # revision identifiers, used by Alembic. revision = 'ad0625914645' down_revision = '8521bce91242' branch_labels = None depends_on = None def upgrade(): op.alter_co...
ThiefMaster/indico
indico/migrations/versions/20190423_0920_ad0625914645_room_is_active_is_deleted.py
Python
mit
814
import asyncio import datetime import math from unsync import unsync import aiohttp import requests def main(): t0 = datetime.datetime.now() tasks = [ compute_some(), compute_some(), compute_some(), download_some(), download_some(), download_some_more(), ...
Wintellect/WintellectWebinars
2019-01-24-async-python-kennedy/code/the_unsync/thesync.py
Python
apache-2.0
1,632
# __author__ = 'Dave' from __future__ import division import numpy as np def boundary_separation(array, idx): """ Computes the distance between boundary points in the 4, partitioned closed sets on S1. :param array: list of each sub-array for the non-empty quadrants (tuple) :param idx: index of t...
brainsqueeze/Image_correction
src/workers/optimization_utils.py
Python
mit
4,137
import cPickle import numpy as np import sys import os __all__ = ['FastaRecord', 'NpyFastaRecord', 'MemoryRecord'] MAGIC = "@flattened@" def is_up_to_date(a, b): return os.path.exists(a) and os.stat(a).st_mtime >= os.stat(b).st_mtime def ext_is_flat(ext): with open(ext) as fh: t = fh.read(len(MAGIC...
c-automate/sequence-editing-helpers
pyfasta/records.py
Python
mit
8,590
class DictionaryBoundObject(object): def __init__(self, dict, restricted_to_keys=None): self._dict = dict assert self._dict != None self._restricted_to_keys = set(restricted_to_keys) if restricted_to_keys != None else None def __getattr__(self, attr): if not attr.startswith("_")...
alessandrostone/mergepbx
src/pbxproj/core.py
Python
gpl-3.0
1,249
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/storage/azure-storage-blob/tests/test_large_block_blob.py
Python
mit
16,306
# Generated by Django 2.2.12 on 2020-05-09 06:28 from django.db import migrations # Can't use fixtures because load_fixtures method is janky with django-tenant-schemas def load_initial_data(apps, schema_editor): Grade = apps.get_model('courses', 'Grade') # add some initial data if none has been created yet ...
timberline-secondary/hackerspace
src/courses/migrations/0016_grades_initialdata.py
Python
gpl-3.0
963
# # Copyright (c) Elliot Peele <elliot@bentlogic.net> # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is distributed in the hope that it...
elliotpeele/prism_core
prism_core/errors.py
Python
mit
536
import ctypes import io import ipaddress import logging import os import platform import random import socket import struct from . import netlink logger = logging.getLogger(__name__) class OperatingSystem: def get_peer(self, remote): raise NotImplementedError() class Linux(OperatingSystem): proc_...
tehmaze-labs/lollipop
lollipop/operatingsystem.py
Python
mit
4,225
# -*- coding: utf-8 -*- # Copyright (C) 2013 Renato Lima - Akretion # # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api class AccountFiscalPosition(models.Model): _inherit = 'account.fiscal.position' @api.v7 def map_tax(sel...
rvalyi/l10n-brazil
l10n_br_account_service/models/res_partner.py
Python
agpl-3.0
3,385
from subprocess import run, PIPE, STDOUT def run_command(command): ''' Use subprocess to run a command and return the console output. LilyPond's console output is via stderr not stdout. ''' proc = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True) console_out = proc.stderr.split('\n') ...
PaulMorris/clairnote-sheet-music-library
console_utils.py
Python
gpl-3.0
685
from .rendermanager import create_render_manager from . import pman import panda3d.core as p3d class BPBase: def __init__(self, base, config): self.rendermanager = create_render_manager(base, config) def init(base): config = pman.get_config() if not pman.is_frozen() and base.appRunner is None an...
Moguri/prototype-lithium
game/blenderpanda/bpbase.py
Python
mit
660
#! /usr/bin/env python import sys,json import MySQLdb as mdb from subprocess import Popen,PIPE error=0 PATH_SCRIPT="Script" HOST=Popen(PATH_SCRIPT+"/GetInfo.sh HOST", stdout=PIPE, shell=True).stdout.read() DB=Popen(PATH_SCRIPT+"/GetInfo.sh DB", stdout=PIPE, shell=True).stdout.read() PASSWORD=Popen(PATH_SCRIPT+"/GetInf...
Bideau/SmartForrest
Package/Python/ProbeManager.py
Python
mit
11,006
from django.core.urlresolvers import reverse from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect from django.conf import settings from django.contrib.auth.decorators import login_...
ericholscher/pinax
pinax/apps/profiles/views.py
Python
mit
7,014
# -*- coding: utf-8 -*- #------------------------------------------------------------ # MonsterTV Regex de miplayer.net # Version 0.1 (02.11.2014) #------------------------------------------------------------ # License: GPL (http://www.gnu.org/licenses/gpl-3.0.html) # Gracias a la librería plugintools de Jesús (www.mim...
manusev/plugin.video.kuchitv
resources/regex/miplayernet.py
Python
gpl-2.0
3,150
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Synced playlists are stored in our plex.db. Interact with it through this module """ from __future__ import absolute_import, division, unicode_literals from logging import getLogger from .common import Playlist from ..plex_db import PlexDB from ..kodi_db import kodiid_...
croneter/PlexKodiConnect
resources/lib/playlists/db.py
Python
gpl-2.0
4,001
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import print_function """Script to checkout a sprout appliance Usage: sprout.py checkout """ import click import os import signal import sys import time import yaml from cfme.test_framework.sprout.plugin import SproutManager, SproutProvisioningReque...
jkandasa/integration_tests
cfme/scripting/sprout.py
Python
gpl-2.0
3,975
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + import copy import unittest from mantid.api ...
mganeva/mantid
scripts/test/Muon/muon_data_context_test.py
Python
gpl-3.0
5,477
#!/usr/bin/env python from __future__ import unicode_literals import unittest import os import datetime from pyjtt import utils class PyjttUtilsTest(unittest.TestCase): # utils.get_local_utc_offset def test_get_local_utc_offset_simple(self): # simple # MSK now = datetime.datetime(2...
citizen-stig/pyjtt
tests/utils_tests.py
Python
gpl-3.0
5,174
"""Module containing character feature extractors.""" import string from unstyle.features.featregister import register_feat @register_feat def characterSpace(text): """Return the total number of characters.""" return len(text) @register_feat def letterSpace(text): """Return the total number of letters ...
pagea/unstyle
unstyle/features/characterfeatures.py
Python
mit
526
# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation. # # 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 appli...
osrg/ryu
ryu/app/simple_switch_13.py
Python
apache-2.0
4,778
# test_greenthreads.py -- Unittests for eventlet. # Copyright (C) 2013 eNovance SAS <licensing@enovance.com> # # Author: Fabien Boucher <fabien.boucher@enovance.com> # # Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU # General Public License as public by the Free Software Foundation; version...
sonntagsgesicht/regtest
.aux/venv/lib/python3.9/site-packages/dulwich/tests/test_greenthreads.py
Python
apache-2.0
4,644
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc import translate.storage.base import pootle_store.fields import pootle.core.mixins.treeitem import pootle.core.storage from django.conf import settings class ...
Yelp/pootle
pootle/apps/pootle_store/migrations/0001_initial.py
Python
gpl-3.0
7,129
# Copyright 2015-2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
ejona86/grpc
src/python/grpcio/grpc/__init__.py
Python
apache-2.0
82,896
import os basedir = os.path.abspath(os.path.dirname(__file__)) #sql config SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') #csrf and openid config WTF_CSRF_ENABLED = True SECRET_KEY = 'what-do-you-think-it-is' OPENID_PROVIDERS ...
divya-csekar/flask-microblog-server
config.py
Python
bsd-3-clause
566
from django import template from ..models import Comment, Ticket register = template.Library() class CommitCommentNode(template.Node): def __init__(self, commit, varname): self.commit = template.Variable(commit) self.varname = varname def render(self, context): commit = self.commit.r...
Mediaphormedia/gitsummary
gitsummary/changelog/templatetags/changelog.py
Python
mit
1,621
ano_nascimento = input("Digite o ano de nascimento:") idade = 2017 - ano_nascimento idade_meses = idade * 12 print(idade_meses) ################### alt1 = float(input('digite a altura 1')) alt2 = float(input('digite a altura 2')) alt3 = float(input('digite a altura 3')) alt4 = float(input('digite a altura 4')) media ...
fkenjikamei/python-exercises
aula06-1.py
Python
gpl-3.0
383
def f(x): return x + 1 raise ValueError("I do not want to be imported")
endlessm/chromium-browser
third_party/llvm/lldb/test/API/commands/command/script/import/rdar-12586188/fail212586188.py
Python
bsd-3-clause
77
#!/usr/bin/env python """ # Software License Agreement (BSD License) # # Copyright (c) 2012, University of California, Berkeley # All rights reserved. # Authors: Cameron Lee (cameronlee@berkeley.edu) and Dmitry Berenson ( berenson@eecs.berkeley.edu) # # Redistribution and use in source and binary forms, with or without...
WPI-ARC/lightning_ros
scripts/RR_action_server.py
Python
bsd-3-clause
22,385
""" Uses SMOS GeoTiff data as input and combines them to multiple rasters to one daily raster """ import os import arcpy inFol = "D:/Test/SMOStif/Tiffs/" outFol = "D:/Test/SMOStif/DailyTiffs/" # Processing range years startYear = 2009 endYear = 2016 # method of mosaic construction LAST | FIRST | BLEND | MEAN | MINI...
jdegene/ArcGIS-scripts
SMOS_mosaic_daily.py
Python
mit
1,990
#!/usr/bin/env python # encoding: utf-8 """ score_function.py Create a score function Created by Måns Magnusson on 2015-09-08. Copyright (c) 2015 __MoonsoInc__. All rights reserved. """ from __future__ import print_function import logging from intervaltree import IntervalTree class ScoreFunction(object): """C...
moonso/genmod
genmod/score_variants/score_function.py
Python
mit
6,051
from __future__ import absolute_import, division, print_function import numpy as np from functools import partial, wraps from toolz import compose, curry from .core import (_concatenate2, insert_many, Array, atop, names, sqrt, elemwise) from ..core import flatten from ..utils import ignoring def reduction(x...
PeterDSteinberg/dask
dask/array/reductions.py
Python
bsd-3-clause
7,266
"""PEP 366 ("Main module explicit relative imports") specifies the semantics for the __package__ attribute on modules. This attribute is used, when available, to detect which package a module belongs to (instead of using the typical __path__/__name__ test). """ import unittest import warnings from .. import util cla...
FFMG/myoddweb.piger
monitor/api/python/Python-3.7.2/Lib/test/test_importlib/import_/test___package__.py
Python
gpl-2.0
5,638
# Copyright 2020 The HuggingFace Team. 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 applicabl...
huggingface/transformers
tests/trainer/test_trainer_distributed.py
Python
apache-2.0
5,060
""" Contains data structures designed for manipulating panel (3-dimensional) data """ # pylint: disable=E1103,W0231,W0212,W0621 from __future__ import division import numpy as np import warnings from pandas.core.dtypes.cast import ( infer_dtype_from_scalar, cast_scalar_to_array, maybe_cast_item) from panda...
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/core/panel.py
Python
apache-2.0
57,292
""" Python Markdown A Python implementation of John Gruber's Markdown. Documentation: https://python-markdown.github.io/ GitHub: https://github.com/Python-Markdown/markdown/ PyPI: https://pypi.org/project/Markdown/ Started by Manfred Stienstra (http://www.dwerg.net/). Maintained for a few years by Yuri Takhteyev (ht...
waylan/Python-Markdown
markdown/postprocessors.py
Python
bsd-3-clause
4,262
import numpy as np import pandas as pd import scipy as sp import scipy.signal def cnn_convolve(filter_dim, num_filters, images, W, b): # cnn_convolve Returns the convolution of the features given by W and b with # the given images # # Parameters: # filterDim - filter (feature) dimension # nu...
johnnywalleye/ufldl_completed
cnn.py
Python
mit
4,367
from www import app from flask import render_template, request @app.route('/') def index(): return render_template('index.html') @app.route('/build') def builder(): return render_template('build.html') @app.route('/train') def trainer(): return render_template('train.html', network_name=request.args.get(...
2PacIsAlive/DeepOncology
www/views.py
Python
mit
339
#!/usr/bin/python # Copyright: (c) 2015, Google Inc. All Rights Reserved. # 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', ...
dagwieers/ansible
lib/ansible/modules/clustering/k8s/_kubernetes.py
Python
gpl-3.0
16,691
#!/usr/bin/env python # # Copyright 2009 Facebook # # 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...
zguangyu/tornado
setup.py
Python
apache-2.0
6,621
# Copyright 2014 The Oppia 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 applicable ...
shaz13/oppia
core/controllers/admin_test.py
Python
apache-2.0
13,503
#!/usr/bin/env python """Bootstrap setuptools installation To use setuptools in your package's setup.py, include this file in the same directory and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() To require a specific version of setuptools, set a download mirror, ...
dtudares/hello-world
yardstick/ez_setup.py
Python
apache-2.0
10,476
import tempfile from git import InvalidGitRepositoryError try: from unittest2 import TestCase from mock import patch, Mock except ImportError: from unittest import TestCase from mock import patch, Mock import textwrap from datetime import datetime from botocore.exceptions import ClientError from dat...
marco-hoyer/cfn-sphere
src/unittest/python/util_tests.py
Python
apache-2.0
8,933
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' ''' Try to read metadata from an HTML file. ''' import re from calibre.eb...
jelly/calibre
src/calibre/ebooks/metadata/html.py
Python
gpl-3.0
5,945
from __future__ import annotations import collections from datetime import datetime from decimal import Decimal from functools import wraps import operator import os import re import string from typing import ( TYPE_CHECKING, Callable, ContextManager, Counter, Iterable, ) import warnings import nu...
jorisvandenbossche/pandas
pandas/_testing/__init__.py
Python
bsd-3-clause
29,153
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or m...
gurneyalex/vertical-travel
travel_journey/travel_passenger.py
Python
agpl-3.0
1,368
# Copyright 2018 The go-python Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """ Simple test harness """ def assertRaises(expecting, fn, *args, **kwargs): """Check the exception was raised - don't check the text""" try: ...
go-python/gpython
builtin/tests/libtest.py
Python
bsd-3-clause
449
""" Library edit page in Studio """ from __future__ import absolute_import import six from bok_choy.javascript import js_defined, wait_for_js from bok_choy.page_object import PageObject from bok_choy.promise import EmptyPromise from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select impo...
ESOedX/edx-platform
common/test/acceptance/pages/studio/library.py
Python
agpl-3.0
9,050
# Copyright (c) 2016 Mirantis, 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 requir...
bswartz/manila
manila/share/drivers/container/storage_helper.py
Python
apache-2.0
4,203
''' heatmap (:mod:`calour.heatmap`) =============================== .. currentmodule:: calour.heatmap Functions ^^^^^^^^^ .. autosummary:: :toctree: generated plot heatmap ''' # ---------------------------------------------------------------------------- # Copyright (c) 2016--, Calour development team. #...
RNAer/Calour
calour/heatmap/__init__.py
Python
bsd-3-clause
608
# Copyright (c) 2021 PaddlePaddle 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 app...
luotao1/Paddle
python/paddle/fluid/tests/unittests/test_fill_any_op.py
Python
apache-2.0
1,936
# $Id: TestFileSharedArea.py 1047 2009-01-15 14:48:58Z graham $ # # Unit testing for FileUserSharedArea module # import os import sys import httplib import urllib2 import unittest import subprocess sys.path.append("../..") from TestConfig import TestConfig import TestHttpUtils class TestFileSharedArea(unittest.Tes...
tectronics/admiral-jiscmrd
test/FileShare/tests/TestFileSharedArea.py
Python
mit
8,163
"""TestCase and TestSuite artifacts and testing decorators.""" import itertools import operator import re import sys import types import warnings from cStringIO import StringIO from sqlalchemy.test import config, assertsql, util as testutil from sqlalchemy.util import function_named, py3k from engines import drop_all...
obeattie/sqlalchemy
lib/sqlalchemy/test/testing.py
Python
mit
27,201
from datascience import Table from numbers import Number import numpy as np import matplotlib.pyplot as plots from matplotlib import cm from mpl_toolkits.mplot3d.axes3d import Axes3D from sklearn import linear_model, neighbors, discriminant_analysis from matplotlib import colors cmap = colors.LinearSegmentedColormap( ...
deculler/MachineLearningTables
ml_table.py
Python
bsd-2-clause
30,116
""" The MIT License (MIT) Copyright (c) Serenity Software, LLC 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, m...
hickeroar/cahoots
tests/parsers/programming/lexer.py
Python
mit
2,268
# -*- coding: utf-8 -*- from pyknyx.api import FunctionalBlock from pyknyx.api import logger, schedule, notify class WeatherTempFB(FunctionalBlock): """ Temperature/humidity handling """ # Datapoints definition DP_01 = dict(name="temperature", access="output", dptId="9.001", default=19.) DP_02 =...
knxd/pKNyX
pyknyx/examples/3_weather/weather/fb/weatherTempFB.py
Python
gpl-3.0
960
# -*- coding: utf-8 -*- # Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/ # # This file is part of Eff. # # Eff 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 ...
machinalis/eff
eff_site/eff/tests.py
Python
gpl-3.0
1,541
#!/usr/bin/env python2 """ Unit tests for t05_Object.py """ import t05_Object import t05_Integer import t05_String import unittest state = "state" class t05_ObjectTest(unittest.TestCase): def testObjectCreation(self): o1 = t05_Object.create(state) self.assertEqual(o1.state, state) def test...
gru2/pyt05
src/t05_ObjectTest.py
Python
mit
1,618
# Copyright (c) 2016-2017 Dustin Doloff # Licensed under Apache License v2.0 import argparse import difflib import hashlib import os import subprocess import zipfile # Resets color formatting COLOR_END = '\33[0m' # Modifies characters or color COLOR_BOLD = '\33[1m' COLOR_DISABLED = '\33[02m' # Mostly just means darke...
quittle/bazel_toolbox
assert/scripts/assert_equal.py
Python
apache-2.0
4,276
import tensorflow as tf import predictron.predictron as predictron class PredictronTest(tf.test.TestCase): def test_preturn(self): with self.test_session() as sess: rewards = tf.constant([0, 1, 2], shape=[1, 3, 1], dtype=tf.float32) discounts = tf.constant( [1.0, 0.5, 0.2], shape=[1, 3, 1...
brendanator/predictron
test/test_predictron.py
Python
mit
1,673
import logging import shutil logger = logging.getLogger('phockup') def check_dependencies(): if shutil.which('exiftool') is None: raise Exception("Exiftool is not installed.\ Visit http://www.sno.phy.queensu.ca/~phil/exiftool/")
ivandokov/phockup
src/dependency.py
Python
mit
245
x = input('Please input x: ') y = input('Please input y: ') if y >= 0: if x >= 0: print('first') else: print('two') else: if x < 0: print('three') else: print('four')
zeroonegit/python
crossincode.com/Python_Getting_Started/if2.py
Python
mit
216
__author__ = "Jon Reid" __copyright__ = "Copyright 2011 hamcrest.org" __license__ = "BSD, see License.txt" from hamcrest.core.base_matcher import BaseMatcher import six class IsEqualIgnoringCase(BaseMatcher): def __init__(self, string): if not isinstance(string, six.string_types): raise Type...
msabramo/PyHamcrest
src/hamcrest/library/text/isequal_ignoring_case.py
Python
bsd-3-clause
1,257
import os from unittest import skipIf import swapper from django.contrib.auth import get_user_model from django.test import TestCase from .. import settings as app_settings from ..models import RadiusUserGroup from . import CreateRadiusObjectsMixin, PostParamsMixin from .base.test_api import ( BaseTestApi, BaseTe...
openwisp/django-freeradius
django_freeradius/tests/test_api.py
Python
gpl-3.0
1,868
from enum import Enum class EnumClusterCreateMetaDriveType(Enum): nvme = "nvme" ssd = "ssd" hdd = "hdd" archive = "archive"
zero-os/0-orchestrator
pyclient/zeroos/orchestrator/client/EnumClusterCreateMetaDriveType.py
Python
apache-2.0
142
from __future__ import absolute_import, division, print_function, unicode_literals from datetime import datetime import logging import requests from warrant.aws_srp import AWSSRP from amaascore.config import ENDPOINTS, ConfigFactory, get_factory from amaascore.exceptions import AMaaSException class AMaaSSession(ob...
amaas-fintech/amaas-core-sdk-python
amaascore/core/interface.py
Python
apache-2.0
5,572
from django.forms import ModelForm from django.urls import reverse_lazy from django.utils.html import format_html from django.utils.translation import ungettext, ugettext_lazy as _ from reversion.admin import VersionAdmin from judge.models import Comment from judge.widgets import HeavyPreviewAdminPageDownWidget, Heavy...
monouno/site
judge/admin/comments.py
Python
agpl-3.0
2,632
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/clusterfuzz
src/local/butler/clean_indexes.py
Python
apache-2.0
1,421
# All the variables that are used in the distance metric PRE_TRANSITION_VARIABLES = [ "one start" ] # The variables that correspond to the variables in PRE_TRANSITION_VARIABLES POST_TRANSITION_VARIABLES = [ "one end" ] # All the variables we visualize STATE_SUMMARY_VARIABLES = [ "action", "reward" ] ...
MDPvis/mfmci
databases/testing/annotate.py
Python
mit
391
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('payment', '0005_auto_20150429_1758'), ] operations = [ migrations.AlterField( model_name='payment', name='added_date', field=mo...
dotKom/onlineweb4
apps/payment/migrations/0006_auto_20151014_1938.py
Python
mit
457
#!/var/www/testsite/env/bin/python # EASY-INSTALL-SCRIPT: 'Pillow==2.8.1','pilfile.py' __requires__ = 'Pillow==2.8.1' import pkg_resources pkg_resources.run_script('Pillow==2.8.1', 'pilfile.py')
andfoy/margffoy-tuay-server
env/bin/pilfile.py
Python
gpl-2.0
195
from mock import MagicMock, patch import mock import mongoengine from pulp.common.compat import unittest from pulp.plugins.loader import exceptions as plugin_exceptions from pulp.plugins.model import PublishReport from pulp.server.controllers import repository as repo_controller from pulp.server import exceptions as p...
rbramwell/pulp
server/test/unit/server/controllers/test_repository.py
Python
gpl-2.0
59,847
# testyacc.py import unittest try: import StringIO except ImportError: import io as StringIO import sys import os sys.path.insert(0,"..") sys.tracebacklimit = 0 import ply.yacc def check_expected(result,expected): resultlines = [] for line in result.splitlines(): if line.startswith("WARNING...
anuragiitg/nixysa
third_party/ply-3.1/test/testyacc.py
Python
apache-2.0
13,190
import numpy as np def selective_sort(a): for i in range(0, len(a)): min_val = a[i] min_pos = i for j in range(i, len(a)): if a[j] < min_val: min_pos = j min_val = a[j] a[min_pos], a[i] = a[i], a[min_pos] if __name__ == '__main__': ...
free-free/algorithm
sort-algorithm/selective_sort.py
Python
apache-2.0
435
from datetime import datetime from skylines.model import FlightMeetings, Flight from tests.api import auth_for from tests.data import ( add_fixtures, igcs, flights, clubs, users, aircraft_models, airports, traces, flight_comments, contest_legs, flight_phases, ) def expecte...
Turbo87/skylines
tests/api/views/flights/read_test.py
Python
agpl-3.0
16,988
# -*- coding: utf-8 -*- # # AWL simulator - instructions # # Copyright 2012-2014 Michael Buesch <m@bues.ch> # # 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 ...
gion86/awlsim
awlsim/core/instructions/insn_mu_d.py
Python
gpl-2.0
1,763
""" Django settings for maoaberta project. Generated by 'django-admin startproject' using Django 1.8.5. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build pa...
opensanca/maoaberta
maoaberta/maoaberta/settings.py
Python
gpl-2.0
3,152
import openmc from tests.testing_harness import PyAPITestHarness class CreateFissionNeutronsTestHarness(PyAPITestHarness): def _build_inputs(self): # Material is composed of H-1 and U-235 mat = openmc.Material(material_id=1, name='mat') mat.set_density('atom/b-cm', 0.069335) mat.a...
johnnyliu27/openmc
tests/regression_tests/create_fission_neutrons/test.py
Python
mit
2,537
import datetime import os import time from sparchive.archive import Archive class Filer(object): def __init__(self, basedir, compress_module): self.basedir = basedir self.compress_module = compress_module def find_file(self, filename): for root, dirs, files in os.walk(self.basedir): ...
egh/sparchive
sparchive/filer.py
Python
gpl-3.0
2,101
#!/usr/bin/env python # -*- coding:utf8 -*- # Copyright (C) 2013 FinalsClub Foundation import os import traceback from celery import task from celery.utils.log import get_task_logger from karmaworld.apps.notes.models import Note import twitter import gdshortener logger = get_task_logger(__name__) @task(name="tweet_...
FinalsClub/karmaworld
karmaworld/apps/notes/tasks.py
Python
agpl-3.0
2,304
from django.contrib.auth.models import User from core.tests import datautil from package.models import Category, Package, Version from profiles.models import Profile def load(): category, created = Category.objects.get_or_create( pk=2, description=u'Large efforts that combine many python modules ...
miketheman/opencomparison
package/tests/data.py
Python
mit
38,603
""" Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor 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 la...
gkadillak/rockstor-core
src/rockstor/system/network.py
Python
gpl-3.0
9,100
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe import _ def set_employee_name(doc): if doc.employee and not doc.employee_name: doc.employee_name = frappe.db.get_value...
indictranstech/focal-erpnext
hr/utils.py
Python
agpl-3.0
364
# -*- coding: utf-8 -*- ## ## Some functions about dates ## ## This file is part of Invenio. ## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by ...
PXke/invenio
invenio/utils/date.py
Python
gpl-2.0
20,470
import json import logging import os from typing import Set import build_tool.manifest_pb2 as proto from build_tool.cpp_parser.token import Token class Manifest(): """ This class represents a file-backed manifest, which keeps track of files and their modification times. The file used to persistently stor...
Khouderchah-Alex/tetrad-engine
src/tools/build_tool/build_tool/manifest.py
Python
apache-2.0
2,723
#!/usr/bin/env python import os import sys import random import math from ete2 import SeqGroup def gentesting(ftaxa, fseq, fout, fold = 10): ftax = open(ftaxa) lines = ftax.readlines() ftax.close() #seqs = SeqGroup(fseq, format='phylip_relaxed') seqs = SeqGroup(fseq) idx = range(len(l...
zhangjiajie/tax_benchmark
script/tenfold_generator.py
Python
gpl-3.0
2,214
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. __author__="alex" __date__ ="$29.07.2014 17:15:19$" class ListCompareController(object): model = None view = None def __init__(sel...
sora7/listparse
OLD/CertainProg/src/listcompare/controller.py
Python
gpl-2.0
3,412
import collections import datetime import enum import logging import math import random from dateutil.relativedelta import * from dateutil.rrule import * from plans.week import Week, Week_types, Week_variants from plans.plan import Plan, Phases from plans.day import Day, Day_types from plans.prototypes import weeks, ...
supermitch/runblueprint.com
runblueprint/plans/planner.py
Python
gpl-3.0
13,576
"""Parse a Python module and describe its classes and methods. Parse enough of a Python file to recognize imports and class and method definitions, and to find out the superclasses of a class. The interface consists of a single function: readmodule_ex(module [, path]) where module is the name of a Pyth...
Orav/kbengine
kbe/src/lib/python/Lib/pyclbr.py
Python
lgpl-3.0
13,871
#!/usr/bin/python # See the test.osl source for explanation of this test command = testshade("-g 16 16 test -od uint8 -o Cout out.tif") outputs = [ "out.tif" ]
Anteru/OpenShadingLanguage
testsuite/bug-outputinit/run.py
Python
bsd-3-clause
163
from django.contrib import admin # Register your models here. from sqlviewer.glimpse.models import Model @admin.register(Model) class ModelAdmin(admin.ModelAdmin): pass
sql-viewer/SQLGlimpse
sqlviewer/glimpse/admin.py
Python
gpl-2.0
176
# Copyright 2019 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. from __future__ import print_function from __future__ import division from __future__ import absolute_import from google.appengine.ext import ndb from dash...
catapult-project/catapult
dashboard/dashboard/api/nudge_alert.py
Python
bsd-3-clause
1,136
# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
aevox/flame
flameclient/__init__.py
Python
mit
716
##################################################################################### # # Copyright (c) Crossbar.io Technologies GmbH # # Unless a separate license agreement exists between you and Crossbar.io GmbH (e.g. # you have purchased a commercial license), the license terms below apply. # # Should you enter ...
NinjaMSP/crossbar
crossbar/adapter/mqtt/test/interop.py
Python
agpl-3.0
6,672
""" Test the filename parameter of the translation calls, to make sure errors are handled well. """ import repyhelper try: repyhelper.translate_and_import('asdkfjaNONEXISTANT_FILEkasfj') except ValueError: pass else: print "Was able to import a nonexistant file (no dir)..." try: repyhelper.translate_and...
sburnett/seattle
portability/tests/py_z_test_badimports.py
Python
mit
659
import logging import time import json import oauth2 as oauth import httplib2 import urllib import twitter_settings class TwitterError(Exception): def __init__(self, status_code, content): self.status_code = status_code self.content = content def __str__(self): return "Twitter retur...
Ethernyan/EbookBot
twitter.py
Python
mit
3,814
from pydata import Data, h5todata import numpy as np import os import h5py def test_Data(tmpdir): o = Data(x=np.ones(3), y=np.ones(3), a=5, b='hh') assert o.b=='hh' assert o['a']==5 o.append(np.ones(5),np.ones(5)) o.save(os.path.join(tmpdir, 'test.txt')) o.save(os.path.join(tmpdir, 'test.h5')) ...
NS2LPS/pyslave
test/pydata/test_datadict.py
Python
mit
574