code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
import matplotlib.cm as cm import numpy import pylab import operator, copy, os #os.chdir('C:/Users/Gregoire/Documents/PythonCode/ternaryplot') from myquaternaryutility import QuaternaryPlot class binarylines: def __init__(self, ax, insetax, ellabels=['A', 'B', 'C', 'D'], offset=0.02, numcomppts=21, view_azim=-1...
johnmgregoire/PythonCompositionPlots
quaternary_binary_lines.py
Python
bsd-3-clause
2,643
"""Initialize database Revision ID: 721be6649087 Revises: None Create Date: 2016-05-18 22:42:25.431499 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "721be6649087" down_revision = None def upgrade(): # commands auto generated by Alembic - please adjust!...
Tafkas/solarpi
migrations/versions/721be6649087_.py
Python
bsd-3-clause
2,933
""" A version of the entropy with signature common to the other multivariate measures. """ from ..helpers import normalize_rvs from ..shannon import conditional_entropy, entropy as shannon_entropy from ..utils import flatten def entropy(dist, rvs=None, crvs=None, rv_mode=None): """ Compute the conditional joi...
chebee7i/dit
dit/multivariate/entropy.py
Python
bsd-3-clause
2,340
from django.core.management.base import NoArgsCommand, CommandError from profiler.db import ProfilerDatabase from profiler.plotter import StatsPlotter import time class Command(NoArgsCommand): help = 'Creates graphs based on profiling statistics.' can_import_settings = True def handle_noargs(self, **o...
socialdevices/manager
profiler/management/commands/plotprofilingstats.py
Python
bsd-3-clause
1,441
import bisect import functools import math import warnings from itertools import product from numbers import Integral, Number from operator import add, itemgetter import numpy as np from tlz import accumulate, concat, memoize, merge, pluck from .. import config, core, utils from ..base import is_dask_collection, toke...
jakirkham/dask
dask/array/slicing.py
Python
bsd-3-clause
72,518
# sqlite is always available from . import sqlite __all__ = ['sqlite'] # mysql driver depends on MySQLdb try: from . import mysql except ImportError: mysql = None __all__.append('mysql')
orbnauticus/silk
silk/webdb/drivers/__init__.py
Python
bsd-3-clause
201
#!/usr/bin/env python from setuptools import setup, find_packages #try: # import setuptools_git #except ImportError: # print "WARNING!" # print "We need the setuptools-git package to be installed for" # print "some of the setup.py targets to work correctly." PACKAGE = 'dataleach' VERSION = '0.1' setup( ...
janies/dataleach
setup.py
Python
bsd-3-clause
868
import re from sublime import Region import sublime_plugin class BaseBlockCommand(sublime_plugin.TextCommand): def _get_row_text(self, row): if row < 0 or row > self.view.rowcol(self.view.size())[0]: raise RuntimeError('Cannot find table bounds.') point = self.view.text_point(row, ...
ericholscher/sublime-rst-completion
helpers.py
Python
bsd-3-clause
1,480
# Copyright (c) 2012, CyberPoint International, LLC # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this lis...
Anaphory/libpgm
libpgm/discretebayesiannetwork.py
Python
bsd-3-clause
9,628
from jobber import jobber from redis import Redis client = Redis() progress = jobber.JobProgress(client=client) progress.run()
tomlepaine/jobber
jobber/scripts/progress.py
Python
bsd-3-clause
130
""" Tests for functionality in the utils module """ import platform import unittest import mock import queries from queries import utils class GetCurrentUserTests(unittest.TestCase): @mock.patch('pwd.getpwuid') def test_get_current_user(self, getpwuid): """get_current_user returns value from pwd.g...
gmr/queries
tests/utils_tests.py
Python
bsd-3-clause
4,097
import sys, traceback def lumberjack(): bright_side_of_death() def bright_side_of_death(): return tuple()[0] def testCode() : return tuple()[0] try: testCode() except IndexError: #exc_type, exc_value, exc_traceback = sys.exc_info() #print "*** print_tb:" #traceback.print_tb(exc_tracebac...
NeuroRoboticTech/AnimatLabPublicSource
Libraries/AnimatSimPy/Scripts/ErrorTesting.py
Python
bsd-3-clause
1,130
import logging import fmcapi import time def test__port_object_group(fmc): logging.info("Testing PortObjectGroup class.") starttime = str(int(time.time())) namer = f"_fmcapi_test_{starttime}" obj10 = fmcapi.ProtocolPortObjects( fmc=fmc, name="_porttcp1", port="8443", protocol="TCP" ) ...
daxm/fmcapi
unit_tests/port_object_group.py
Python
bsd-3-clause
1,589
# -*- coding: utf-8 -*- import json from layeredconfig import source class JsonFile(source.Source): """Source for json files""" def __init__(self, source, **kwargs): super(JsonFile, self).__init__(**kwargs) self._source = source def _read(self): with open(self._source) as fh: ...
hakkeroid/lcconcept
src/layeredconfig/sources/jsonfile.py
Python
bsd-3-clause
457
#!/usr/bin/python # -*- coding: utf-8 -*- import os from setuptools import setup README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-yapi', vers...
andreftavares/django-yapi
setup.py
Python
bsd-3-clause
1,143
import numpy as np from . import _marching_cubes_cy def marching_cubes(volume, level, spacing=(1., 1., 1.)): """ Marching cubes algorithm to find iso-valued surfaces in 3d volumetric data Parameters ---------- volume : (M, N, P) array of doubles Input data volume to find isosurfaces. Will...
almarklein/scikit-image
skimage/measure/_marching_cubes.py
Python
bsd-3-clause
6,374
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'County.country' db.add_column(u'stores_county', 'country', self.gf('dj...
nikdoof/vapemap
app/stores/migrations/0002_auto__add_field_county_country.py
Python
bsd-3-clause
9,572
from collections import defaultdict, namedtuple import datetime from urllib import urlencode import math import operator from pygooglechart import ScatterChart import pytz from corehq.apps.es import filters from corehq.apps.es import cases as case_es from corehq.apps.es.aggregations import ( TermsAggregation, ...
qedsoftware/commcare-hq
corehq/apps/reports/standard/monitoring.py
Python
bsd-3-clause
67,020
""" SCL; 2011, 2012. """ version = "0.2" from btsynth import * from gridworld import *
slivingston/btsynth
btsynth/__init__.py
Python
bsd-3-clause
89
""" Models for user profile """ from django.conf import settings from django.db import models from courses.models import Program from search.models import PercolateQuery from micromasters.models import TimestampedModel class DiscussionUser(TimestampedModel): """ Tracks the user's discussion user and profile ...
mitodl/micromasters
discussions/models.py
Python
bsd-3-clause
1,574
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. # # 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 file. # # All configurati...
mwcraig/ccdproc
docs/conf.py
Python
bsd-3-clause
6,953
from django.core.mail import send_mail from notifications.signals import notify from django_comments.models import Comment events_registry = [] class Event(object): model = None parent = None verb = None @staticmethod def get_email_subject(instance, parent, actor, recipient): raise NotIm...
portnov/assethub
assethub/assets/email.py
Python
bsd-3-clause
1,412
# These tests are similar to the ones in the scripts directory. They not ran on # real data so the testing db needs to be filled with info. import os from django.test.client import Client from django.test import TestCase from mozdns.soa.models import SOA from mozdns.domain.models import Domain from mozdns.address_reco...
rtucker-mozilla/mozilla_inventory
mozdns/mozbind/tests/build_tests.py
Python
bsd-3-clause
10,431
#!/usr/bin/env python3 # Copyright (c) 2014-2017 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the dir...
Jcing95/iop-hd
contrib/seeds/generate-seeds.py
Python
mit
4,326
from __future__ import absolute_import import astropy.units as u from datetime import datetime mission_title = 'FOXSI-SMEX' launch_date = datetime(2022, 7, 1) # DSI Parameters number_of_dsi_telescopes = 2 shutter_material = 'Al' shutter_thickness = [0, 0.02, 0.08, 0.3, 1.3, 6] * u.mm detector_material = 'cdte' detec...
foxsi/foxsi-smex
pyfoxsi/src/pyfoxsi/__init__.py
Python
mit
674
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/draft_schematic/clothing/shared_clothing_belt_field_05_quest.iff" result.a...
anhstudios/swganh
data/scripts/templates/object/draft_schematic/clothing/shared_clothing_belt_field_05_quest.py
Python
mit
466
# Copyright (C) 2010 John Reese # Licensed under the MIT license class Transform: """ This class represents a single modification to the data set, designed to be applied in descending order by line number. The operation determines where the new data will be applied, and how. """ lineum = -1 oper = "noop" dat...
triAGENS/markdown-pp
MarkdownPP/Transform.py
Python
mit
566
# -*- coding: utf-8 -*- # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to e...
noxora/flask-base
flask/lib/python3.4/site-packages/Crypto/__init__.py
Python
mit
1,836
# Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
arkarkark/feedapp
src/server/crud/crud_model.py
Python
mit
7,336
""" The problem definition is here: http://codereview.stackexchange.com/questions/38500/rainfall-challenge The implementaion here uses union-find data structures. """ class Basin(object): """ This class tracks the sink for each basin and number of cells that belongs to the basin. """ def __init__...
bkpathak/HackerRank-Problems
python/graphs/rainfall_challenge.py
Python
mit
1,071
from setuptools import setup, find_packages setup( name = 'gear', version = '0.0.1', url = 'https://github.com/hail-is/hail.git', author = 'Hail Team', author_email = 'hail@broadinstitute.org', description = 'Utils for building services', packages = find_packages(), include_package_data...
cseed/hail
gear/setup.py
Python
mit
328
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Creature() result.template = "object/mobile/shared_warren_imperial_worker_s01.iff" result.attribute_template_id =...
anhstudios/swganh
data/scripts/templates/object/mobile/shared_warren_imperial_worker_s01.py
Python
mit
458
""" This module implements transposition tables, which store positions and moves to speed up the AI. """ import pickle from easyAI.AI.DictTT import DictTT class TT: """ A tranposition table made out of a Python dictionnary. It can only be used on games which have a method game.ttentry() -> string, or ...
mrfesol/easyAI
easyAI/AI/TT.py
Python
mit
2,413
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/space/story_loot/shared_loot_naboo_borvo.iff" result.attribute_temp...
anhstudios/swganh
data/scripts/templates/object/tangible/space/story_loot/shared_loot_naboo_borvo.py
Python
mit
472
#Copyright (c) 2011-2012 Litle & Co. # #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, merge, publish, distri...
Rediker-Software/litle-sdk-for-python
litleSdkPythonTest/certification/TestCert4.py
Python
mit
11,409
#!/usr/bin/env python """ Copyright (c) 2014-2018 Alex Forencich 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,...
alexforencich/verilog-ethernet
tb/test_ip_demux_64_4.py
Python
mit
25,346
################################################################################ # Copyright (C) 2015 Jaakko Luttinen # # This file is licensed under the MIT License. ################################################################################ import numpy as np from bayespy.utils import misc from .deterministi...
SalemAmeen/bayespy
bayespy/inference/vmp/nodes/concatenate.py
Python
mit
5,366
#coding=utf-8 from django.test import TestCase # Create your tests here.
flysmoke/ijizhang
ijizhang_prj/jizhang/tests.py
Python
mit
74
from datetime import date from rest_framework import status as status_code from rest_framework import viewsets from rest_framework.decorators import action from rest_framework.response import Response from app.models import Passphrase, SlackUser from pantry.models import Pantry class PantryViewSet(viewsets.ViewSet)...
waitress-andela/waitress
waitress/pantry/viewsets.py
Python
mit
3,247
from django.contrib import admin from elections.models import Election class ElectionOptions(admin.ModelAdmin): list_display = ['name', 'country', 'active'] search_fields = ['name'] ordering = ['live_date'] admin.site.register( Election, ElectionOptions )
JustinWingChungHui/electionleaflets
electionleaflets/apps/elections/admin.py
Python
mit
312
class NoOpMiddleWare(object): pass class NoOpMiddleWare2(object): pass class NoOpMiddleWare3(object): pass class NoOpMiddleWare4(object): pass class NoOpMiddleWare5(object): pass class NoOpMiddleWare6(object): pass
d0ugal-archive/django-urlmiddleware
tests/test_urlmiddleware/middleware.py
Python
mit
251
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/medicine/crafted/shared_medpack_damage_e.iff" result.attribute_temp...
anhstudios/swganh
data/scripts/templates/object/tangible/medicine/crafted/shared_medpack_damage_e.py
Python
mit
466
from __future__ import print_function, division from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy from lasagne.init import Uniform, Normal from lasagne.layers import LSTMLayer, Dens...
JackKelly/neuralnilm_prototype
scripts/e71.py
Python
mit
2,878
#!/usr/bin/env python3 # coding: utf-8 import sys class Solution: def findPaths(self, m, n, N, i, j): """ :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int """ if N == 0: return 0 from collectio...
feigaochn/leetcode
p576_out_of_boundary_paths.py
Python
mit
1,552
''' Copyright (c) 2011-2014, Agora Games, LLC All rights reserved. https://github.com/agoragames/haigha/blob/master/LICENSE.txt ''' import struct import sys from collections import deque from haigha.reader import Reader class Frame(object): ''' Base class for a frame. ''' # Exceptions class Fr...
TeamODrKnow/doctor-know
haigha/frames/frame.py
Python
mit
4,107
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Static() result.template = "object/static/particle/shared_particle_test_71.iff" result.attribute_template_id = -1...
obi-two/Rebelion
data/scripts/templates/object/static/particle/shared_particle_test_71.py
Python
mit
445
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django.contrib import admin from . import models class UserAdmin(admin.ModelAdmin): list_display = ('username', 'last_connected') admin.site.register(models.User, UserAdmin)...
release-engineering/product-definition-center
pdc/apps/auth/admin.py
Python
mit
448
# OData Python Client and Server Libraries ver. 1.0.0 # Copyright (c) Microsoft Corporation # All rights reserved. # MIT License # 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 re...
yqowen/odatapy-client
codegen_template.py
Python
mit
34,379
#!/usr/bin/env python # # Copyright (c) 2017, Piotr Przymus # # 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, modi...
flacjacket/qtile
libqtile/scripts/qtile_cmd.py
Python
mit
6,464
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Building() result.template = "object/building/poi/shared_tatooine_spicefiend_medium2.iff" result.attribute_templa...
obi-two/Rebelion
data/scripts/templates/object/building/poi/shared_tatooine_spicefiend_medium2.py
Python
mit
458
import sys import numpy import math from foldyFloatList import foldyFloatList class OOBError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) from KMCLib.PluginInterfaces.KMCAnalysisPlugin import KMCAnalysisPlugin from KMCLib.Utilities.CheckU...
joshuahellier/PhDStuff
codes/thesisCodes/kmc/customAnalysis/DensHist.py
Python
mit
2,799
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals def get_jenv(): import frappe if not getattr(frappe.local, 'jenv', None): from jinja2 import Environment, DebugUndefined # frappe will be loaded last, so app templates wil...
ESS-LLP/frappe
frappe/utils/jinja.py
Python
mit
6,657
# -*- coding: utf-8 -*- from django import template from ..utils import su_login_callback register = template.Library() @register.inclusion_tag('su/login_link.html', takes_context=False) def login_su_link(user): return {'can_su_login': su_login_callback(user)}
adamcharnock/django-su
django_su/templatetags/su_tags.py
Python
mit
270
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-03-28 15:26 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): dependencies = [ migrations.swappable_dependen...
madprime/genevieve
genevieve_client/migrations/0004_auto_20160328_1526.py
Python
mit
1,731
import unittest from svtplay_dl.service import Generic from svtplay_dl.service import opengraph_get from svtplay_dl.service import Service from svtplay_dl.service import service_handler from svtplay_dl.service.services import sites from svtplay_dl.utils.parser import setup_defaults class MockService(Service): su...
spaam/svtplay-dl
lib/svtplay_dl/tests/test_service.py
Python
mit
2,933
# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-02-06 16:30 from __future__ import unicode_literals from django.db import migrations def refactor_schedule_times(apps, schema_editor): """Change the JSON data in OfficeHours.schedule so that it goes from this: {'DAY': [[from, to], [from, to], ....
tndatacommons/tndata_backend
tndata_backend/officehours/migrations/0004_revise_schedule_format.py
Python
mit
1,178
#!/usr/bin/env python __author__ = "bt3" ''' Set a bit in a binary number: 1) Shifts 1 over by i bits 2) make an OR with the number, only the value at bit i will change and all the others bit of the mask are zero so will not affect the num ''' def set_bit(num, i): mask = 1 << i return bin( num...
switchkiller/Python-and-Algorithms-and-Data-Structures
src/bitwise/set_bit.py
Python
mit
659
from django.db.models.signals import post_migrate from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission def add_view_permissions(sender, **kwargs): """ This syncdb hooks takes care of adding a view permission too all our content types. """ # f...
Heteroskedastic/chills-pos
chills_pos/pos/management/__init__.py
Python
mit
1,041
"""engine.SCons.Tool.aixf77 Tool-specific initialization for IBM Visual Age f77 Fortran compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001 - 2014 The SCons Foundation # # Permiss...
engineer0x47/SCONS
engine/SCons/Tool/aixf77.py
Python
mit
2,681
from __future__ import absolute_import from .dev import Dev # noqa try: from .production import Production # noqa except ImportError: pass
DanielGabris/radius_restserver
src/settings/__init__.py
Python
mit
149
# ed25519.py - Optimized version of the reference implementation of Ed25519 # # Written in 2011? by Daniel J. Bernstein <djb@cr.yp.to> # 2013 by Donald Stufft <donald@stufft.io> # 2013 by Alex Gaynor <alex.gaynor@gmail.com> # 2013 by Greg Price <price@mit.edu> # # To the extent possible...
vladimir-v-diaz/securesystemslib
securesystemslib/_vendor/ed25519/ed25519.py
Python
mit
7,618
def get_point_cloud(point_cloud_id, number_points=None): from voxel_globe.meta import models from vpgl_adaptor_boxm2_batch import convert_local_to_global_coordinates_array, create_lvcs import os import numpy as np from plyfile import PlyData point_cloud = models.PointCloud.objects.get(id=point_cloud_id) ...
ngageoint/voxel-globe
voxel_globe/voxel_viewer/tools.py
Python
mit
2,209
############################################################################## # MSIBI: A package for optimizing coarse-grained force fields using multistate # iterative Boltzmann inversion. # Copyright (c) 2017 Vanderbilt University and the Authors # # Authors: Christoph Klein, Timothy C. Moore # # Permission is her...
mosdef-hub/msibi
msibi/utils/error_calculation.py
Python
mit
1,706
'''@file alignment_writer.py contains the AlignmentWriter class''' import numpy as np import tensorflow as tf import tfwriter class AlignmentWriter(tfwriter.TfWriter): '''a TfWriter to write kaldi alignments''' def _get_example(self, data): '''write data to a file Args: data: the...
vrenkens/Nabu-asr
nabu/processing/tfwriters/alignment_writer.py
Python
mit
651
#!/usr/bin/env python from iris_sdk.models.maps.base_map import BaseMap class SubscriptionsMap(BaseMap): subscription = None
scottbarstow/iris-python
iris_sdk/models/maps/subscriptions.py
Python
mit
131
# 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 ...
v-iam/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/load_balancing_rule.py
Python
mit
5,338
# -*- coding: utf-8 -*- #!/usr/bin/env python #第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)? import random import string def activation_code(chars = string.ascii_uppercase + string.digits, length=16): return ''.join([random.choice(chars) for i in range(length)]) if __...
Show-Me-the-Code/python
pylyria/0001/0001_1.py
Python
mit
651
try: import xml.etree.cElementTree as ET except ImportError: import cElementTree as ET import Utils.ElementTreeUtils as ETUtils import sys import CorpusElements from optparse import OptionParser def copyParse(input, source, output, parse, tokenization): print >> sys.stderr, "Loading input file", input ...
ashishbaghudana/mthesis-ashish
resources/tees/Utils/InteractionXML/CopyParse.py
Python
mit
4,989
import unittest from rtruffle.node import Node class NodeTest(unittest.TestCase): def test_adopt_child(self): child = ChildNode() parent = RootNode() self.assertIsNone(child.parent) parent.adopt_child(child) self.assertIs(parent, child.parent) def test_adopt_children...
SOM-st/PySOM
tests/rtruffle_tests/test_node.py
Python
mit
2,292
"""Support for an interface resource in Skytap.""" import json from skytap.framework.ApiClient import ApiClient # noqa from skytap.models.PublishedServices import PublishedServices # noqa from skytap.models.SkytapResource import SkytapResource # noqa class Interface(SkytapResource): """One Skytap (network) In...
mapledyne/skytap
skytap/models/Interface.py
Python
mit
1,497
# -*- coding: utf-8 -*- # # bandicoot documentation build configuration file, created by # sphinx-quickstart on Mon Apr 28 20:51:43 2014. # # 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. # #...
ulfaslak/bandicoot
immutable/docs/conf.py
Python
mit
8,601
import re from collections import namedtuple import sqlparse from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models.indexes import Index FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ('pk',)) field_size_re = re....
sametmax/Django--an-app-at-a-time
ignore_this_directory/django/db/backends/sqlite3/introspection.py
Python
mit
18,775
# -*- coding: UTF-8 -*- from models import Artist, Genre, Album, Song, Queue, History, Favourite from django.contrib import admin class ArtistAdmin(admin.ModelAdmin): list_display = ('Name', ) search_fields = ['Name'] class GenreAdmin(admin.ModelAdmin): list_display = ('Name', ) class AlbumAdmin(admi...
rejahrehim/jukebox
jukebox/jukebox_core/admin.py
Python
mit
1,098
from kolibri.auth.permissions.base import BasePermissions class AnonymousUsersCanWriteAnonymousLogs(BasePermissions): """ Permissions class that allows anonymous users to create logs with no associated user. """ def user_can_create_object(self, user, obj): return user.is_anonymous() and not o...
whitzhu/kolibri
kolibri/logger/permissions.py
Python
mit
989
#!/usr/bin/env python from __future__ import division, absolute_import, print_function from future.builtins import super from iris_sdk.models.base_resource import BaseResource from iris_sdk.models.data.tndetails import TndetailsData XML_NAME_TNDETAILS = "TelephoneNumberDetails" XPATH_TNDETAILS = "/tndetails" class ...
scottbarstow/iris-python
iris_sdk/models/tndetails.py
Python
mit
642
#! /usr/bin/env python """ The MIT License (MIT) Copyright (c) 2015 creon (creon.nu@gmail.com) 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...
inuitwallet/plunge
client/client.py
Python
mit
21,310
from __future__ import unicode_literals import sys sys.path = sys.path[1:] from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render, render_to_response from django.core.mail import send_mail from django.conf import settings import os def blog(request): context = {} context...
neuropower/neuropower
neuropower/apps/blog/views.py
Python
mit
393
# -*- coding: utf-8 -*- # # This file is based upon the file generated by sphinx-quickstart. However, # where sphinx-quickstart hardcodes values in this file that you input, this # file has been changed to pull from your module's metadata module. # # This file is execfile()d with the current directory set to its contai...
GCStokum/ECS-Game
ecs-0.1/docs/source/conf.py
Python
mit
8,695
import unittest from github_person import GithubPerson class Test_GithubPerson(unittest.TestCase): def setUp(self): pass if __name__ == '__main__': unittest.main()
pepincho/Python101-and-Algo1-Courses
Programming-101-v3/week6/1-Who-Follows-You-Back/github_person_test.py
Python
mit
185
import unittest # Skip this whole module test if running under PyPy (incompatible with Cython) try: import __pypy__ # Empty test unit to show the reason of skipping class TestMissingDependency(unittest.TestCase): @unittest.skip('Missing dependency - Cython is incompatible with PyPy') def ...
lrq3000/unireedsolomon
unireedsolomon/tests/test_cpolynomial.py
Python
mit
9,289
zoo_animals = ["pangolin", "cassowary", "sloth", "tiger"] # Last night our zoo's sloth brutally attacked #the poor tiger and ate it whole. # The ferocious sloth has been replaced by a friendly hyena. zoo_animals[2] = "hyena" # What shall fill the void left by our dear departed tiger? # Your code here! zoo_animals[3] ...
vpstudios/Codecademy-Exercise-Answers
Language Skills/Python/Unit 5/1-Python Lists and Dictionaries/Lists/3-New Neibors.py
Python
mit
329
#! /usr/bin/python3 import sys, os, time, tempfile import pytest import util_test from util_test import CURR_DIR from fixtures.vectors import UNITTEST_VECTOR from fixtures.params import DEFAULT_PARAMS as DP from lib import (config, util, api) import counterpartyd def setup_module(): counterpartyd.set_options(data...
Ziftr/counterpartyd
test/unit_test.py
Python
mit
1,568
#coding=utf-8 #author='Shichao-Dong' import requests def r_post(url,headers,data): r=requests.post(url=url,headers=headers,data=data) return r def login_func(host,name,code,password): url="http://"+ host +'/portal/logon.action' headers = {"Connection": "keep-alive", "Referer": "http://172...
NJ-zero/Android
requests_demo/bas_pd/Public_Client_Method.py
Python
mit
1,331
config = { "username": 'debtbot', "icon": ":money_with_wings:", }
cmyr/debt-bot
debtbot/config.py
Python
mit
72
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, merge, publish, ...
datalogics/scons
test/TEX/auxiliaries.py
Python
mit
3,930
import random from abc import ABC, abstractmethod import logging import numpy import rlr from typing import List from typing_extensions import Protocol import dedupe.sampling as sampling import dedupe.core as core import dedupe.training as training import dedupe.datamodel as datamodel from dedupe._typing import Train...
datamade/dedupe
dedupe/labeler.py
Python
mit
15,590
# 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 ...
SUSE/azure-sdk-for-python
azure-servicefabric/azure/servicefabric/version.py
Python
mit
494
################################################################################ # # This program is part of the HPEVAMon Zenpack for Zenoss. # Copyright (C) 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss.com/oss # #...
anksp21/Community-Zenpacks
ZenPacks.community.HPEVAMon/ZenPacks/community/HPEVAMon/HPEVAStorageDiskEnclosure.py
Python
gpl-2.0
5,528
# Copyright 2016-2020 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 2 of the License, or # (at your option) any later version. # # This program is distributed in...
nirs/vdsm
tests/network/functional/netrestore_test.py
Python
gpl-2.0
5,990
# -*- coding: utf-8 -*- """ *************************************************************************** widgetBatchBase.py --------------------- Date : June 2010 Copyright : (C) 2010 by Giuseppe Sucameli Email : brush dot tyler at gmail dot com ************...
camptocamp/QGIS
python/plugins/GdalTools/tools/widgetBatchBase.py
Python
gpl-2.0
5,310
# -*- coding: utf-8 -*- """ *************************************************************************** GridDataMetrics.py --------------------- Date : October 2013 Copyright : (C) 2013 by Alexander Bruy Email : alexander dot bruy at gmail dot com *********...
nirvn/QGIS
python/plugins/processing/algs/gdal/GridDataMetrics.py
Python
gpl-2.0
9,332
# Generated by Django 2.2.12 on 2020-04-25 15:53 from django.db import migrations, models import django.db.models.deletion import djangocms_text_ckeditor.fields import parler.fields import parler.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ ...
gitsimon/tq_website
partners/migrations/0001_initial.py
Python
gpl-2.0
1,987
#!/usr/bin/env python import os import re import sys group_id = '142394' def stamp(html): """Stamp a Python HTML documentation page with the SourceForge logo""" def replace(m): return ('<span class="release-info">%s ' 'Hosted on <a href="http://sourceforge.net">' '<im...
PyQwt/PyQwt5
Doc/sourceforge.py
Python
gpl-2.0
990
""" Tests for GPU convolution """ from __future__ import print_function import sys import time import unittest import numpy from six.moves import xrange import theano from theano import tensor from theano.tests.unittest_tools import seed_rng # We let that import do the init of the back-end if needed. from .config im...
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/sandbox/gpuarray/tests/test_conv_cuda_ndarray.py
Python
gpl-2.0
27,571
''' Python class on writing reusable code ''' def func1(): '''Simple test function''' print "Hello world" class MyClass(object): '''Simple test class''' def __init__(self, var1, var2, var3): self.var1 = var1 self.var2 = var2 self.var3 = var3 def hello(self): '''Simp...
nonemaw/pynet
pyth_ans_ecourse/class9/exercise6/mytest/world.py
Python
gpl-2.0
1,292
#python import k3d import testing setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapAdd") setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8.png") setup.modifier.value = 0.5 testing.require_similar_bitmap(setup.document, setup.modifier.get_property("out...
barche/k3d
tests/bitmap/bitmap.modifier.BitmapAdd.py
Python
gpl-2.0
350
from pysal.cg import Point, LineSegment, Line, Ray, Chain, Rectangle, Polygon import doctest import unittest class test_Point(unittest.TestCase): def test___init__1(self): """ Tests whether points are created without issue. Test tag: <tc>#tests#Point.__init__</tc> """ for...
anitagraser/processing_pysal
ext-libs/pysal/cg/tests/test_shapes.py
Python
gpl-2.0
27,046
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Faraday Penetration Test IDE - Community Version Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) See the file 'doc/LICENSE' for the license information ''' from __future__ import with_statement from plugins import core from model import api import re im...
Snifer/BurpSuite-Plugins
faraday/plugins/repo/acunetix/plugin.py
Python
gpl-2.0
9,521
#!/usr/bin/env python LICENSE=""" Copyright (C) 2011 Michael Ihde This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This progra...
JCHappytime/MyQuantopian
strategies/strategy.py
Python
gpl-2.0
3,094
######################################################################## # # File: label.py # Author: Alex Samuel # Date: 2001-03-17 # # Contents: # Label # # Copyright (c) 2001, 2002 by CodeSourcery, LLC. All rights reserved. # # For license terms see the file COPYING. # #######################################...
stefanseefeld/qmtest
qm/label.py
Python
gpl-2.0
6,102