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
import hashlib import json from datetime import datetime from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from django.test.utils import override_settings try: from unittest import mock except ImportError: import mock try: from django.urls import ...
bradleyg/django-s3direct
s3direct/tests.py
Python
mit
20,216
from django.contrib import admin from django.conf import settings from models import Album, Image from django.utils.translation import ugettext_lazy as _ from utils.admin import BaseAdmin from django.contrib.contenttypes import generic class ImageInline(generic.GenericTabularInline): model = Image extra = 1 ...
Mercy-Nekesa/sokoapp
sokoapp/gallery/admin.py
Python
mit
565
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models from odoo.tools.safe_eval import safe_eval class Team(models.Model): _name = 'crm.team' _inherit = ['mail.alias.mixin', 'crm.team'] resource_calendar_id = fields.Many2o...
hip-odoo/odoo
addons/crm/models/crm_team.py
Python
agpl-3.0
3,700
# 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 # d...
openstack/horizon
openstack_dashboard/test/integration_tests/pages/identity/groupspage.py
Python
apache-2.0
2,948
# Copyright (c) 2013 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 or agreed to in writ...
rnirmal/savanna
tools/get_auth_token.py
Python
apache-2.0
2,703
import networkx as nx def all_relatives(relation_fn, node, flatten): nodes = relation_fn(node) sub_nodes = [all_relatives(relation_fn, n, flatten) for n in nodes] if flatten: sub_nodes = [y for x in sub_nodes for y in x] return nodes + [n for n in sub_nodes if n] def all_predecessors(graph, ...
noelevans/sandpit
directional_networkx_graph_demo.py
Python
mit
1,432
#!/usr/bin/python # -*- coding: utf-8 -*- import math import os import time import unittest def mean(lst): num_items = len(lst) mean = sum(lst)/num_items return mean def standard_deviation(lst): num_items = len(lst) mean = sum(lst)/num_items differences = [i - mean for i in lst] sq_d...
andrellsantos/agentspeak-py
agentspeak-py/tests/test_performance.py
Python
gpl-3.0
992
# ----------- # User Instructions # # Define a function smooth that takes a path as its input # (with optional parameters for weight_data, weight_smooth, # and tolerance) and returns a smooth path. The first and # last points should remain unchanged. # # Smoothing should be implemented by iteratively updating # each e...
opikalo/pyfire
smoothing/gd.py
Python
mit
6,937
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @file environ.py @author Allen Woods @date 2016-07-29 @version 16-7-29 下午2:51 ??? SUMO simulation environment """ import os import subprocess from subprocess import PIPE import sys from itertools import cycle from lxml import etree sumo_root = os.e...
allenwoods/parasys
SumoEnv/create_cfg.py
Python
mit
14,797
from datetime import datetime import numpy as np import pytest import pandas as pd from pandas import ( DataFrame, Index, MultiIndex, Series, _testing as tm, ) def test_split(any_string_dtype): values = Series(["a_b_c", "c_d_e", np.nan, "f_g_h"], dtype=any_string_dtype) result = values....
dsm054/pandas
pandas/tests/strings/test_split_partition.py
Python
bsd-3-clause
21,379
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Author', fields=[ ('id', models.AutoField(verbo...
brotherjack/oasison-repo
apps/OASIS_Blog/migrations/0001_initial.py
Python
mit
2,316
class Bunch(dict): """ A class to hold a "bunch" of items. This has the advantage of a regular dictionary of providing dot access to elements. Example: >>> b = Bunch(GET='GET', POST='POST') >>> b.GET 'GET' >>> b['GET'] 'GET' >>> b = Bunch(**{'a' : 1, 'b' : 2}) >>> b.a ...
Planeman/crashplan-api
code42/util/container.py
Python
gpl-3.0
1,406
# =============================================================================== # Copyright 2014 Jake Ross # # 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/licens...
USGSDenverPychron/pychron
pychron/canvas/canvas2D/strat_canvas.py
Python
apache-2.0
2,267
# 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 # d...
sjsucohort6/openstack
python/venv/lib/python2.7/site-packages/novaclient/tests/functional/v2/legacy/test_volumes_api.py
Python
mit
3,078
#!/usr/bin/env python3 # # Copyright 2017+ Jakub Kolasa <jkolczasty@gmail.com> # # 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 # ...
jkolczasty/appletree
appletree/backend/local.py
Python
gpl-3.0
10,127
# -*- coding: utf-8 -*- # # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName...
jopohl/urh
src/urh/ui/ui_main.py
Python
gpl-3.0
28,156
from django.core.urlresolvers import reverse_lazy from django.views.generic import ListView, UpdateView from django.views.generic.base import TemplateView from django.views.generic.edit import CreateView, DeleteView from core.forms import EntryForm from core.models import Entry, Log __author__ = 'alexandreferreira' c...
alexandreferreira/namesearch-example
core/views.py
Python
gpl-2.0
1,587
from __future__ import absolute_import from bokeh.io import save from bokeh.plotting import figure from tests.integration.utils import has_no_console_errors import pytest pytestmark = pytest.mark.integration @pytest.mark.screenshot def test_visible_property_hides_things_correctly(output_file_url, selenium, screensho...
draperjames/bokeh
tests/integration/plotting/test_visible_property.py
Python
bsd-3-clause
699
from segment import Segment class Word: '''A representation of a word, containing multiple Segments.''' __slots__ = ['segments'] def __init__(self, segments): self.segments = segments def __key(self): '''The key of a Word is a tuple containing a tuple for each segment, where...
kdelwat/LangEvolve
engine/word.py
Python
mit
3,195
# Python test set -- built-in functions import test.test_support, unittest from test.test_support import is_jython import sys import pickle import itertools import warnings warnings.filterwarnings("ignore", "integer argument expected", DeprecationWarning, "unittest") # pure Python implementat...
adaussy/eclipse-monkey-revival
plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_xrange.py
Python
epl-1.0
5,403
from flask import Blueprint __author__ = 'Manuel Escriche' delivery = Blueprint('delivery', __name__) from . import views
flopezag/fiware-backlog
app/delivery/__init__.py
Python
apache-2.0
125
__author__ = 'moyiz' __doc__ = """ This script will forward its arguments as commands to MPD. For example: mpc_for_shell.py play mpc_for_shell.py pause mpc_for_shell.py next mpc_for_shell.py previous And so on. """ import sys from ommpc import OMMPClient def forward_mpd(mpd_server, mpd_port, command, args): cl...
moyiz/ommpc
examples/mpc_for_shell.py
Python
bsd-3-clause
658
from __future__ import unicode_literals from future.builtins import map import os from django.template import Template, TemplateSyntaxError, TemplateDoesNotExist from django.template.loader_tags import ExtendsNode from zhiliao import template register = template.Library() class OverExtendsNode(ExtendsNode): ...
gladgod/zhiliao
zhiliao/template/loader_tags.py
Python
bsd-3-clause
6,331
from collections import namedtuple import numpy as np import GPy BumpResults = namedtuple('BumpResults', ('bump_time', 'bump_time_err', 'probability_bump', 'probability_shoulder', 'number_points...
astrobarn/BumpCalculator
bump_calculator/bump_calculator.py
Python
agpl-3.0
4,231
# coding=utf-8 from __future__ import print_function import doctest import glob from pprint import pprint import os import pytest from flowdas import meta from flowdas.meta.compat import * EX = os.path.join(os.path.dirname(__file__), 'ex') def get_names(pattern): return map(lambda x: os.path.splitext(os.path.b...
flowdas/meta
tests/test_examples.py
Python
mpl-2.0
1,459
# Embedded file name: /usr/lib/enigma2/python/Components/Renderer/EGclock.py from Components.VariableValue import VariableValue from Renderer import Renderer from enigma import eGauge class EGclock(VariableValue, Renderer): def __init__(self): Renderer.__init__(self) VariableValue.__init_...
kingvuplus/boom
lib/python/Components/Renderer/EGclock.py
Python
gpl-2.0
849
import os from numpy.distutils.core import setup from numpy.distutils.misc_util import Configuration from numpy import get_include from scipy._build_utils import numpy_nodepr_api def configuration(parent_package='', top_path=None): config = Configuration('ndimage', parent_package, top_path) include_dirs = ...
mdhaber/scipy
scipy/ndimage/setup.py
Python
bsd-3-clause
1,474
# -*- coding: utf-8 -*- neutral = [ 'No jokes found.', ] jokes_de = { 'neutral': neutral, 'all': neutral, }
trojjer/pyjokes
pyjokes/jokes_de.py
Python
bsd-3-clause
122
#!/usr/bin/env python from setuptools import setup setup( name='survivalvolume', version='1.2.4', author='Matthew Wakefield', author_email='matthew.wakefield@unimelb.edu.au', python_requires=">=3.8", install_requires = [ 'setuptools', 'lifelines>=0.26', 'matplotlib>=3.3', ...
genomematt/survivalvolume
setup.py
Python
gpl-3.0
1,147
""" =========================================== Store and load `skopt` optimization results =========================================== Mikhail Pak, October 2016. Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt Problem statement ================= We often want to store optimization results in a file....
scikit-optimize/scikit-optimize
examples/store-and-load-results.py
Python
bsd-3-clause
5,427
#!/usr/bin/env python """This is the minimal example from the README""" import json import numpy import cupy as cp from kernel_tuner import tune_kernel def tune(): kernel_string = """ __global__ void vector_add(float *c, float *a, float *b, int n) { int i = blockIdx.x * block_size_x + threadIdx.x; ...
benvanwerkhoven/kernel_tuner
examples/cuda/vector_add_cupy.py
Python
apache-2.0
975
#!/usr/bin/env python # -*- coding: utf-8 -*- # winapi.py: Windows API-Python interface (removes dependency on pywin32) # # Copyright (C) 2007 Thomas Heller <theller@ctypes.org> # Copyright (C) 2010 Will McGugan <will@willmcgugan.com> # Copyright (C) 2010 Ryan Kelly <ryan@rfk.id.au> # Copyright (C) 2010 Yesudeep Mangal...
d-ai/Sourcepawn
watchdog/observers/winapi.py
Python
gpl-3.0
11,655
from flask import Blueprint, g from flask import render_template, request from flask.ext.login import login_required import requests import yaml from cloudmesh_base.logger import LOGGER from pprint import pprint from cloudmesh_base.ConfigDict import ConfigDict import json from cloudmesh_base.locations import config_fil...
rajpushkar83/cloudmesh
cloudmesh_web/modules/metric.py
Python
apache-2.0
1,875
# util/deprecations.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Helpers related to deprecation of functions, methods, classes, other functiona...
jessekl/flixr
venv/lib/python2.7/site-packages/sqlalchemy/util/deprecations.py
Python
mit
4,419
# # 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...
shakamunyi/beam
sdks/python/apache_beam/examples/cookbook/mergecontacts.py
Python
apache-2.0
6,114
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('main', '0015_no_normalize_thumbnails'), ] operations = [ migrations.AlterField( model_name='file', n...
sevein/archivematica
src/dashboard/src/main/migrations/0016_file_currentlocation_nullable.py
Python
agpl-3.0
472
# -*- coding: utf-8 -*- # ${WIKI_URL} from find_contact import Test_Case class Sequence_Diagram (Test_Case): def test_Run (self): try: self.Preconditions () self.Step (Message = "Receptionist-N ->> Klient-N [genvej: for-kontaktliste]") self.Step (Message =...
AdaHeads/Hosted-Telephone-Reception-System
use-cases/.patterns/kontaktliste_fokus/test.py
Python
gpl-3.0
400
import json from sklearn.feature_extraction.text import TfidfVectorizer import nltk from nltk.corpus import stopwords from wordcloud import WordCloud import matplotlib.pyplot as plt import db import os DATASET_PATH = os.environ['HOME'] + '/nltk_data/corpora/twitter_samples/tweets.20150430-223406.json' def calc_frequen...
codeforfrankfurt/PolBotCheck
polbotcheck/word_cluster.py
Python
mit
3,812
# -*- coding: utf-8 -*- ############################################################################## # # Copyright Camptocamp SA # Author Joel Grand-Guillaume # 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 # ...
VitalPet/bank-statement-reconcile
account_statement_base_import/parser/generic_file_parser.py
Python
agpl-3.0
3,079
# -*- coding: UTF-8 -*- # Copyright 2013-2014 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Turns a list of items into an endless loop. Useful when generating demo fixtures. >>> from lino.utils import Cycler >>> def myfunc(): ... yield "a" ... yield "b" ... yield "c" >>> c = Cycler(myf...
khchine5/lino
lino/utils/cycler.py
Python
bsd-2-clause
1,929
import random from hashlib import md5 from DIRAC.Core.Utilities.ThreadSafe import Synchronizer from DIRAC.Core.DISET.private.BaseClient import BaseClient from DIRAC.Core.DISET.private.MessageBroker import getGlobalMessageBroker from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR, isReturnStructure from DIRAC.C...
DIRACGrid/DIRAC
src/DIRAC/Core/DISET/MessageClient.py
Python
gpl-3.0
5,645
#!/usr/bin/python3 import tensorflow as tf from agents.agent_states import LinearHiddenState from rstools.tf.optimization import build_model_optimization from agents.agent_networks import FeatureNet, PolicyNet class ReinforceAgent(object): def __init__(self, state_shape, n_actions, network, special=None): ...
Scitator/rl-course-experiments
PG/reinforce.py
Python
mit
1,954
# -*- coding: utf-8 -*- # YAFF is yet another force-field code. # Copyright (C) 2011 Toon Verstraelen <Toon.Verstraelen@UGent.be>, # Louis Vanduyfhuys <Louis.Vanduyfhuys@UGent.be>, Center for Molecular Modeling # (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise # stated. # # This file is pa...
molmod/yaff
yaff/pes/test/test_pair_pot.py
Python
gpl-3.0
61,936
import sqlite3 # sqlite 3 database import file_check_ex # to check if there is a file import database # creating, editing, deleting the database import intCheck # check that it is an integar option = None # choose what manu option they want sqlite_file = "" # the name of the sqlite3 file option_list = (0, 1, 2, 3) # ...
RincewindLangner/Game_database
V12/gamefile_load.py
Python
gpl-3.0
1,469
#!/usr/bin/python # -*- coding: utf-8 -*- ''' #********************************************* # # SVM_learning_spectra_Labspec-full # Perform SVM machine learning on Raman maps. # version: 20160926a # # By: Nicola Ferralis <feranick@hotmail.com> # #********************************************** ''' print(__doc__) i...
feranick/SpectralMachine
Other/obsolete/SVM_learning_spectra_Labspec-full.py
Python
gpl-3.0
1,675
import json import os import sys from collections import OrderedDict def json_read(path): return json.loads(open(path).read(), object_pairs_hook=OrderedDict) def json_write(path, data): with open(os.getcwd() + path, "w") as outfile: json.dump(data, outfile, indent=4) def parse_models(models): ...
figshare/user_documentation
swagger_documentation/parse_swagger.py
Python
cc0-1.0
1,774
from itertools import chain from collections import defaultdict from .. utils.nodes import getAnimationNodeTrees, iterAnimationNodesSockets class ForestData: def __init__(self): self._reset() def _reset(self): self.nodes = [] self.nodesByType = defaultdict(set) self.typeByNode ...
Thortoise/Super-Snake
Blender/animation_nodes-master/tree_info/forest_data.py
Python
gpl-3.0
4,529
# -*- coding: utf-8 -*- { 'name': "Bestja: Projects", 'summary': "Project management in BestJa", 'description': """ BestJa Project management ========================= Define projects and assign users to tasks. """, 'author': "Laboratorium EE", 'website': "http://www.laboratorium.ee", 'version':...
KrzysiekJ/bestja
addons/bestja_project/__openerp__.py
Python
agpl-3.0
733
""" numpy.ma : a package to handle missing or invalid values. This package was initially written for numarray by Paul F. Dubois at Lawrence Livermore National Laboratory. In 2006, the package was completely rewritten by Pierre Gerard-Marchant (University of Georgia) to make the MaskedArray class a subclass of ndarray,...
joferkington/numpy
numpy/ma/core.py
Python
bsd-3-clause
246,160
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2011 University of Dundee & Open Microscopy Environment. # All Rights Reserved. # Use is subject to license terms supplied in LICENSE.txt # import omero.scripts as scripts from random import random import math from numpy import array f...
dominikl/openmicroscopy
examples/Training/python/Task_Scripts/ROIs_To_Table.py
Python
gpl-2.0
7,625
import hashlib import random import string import sys import uuid from flask_babel import gettext # required answerer attribute # specifies which search query keywords triggers this answerer keywords = ('random',) random_int_max = 2**31 if sys.version_info[0] == 2: random_string_letters = string.lowercase + stri...
jcherqui/searx
searx/answerers/random/answerer.py
Python
agpl-3.0
1,784
from __future__ import absolute_import from ..plot_object import PlotObject from ..properties import HasProps from ..properties import Any, Int, String, Instance, List, Dict, Either class DataSource(PlotObject): """ A base class for data source types. ``DataSource`` is not generally useful to instantiate on i...
almarklein/bokeh
bokeh/models/sources.py
Python
bsd-3-clause
7,168
#Este é o exercício 7 da Lista 1 /Python para Zumbis Prof. Masanori #7) Converta uma temperatura digitada em Celsius para Fahrenheit. F = 9*C/5 + 32 Celsius = float(input('Digite a temperatura em Celsius: ')) Fahrenheit = ((9* Celsius)/ 5) +32 print ('Temperatura ',Celsius,' em Fahrenheit fica: ',Fahrenheit)
Uleandrosp/Python
Exercicio_7_Lista_1.py
Python
gpl-3.0
312
#!/usr/bin/env python from distutils.core import setup import py2exe setup(windows=[{ "script": "book_reader.py", "icon_resources": [(1, "openscrolls.ico")] }])
tamentis/openscrolls
py2exe_setup.py
Python
bsd-2-clause
167
import os.path, subprocess, sys import platform from build.project import Project def make_cross_file(toolchain): if toolchain.is_windows: system = 'windows' windres = "windres = '%s'" % toolchain.windres else: system = 'linux' windres = '' if toolchain.is_arm: cpu...
dhocker/MPD
python/build/meson.py
Python
gpl-2.0
3,311
"""SCons.Tool.rpcgen Tool-specific initialization for RPCGEN tools. Three 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 - 2014 The SCons Foundation # # Permission is hereby granted, free of...
dezelin/scons
scons-local/SCons/Tool/rpcgen.py
Python
mit
2,831
from datetime import timedelta import operator from sys import getsizeof from typing import Any, List, Optional, Tuple import warnings import numpy as np from pandas._libs import index as libindex from pandas._libs.lib import no_default from pandas._typing import Label from pandas.compat.numpy import function as nv f...
jreback/pandas
pandas/core/indexes/range.py
Python
bsd-3-clause
29,454
#******************************************************************************\ # * Copyright (c) 2003-2004, Martin Blais # * All rights reserved. # * # * Redistribution and use in source and binary forms, with or without # * modification, are permitted provided that the following conditions are # * met: # * # * * Red...
gc3-uzh-ch/easybuild-framework
vsc/utils/optcomplete.py
Python
gpl-2.0
22,248
# -*- coding: utf-8 -*- from multiprocessing.pool import ThreadPool def apply_threading(l, function, cant_threads, **kwargs): if cant_threads == 1: return [function(x, **kwargs) for x in l] pool = ThreadPool(processes=cant_threads) results = pool.map(function, l) pool.close() pool.join() ...
datosgobar/pydatajson
pydatajson/threading_helper.py
Python
mit
339
# # Parse tree nodes for expressions # from __future__ import absolute_import import cython cython.declare(error=object, warning=object, warn_once=object, InternalError=object, CompileError=object, UtilityCode=object, TempitaUtilityCode=object, StringEncoding=object, operator=object, ...
mrGeen/cython
Cython/Compiler/ExprNodes.py
Python
apache-2.0
498,361
import urllib2 import shutil import urlparse import os import test.storageserverdummy as StorageServer import argparse import subprocess from FakePlugin import FakePlugin from resources.lib import globo from datetime import datetime class GloboDownloader: def __init__(self, iniFile): self.cache = Storag...
rdtorres/gbDownloader
globoDownloader.py
Python
gpl-2.0
9,417
from django.conf import settings from django.contrib import messages from django.shortcuts import render, redirect, get_object_or_404 from django.views.decorators.http import require_POST from django.db import transaction from django.db.models import Max from jsonview.decorators import json_view from airmozilla.main....
Nolski/airmozilla
airmozilla/manage/views/url_transforms.py
Python
bsd-3-clause
3,948
from flask import Flask from flask import render_template app = Flask(__name__) @app.route('/') @app.route('/<name>') def index(name="Treehouse"): return render_template("index.html", name=name) @app.route('/add/<int:num1>/<int:num2>') @app.route('/add/<float:num1>/<float:num2>') @app.route('/add...
CaseyNord/Treehouse
Flask Basics/Flask Basics SimpleApp/simpleapp.py
Python
mit
557
# Average 3 # -*- coding: utf-8 -*- N1, N2, N3, N4 = map(float,raw_input().split()) M = (2*N1+3*N2+4*N3+N4)/(10) print"Media: %.1f"%M if (M<5.0): print"Aluno reprovado." elif (M<7.0): print"Aluno em exame." N = float(raw_input()) print"Nota do exame: %.1f"%N M = (M+N)/2 if (M>5.0): p...
edbandeira/URI
1040.py
Python
agpl-3.0
454
# -*- coding: utf-8 -*- # # Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eith...
miyataken999/weblate
weblate/trans/autofixes/base.py
Python
gpl-3.0
1,358
import json from copy import deepcopy from django.conf import settings from django.contrib.auth.decorators import permission_required from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.core.paginator import EmptyPage from django.db import IntegrityError from django.fo...
diefenbach/django-lfs
lfs/manage/product/variants.py
Python
bsd-3-clause
31,374
######################################################################## # Copyright (C) 2013 Sol Birnbaum # # 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 Licen...
solbirn/pyActiveSync
pyActiveSync/utils/wbxml.py
Python
gpl-2.0
12,682
#!/usr/bin/env python __author__ = 'greg' from sklearn.cluster import DBSCAN import numpy as np import math import matplotlib.cbook as cbook from PIL import Image import matplotlib.pyplot as plt def dist(c1,c2): return math.sqrt((c1[0]-c2[0])**2 + (c1[1]-c2[1])**2) class CannotSplit(Exception): def __init__(s...
camallen/aggregation
experimental/penguins/cython/divisiveDBSCAN.py
Python
apache-2.0
7,243
# # 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...
airbnb/airflow
airflow/contrib/operators/discord_webhook_operator.py
Python
apache-2.0
1,191
''' Timeline - An AS3 CPPS emulator, written by dote, in python. Extensively using Twisted modules and is event driven. Engine is the main reactor, based on Twisted which starts the server and listens to given details ''' from Timeline.Server.Constants import TIMELINE_LOGGER, WORLD_SERVER, AS3_PROTOCOL from Timeli...
Times-0/Timeline
Timeline/Server/Engine.py
Python
gpl-3.0
5,523
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 you...
beernarrd/gramps
gramps/gen/filters/rules/repository/_hasnotematchingsubstringof.py
Python
gpl-2.0
1,782
#!/usr/bin/env python # 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>' import itertools, operator, os from types import MethodType from threading im...
insomnia-lab/calibre
src/calibre/gui2/library/alternate_views.py
Python
gpl-3.0
33,530
#### helpers.py #### # # alphabet_position() # ## A helper function ## ## Receives a letter (i.e. a string with only one alphabetic ## character) and returns the 0-indexed position of ## that letter within the alphabet. ## ## Should be case-insensitive (i.e. both 'a' and 'A' are index 0). # # # Rather than manually...
e-inquirer/crypto
helpers.py
Python
gpl-3.0
3,623
# (c) 2017, Dag Wieers <dag@wieers.com> # # This file is part of Ansible # # Ansible 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. # ...
wrouesnel/ansible
lib/ansible/plugins/action/wait_for_connection.py
Python
gpl-3.0
4,394
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type from operator import attrgetter import os.path import transaction from zope.component import getUtility from zope.security.proxy import removeSecurityPr...
abramhindle/UnnaturalCodeFork
python/testdata/launchpad/lib/lp/translations/tests/test_translationimportqueue.py
Python
agpl-3.0
30,965
import xbmcaddon import xbmcgui import xbmc import subprocess import sys import time ACTION_PREVIOUS_MENU = 10 ''' Method/Function to upgrade the operating system. Executes upgrade commands based on addon setting. Ex: apt-get For Debian based systems it also installs packages that have been held back and autoremoves...
puffyCid/OS-Updater
addon.py
Python
bsd-2-clause
6,242
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-27 14:17 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('human_resources', '0015_employee...
kirillmakhonin/med
MED.Server/apps/patients/migrations/0002_auto_20160827_1417.py
Python
mit
1,510
from airflow.hooks.base_hook import BaseHook from snakebite.client import Client, HAClient, Namenode from airflow.utils import AirflowException class HDFSHookException(AirflowException): pass class HDFSHook(BaseHook): ''' Interact with HDFS. This class is a wrapper around the snakebite library. '''...
smarden1/airflow
airflow/hooks/hdfs_hook.py
Python
apache-2.0
957
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import csv import logging import os from enum import Enum from itertools import takewhile from rspub.util.observe import Observable, ObserverInterruptException LOG = logging.getLogger(__name__) class SelectorEvent(Enum): file_does_not_exist = 0 not_a_regular_...
cegesoma/rspub-core
rspub/core/selector.py
Python
apache-2.0
9,085
import sys from cli_client import APP_KEY, APP_SECRET, DropboxTerm def main(src,dest,parent_rev=None): if APP_KEY == '' or APP_SECRET == '': exit("You need to set your APP_KEY and APP_SECRET!") term = DropboxTerm(APP_KEY, APP_SECRET) if(parent_rev != None): metadata = term.do_put(src,dest,...
astrieanna/haiku-dropbox-client
db_put.py
Python
mit
773
#!/usr/bin/python # -*- coding: utf-8 -*- # ====================================================================== # Copyright 2016 Julien LE CLEACH # # 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 Lice...
julien6387/supervisors
supvisors/tests/base.py
Python
apache-2.0
13,572
from rest_framework import renderers from sightings.views.observations import ObservationViewSet from sightings.views.birds import BirdObservationViewSet from locations.views import GridTileViewSet from keadatabase.pagination import ObservationGeoJSONPagination, GridTileGeoJSONPagination, BirdObservationGeoJSONPaginat...
greenstone/keadatabase-back
src/geojson/views.py
Python
agpl-3.0
1,217
# Copyright 2019 Virgil Dupras # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html import weakref from ..saver.csv import save as save_csv from ..saver.qif i...
brownnrl/moneyguru
core/gui/export_panel.py
Python
gpl-3.0
2,240
from __future__ import print_function import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.colors import LogNorm from matplotlib import rcParams rcParams['image.cmap'] = 'plasma' rcParams['font.family'] = 'serif' rcParams['legend.fontsize'] = 10 rcParams[...
rbooth200/DiscEvolution
scripts/makeMovie_chem_slide.py
Python
gpl-3.0
4,391
import numpy as np import matplotlib.pyplot as plt from scipy import ndimage from mpl_toolkits.mplot3d import Axes3D import matplotlib.image as mplimg from matplotlib.colors import LogNorm from numpy import fft def get_photon_positions(image, cdf, cdf_indexes, nphot=1): """ Uses an inverse CDF lookup to find ...
davidwhogg/DiffractionMicroscopy
code/toyproblems/generate_images.py
Python
mit
14,588
from django.contrib import admin from attachments.admin import AttachmentInlines from tasks.models import Task class TaskOptions(admin.ModelAdmin): inlines = [AttachmentInlines] admin.site.register(Task, TaskOptions)
alex/pinax
pinax/apps/tasks/admin.py
Python
mit
226
#!/usr/bin/env python ################################################################################# # 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....
StephanEwen/incubator-flink
flink-python/pyflink/fn_execution/beam/beam_boot.py
Python
apache-2.0
5,134
l = [3,5,1,8] l2 = sorted(l) print(l) print(l2) l.sort(reverse=True) print(l)
stoneflyop1/fluent_py
ch02/sort.py
Python
mit
77
# Many built-in types have built-in names assert type(5) == int assert type(True) == bool assert type(5.7) == float assert type(9 + 5j) == complex assert type((8, 'dog', False)) == tuple assert type('hello') == str assert type(b'hello') == bytes assert type([1, '', False]) == list assert type(range(1,10)) == range asse...
rtoal/polyglot
python/simple_types.py
Python
mit
853
''' Created on Jan 19, 2013 @author: Brad ''' from solver import Solver, has_count, has_size, SolvedSet class SwordFishSolver(Solver): NAME = "SwordFish" TYPES = {1:"Row",2:"Col"} def find(self, board, do_all = False): solved_sets = [] possible = [has_count(has_size(board.get_row(i),2...
bcorso/sudoku-solver
sudoku_solver/src/swordfish_solver.py
Python
mit
2,122
#!/usr/bin/env python #coding:utf-8 # Author: mozman --<mozman@gmx.at> # Purpose: test svg element # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.container import SVG, Symbol class TestSVG(unittest.TestCase): def test_constructor(self):...
MindPass/Code
Interface_graphique/mindmap/svgwrite-1.1.6/tests/test_svg.py
Python
gpl-3.0
802
"""Utility module to handle the rhsso-satellite configure UI/CLI/API testing""" import json import random from contextlib import contextmanager from fauxfactory import gen_string from pexpect import pxssh from robottelo import ssh from robottelo.cli.base import CLIReturnCodeError from robottelo.config import settings...
rplevka/robottelo
robottelo/rhsso_utils.py
Python
gpl-3.0
8,162
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from tapi_server.models.base_model_ import Model from tapi_server import util class TapiTopologyGetlinkdetailsInput(Model): """NOTE: This class is auto generated ...
karthik-sethuraman/ONFOpenTransport
RI/flask_server/tapi_server/models/tapi_topology_getlinkdetails_input.py
Python
apache-2.0
3,046
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-10-16 22:40 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migration...
phildini/logtacts
payments/migrations/0001_initial.py
Python
mit
1,888
import base64 import codecs import mimetypes import re import warnings from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _make_encode_wrapper f...
mitsuhiko/werkzeug
src/werkzeug/datastructures.py
Python
bsd-3-clause
97,929
########################################################################## #This file is part of WTFramework. # # WTFramework 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 L...
LeXuZZ/localway_tests
wtframework/wtf/config.py
Python
gpl-3.0
6,756
#!/usr/bin/env python """ Module-level unit tests. """ import unittest import sys sys.path.insert(0, '..') import bitstring import copy class ModuleData(unittest.TestCase): def testVersion(self): self.assertEqual(bitstring.__version__, '3.1.3') def testAll(self): exported = ['ConstBitArray',...
kostaspl/SpiderMonkey38
python/bitstring/test/test_bitstring.py
Python
mpl-2.0
3,077
#!/usr/bin/python from __future__ import division import unittest import time import logging import sys import random import os import shelve from avocado.utils import process from six.moves import xrange # simple magic for using scripts within a source tree basedir = os.path.dirname(os.path.dirname(os.path.abspat...
avocado-framework/avocado-vt
selftests/unit/test_utils_net.py
Python
gpl-2.0
27,394
## # @file hpwl_unitest.py # @author Yibo Lin # @date Mar 2019 # import os import sys import numpy as np import unittest import torch from torch.autograd import Function, Variable sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from dreamplace.ops.hpwl import hpwl sy...
limbo018/DREAMPlace
unittest/ops/hpwl_unittest.py
Python
bsd-3-clause
5,688
#! /usr/bin/python import os SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)); import sys; sys.path.append(SCRIPT_PATH + '/../src'); import subprocess; import multiprocessing; import basicdefines; ALIGNER_URL = 'http://sourceforge.net/projects/bbmap/files/BBMap_35.10.tar.gz' ALIGNER_PATH = os.path.join(ba...
isovic/realsim
src/wrappers/wrapper_bbmap.py
Python
mit
6,665