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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp import models
class PaymentTransaction(models.Model):
_inherit = 'payment.transaction'
def form_feedback(self, cr, uid, data, acquirer_name, context=None):
super(PaymentTransaction, self).form_feedback(cr, uid, data, acquirer_name,... | ilmir-k/website-addons | website_sale_auto_confirm_order/models.py | Python | lgpl-3.0 | 780 |
"""
Test the abstract base class approach upon
which our objects are built.
"""
from unittest import TestCase
from serpentTools.parsers.base import BaseReader
class BadSubclass(BaseReader):
"""Class that does not overwrite abstract methods."""
def __init__(self):
BaseReader.__init__(self, None, '')... | CORE-GATECH-GROUP/serpent-tools | tests/test_meta.py | Python | mit | 992 |
import sys
def setup():
return
def run(core, actor, target, commandString):
if actor.getLevel() < 76:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
return
if core.entertainmentService.performEffect(actor, 'FireJetsB', 'clienteffect/entertainer_fire_jets2.cef', target) is True:
... | agry/NGECore2 | scripts/commands/firejet2.py | Python | lgpl-3.0 | 397 |
# coding: utf-8
#
# Copyright 2010 Alexandre Fiori
# based on the original Tornado by Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | fiorix/cyclone | demos/ssl/helloworld_simple.py | Python | apache-2.0 | 965 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Schema for cdash.yaml configuration file.
.. literalinclude:: ../spack/schema/cdash.py
:lines: 13-
"""
#: Propert... | rspavel/spack | lib/spack/spack/schema/cdash.py | Python | lgpl-2.1 | 971 |
# Copyright 2014-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | abydos/phonetic/_russell_index.py | Python | gpl-3.0 | 3,705 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 8 18:16:30 2015
@author: mehdi.rahim@cea.fr
"""
import os, sys
import numpy as np
from fetch_data import fetch_adni_baseline_rs_fmri, fetch_adni_masks, \
fetch_adni_longitudinal_rs_fmri_DARTEL, set_cache_base_dir
from base_connectivity_classifier... | mrahim/adni_rs_fmri_analysis | test_network_connectivity_classifier.py | Python | gpl-2.0 | 2,749 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2007 Troy Melhase
# Distributed under the terms of the GNU General Public License v2
# Author: Troy Melhase <troy@gci.net>
from os.path import join, split
from PyQt4.QtGui import QDialog
import profit
from profit.workbench.widgets.ui_aboutdialog import Ui_Abo... | InfiniteAlpha/profitpy | profit/workbench/aboutdialog.py | Python | gpl-2.0 | 1,117 |
# Copyright (c) 2012 Spotify AB
#
# 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, s... | mortardata/luigi | luigi/util.py | Python | apache-2.0 | 9,728 |
"""
Tests i18n in courseware
"""
import re
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
@attr('shard_1')
@override_settings(LANGUAGES=[('eo', 'Esperanto'), ('ar', 'Arabic')])
class I18nTestCase(TestCase):
"""
Tests for i18n
"""
... | kamalx/edx-platform | lms/djangoapps/courseware/tests/test_i18n.py | Python | agpl-3.0 | 2,105 |
#!/usr/bin/python
from math import *
from itertools import ifilterfalse
Temperature=1700 # Temperature in Kelvins
dtmd=0.1 # timestep in COLVAR file (ps)
vesbiascol=5 # Column of VES bias (index starting from 1)
metabiascol=7 # Column of metadynamics bias (index starting from 1)
fname='COLVAR' ... | PabloPiaggi/plumed2 | user-doc/tutorials/others/ves-lugano2017-kinetics/TRAJECTORIES-1700K/get-all-fpt.py | Python | lgpl-3.0 | 981 |
"""Predicted Electoral Vote Count"""
import re
from madcow.util.http import getsoup
from madcow.util.color import ColorLib
from madcow.util import Module, strip_html
class Main(Module):
pattern = re.compile(r'^\s*(election|ev)\s*$', re.I)
help = u'ev - current election 2008 vote prediction'
baseurl = u'h... | icucinema/madcow | madcow/modules/election.py | Python | gpl-3.0 | 1,577 |
# !/usr/bin/env python3
"""
This is the GSM Entry Point
ALl the processing and redirection should be done here.
"""
# ====================== GPL License and Copyright Notice ======================
# This file is part of ModReader
# Copyright (C) 2016 Diana Land
#
# This program is free software: you can redistribute i... | iaz3/ModReader | modreader/game/skyrim/main.py | Python | gpl-3.0 | 2,324 |
import numpy as np
folder = "/tmp/"
def SetOutputTimesteps(algorithm, timesteps):
executive = algorithm.GetExecutive()
outInfo = executive.GetOutputInformation(0)
outInfo.Remove(executive.TIME_STEPS())
for timestep in timesteps:
outInfo.Append(executive.TIME_STEPS(), timestep)
out... | FHust/ISEAFramework | auswertung/paraview/requestInformation.py | Python | gpl-3.0 | 664 |
# -*- coding: utf-8 -*-
from expects import expect
from mamba import describe, context, before
from spec.ui._ipod_helpers import *
from spec.ui._fixture import update_environment
with describe('ipodio playlist create') as _:
@before.all
def setup_all():
_.new_name = 'leño'
_.playlist_name =... | jvrsantacruz/ipodio | spec/ui/playlist_rename_spec.py | Python | bsd-3-clause | 1,953 |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic import (CreateView,
UpdateView,
DeleteView
)
from django.core.urlresolvers import (reverse,
... | henrykh/django-imager | imager_images/views.py | Python | mit | 6,738 |
import unittest
import os
import json
import time
from os import environ
from ConfigParser import ConfigParser
from pprint import pprint
from biokbase.workspace.client import Workspace as workspaceService
from psd_count_contigs.psd_count_contigsImpl import psd_count_contigs
class psd_count_contigsTest(unittest.Test... | janakagithub/psd_count_contigs | test/psd_count_contigs_server_test.py | Python | mit | 2,393 |
import __settings__
from __settings__ import INSTALLED_APPS
assert hasattr(__settings__, 'BASE_DIR'), 'BASE_DIR required'
INSTALLED_APPS += (
'post',
)
| novafloss/django-compose-settings | tests/fixtures/my_app/settings/post.py | Python | mit | 161 |
import argparse
import graph
import json
FIELD = 'code_size'
OPTIMIZATIONS = sorted(['copyprop', 'dce', 'inline', 'no_opts', 'peephole',
'simplify', 'tce'])
BENCHMARKS = sorted(['alignment', 'dft', 'inlining', 'knuth_bendix', 'life',
'mandelbrot', 'matrix_multiplication', '... | j-c-w/mlc | microbench/pass_comparison_code_size.py | Python | gpl-3.0 | 2,569 |
'''lima: Lightweight Marshalling of Python 3 Objects.'''
# pollute package namespace with the most commonly used names
from lima import exc
from lima import fields
from lima import schema
from lima.schema import Schema
__version__ = '0.6.dev0'
| b6d/lima | lima/__init__.py | Python | mit | 246 |
"""
A dates class to parse and represent local calendar.abs
"""
import time
import calendar
from time import localtime, struct_time
from datetime import datetime, date, timedelta
# Define default date format
DEFAULT_DATE_FORMAT = '%Y-%m-%d'
# Define default first day of week
DEFAULT_WEEK_START_DAY = 1
# Define defaul... | tonylixu/python-tools | python3/pysysadmin/sysadmin/dates.py | Python | gpl-3.0 | 2,840 |
import os
import sys
import time
start = time.time()
triangle_file = sys.argv[1] if len(sys.argv) == 2 else "big_triangle.txt"
print "node using '%s'" % triangle_file
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
triangle_file))
# method to integerify ... | bertrandvidal/stuff | triangle/node_triangle.py | Python | unlicense | 2,192 |
# Copyright (C) 2014, Hitachi, Ltd.
#
# 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... | Accelerite/cinder | cinder/volume/drivers/hitachi/hbsd_iscsi.py | Python | apache-2.0 | 16,787 |
# -*- coding: ISO-8859-15 -*-
from twisted.web import client
from twisted.internet.defer import inlineCallbacks
from core.Uusipuu import UusipuuModule
import urllib, simplejson
class Module(UusipuuModule):
def startup(self):
self.log('google.py loaded')
@inlineCallbacks
def cmd_google(self, ... | desaster/uusipuu | modules/google.py | Python | bsd-2-clause | 1,007 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2017 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... | alexforencich/python-ivi | ivi/agilent/agilentBase8590A.py | Python | mit | 2,338 |
import numpy as np
from bokeh.models import ColumnDataSource, Plot, LinearAxis, Grid
from bokeh.models.markers import Cross
from bokeh.io import curdoc, show
N = 9
x = np.linspace(-2, 2, N)
y = x**2
sizes = np.linspace(10, 20, N)
source = ColumnDataSource(dict(x=x, y=y, sizes=sizes))
plot = Plot(
title=None, pl... | stonebig/bokeh | examples/reference/models/Cross.py | Python | bsd-3-clause | 775 |
# Copyright (C) 2016 Swift Navigation Inc.
# Contact: Valeri Atamaniouk <valeri@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... | swift-nav/peregrine | peregrine/iqgen/if_iface.py | Python | gpl-3.0 | 8,812 |
"""
Python Interchangeable Virtual Instrument Driver
Copyright (c) 2012-2014 Alex Forencich
Modified by Coburn Wightman 2017
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,... | coburnw/hp5334-ivi | local/__init__.py | Python | mit | 1,303 |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agree... | deepmind/xmanager | xmanager/generated/data_pb2.py | Python | apache-2.0 | 9,504 |
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import os
DATA_DIR = "data" # put your posts-2011-12.xml into this directory
CHART_DIR = "charts"
fil... | krahman/BuildingMachineLearningSystemsWithPython | ch05/data.py | Python | mit | 532 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 09/09/2015
Updated: 07/03/2018
# Description
Selection sorting is conceptually probably the simplest sorting algorithm.
This algorithm first finds the smallest element in the list and exchanges it
with the element in ... | nbro/ands | ands/algorithms/sorting/comparison/selection_sort.py | Python | mit | 1,231 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Bot to create capitalized redirects where the first character of the first
word is uppercase and the remainig characters and words are lowercase.
Command-line arguments:
¶ms;
-always Don't prompt to make changes, just do them.
-titlecase creates a... | races1986/SafeLanguage | CEM/capitalize_redirects.py | Python | epl-1.0 | 3,855 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
'Base command to include ES logging'
from __future__ import absolute_import
from __future__ import unicode_literals
imp... | Pike/elmo | apps/l10nstats/management/__init__.py | Python | mpl-2.0 | 786 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
from pytraits import extendable
# Let's start by creating a simple class with some values. It contains
# class variables and instance variables. Composed methods will have
# access to all these variables.
@extendable
class ExampleClass(object):
PUBLIC = 24
_HIDDEN... | Debith/py2traits | examples/instance_is_composed_from_cherrypicked_method_in_class.py | Python | apache-2.0 | 2,033 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Mischa Peters <mpeters@a10networks.com>,
# Eric Chou <ericc@a10networks.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = t... | alxgu/ansible | lib/ansible/modules/network/a10/a10_service_group.py | Python | gpl-3.0 | 13,223 |
#!/usr/bin/env python
# encoding: utf-8
#
# 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, Versi... | chrismattmann/NLTKRest | nltkrest/nltkrest/server.py | Python | apache-2.0 | 4,079 |
from day_17 import parse, find_n_combos, find_min_combos
def test_parse():
assert parse("20\n15\n10\n5\n5") == [5, 5, 10, 15, 20]
assert parse("10\n15\n20\n5\n5") == [5, 5, 10, 15, 20]
def test_parse_with_empty_line():
assert parse("20\n15\n10\n5\n5\n") == [5, 5, 10, 15, 20]
assert parse("10\n15\n20... | masasin/advent_of_code_2015 | tests/test_day_17.py | Python | mit | 521 |
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contract 89233218CNA000001 #
... | CSD-Public/stonix | src/stonix_resources/solaris.py | Python | gpl-2.0 | 7,231 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Alan Tindale, 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
#
#... | atindale/business-glossary | app/commands.py | Python | apache-2.0 | 1,736 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from decimal import Decimal
from unittest import skipIf
from django import test
from django import VERSION as DJANGO_VERSION
from django.utils import timezone
from django.utils import translation
from yepes.contrib.registry... | samuelmaudo/yepes | tests/modelmixins/tests.py | Python | bsd-3-clause | 44,994 |
# test making a FAT filesystem on a very large block device
try:
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
uos.VfsFat
except AttributeError:
print("SKIP")
raise SystemExit
class RAMBDevSparse:
SEC_SIZE = 512
def __init__(self, blocks):
self.blocks =... | pozetroninc/micropython | tests/extmod/vfs_fat_ramdisklarge.py | Python | mit | 1,659 |
if isinstance(varA, basestring) or isinstance(varB, basestring):
print("string involved")
elif varA > varB:
print("bigger")
elif varA == varB:
print("equal")
elif varA < varB:
print("smaller") | mottosso/mitx-6.00.1x | week1/l2problem11.py | Python | mit | 200 |
# -*- coding: utf-8 -*-
##
## Some functions about dates
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 Fr... | inspirehep/invenio | modules/miscutil/lib/dateutils.py | Python | gpl-2.0 | 19,099 |
"""
Experiment Diary 2016-05-17
"""
import sys
import math
import matplotlib.pyplot as plt
from scipy import io
import numpy as np
from scipy.sparse.linalg import *
sys.path.append("../src/")
from worker import Worker
from native_conjugate_gradient import NativeConjugateGradient
from native_conjugate_gradient import ... | sclc/NAEF | exp_scripts/worker_exp_160517.py | Python | gpl-3.0 | 6,536 |
from django.conf.urls.defaults import patterns, include, url
from django.http import HttpResponseRedirect
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'upload.views.home', name='home'),
url... | aih/pdf2html | urls.py | Python | mit | 854 |
# -*- coding: utf-8 -*-
import calendar
from datetime import datetime, timedelta
from flask import Blueprint, render_template
from solarpi.charts.helper import get_timestamps, get_daily_pv_chart_data
from solarpi.electricity.helper import get_last_n_days_import
from solarpi.pvdata.helper import (
get_sec,
get... | Tafkas/solarpi | solarpi/charts/views.py | Python | bsd-3-clause | 4,772 |
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""Robustly perform a checkout.
This extension provides the ``hg robustcheckout`` command for
ensuring a working directory is updated to the specified revision
from a source repo usin... | Yukarumya/Yukarum-Redfoxes | testing/mozharness/external_tools/robustcheckout.py | Python | mpl-2.0 | 14,769 |
from menpo.base import MenpoMissingDependencyError
try:
import menpofit
except ImportError:
raise MenpoMissingDependencyError('menpofit')
# Continue with imports if we have menpofit
from collections import OrderedDict
import numpy as np
import ipywidgets
import IPython.display as ipydisplay
import matplot... | grigorisg9gr/menpowidgets | menpowidgets/menpofit/base.py | Python | bsd-3-clause | 106,403 |
import os
import sys
VERSION = (0,1,0)
VERSION_STRING = "v%d.%d.%d" % VERSION
TITLE = "Orbis :: %s" % VERSION_STRING
#setup root directory path
FROZEN = getattr(sys, 'frozen', '')
if not FROZEN: # not frozen: in regular python interpreter
ROOT = os.path.abspath(os.path.dirname(__file__))
FROZEN = False
elif F... | randlet/Orbis | orbis/settings.py | Python | bsd-3-clause | 628 |
#from https://gist.github.com/sixtenbe/1178136
import numpy as np
from math import pi, log
import pylab
from scipy import fft, ifft
from scipy.optimize import curve_fit
i = 10000
x = np.linspace(0, 3.5 * pi, i)
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 *
np.random.randn(i))
def _dat... | timothydmorton/kepler-rotation | rotation/findpeaks.py | Python | mit | 28,319 |
# Copyright (C) IBM Corp. 2016.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | gutoyr/builds | lib/repository.py | Python | gpl-3.0 | 12,011 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# import datasets.face
# import os
# import datasets.imdb as imdb
# imp... | playerkk/face-py-faster-rcnn | lib/datasets/face.py | Python | mit | 14,779 |
import logging
import random
from xmodule.x_module import XModule, STUDENT_VIEW
from xmodule.seq_module import SequenceDescriptor
from lxml import etree
from xblock.fields import Scope, Integer
from xblock.fragment import Fragment
log = logging.getLogger('edx.' + __name__)
class RandomizeFields(object):
choic... | geekaia/edx-platform | common/lib/xmodule/xmodule/randomize_module.py | Python | agpl-3.0 | 3,692 |
"""
Example script
"""
import argparse
import os
#from unimorph_inflect import download
from unimorph_inflect.utils.resources import download, DEFAULT_MODEL_DIR
from unimorph_inflect import inflect
if __name__ == '__main__':
# get arguments
parser = argparse.ArgumentParser()
# main arguments
parser.a... | antonisa/unimorph_inflect | examples/example.py | Python | apache-2.0 | 2,164 |
import sys, os
from rpython.rlib import jit
from rpython import conftest
class o:
view = False
viewloops = True
conftest.option = o
from rpython.jit.metainterp.test.test_ajit import LLJitMixin
from sqpyte.interpreter import Sqlite3DB, Sqlite3Query
from sqpyte.capi import CConfig
from sqpyte.test.test_interpre... | HPI-SWA-Lab/SQPyte | sqpyte/test/jit.py | Python | mit | 3,288 |
def get_stack_elements(stack):
return stack[1:stack.top].elements
def get_queue_elements(queue):
if queue.head <= queue.tail:
return queue[queue.head:queue.tail - 1].elements
return queue[queue.head:queue.length].elements + queue[1:queue.tail - 1].elements
| wojtask/CormenPy | test/queue_util.py | Python | gpl-3.0 | 279 |
from django.shortcuts import render, render_to_response, RequestContext
from django.http import HttpResponseRedirect
from django.core.context_processors import csrf
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from .forms import ... | drchangliu/VisualPhonetics | VowelCatApp/views.py | Python | mit | 3,528 |
title = "The Meaning of Life"
quote="Hello World!"
| dreadrel/UWF_2014_spring_COP3990C-2507 | notebooks/scripts/myfile.py | Python | apache-2.0 | 51 |
from django.core.files.base import File
from django.core.files.storage import FileSystemStorage
from os.path import join as joinpath, dirname
from django import test
from ginger.views.storages import StorageFile
MEDIA_ROOT = joinpath(dirname(__file__), "media")
@test.override_settings(MEDIA_ROOT=MEDIA_ROOT)
class T... | vivsh/django-ginger | _tests/storage.py | Python | mit | 658 |
#!/usr/bin/env python
from __future__ import division # so that 1/3=0.333 instead of 1/3=0
__author__ = 'Horea Christian' #if you contribute add your name to the end of this list
import numpy as np
from os import path, listdir
import pandas as pd
from chr_helpers import get_config_file
import fnmatch
def parse_result... | TheChymera/questioPy | questiopy.py | Python | gpl-3.0 | 3,787 |
# Author: Hubert Kario, (c) 2018
# Released under Gnu GPL v2.0, see LICENSE file for details
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHelloGene... | tomato42/tlsfuzzer | scripts/test-tls13-pkcs-signature.py | Python | gpl-2.0 | 9,887 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app1', '0015_auto_20141106_1337'),
]
operations = [
migrations.AlterField(
model_name='event',
name=... | AGnarlyNarwhal/cse360_webapp | app1/migrations/0016_auto_20141106_1434.py | Python | gpl-2.0 | 535 |
from __future__ import print_function
import math
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from... | choupi/NDHUDLWorkshop | 2048/value_2048.py | Python | mit | 2,251 |
# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your op... | marshall/pynaries | paramiko/kex_group1.py | Python | apache-2.0 | 5,349 |
# -*- 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):
# Removing unique constraint on 'Url', fields ['url', 'site']
db.delete_unique('seo_url', ['url', 'site_id']... | bashu/django-easy-seo | seo/south_migrations/0004_auto__del_url__del_unique_url_url_site.py | Python | gpl-3.0 | 2,904 |
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | carl-mastrangelo/grpc | src/python/grpcio_tests/tests/fork/_fork_interop_test.py | Python | apache-2.0 | 5,521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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... | Nazg-Gul/bfarm | lib/master/RenderServer.py | Python | gpl-2.0 | 9,142 |
from django.db import models
from django.conf import settings
from mygpo.core.models import UpdateInfoModel, DeleteableModel
from mygpo.podcasts.models import Podcast
class PodcastSuggestion(UpdateInfoModel, DeleteableModel):
"""A podcast which is suggested to a user
A suggestion can be marked as "unwanted"... | gpodder/mygpo | mygpo/suggestions/models.py | Python | agpl-3.0 | 697 |
import math, time
import Utility
from Utility import *
from kivy.animation import Animation
from Sprite import Sprite, SpriteMgr
from Particle import gFxMgr
from Character import gCharacterMgr
from Stuff import gStuffMgr
from ResourceMgr import gResMgr
from Constants import *
import GameFrame
import Character
class S... | ubuntunux/JumpJump | Stage.py | Python | gpl-3.0 | 2,921 |
from collections import deque
from webskewer.common.http_grammar import range_spec
from webskewer.common.exceptions import BadRangeSpecError
def parse_range(s):
start, end = (int(x) if x else None for x in s.split('-', 1))
if (start, end) == (None, None):
raise BadRangeSpecError((start, end))
if ... | dhain/webskewer | webskewer.common/webskewer/common/range_util.py | Python | mit | 3,311 |
# Copyright (c) 2015,2016,2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the `skewt` module."""
import matplotlib
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt
import numpy as np
import pytest
from metpy... | jrleeman/MetPy | metpy/plots/tests/test_skewt.py | Python | bsd-3-clause | 11,649 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (c) 2017, Antonio Coratelli.
Released under BSD 3-Clause License. See 'LICENSE' file.
'''
from peewee import *
import random
import dateutil.parser
from datetime import datetime, timedelta
database = SqliteDatabase(None)
class DBMODEL(Model):
class M... | antoniocoratelli/rss2mail | src/rss2mail/dbschema.py | Python | bsd-3-clause | 5,062 |
#!/usr/bin/env python
# encoding: utf-8
"""
AutoRunner -- Determine the correct runner class (GDB, ASan, etc) for
the given program, instantiate and return it.
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a co... | lazyparser/FuzzManager | FTB/Running/AutoRunner.py | Python | mpl-2.0 | 6,653 |
#!/usr/bin/python
"""
PunkMoney 0.2 :: graph.py
Calculates karma as PageRank in the thank-you graph.
"""
# Create a graph
import networkx as nx
from networkx.exception import NetworkXError
from mysql import Connection
from pprint import pprint
import math
import operator
class Karma(Connection):
def __init_... | webisteme/punkmoney | tracker/utils/graph.py | Python | mit | 1,913 |
"""
get latest integration branch:
Returns the latest integration branch for {0}
Usage:
get latest integration branch
"""
import logging
import pycurl
import json
from StringIO import StringIO
import re
import hepshell
LOG = logging.getLogger(__name__)
URL = 'https://api.github.com/re... | kreczko/l1t_cli | l1t_cli/commands/get/latest/integration/tag/__init__.py | Python | apache-2.0 | 2,335 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | vincent-noel/libSigNetSim | libsignetsim/numl/container/ListOf.py | Python | gpl-3.0 | 1,379 |
"Supporting objects and functions to convert Matplotlib objects into Bokeh."
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.t... | canavandl/bokeh | bokeh/mpl.py | Python | bsd-3-clause | 18,551 |
from flask import request
from kubeflow.kubeflow.crud_backend import api, decorators, helpers, logging
from ...common import form, utils, volumes
from ..utils import common as rok_common
from . import bp
log = logging.getLogger(__name__)
@bp.route("/api/namespaces/<namespace>/notebooks", methods=["POST"])
@decorat... | kubeflow/kubeflow | components/crud-web-apps/jupyter/backend/apps/rok/routes/post.py | Python | apache-2.0 | 3,058 |
#!/usr/bin/python
#
# Copyright (C) 2008 Google 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 ... | pforret/python-for-android | python3-alpha/python-libs/atom/url.py | Python | apache-2.0 | 4,351 |
# shipSETCapNeedAmarrTacticalDestroyer2
#
# Used by:
# Ship: Confessor
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Energy Turret"),
"capacitorNeed", ship.getModifiedItemAttr("shipBonusTacticalDestroyerA... | Ebag333/Pyfa | eos/effects/shipsetcapneedamarrtacticaldestroyer2.py | Python | gpl-3.0 | 397 |
"""Support for Z-Wave."""
import asyncio
import copy
from importlib import import_module
import logging
from pprint import pprint
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import callback, CoreState
from homeassistant.helpers import discovery
from homeassistant.helpers.... | fbradyirl/home-assistant | homeassistant/components/zwave/__init__.py | Python | apache-2.0 | 46,742 |
# -*- coding: utf-8 -*-
import unittest
import os
import json
from base64 import urlsafe_b64decode as decode
from base64 import urlsafe_b64encode as encode
from hashlib import sha1
import hmac
import urllib
from qiniu import conf
from qiniu import rpc
from qiniu import rs
conf.ACCESS_KEY = os.getenv("QINIU_ACCESS_KEY... | ego008/ijd8 | sae/qiniu/rs/test/rs_token_test.py | Python | mit | 1,429 |
# What's the single most important factor in designing your application schema within MongoDB?
# Matching the data access patterns of your application.
# Which data access pattern is not well supported by the blog schema?
# Providing a table of contents by tag
# What does Living Without Constraints refer to?
# Keepin... | baocongchen/M101P-MONGODB-FOR-PYTHON-DEVELOPERS | week3/Quiz.py | Python | mit | 578 |
# Liberally borrowed http://stackoverflow.com/a/21515453/2367526
def split_obj (obj, prefix = None):
'''
Split the object, returning a 3-tuple with the flat object, optionally
followed by the key for the subobjects and a list of those subobjects.
'''
# copy the object, optionally add the prefix be... | NewKnowledge/punk | punk/preppy/format.py | Python | mit | 1,593 |
#!/usr/bin/env python
"""
configure the setup.py setting the sources files among other things setup.py needs
"""
import sys
import re
try:
import argparse
except ImportError:
print ""
print "****ERROR****"
print "The following errors occured while configuring tellapic:\n"
print "No argparse module foun... | tectronics/tellapic | src/swig/python/configure_setup.py | Python | gpl-3.0 | 2,808 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 Intel
#
# Author: Shuangtai Tian <Shuangtai.tian@intel.com>
#
# 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/licen... | NeCTAR-RC/ceilometer | ceilometer/tests/compute/notifications/test_cpu.py | Python | apache-2.0 | 6,830 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | Danielweber7624/pybuilder | src/main/python/pybuilder/plugins/source_distribution_plugin.py | Python | apache-2.0 | 1,845 |
import os
from cement.utils.test import raises
from cement.cli.main import main
from cement.cli.main import CementTestApp as App
def test_main(tmp):
with raises(SystemExit):
main()
def test_app():
argv = []
with App(argv=argv) as app:
no_base_controller_retval = app.run()
asser... | datafolklabs/cement | tests/cli/test_main.py | Python | bsd-3-clause | 557 |
from itertools import imap, count
import idaapi
import idautils
import idc
from ..core import fix_addresses
from .xref import Xref
from .instruction import Instruction
from ..ui import updates_ui
from .base import get_selection, get_offset_name, demangle
from .. import data
class Comments(object):
"""IDA Line Com... | chubbymaggie/Sark | sark/code/line.py | Python | mit | 8,653 |
'''
Fibonacci Sequence
'''
from time import clock
def F(n):
if n == 0: return 0
elif n == 1: return 1
else: return F(n-1)+F(n-2)
def main():
start = clock()
a = F( 32 )
print(clock()-start)
main() | secureosv/pythia | regtests/bench/recursive_fib.py | Python | bsd-3-clause | 207 |
# Copyright 2021 Google LLC. 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 a... | GoogleCloudPlatform/professional-services | examples/vertex_pipeline/components/component_base/src/metrics.py | Python | apache-2.0 | 2,442 |
"""
Contains things to detect changes - either using options passed in on the
commandline, or by using autodetection, etc.
"""
from __future__ import print_function
from django.db import models
from django.contrib.contenttypes.generic import GenericRelation
from django.utils.datastructures import SortedDict
from sou... | mvaled/sentry | src/south/creator/changes.py | Python | bsd-3-clause | 26,101 |
import collections
import functools
import json
import os
import re
import textwrap
from collections import OrderedDict
import simple_yaml as yaml
from flask import abort as flask_abort
from flask import Flask, jsonify, request
from jinja2 import Template
from markdown import markdown as origin_markdown
from validr im... | ncuhome/fighting | fighting/app.py | Python | mit | 6,981 |
#MIT Getting Started
raw_input('Enter the value')
# x = raw_input('Enter your last name: ')
# print ('your name is' + x) | FBH037/MIT-Open-Courseware-class-6.00 | MIT Getting Started.py | Python | mit | 124 |
from cStringIO import StringIO
import boto.exception
import boto.s3.connection
import boto.s3.acl
import boto.s3.lifecycle
import bunch
import datetime
import time
import email.utils
import isodate
import nose
import operator
import socket
import ssl
import os
import requests
import base64
import hmac
import sha
import... | CatKang/zeppelin-gateway | tests/s3tests/functional/test_s3.py | Python | apache-2.0 | 247,302 |
from __future__ import print_function, division
from sympy.core import S, sympify, cacheit, pi, I, Rational
from sympy.core.add import Add
from sympy.core.function import Function, ArgumentIndexError, _coeff_isneg
from sympy.functions.combinatorial.factorials import factorial, RisingFactorial
from sympy.functions.elem... | kaushik94/sympy | sympy/functions/elementary/hyperbolic.py | Python | bsd-3-clause | 48,081 |
#!/usr/bin/env python
#
# make_mock_solid_dir.py: make mock SOLiD directory for test purposes
# Copyright (C) University of Manchester 2011 Peter Briggs
#
########################################################################
#
# make_mock_solid_dir.py
#
#######################################################... | fw1121/genomics | utils/make_mock_solid_dir.py | Python | artistic-2.0 | 1,723 |
from braces.views import JsonRequestResponseMixin, LoginRequiredMixin
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views import View
from astrobin_apps_users.services import UserService
class EmptyTrash(JsonRequestResponseMixin, LoginRequiredMixin, View):
... | astrobin/astrobin | astrobin_apps_json_api/user/views/empty_trash.py | Python | agpl-3.0 | 584 |
"""
Linux on Hyper-V and Azure Test Code, ver. 1.0.0
Copyright (c) Microsoft Corporation
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/LICEN... | mihaico/lis-test | WS2012R2/lisa/tools/middleware_bench/providers/amazon_service.py | Python | apache-2.0 | 17,854 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/protocol/receiver.py | Python | bsd-3-clause | 7,389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.