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
""" Monte Carlo Approximation of Pi Statistical Version 3/28/15 Albert Liang Uses a Monte Carlo method to approximate Pi. User can control accuracy by determining the number of random samples. This program builds on top of mcPi.py, by taking many trial runs and determining the standard deviation and error of the sum...
albertliangcode/Pi_MonteCarloSim
s_mcPi.py
Python
mit
5,504
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of ...
mx3L/archivczsk
build/plugin/src/resources/libraries/simplejson/__init__.py
Python
gpl-2.0
18,584
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-17 11:53 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('learn', '0001_initial'), ] operations = [ migrations.RenameField( model_...
Aigrefin/py3learn
learn/migrations/0002_auto_20160517_1353.py
Python
mit
427
# -*- coding: utf-8 -*- # # Clang.jl documentation build configuration file, created by # sphinx-quickstart on Sun Oct 27 21:11:35 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
mdcfrancis/Clang.jl
doc/conf.py
Python
mit
7,840
_base_ = './rpn_r50_fpn_2x_coco.py' model = dict( backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), style='pytorch', ...
open-mmlab/mmdetection
configs/rpn/rpn_x101_32x4d_fpn_2x_coco.py
Python
apache-2.0
413
from django.contrib.auth.models import User from django.test import TestCase import autofixture autofixture.autodiscover() class AutodiscoverTestCase(TestCase): def test_builtin_fixtures(self): from autofixture.autofixtures import UserFixture self.assertEqual(autofixture.REGISTRY[User], UserFixt...
gregmuellegger/django-autofixture
autofixture_tests/tests/test_autodiscover.py
Python
bsd-3-clause
325
""" Module simplifying manipulation of XML described at http://libvirt.org/formatstorage.html#StorageVol """ from virttest.libvirt_xml import base, accessors from virttest.libvirt_xml.xcepts import LibvirtXMLNotFoundError class VolXMLBase(base.LibvirtXMLBase): """ Accessor methods for VolXML class. Pro...
clebergnu/avocado-vt
virttest/libvirt_xml/vol_xml.py
Python
gpl-2.0
7,156
# -*- coding: utf-8 -*- """Helper methods for libtmux and downstream libtmux libraries.""" from __future__ import absolute_import, unicode_literals, with_statement import contextlib import logging import os import tempfile import time logger = logging.getLogger(__name__) TEST_SESSION_PREFIX = 'libtmux_' RETRY_TIMEO...
tony/libtmux
libtmux/test.py
Python
bsd-3-clause
6,243
# 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. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py
Python
mit
33,162
# Copyright 2016-2017 Capital One Services, 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 ...
jimmyraywv/cloud-custodian
tests/test_efs.py
Python
apache-2.0
2,532
#!/usr/bin/env python3 import pprint import argparse import inspect import json import os import requests import argh import subprocess import urllib.parse API_ENDPOINT = 'https://api.digitalocean.com/v2' DEBUG = False DO_API_TOKEN = os.environ.get('DO_API_TOKEN') DO_KEYPAIR_ID = os.environ.get('DO_KEYPAIR_ID') DO_K...
t0mk/dosl
dosl.py
Python
mit
19,968
from xml.dom import minidom from geopy.distance import distance import os, datetime, json os.chdir('data') runs = [] print 'progreso,ritmo,tipo' for filename in os.listdir(os.getcwd()): e = minidom.parse(filename) run = {} total_time = 0 total_distance = 0 raw_points = [] enriched_points = [] for trkpt...
santi698/infovis
runkeeper-stats/parse_data.py
Python
gpl-3.0
2,938
import json from flask import request from redash import models from redash.handlers.base import BaseResource from redash.permissions import (require_access, require_object_modify_permission, require_permission, view_only) class WidgetListResource(BaseR...
stefanseifert/redash
redash/handlers/widgets.py
Python
bsd-2-clause
2,967
#! /usr/bin/env python # -*- coding: utf-8 -*- import cookielib import sys import urllib from BeautifulSoup import BeautifulSoup import mechanize class WebPttBot(object): def __init__(self,board): self._board = board # Browser self._br = mechanize.Browser() # Cookie Jar ...
eternnoir/PyrserPTT
PyrserPTT/PttHtmlGraber.py
Python
gpl-2.0
1,773
#!/usr/bin/python # # # import sys import os import datetime import commands import re import time import simplejson as json from optparse import OptionParser def run(inJsonFilename): inJson = open(inJsonFilename).read() data = json.loads(inJson) # Add a name for the output file that will be generated ...
eriser/marsyas
src/apps/openmir/omTrainClassifier.py
Python
gpl-2.0
1,847
from django.shortcuts import render from django.http import HttpResponseRedirect from django.core.mail import send_mail from django.conf import settings from contact.forms import ContactForm def contact(request): if request.method == 'POST': # If the form has been submitted... form = ContactForm(request...
mtarsel/djangoclass
simplewebsiteEXAMPLE/contact/views.py
Python
gpl-2.0
1,200
import datetime from satoshidicetools.api import satoshidice class DiceRoller: """ DiceRoller bot skeleton. """ def __init__(self, secret): self.api = satoshidice.Api(secret=secret) def bet(self, bet_in_satoshis, below_roll_to_win, client_roll): result = self.api.place_bet(bet_in_...
tranqil/satoshi-dice-tools
satoshidicetools/api/examples/diceroller.py
Python
mit
1,052
import numpy as np def split(frac_training,frac_valid, datafile, file_train, file_valid, file_test): f_train = open(file_train, "w") f_valid = open(file_valid, "w") f_test = open(file_test, "w") ntrain = 0 nvalid = 0 ntest = 0 with open(datafile, "r") as f: for line in f: ...
JasonLC506/CollaborativeFiltering
traintestSplit.py
Python
mit
1,241
""" Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -mtailchaser` python will execute ``__main__.py`` as a...
thanos/tailchaser
src/tailchaser/cli.py
Python
bsd-2-clause
976
""" Streams represent basic IO objects, used by devices for reading or writing (streams) of data. ``Stream`` object encapsulates an actual IO object - ``file``-like stream, raw file descriptor, or even something completely different. ``Stream`` classes then provide basic IO methods for moving data to and from stream, ...
happz/ducky
ducky/streams.py
Python
mit
12,385
"""Configuration of Radar forms.""" import os import typing from typing import Mapping, Optional, Sequence, TypedDict import json5 class Config(TypedDict): """Configuration of Radar forms.""" domainIds: Sequence[str] skillIds: Sequence[str] translations: Mapping[str, str] def from_json5_file(json...
bayesimpact/bob-emploi
data_analysis/radar/config.py
Python
gpl-3.0
604
import cv2 import sys import os import numpy as np from matplotlib import pyplot as plt import matplotlib import shutil ''' To Do: Allow for user input for folder date! Copy Image Folder Directory Search through all image files Store in array of images to be processed Vary Thresholds Edge images are then written to e...
patrickstocklin/SeniorThesis
scripts/edgeDetect.py
Python
agpl-3.0
1,509
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "barati.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
abhaystoic/barati
barati/manage.py
Python
apache-2.0
249
#-------------------------------------------------------------------------------------------------------------------# # # IB2d is an Immersed Boundary Code (IB) for solving fully coupled non-linear # fluid-structure interaction models. This version of the code is based off of # Peskin's Immersed Boundary Method Paper...
nickabattista/IB2d
pyIB2d/Examples/Rayleigh_Taylor_Instability/please_Compute_External_Forcing.py
Python
gpl-3.0
6,723
from util import utils import os from queue import PriorityQueue k = None def readGrid(filename): filePath = os.path.join(utils.getResourcesPath(), filename) f = open(filePath, 'r') global k k = int(f.readline().strip()) grid = [] for i in range(0, k): grid.appen...
5agado/intro-ai
src/test/nPuzzle.py
Python
apache-2.0
4,709
#!/usr/bin/env python # 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. """A tool to generate symbols for a binary suitable for breakpad. Currently, the tool only supports Linux, Android, and Mac. Support f...
nwjs/chromium.src
components/crash/content/tools/generate_breakpad_symbols.py
Python
bsd-3-clause
15,345
import numpy as np import theano import theano.tensor as T import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from scipy.misc import imsave def initialize_weight(n_vis, n_hid, W_name, numpy_rng, rng_dist): if 'uniform' in rng_dist: W = numpy_rng.uniform(low=-np.sqrt(6. / (n_vis ...
lebek/reversible-raytracer
orbit_experiments/util.py
Python
mit
2,653
# coding: utf-8 """A tornado based nteract server.""" # Copyright (c) nteract development team. # Distributed under the terms of the Modified BSD License. import os from notebook.utils import url_path_join as ujoin from os.path import join as pjoin from jupyter_core.paths import ENV_JUPYTER_PATH, jupyter_config_path ...
jdfreder/nteract
applications/jupyter-extension/nteract_on_jupyter/extension.py
Python
bsd-3-clause
1,557
# -*- coding: utf-8 -*- import base64 import werkzeug import werkzeug.urls from openerp import http, SUPERUSER_ID from openerp.http import request from openerp.tools.translate import _ class contactus(http.Controller): def generate_google_map_url(self, street, city, city_zip, country_name): url = "http...
mycodeday/crm-platform
website_crm/controllers/main.py
Python
gpl-3.0
5,499
#!/usr/bin/env python3 # Advent of Code 2016 - Day 21, Part One import sys import re def swap_position(string, x, y): string[x], string[y] = string[y], string[x] return string def swap_letter(string, x, y): for i, c in enumerate(string): if c == x: string[i] = y elif c == y:...
mcbor/adventofcode
2016/day21/day21-pt1.py
Python
mit
2,337
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import gzip from Bio.Blast import NCBIXML import multiprocessing import argparse def func_os_GetAllFilesPathAndNameWithExtensionInFolder (FolderAddress, FileExtension, ProcessSubFoldersAlso = True): #IMPORTANT ... Extenstion should be like : "tx...
TurkuNLP/CAFA3
sequence_features/deltaBLAST_results_FeatureGenerator.py
Python
lgpl-3.0
7,031
# orm/scoping.py # Copyright (C) 2005-2012 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 from sqlalchemy import exc as sa_exc from sqlalchemy.util import ScopedRegistry, Thread...
aurofable/medhack-server
venv/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py
Python
mit
4,600
''' This is the library for getting DotA2 insight information. Problem: there was no way to get dota internal data about heroes, their abilities... in suitable for further work form. Solution: this library allows you to get access to all the data in the in-game files. But information about single her...
gasabr/AtoD
atod/__init__.py
Python
mit
806
from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^$', 'blog.views.home', name='home'), url(r'^ver_post/(?P<id_post>[0-9]+)/$', 'blog.views.ver_post', name='vermipost'), url(r'^contactame/$', 'blog.views.contact', na...
RodrigoToledoA/Blog
blog/urls.py
Python
gpl-2.0
1,094
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
hpproliant/ironic
ironic/tests/unit/__init__.py
Python
apache-2.0
1,020
import os import sys import pyttsx import random from data import * EXIT_TAG = 'n' class CTrain(object): def __init__(self): self._eng = pyttsx.init() def pre(self): print "*"*10,"DICTATE NUMBER TRAING", "*"*10 name = raw_input("Please enter your name: ") data = CData(nam...
anferneeHu/training
dictate_num/train.py
Python
bsd-2-clause
2,041
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-02-02 12:18 from __future__ import unicode_literals from django.contrib.auth.models import Permission from django.db import migrations def delete_old_comment_permission(apps, schema_editor): """ Deletes the old 'can_see_and_manage_comments' permiss...
CatoTH/OpenSlides
server/openslides/motions/migrations/0005_auto_20180202_1318.py
Python
mit
2,199
#!/usr/bin/python3 import os, os.path, re, zipfile, json, shutil def get_files_to_zip(): #Exclude git stuff, build scripts etc. exclude = [ r'\.(py|sh|pem)$', #file endings r'(\\|/)\.', #hidden files r'package\.json|icon\.html|updates\.json|visma\.js', #file names r'(...
samiljan/testdata
build.py
Python
mit
2,510
# -*- coding: utf-8 -*- # # poster documentation build configuration file, created by # sphinx-quickstart on Sat Jun 28 17:00:50 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleab...
EvanDarwin/poster3
docs/conf.py
Python
mit
5,834
#!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: Cheetara Rx # Generated: Mon Dec 17 21:03:15 2012 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import uhd from gnuradio import win...
levelrf/level_basestation
wardrive/full_test/cheetara_rx.py
Python
gpl-3.0
2,302
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Orgs are collections of people who make decisions after a threshold of consensus. When new admins are added, the org keys fundimentally change hands. Operations involving adding or removing citizens, however, occur under the existing keys. """ from __future__ import abs...
Thetoxicarcade/ac
congredi/commands/proofs/org.py
Python
gpl-3.0
6,036
"""Collection of constants fo the ``server_guardian`` app.""" # keep this in sync with server_guardian_api.constants SERVER_STATUS = { # pragma: no cover 'OK': 'OK', 'WARNING': 'WARNING', 'DANGER': 'DANGER', } SERVER_STATUS_CHOICES = ( # pragma: no cover ('OK', SERVER_STATUS['OK']), ('WARNING',...
bitmazk/django-server-guardian
server_guardian/constants.py
Python
mit
653
#!/usr/bin/python # -*- coding: utf-8 -*- """This file contains the tests for the event storage.""" import os import tempfile import unittest import zipfile from plaso.dfwinreg import fake as dfwinreg_fake from plaso.engine import queue from plaso.events import text_events from plaso.events import windows_events from...
ostree/plaso
tests/lib/storage.py
Python
apache-2.0
11,812
# This file is part of the Edison Project. # Please refer to the LICENSE document that was supplied with this software for information on how it can be used. from django.conf.urls.defaults import * from django.conf import settings from django.contrib.auth.views import login, logout # Project specific imports from view...
proffalken/edison
cmdb/urls.py
Python
bsd-3-clause
732
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'ParameterValue.value' db.alter_column(u'damis_paramete...
InScience/DAMIS-old
src/damis/migrations/0039_auto__chg_field_parametervalue_value.py
Python
agpl-3.0
11,165
import unittest from reoccur import reoccur, reoccur_no_mem class TestReoccur(unittest.TestCase): def test_reoccur_1(self): self.assertEqual(reoccur("abcdefabcdef"), 'a') def test_reoccur_2(self): self.assertEqual(reoccur("cc"), 'c') def test_reoccur_3(self): self.assertEq...
icemanblues/InterviewCodeTests
reoccurring-characters/test_reoccur.py
Python
gpl-2.0
1,256
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2011-2015 EDF SA # Contact: # CCN - HPC <dsp-cspit-ccn-hpc@edf.fr> # 1, Avenue du General de Gaulle # 92140 Clamart # # Authors: CCN - HPC <dsp-cspit-ccn-hpc@edf.fr> # # This file is part of HPCStats. # # HPCStats is free software: you can re...
edf-hpc/hpcstats
HPCStats/Model/Cluster.py
Python
gpl-2.0
6,981
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Wed Jan 22 15:52:24 2014 Script to plot the seismograms generated by SPECFEM2D. The arguments must be correct paths to existing 2D seismogram files or an existing option (--hold, --grid) @author: Alexis Bottero (alexis.bottero@gmail.com) """ from __future__ i...
geodynamics/specfem1d
Fortran_version/plot_script_using_python.py
Python
gpl-2.0
1,288
""" Copyright 2015 Paul T. Grogan, Massachusetts Institute of Technology Copyright 2017 Paul T. Grogan, Stevens Institute of Technology 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://ww...
ptgrogan/ofspy
ofspy/test/context/test_location.py
Python
apache-2.0
1,888
# 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. import json import logging import re import signal import subprocess import sys import tempfile from telemetry.core.platform import profiler # Parses one ...
androidarmv6/android_external_chromium_org
tools/telemetry/telemetry/core/platform/profiler/strace_profiler.py
Python
bsd-3-clause
7,691
from django import template register = template.Library() class SetVarNode(template.Node): def __init__(self, var_name, var_value): self.var_name = template.Variable(str(var_name)) self.var_value = var_value def render(self, context): try: value = template...
raychorn/knowu
django/djangononrelsample2/views/templatetags/setvariabletag.py
Python
lgpl-3.0
841
#!/usr/bin/python -tt __author__ = 'mricon' import logging import os import sys import anyjson import totpcgi import totpcgi.backends import totpcgi.backends.file import totpcgi.utils import datetime import dateutil import dateutil.parser import dateutil.tz from string import Template import syslog #-------------...
n054/totp-cgi
contrib/gitolite/command.py
Python
gpl-2.0
22,349
from __future__ import unicode_literals, print_function from builtins import bytes, dict, list, int, float, str import json import sys from cmd import Cmd from reflectrpc.client import RpcClient from reflectrpc.client import RpcError import reflectrpc import reflectrpc.cmdline def print_types(types): for t in t...
aheck/reflectrpc
reflectrpc/rpcsh.py
Python
mit
10,259
# -*- coding: utf-8 -*- import datetime from ..core.model import DeclarativeBase from sqlalchemy import Column, DateTime, Index, Integer, Numeric, Text class AccountTransaction(DeclarativeBase): __tablename__ = 'account_transactions' id = Column(Integer, nullable=False, primary_key=True) account_id = Co...
masom/doorbot-api-python
doorbot/models/account_transaction.py
Python
mit
631
""" Management for multiprocessing in varial. WorkerPool creates child processes that do not daemonize. Therefore they can spawn further children, which is handy to parallelize at many levels (e.g. run parallel tools at every level of a complex directory structure). Nevertheless, only a given number of workers runs at...
HeinerTholen/Varial
varial/multiproc.py
Python
gpl-3.0
4,580
from robot.api import deco def passing_handler(*args): for arg in args: print arg, return ', '.join(args) def failing_handler(*args): if len(args) == 0: msg = 'Failure' else: msg = 'Failure: %s' % ' '.join(args) raise AssertionError(msg) class GetKeywordNamesLibrary: ...
xiaokeng/robotframework
atest/testresources/testlibs/GetKeywordNamesLibrary.py
Python
apache-2.0
1,526
import django from django.conf import settings from django.contrib.admin.util import lookup_field, display_for_field from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils.html import escape, conditional_esc...
zzzombat/lucid-python-django-mptt
mptt/templatetags/mptt_admin.py
Python
mit
7,085
"""Code for finding content.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import abc import collections import os from ... import types as t from ...util import ( ANSIBLE_SOURCE_ROOT, ) from .. import ( PathProvider, ) class Layout: """Description of conte...
amenonsen/ansible
test/lib/ansible_test/_internal/provider/layout/__init__.py
Python
gpl-3.0
6,980
#!/usr/bin/env python3 from person import Person, Manager bob = Person('Bob Smith') sue = Person('Sue Jones', job='dev', pay=100000) tom = Manager('Tom Jones', 50000) import shelve db = shelve.open('persondb') for obj in (bob, sue, tom): db[obj.name] = obj db.close() import glob print(glob.glob('person*')) ...
eroicaleo/LearningPython
ch28/makedb.py
Python
mit
791
""" Copyright 2016 Christian Fobel This file is part of command_plugin. command_plugin 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. com...
ryanfobel/microdrop
microdrop/core_plugins/command_plugin/microdrop_plugin.py
Python
gpl-3.0
2,862
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2007, 2008, 2009, 2010, 2011 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 the Free Software Foundation; either version 2 of the ## Licens...
fjorba/invenio
modules/webjournal/lib/webjournal_utils.py
Python
gpl-2.0
67,476
# Generated by Django 2.1.4 on 2020-01-31 16:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('plugininstances', '0009_auto_20190715_1706'), ] operations = [ migrations.AlterField( model_name='pathparameter', na...
FNNDSC/ChRIS_ultron_backEnd
chris_backend/plugininstances/migrations/0010_auto_20200131_1619.py
Python
mit
401
"""Contains functions to annotate macromolecular entities.""" from cogent.core.entity import HIERARCHY __author__ = "Marcin Cieslik" __copyright__ = "Copyright 2007-2012, The Cogent Project" __credits__ = ["Marcin Cieslik"] __license__ = "GPL" __version__ = "1.5.3" __maintainer__ = "Marcin Cieslik" __email__ = "mpc4p...
sauloal/cnidaria
scripts/venv/lib/python2.7/site-packages/cogent/struct/annotation.py
Python
mit
1,011
"""project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
Schakkall/Votapar
project/project/urls.py
Python
gpl-3.0
764
#!/usr/bin/env python3 # Copyright (c) 2016-2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test NULLDUMMY softfork. Connect to a single node. Generate 2 blocks (save the coinbases for later). G...
prusnak/bitcoin
test/functional/feature_nulldummy.py
Python
mit
7,358
import dbus from servicetest import assertEquals, assertNotEquals, call_async, EventPattern from gabbletest import exec_test, acknowledge_iq, make_muc_presence import constants as cs from twisted.words.xish import xpath import ns from mucutil import join_muc_and_check def test(q, bus, conn, stream, access_control):...
mlundblad/telepathy-gabble
tests/twisted/tubes/accept-muc-dbus-tube.py
Python
lgpl-2.1
4,784
from __future__ import unicode_literals from django.utils import timezone from django.core.management.base import NoArgsCommand from sms_operator.sender import sender class Command(NoArgsCommand): def handle_noargs(self, **options): checked_messages_qs = sender.update_status() self.stdout.write...
matllubos/django-sms-operator
sms_operator/management/commands/update_sms_status.py
Python
lgpl-3.0
387
# -*- coding: utf-8 -*- # Copyright (C) 2005 Osmo Salomaa # # 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 pr...
otsaloma/gaupol
gaupol/agents/test/test_tools.py
Python
gpl-3.0
3,011
#!/usr/bin/env python2 # # Copyright (C) 2015 Red Hat, Inc. # # 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 p...
cathay4t/python-libobs
libobs.py
Python
gpl-3.0
10,027
# Generated by Django 2.1.7 on 2019-04-11 06:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products', '0014_auto_20190120_1049'), ] operations = [ migrations.AlterField( model_name='chapter', name='image', ...
flavoi/diventi
diventi/products/migrations/0015_auto_20190411_0806.py
Python
apache-2.0
1,132
#!/usr/bin/python # # Copyright (C) 2012 Michael Spreitzenbarth, Sven Schmitt # # 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 ...
draekko/ADEL
_analyzeDB.py
Python
gpl-3.0
53,681
#!/usr/bin/python import sys from LAPS.MsgBus.Bus import Bus # Create queue with a unique name # insert message # receive msg # delete queue if __name__ == "__main__": # If invoked directly, parse command line arguments for logger information # and pass the rest to the run() metho...
jjdmol/LOFAR
SubSystems/LAPS_CEP/test/startPythonFromMsg.py
Python
gpl-3.0
725
import functools import mock from django.test import TestCase from django.views.generic import View from django_universal_view_decorator.decorators.view_class_decorator import view_class_decorator, ViewClassDecorator def test_log(*args, **kwargs): pass # Test decorators class Decorator(object): def __ini...
pasztorpisti/django-universal-view-decorator
tests/test_view_class_decorator.py
Python
mit
6,461
import py from rpython.jit.metainterp.test.support import LLJitMixin from rpython.rlib.jit import JitDriver class ListTests(object): def test_basic_list(self): myjitdriver = JitDriver(greens = [], reds = ['n', 'lst']) def f(n): lst = [] while n > 0: myjitdri...
oblique-labs/pyVM
rpython/jit/metainterp/test/test_slist.py
Python
mit
3,217
import string import random import logging import os from rootpy import asrootpy, log from rootpy.plotting import Legend, Canvas, Pad, Graph from rootpy.plotting.base import Color, MarkerStyle from rootpy.plotting.utils import get_limits import ROOT # from external import husl # suppress some nonsense logging messa...
AudreyFrancisco/AliPhysics
PWGMM/MC/aligenqa/aligenqa/roofie/figure.py
Python
bsd-3-clause
20,679
import joint class Limb: _name = "limb" joints = {} def __init__(self, name): self._name = name def add_joint(self, joint): self.joints[joint.name] = joint def shutdown(self): for j in self.joints: self.joints[j].shutdown()
mhespenh/eva
limb.py
Python
gpl-2.0
283
# -*- coding: utf-8 -*- # Tests to prevent against recurrences of earlier bugs. regression_tests = r""" It should be possible to re-use attribute dictionaries (#3810) >>> from django.newforms import * >>> extra_attrs = {'class': 'special'} >>> class TestForm(Form): ... f1 = CharField(max_length=10, widget=TextInpu...
jonaustin/advisoryscan
django/tests/regressiontests/forms/regressions.py
Python
mit
2,175
#!/usr/bin/python # -*- coding: utf-8 -*- # # This is derived from a cadquery script for generating QFP/GullWings models in X3D format. # # from https://bitbucket.org/hyOzd/freecad-macros # author hyOzd # ## file of parametric definitions import collections from collections import namedtuple import FreeCAD, Draft, F...
easyw/kicad-3d-models-in-freecad
cadquery/FCAD_script_generator/Buzzer_Beeper/cq_parameters.py
Python
gpl-2.0
1,472
from sympy import expand, simplify from galgebra.printer import Format, xpdf from galgebra.ga import Ga g = '1 # #,' + \ '# 1 #,' + \ '# # 1' Format() ng3d = Ga('e1 e2 e3', g=g) (e1, e2, e3) = ng3d.mv() print('g_{ij} =', ng3d.g) E = e1 ^ e2 ^ e3 Esq = (E * E).scalar() print('E =', E) print('%E^{2} =', Esq) E...
arsenovic/galgebra
doc/python/ReciprocalBasis.py
Python
bsd-3-clause
1,108
# -*- coding: utf-8 -*- from flask import render_template, redirect from ffsjp import app, db, models from ffsjp.base import Base import copy base = Base() @app.route('/') def index(): base_local = copy.deepcopy(base) base_local.setPage(models.Pages.query.filter_by(model='index').first()) return render_t...
ffsjp/ffsjp
ffsjp/views.py
Python
mit
1,999
from __future__ import division from pylab import * import random # there already is a sample in the namespace from numpy from random import sample as smpl import itertools import utils utils.backup(__file__) import synapses class AbstractSource(object): def __init__(self): """ Initialize all relev...
Saran-nns/SORN
common/sources.py
Python
mit
19,478
# -*- coding: utf-8 -*- # Standard library imports import re from collections import namedtuple from functools import total_ordering # Local imports from . import compat __all__ = [ 'ParseError', 'Version', 'parse_version', 'default_version', ] # Strange nuke version pattern nuke_version_pattern =...
cpenv/autocpenv
packages/cpenv/versions.py
Python
mit
5,219
arrBad = [ '2g1c', '2 girls 1 cup', 'acrotomophilia', 'anal', 'anilingus', 'anus', 'arsehole', 'ass', 'asses', 'asshole', 'assmunch', 'auto erotic', 'autoerotic', 'babeland', 'baby batter', 'ball gag', 'ball gravy', 'ball kicking', 'ball licking', 'ball sack', 'ball sucking', 'bangbros', 'bareback', 'barely legal', 'ba...
wasimreza08/Word-search
word_scripts/profanity_filter.py
Python
mit
4,348
from flask import url_for from flask.ext.script import Manager from main import app manager = Manager(app) @manager.command def list_routes(): import urllib output = [] for rule in app.url_map.iter_rules(): options = {} for arg in rule.arguments: options[arg] = "[{0}]".format(...
AltCtrlSupr/acs-nginx-api
manager.py
Python
gpl-3.0
629
# coding=utf-8 """Dialog test. .. note:: 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. """ __author__ = 'ser...
syilmazturk/NDVIST
test/test_ndvist_dialog.py
Python
mit
1,506
#!/usr/bin/env python3.2 # -*- coding: utf-8 -*- """ Compare two spectra and return the cosine distance between them. The returned value is between 0 and 1, a returned value of 1 represents highest similarity. Example: >>> spec1 = pymzml.spec.Spectrum(measuredPrecision = 20e-5) >>> spec2 = pymzml.spec.Spectr...
hroest/pymzML
example_scripts/compareSpectra.py
Python
lgpl-3.0
1,732
# -*- coding: utf-8 -*- ''' Exodus Add-on 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 progra...
mrquim/repository.mrquim
script.module.exodus/lib/resources/lib/sources/en/vodly.py
Python
gpl-2.0
4,365
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! 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.or...
pombredanne/anvil
anvil/actions/uninstall.py
Python
apache-2.0
2,482
from pycukes import * @Given('I have a calculator') def i_have_a_calc(context): pass @When('I enter with 1 + -2 and press =') def one_plus_minus_two(context): pass @Then('I see -1 in my LCD') def fail(context): assert None
hltbra/pycukes
specs/steps/sum_of_one_and_two_negative_with_two_oks_and_one_fail.py
Python
mit
238
import sublime import sublime_plugin try: from GitGutter.view_collection import ViewCollection except ImportError: from view_collection import ViewCollection def plugin_loaded(): """ Ugly hack for icons in ST3 kudos: github.com/facelessuser/BracketHighlighter/blob/BH2ST3/bh_core.py...
cristianomarjar/SublimeText
git_gutter.py
Python
mit
3,628
# -*- coding: utf-8 -*- # # # This file is a part of 'linuxacademy-dl' project. # # Copyright (c) 2016-2017, Vassim Shahir # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of...
vassim/linuxacademy-dl
linuxacademy_dl/downloader.py
Python
bsd-3-clause
5,435
import types from abc import ABCMeta, abstractmethod from importlib import import_module import framework.db as db from framework.core.util import extract_artifact_id, is_uri, get_feature_from_uri class BaseType(object): # These are set at registration. name = None uri = None def __init__(self, *args...
biocore/metoo
framework/types/__init__.py
Python
bsd-3-clause
7,874
#!/usr/bin/env python3 import command_set_test import command_test
aaronlbrink/cs108FinalProject
src/test.py
Python
gpl-3.0
68
#!/usr/bin/env python -t # -*- coding: utf-8 -*- # Copyright (C) 2017 Jonathan Delvaux <pyshell@djoproject.net> # 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...
djo938/supershell
pyshell/arg/checker/string43.py
Python
gpl-3.0
4,532
import numpy as np def voc_ap(rec, prec, use_07_metric=False): """ ap = voc_ap(rec, prec, [use_07_metric]) Compute VOC AP given precision and recall. If use_07_metric is true, uses the VOC 07 11 point method (default:False). Adopted from https://github.com/rbgirshick/py-faster-rcnn/blob/master/li...
xdshang/VidVRD-helper
evaluation/common.py
Python
mit
3,685
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-21 14:11 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lowfat', '0082_auto_20161215_1623'), ] operations = [ migrations.RenameMode...
softwaresaved/fat
lowfat/migrations/0083_auto_20161221_1411.py
Python
bsd-3-clause
1,018
########################################################################### # # 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 # # https://www.apache.org/l...
google/starthinker
dags/bucket_dag.py
Python
apache-2.0
4,423
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2013 Kai Kratzer, Universität Stuttgart, ICP, # Allmandring 3, 70569 Stuttgart, Germany; all rights # reserved unless otherwise stated. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public Licen...
freshs/freshs
scripts/ffs_show_DB.py
Python
gpl-3.0
1,168
import requests from PIL import Image, ImageEnhance, ImageChops, ImageFilter from io import BytesIO, StringIO import time import sys, os import codecs url = 'http://d1222391-23d7-46de-abef-73cbb63c1862.levels.pathwar.net' imgurl = url + '/captcha.php' headers = { 'Host' : 'd1222391-23d7-46de-abef-73cbb63c1862.levels....
KKfo/captcha_solver
experiment.py
Python
gpl-3.0
7,350
# # This tree searcher uses the lab3 games framework # to run alpha-beta searches on static game trees # of the form seen in quiz/recitation/tutorial examples. # # (See TEST_1 for an example tree.) # # In the directory where lab3.py lives, run: # # ~> python tree_search.py # # But as prereq, your lab3.py should have...
popuguy/mit-cs-6-034
lab3/tree_searcher.py
Python
unlicense
6,307