code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
from setuptools import setup
setup()
| scienceopen/pyAIRtools | setup.py | Python | bsd-3-clause | 61 |
class Solution:
# returns sum of contiguous non-empty subarray with greatest sum
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
sumCurr = 0
sumMax = -math.inf
for i in range(len(nums)):
sumCurr += nums[i]
if ... | SelvorWhim/competitive | LeetCode/MaximumSubarray.py | Python | unlicense | 588 |
# Copyright 2018 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 a... | GoogleCloudPlatform/cloud-foundation-toolkit | dm/templates/forwarding_rule/forwarding_rule.py | Python | apache-2.0 | 3,116 |
class Capturer:
def toogle_saving_images(self):
pass
def save_images_dir(self, path):
pass
def save_images_speed(self,parity):
pass
def start_capture(self):
pass
def log(self,string):
pass
def get_last_frame_pil(self):
pass
def get_last_... | detorto/mariobot | Capture/Capturer.py | Python | mit | 446 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Rashminadig/SDN | ryu/tests/switch/tester.py | Python | apache-2.0 | 34,887 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import django.views.generic
from django.http import HttpResponseRedirect
from django.views... | shoopio/shoop | shuup/front/apps/personal_order_history/views.py | Python | agpl-3.0 | 2,304 |
def duplicate_sandwich(arr):
seen = set()
for word in arr:
if word in seen:
double = word
break
seen.add(word)
i1 = -1
i2 = -1
for i,word in enumerate(arr):
if word == double:
if i1 < 0:
i1 = i
else:
... | SelvorWhim/competitive | Codewars/DuplicateSandwich.py | Python | unlicense | 377 |
from tests.base_test import BaseTest
from tests import config
from core.sessions import SessionURL
from core import modules
from core import messages
import subprocess
import logging
import tempfile
import os
import re
import time
import json
import socket
class Proxy(BaseTest):
def setUp(self):
session ... | epinna/weevely3 | tests/test_net_proxy.py | Python | gpl-3.0 | 4,397 |
# -*- coding: utf-8 -*-
"""Tests for safetymomentum views."""
from django.test import TestCase
class TestHome(TestCase):
"""Test the home page."""
def test_get_home(self):
"""Test GET /."""
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
| jwhitlock/safetymomentum | safetymomentum/tests/test_views.py | Python | mpl-2.0 | 302 |
# -*- coding: utf-8 -*-
# © 2017 Savoir-faire Linux
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import logging
from odoo import api, SUPERUSER_ID
logger = logging.getLogger(__name__)
def update_partners_indexed_name(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
logger.info('... | savoirfairelinux/partner-addons | partner_duplicate_mgmt/init_hook.py | Python | lgpl-3.0 | 443 |
# This file is part of Mylar.
# -*- coding: utf-8 -*-
#
# Mylar 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.
#
# Mylar is dist... | evilhero/mylar | mylar/webserve.py | Python | gpl-3.0 | 350,353 |
# -*- coding: utf-8 -*-
import sqlite3
class GalaxyDB:
PLANET_TYPE_PLANET = 1
PLANET_TYPE_BASE = 5
def __init__(self):
self._conn = sqlite3.connect('galaxy5.db')
self._conn.row_factory = sqlite3.Row
self._cur = self._conn.cursor()
self._log_queries = False
def create... | minlexx/xnova_galaxy_parser | site_uni5/classes/galaxy_db.py | Python | gpl-3.0 | 8,514 |
# Copyright (c) 2012 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 logging
import os
import unittest
from telemetry.core import browser_finder
from telemetry.unittest import options_for_unittests
class BrowserTes... | pozdnyakov/chromium-crosswalk | tools/telemetry/telemetry/core/browser_unittest.py | Python | bsd-3-clause | 4,041 |
# (c) 2015, Jon Hadfield <jon@lessknown.co.uk>
"""
Description: This lookup takes an AWS region and a list of one or more
subnet names and returns a list of matching subnet ids.
Example Usage:
{{ lookup('aws_subnet_ids_from_names', ('eu-west-1', ['subnet1', 'subnet2'])) }}
"""
from ansible import errors
try:
impor... | jonhadfield/ansible-lookups | v1/aws_subnet_ids_from_names.py | Python | mit | 1,007 |
"""
Database crypto.
"""
import binascii
from sqlalchemy import func, and_
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from Crypto.Random import get_random_bytes
from Crypto.Protocol.KDF import PBKDF2
from ensconce import model, exc
from ensconce.model import meta
from ensconce.crypto import e... | EliAndrewC/ensconce | ensconce/crypto/util.py | Python | bsd-3-clause | 13,559 |
CHECKPOINT_FREQUENCY = 100
CHECKPOINT_MIN_WAIT = 300
DEFAULT_PROCESSOR_CHUNK_SIZE = 10
| dimagi/commcare-hq | corehq/ex-submodules/pillowtop/const.py | Python | bsd-3-clause | 88 |
'''
Created on Apr 18, 2010
@author: ulno
Create from the images path the corresponding directory in images.
inkscape is needed for this
'''
import glob
import sys
import os
import re
import subprocess
import distutils.dir_util
import pygame
# the source images in SVG
IMAGE_DIRECTORY=os.path.join("..","images")
... | ulno/mcminos | extra/converters/convert_images.py | Python | gpl-3.0 | 18,629 |
from .HtmlElementModule import HtmlElement
from .TextElementModule import TextElement
class Label(HtmlElement):
def __init__(self, value, **attributes):
HtmlElement.__init__(self, 'label', **attributes)
self.append(TextElement(value))
| megamandos/spiderbox | html/LabelModule.py | Python | mit | 256 |
#!/usr/bin/python3
"""Apply a configuration file to a node
For example, we have the configuration of the databases in Zookeeper. We write
that config out to a JSON file:
/var/lib/zgres/config/databases.json
But, then we need to use that config to reconfigure various services, so we
write the code to reconfigure ... | jinty/zgres | zgres/apply.py | Python | mit | 5,218 |
# -*- 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):
# Changing field 'FeedImport.total_videos'
db.alter_column('localtv_feedimport', 'total_videos', self.gf('... | pculture/mirocommunity | localtv/migrations/0069_auto__chg_field_feedimport_total_videos__chg_field_searchimport_total_.py | Python | agpl-3.0 | 25,073 |
""" Tests for analytics.distributions """
from django.test import TestCase
from nose.tools import raises
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from instructor_analytics.distributions import AVAILABLE_PROFILE_FEATURES, profile_distribution
from student.models import CourseEnrollment
from studen... | pepeportela/edx-platform | lms/djangoapps/instructor_analytics/tests/test_distributions.py | Python | agpl-3.0 | 5,109 |
# Portions Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# Copyright 2014 Mercurial Contributors
#
# This software may be used and distributed according to the terms of the
# GNU General Public Licens... | facebookexperimental/eden | eden/hg-server/edenscm/mercurial/namespaces.py | Python | gpl-2.0 | 9,152 |
#!/usr/bin/env python
"""Clean a raw file from EOG and ECG artifacts with PCA (ie SSP)
"""
from __future__ import print_function
# Authors : Dr Engr. Sheraz Khan, P.Eng, Ph.D.
# Engr. Nandita Shetty, MS.
# Alexandre Gramfort, Ph.D.
import os
import sys
import mne
def clean_ecg_eog(in_fif_fna... | jaeilepp/eggie | mne/commands/mne_clean_eog_ecg.py | Python | bsd-2-clause | 4,882 |
from numpy import sum
from numpy import zeros
from gwlfe.Memoization import memoize
from gwlfe.MultiUse_Fxns.Erosion.ErosWashoff import ErosWashoff
from gwlfe.MultiUse_Fxns.Erosion.ErosWashoff import ErosWashoff_f
def LuErosion(NYrs, DaysMonth, InitSnow_0, Temp, Prec, NRur, NUrb, Acoef, KF, LS,
C, P, A... | WikiWatershed/gwlf-e | gwlfe/MultiUse_Fxns/Erosion/LuErosion.py | Python | apache-2.0 | 918 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | devananda/bifrost | bifrost/tests/test_bifrost.py | Python | apache-2.0 | 768 |
#!/usr/bin/env python3
# Copyright (C) 2017 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
child.expect(r... | x3ro/RIOT | tests/pkg_relic/tests/01-run.py | Python | lgpl-2.1 | 411 |
#!/usr/bin/python
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You ... | capveg/ONL | tools/py/pcgen.py | Python | epl-1.0 | 4,616 |
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
from orthography import add_suffix
import unittest
class OrthographyTestCase(unittest.TestCase):
def test_add_suffix(self):
cases = (
('artistic', 'ly', 'artistically'),
('cosmetic', 'ly', 'cosmetically'),
... | blockbomb/plover | plover/test_orthography.py | Python | gpl-2.0 | 4,487 |
def ga_key(request):
from django.conf import settings
return {'ga_key': settings.GOOGLE_ANALYTICS_KEY}
| mrpindo/openshift-estore | tokoku/tokoku/context_processors.py | Python | gpl-2.0 | 111 |
# file openpyxl/shared/units.py
# Copyright (c) 2010-2011 openpyxl
#
# 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, co... | sbhowmik7/PSSEcompare | ext_libs/openpyxl/shared/units.py | Python | gpl-3.0 | 2,039 |
from .image import Image
from .product_category import ProductCategory
from .supplier import Supplier, PaymentMethod
from .product import Product
from .product import ProductImage
from .enum_values import EnumValues
from .related_values import RelatedValues
from .customer import Customer
from .expense import Expense
fr... | betterlife/psi | psi/app/models/__init__.py | Python | mit | 875 |
"""update db functions
Revision ID: 8a786f9bf241
Revises: 0c2ff8b95c98
Create Date: 2017-09-27 00:11:13.429144
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8a786f9bf241'
down_revision = '0c2ff8b95c98'
branch_labels = None
depends_on = None
def upgrade():
... | SCUEvals/scuevals-api | db/alembic/versions/20170927001113_update_db_functions.py | Python | agpl-3.0 | 6,092 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Sylvain Boily
#
# 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... | sboily/xivo-popc-stats | popc_stats/plugins/popcstats/load.py | Python | gpl-3.0 | 1,022 |
# coding: utf-8
"""
Command Wrapper.
A command wrapper to get a live output displayed.
"""
import subprocess
import sys
from io import BufferedReader
from click import echo, style
def launch_cmd_displays_output(cmd: list, print_msg: bool = True, print_err: bool = True,
err_to_out: boo... | edyan/stakkr | stakkr/command.py | Python | apache-2.0 | 1,711 |
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wger W... | rolandgeider/wger | wger/utils/api_token.py | Python | agpl-3.0 | 1,240 |
import json
import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../scripts'))
from flask import Flask, render_template, request
from py2neo import neo4j
from ollie import pipeline
app = Flask(__name__)
"""@app.route('/render', method=['POST'])
def render():
pairs = json.loads(re... | dash1291/major | webserver/app.py | Python | gpl-3.0 | 4,561 |
#!/usr/bin/python
from pisi.actionsapi import shelltools, get, autotools, pisitools
def setup():
autotools.configure ("--disable-debugging \
--disable-static")
def build():
autotools.make ()
def install():
autotools.install ()
pisitools.dodoc ("COPYI... | richard-fisher/repository | multimedia/codecs/libmad/actions.py | Python | gpl-2.0 | 325 |
#!/usr/bin/python
import numpy
from paths.svms import mfeavg200, mfestd200, efeavg200, efestd200
from sequence.rna_tools import RNAFolder
from sequence.seq_tools import kContent
from libsvm import svmutil
FOLDER = RNAFolder(p=True)
def loadRange(fname):
avgs = []
stds = []
with open(fname, encoding='ut... | childsish/lhc-python | lhc/binf/feature/gen.py | Python | gpl-2.0 | 2,853 |
# (c) 2013, Jan-Piet Mens <jpmens(at)gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | krishnazure/ansible | lib/ansible/plugins/lookup/etcd.py | Python | gpl-3.0 | 2,396 |
#!/usr/bin/env python3
import asyncio
import os
from datetime import datetime
import aiohttp
from aiohttp import web
from raven import Client
from restaurants import (FormattedMenus, SafeRestaurant, OtherRestaurant,
AvalonRestaurant, TOTORestaurant, TOTOCantinaRestaurant,
... | fadawar/infinit-lunch | main.py | Python | gpl-3.0 | 2,316 |
# -*- coding: utf-8 -*-
import io
import logging
import re
from babelfish import Language, language_converters
from guessit import guessit
try:
from lxml import etree
except ImportError:
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
fr... | pedro2d10/SickRage-FR | lib/subliminal/providers/podnapisi.py | Python | gpl-3.0 | 6,891 |
from . import recipeMergerPlugin
plugins = [
recipeMergerPlugin.RecipeMergerPlugin,
recipeMergerPlugin.RecipeMergerImportManagerPlugin
]
| kirienko/gourmet | src/gourmet/plugins/duplicate_finder/__init__.py | Python | gpl-2.0 | 150 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-24 21:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
m... | jojoriveraa/titulacion-NFCOW | NFCow/users/migrations/0002_auto_20151224_2148.py | Python | apache-2.0 | 487 |
# 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-mgmt-compute/azure/mgmt/compute/compute/v2015_06_15/models/vault_secret_group.py | Python | mit | 1,462 |
#!/usr/bin/env python
import rospy
import math
import random
from std_msgs.msg import String
import sys
import array
pub = None
# not truly implemented yet.
# def floored_abs():
# counter = 1
# step_size = 5000
# maximum = 20000
# distance = maximum - counter
# duration = rospy.get_param("~durati... | andreasBihlmaier/arni | arni_core/test/predefined_publisher.py | Python | bsd-2-clause | 7,498 |
"""
Ecks plugin to collect system memory usage information
Copyright 2011 Chris Read (chris.read@gmail.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.... | cread/ecks | ecks/plugins/memory.py | Python | apache-2.0 | 1,335 |
import sys
import os
import numpy as np
import lasagne as nn
import theano
import theano.tensor as T
from PIL import Image
import utils as u
import models as m
import config as c
# 01/03/2016
# Trains a convnet for going from the conv features back to images
# because just using the bottom of the autoencoder doesn't ... | tencia/video_predict | train_deconv.py | Python | mit | 3,819 |
from AutoNetkit.examples.examples import *
import AutoNetkit.examples.examples
| sk2/ank_le | AutoNetkit/examples/__init__.py | Python | bsd-3-clause | 80 |
#!/usr/bin/env python
# Copyright (c) 2014, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" A... | PaloAltoNetworks/terraform-templates | pan_guard_duty/lambda_code/pandevice/objects.py | Python | apache-2.0 | 16,190 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("JEEVES_SETTINGS_MODULE", "settings")
from jeeves.core.management import execute_from_command_line
execute_from_command_line(sys.argv[1:])
| silent1mezzo/jeeves-framework | jeeves/conf/project_template/bot.py | Python | isc | 246 |
# -*- coding: utf-8 -*-
class TrafficEntry:
def __init__(self, broadcast_count=0L, broadcast_bytes=0L, unicast_count=0L, unicast_bytes=0L):
self.broadcast_count = broadcast_count
self.broadcast_bytes = broadcast_bytes
self.unicast_count = unicast_count
self.unicast_bytes = ... | relman/sevpn-mgmt-py | SevpnMgmtPy/admin_api/traffic.py | Python | mit | 1,143 |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test import Test... | MiltosD/CEFELRC | lib/python2.7/site-packages/django/contrib/auth/tests/views.py | Python | bsd-3-clause | 19,815 |
################################################################################################################
#
# Copyright 2022 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
... | googleforgames/clean-chat | components/model/bert/preprocessing.py | Python | apache-2.0 | 1,145 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------... | Ecpy/ecpy | exopy/app/api.py | Python | bsd-3-clause | 563 |
from __future__ import print_function
"""
Some tests for narrative exporting.
"""
__author__ = "Bill Riehl <wjriehl@lbl.gov>"
from biokbase.narrative.narrativeio import PermissionsError
from biokbase.narrative.exporter.exporter import NarrativeExporter
import os
import sys
import argparse
def main(args):
if not ... | mlhenderson/narrative | scripts/export_narrative.py | Python | mit | 1,511 |
# Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | DavidPurcell/murano_temp | murano/api/middleware/version_negotiation.py | Python | apache-2.0 | 3,306 |
from flask import Flask, jsonify, render_template, request
from werkzeug import secure_filename
#import inception_client
UPLOAD_FORDER = 'flaskr2/upload'
ALLOWED_ENTENSIONS = set(['txt','pdf','png','jpg','jpeg','gif'])
app = Flask(__name__,static_url_path='/flaskr2/static')
app.config['UPLOAD_FORDER'] = UPLOAD_FORDE... | yuzhao12/MindCamera | flaskr2/__init__.py | Python | mit | 512 |
import argparse
import pysam
import sys
from Bio import SeqIO
from Bio.Seq import Seq
def _gen_seqs(bam):
"""Yield SeqIO records of the reference sequence each query is aligned to."""
for read in bam:
ref_seq = read.get_reference_sequence().upper()
name = '{}_{}'.format(read.reference_name, re... | nanoporetech/pomoxis | pomoxis/ref_seqs_from_bam.py | Python | mpl-2.0 | 888 |
"""
This page is in the table of contents.
Stretch is very important Skeinforge plugin that allows you to partially compensate for the fact that extruded holes are
smaller then they should be. It stretches the threads to partially compensate for filament shrinkage when extruded.
The stretch manual page is at:
http://... | zeograd/gcodeutils | gcodeutils/stretch/stretch.py | Python | gpl-2.0 | 33,216 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/shell/gui/startShellGui.py | Python | gpl-3.0 | 4,687 |
__author__ = 'henla464'
import time
class LoraRadioMessageAndMetadata(object):
def __init__(self, loraRadioMessage):
self.loraRadioMessage = loraRadioMessage
self.timeCreated = time.monotonic()
def GetLoraRadioMessageRS(self):
return self.loraRadioMessage
def GetTimeCreated(self... | henla464/WiRoc-Python-2 | loraradio/LoraRadioMessageAndMetadata.py | Python | gpl-3.0 | 355 |
__kupfer_name__ = _("Document Templates")
__kupfer_sources__ = ("TemplatesSource", )
__kupfer_actions__ = ("CreateNewDocument", )
__description__ = _("Create new documents from your templates")
__version__ = ""
__author__ = "Ulrik Sverdrup <ulrik.sverdrup@gmail.com>"
import os
import gio
import glib
from kupfer.obje... | cjparsons74/kupfer | kupfer/plugin/templates.py | Python | gpl-3.0 | 3,706 |
# Copyright 2016, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools 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 option) any later ... | TresysTechnology/setools | setools/boundsquery.py | Python | lgpl-2.1 | 2,406 |
from openturns import *
from otfftw import *
from time import time
# Create a process sample
dim = 1
n = 8
tg = RegularGrid(0.0, 1.0, n)
process = SpectralNormalProcess(CauchyModel(NumericalPoint(dim, 1), NumericalPoint(dim, 1)), tg)
# Sample size
size = 3
# Sample the process
sample = process.getSample(size)
# Wel... | openturns/otfftw | doc/UC3_Welch.py | Python | gpl-3.0 | 564 |
import os
print("hello ACM\nWhat is your name??")
exitBool = True
def talk():
print("I'm sorry, " + name + ", but I can't do that")
anyKey1 = raw_input("\nPress any key to continue...")
os.system("clear")
name = raw_input()
print("Well hello there.")
while(exitBool):
print("\n\n\n\... | ChadJPetersen/RobotisCM-530WirelessProtocol | src/Controller/__init__.py | Python | gpl-2.0 | 617 |
# -*- 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 unique constraint on 'SidPoint', fields ['sidtime', 'idx']
db.create_unique('clouds_sidpoint', ['si... | Bjwebb/detecting-clouds | clouds/migrations/0013_auto__add_unique_sidpoint_sidtime_idx.py | Python | mit | 3,727 |
# Copyright 2017 Max W. Y. Lam
#
# 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, so... | MaxInGaussian/ZS-VAFNN | uci-expts/regression/protein/training.py | Python | apache-2.0 | 3,917 |
""" Cuckoo Filter, python implementation
License: MIT
Author: Tyler Barrus (barrust@gmail.com)
"""
import math
import random
from array import array
from io import BytesIO, IOBase
from mmap import mmap
from numbers import Number
from pathlib import Path
from struct import Struct
from typing import ByteString, ... | barrust/pyprobables | probables/cuckoo/cuckoo.py | Python | mit | 18,971 |
from BeautifulSoup import BeautifulSoup
import datetime
import urllib2
from rpi_courses.web import get
from features import * # all object postfixed with '_feature' will get used.
import re
RE_DIV = re.compile(r'</?div[^>]*?>', re.I)
def _remove_divs(string):
# Some of the DIV formatting even breaks beautif... | jeffh/rpi_courses | rpi_courses/sis_parser/course_catalog.py | Python | mit | 3,862 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# ttysnoop Watch live output from a tty or pts device.
# For Linux, uses BCC, eBPF. Embedded C.
#
# Due to a limited buffer size (see BUFSIZE), some commands (eg, a vim
# session) are likely to be printed a little messed up.
#
# Copyright (c)... | brendangregg/bcc | tools/ttysnoop.py | Python | apache-2.0 | 5,269 |
#!/usr/bin/env python
import argparse
import logging
import sys
import pebble.PblAnalytics as PblAnalytics
# Catch any missing python dependencies so we can send an event to analytics
try:
# NOTE: Even though we don't use websocket in this module, keep this
# import here for the unit tests so that they can ... | sdeyerle/pebble_fun | PebbleSDK-2.0-BETA7/tools/pebble.py | Python | gpl-2.0 | 6,157 |
from django.core.management import call_command
from django.core.management.commands.syncdb import Command as SyncDBCommand
from optparse import make_option
class Command(SyncDBCommand):
option_list = SyncDBCommand.option_list + (
make_option('--skip-migrations',
action='store_false',
... | paltman/nashvegas | nashvegas/management/commands/syncdb.py | Python | mit | 1,185 |
from flask import Flask, session, url_for, redirect, request, render_template, abort
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
import bcrypt
import smtplib
from datetime import datetime, date
import functools
import telepot
import threading
import enum
import requests
import os
import sys
... | LBindustries/Condivisione-Fermi | server.py | Python | lgpl-3.0 | 43,211 |
from copy import deepcopy
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import ( # noqa: E501
RULES,
)
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_consts import (
RULE_LEVEL_DANGER,
RULE_LEVEL_WARNING,
)
from monkey_island.cc.services.... | guardicore/monkey | monkey/tests/unit_tests/monkey_island/cc/services/zero_trust/scoutsuite/test_scoutsuite_rule_service.py | Python | gpl-3.0 | 2,287 |
import os
import patch_ng
import pytest
from conan.tools.files import patch, apply_conandata_patches
from conans.errors import ConanException
from conans.test.utils.mocks import ConanFileMock
class MockPatchset:
filename = None
string = None
apply_args = None
def apply(self, root, strip, fuzz):
... | conan-io/conan | conans/test/unittests/tools/files/test_patches.py | Python | mit | 7,379 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
from bgfiles.http import create_content_disposition
from django.test import SimpleTestCase
class CreateContentDispositionTest(SimpleTestCase):
def test(self):
header = create_content_disposition('Fu... | climapulse/dj-bgfiles | tests/test_http.py | Python | bsd-3-clause | 1,483 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | apps/about/src/about/urls.py | Python | apache-2.0 | 1,059 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple, OrderedDict
import itertools
import json
from six import string_types
from six.moves.urllib import parse
import requests
from pydrui... | kawamon/hue | desktop/core/ext-py/pydruid-0.5.11/pydruid/db/api.py | Python | apache-2.0 | 12,084 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# 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
# ... | nii-cloud/dodai-compute | nova/scheduler/simple.py | Python | apache-2.0 | 6,448 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Part of pymzml test cases
"""
import os
import pymzml.run as run
import unittest
from pymzml.spec import Spectrum, Chromatogram
import test_file_paths
class runTest(unittest.TestCase):
"""
"""
def setUp(self):
"""
"""
self.paths =... | StSchulze/pymzML | tests/main_reader_test.py | Python | mit | 9,619 |
import _plotly_utils.basevalidators
class ClicktoshowValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="clicktoshow", parent_name="layout.annotation", **kwargs
):
super(ClicktoshowValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/annotation/_clicktoshow.py | Python | mit | 555 |
# -*- coding: utf-8 -*-
"""Combatant API endpoints.
This module implements the REST API endpoints for managing combatants.
Currently included are:
CombatantApi: Invoked to create or update combatant records
CombatantListDataTable: Invoked to retrieve a list of combatant data formatted
for Dat... | lrt512/emol | emol/emol/api/combatant_api.py | Python | mit | 6,847 |
# Copyright 2015-2018 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 ... | FireballDWF/cloud-custodian | tools/c7n_azure/tests/test_networksecuritygroup.py | Python | apache-2.0 | 7,188 |
# region Description
"""
dhcpv6_server.py: DHCPv6 server (dhcpv6_server)
Author: Vladimir Ivanov
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from raw_packet.Utils.base import Base
from raw_packet.Utils.utils import Utils
from raw_packet.Utils.tm import ThreadManager
from raw_packet.... | Vladimir-Ivanov-Git/raw-packet | raw_packet/Servers/dhcpv6_server.py | Python | mit | 34,064 |
# Copyright (C) 2010-2017 GRNET S.A.
#
# 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 i... | grnet/synnefo | snf-webproject/synnefo/webproject/manage.py | Python | gpl-3.0 | 3,730 |
from typing import Dict, Optional, Tuple, Callable, Any, Union
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import json
import requests
import dateparser
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
# key = field of a ticket , val = ... | VirusTotal/content | Packs/QuestKace/Integrations/QuestKace/QuestKace.py | Python | mit | 36,041 |
import os
import socket
import StringIO
import tempfile
import time
import traceback
from django.conf import settings
import commonware.log
import requests
from PIL import Image
import amo.search
from amo.utils import memoize
from applications.management.commands import dump_apps
from lib.crypto import packaged, rec... | Joergen/zamboni | apps/amo/monitors.py | Python | bsd-3-clause | 9,414 |
"""This module provides helper functions for subprocess management."""
import logging
import signal
import subprocess
import sys
import os
import psutil
import cook
import cook.io_helper as cio
def launch_process(command, environment):
"""Launches the process using the command and specified environment.
P... | twosigma/Cook | executor/cook/subprocess.py | Python | apache-2.0 | 9,401 |
"""This class provides an iterator. Under the covers it does multi-threaded
consumption of events, only providing information to the iterator when it's
been ordered correctly."""
import cloudpassage
from halocelery.apputils import Utility as hc_util
class HaloEvents(object):
"""Instantiate with a donlib.ConfigH... | ashmastaflash/don-bot | app/donlib/halo_events.py | Python | bsd-3-clause | 1,891 |
from django.test import TestCase
from app_forum.models import Forum, Comment
from app_forum.forms import CommentForm, ThreadForm
# test for forms
class CommentFormTest(TestCase):
def test_comment_forms(self):
form_data = {
'comment_content' : 'comment'
}
form = CommentForm(dat... | django-id/website | app_forum/tests/test_forms.py | Python | mit | 685 |
import os
from PIL import Image
from vistas.core.graphics.overlay import BasicOverlayButton
from vistas.core.paths import get_resources_directory
class ExpandButton(BasicOverlayButton):
""" Expand/collapse button for the right panel """
def __init__(self):
self._expanded = False
self.image =... | VISTAS-IVES/pyvistas | source/vistas/ui/controls/expand_button.py | Python | bsd-3-clause | 748 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ------------------------------------
# file: manlabeled_nsamples.py
# date: Tue August 05 03:05 2014
# author:
# Maarten Versteegh
# github.com/mwv
# maartenversteegh AT gmail DOT com
#
# Licensed under GPLv3
# ------------------------------------
"""nsamples_performance_sup... | bootphon/monkey_business | nsamples_performance_supervised.py | Python | gpl-2.0 | 7,035 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/openstack/tests/unit/key_management/test_key_management_service.py | Python | mit | 1,130 |
import argparse
import sys
import unittest
from argparse import ArgumentParser, FileType
from gooey import GooeyParser
from gooey.python_bindings import argparse_to_json
from gooey.util.functional import getin
from gooey.tests import *
from gui.components.options.options import FileChooser
from gui.component... | chriskiehl/Gooey | gooey/tests/test_argparse_to_json.py | Python | mit | 12,621 |
import tmt
DESCRIPTION = "A dead simple svg generation library written in pure Java, with no dependencies. This code runs on both desktop Java, Android, and compiles to Javascript with GWT."
tmt.EclipseProject(tmt.projectName(), description=DESCRIPTION)
| pedrosino/tnoodle | svglite/tmtproject.py | Python | gpl-3.0 | 256 |
# ##### 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 later version.
#
# This program is distrib... | uhlik/render_maxwell | log.py | Python | gpl-2.0 | 3,222 |
"""
Asset Manager
Interface allowing course asset saving/retrieving.
Handles:
- saving asset in the BlobStore -and- saving asset metadata in course modulestore.
- retrieving asset metadata from course modulestore -and- returning URL to asset -or- asset bytes.
Phase 1: Checks to see if an asset's metadata can be f... | stvstnfrd/edx-platform | common/lib/xmodule/xmodule/assetstore/assetmgr.py | Python | agpl-3.0 | 2,322 |
__author__ = 'idclark'
import requests as r
def about_subreddit(sr):
"""get an overview for a given subreddit
> running = about_subreddit('running')
"""
url = r'http://www.reddit.com/r/{sr}/about.json'.format(sr=sr)
response = r.get(url)
return response.json()['data']
def my_subreddits(c... | idclark/wrap-it-up | reddit_py/subreddits.py | Python | mit | 2,511 |
# Copyright (C) 2007-2010 Samuel Abels.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANT... | gnperumal/exscript | src/Exscript/interpreter/ExpressionNode.py | Python | gpl-2.0 | 6,560 |
import time
class Timer:
def __init__(self, verbose=False):
self.verbose = verbose
def __enter__(self):
self.start = time.time()
return self
def __exit__(self, *args):
self.end = time.time()
self.secs = self.end - self.start
self.msecs = self.secs * 1000 #... | caynan/adsd | measuringProject/app/timer.py | Python | mit | 409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.