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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-08-31 14:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('checkout', '0010_auto_20170614_1434'),
]
operation... | martinstastny/django-simplestore | simplestore/checkout/migrations/0011_auto_20170831_1618.py | Python | mit | 654 |
import copy
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
QUERIES = {
"tag": "get_taginfo",
"signature": "get_siginfo",
"file_type": "get_file_type",
"clamav": "get_clamavinfo",
"imphash": "get_imphash",
"yara_rule": "get_yarainfo",
"issuer_cn": ... | VirusTotal/content | Packs/MalwareBazaar/Integrations/MalwareBazaar/MalwareBazaar.py | Python | mit | 12,522 |
# -*-coding:Utf-8 -*
from abcmodels import AModel
from mplotlab.utils.abctypes import FLOAT,LIST,STRING,BOOL,RegisterType
class AProjection(AModel):
parametersInfo = list(AModel.parametersInfo)
parametersInfo.extend([
("plotmodels",LIST,lambda:[],"plotModels"),
("title", STRING,lambd... | astyl/wxPlotLab | mplotlab/models/projections.py | Python | mit | 920 |
# You are climbing a stair case. It takes n steps to reach to the top.
#
# Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
#
# Note: Given n will be a positive integer.
#
# Example 1:
#
# Input: 2
# Output: 2
# Explanation: There are two ways to climb to the top.
# 1. ... | jigarkb/CTCI | LeetCode/070-E-ClimbingStairs.py | Python | mit | 877 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | ryanss/holidays.py | holidays/countries/mozambique.py | Python | mit | 2,356 |
from protocols.forms import forms
from core.utils import TIME_UNITS
class DiscardForm(forms.VerbForm):
name = "Discard"
slug = "discard"
has_manual = True
layers = ['item_to_act','item_to_retain','conditional_statement','settify']
item_to_act = forms.CharField(required=False, label='item to disca... | Bionetbook/bionetbook | bnbapp/protocols/forms/verbs/discard.py | Python | mit | 870 |
from django.views.generic import ListView, DetailView, CreateView, \
DeleteView, UpdateView, \
ArchiveIndexView, DateDetailView, \
DayArchiveView, MonthArchiveView, \
TodayArchiveView, Wee... | tnemis/staging-server | schoolnew/views.py | Python | mit | 219,616 |
# -*- coding: utf-8
import re
import copy
import humanfriendly
import json
import jsonpickle
from lain_sdk.yaml.parser import ProcType, resource_instance_name
from .utils import get_system_volumes_from_etcd
class AppType:
Normal = 'app'
Service = 'service'
Resource = 'resource'
ResourceInstance = 'r... | supermeng/console | apis/specs.py | Python | mit | 15,232 |
from electrum_vtc.i18n import _
fullname = _('Cosigner Pool')
description = ' '.join([
_("This plugin facilitates the use of multi-signatures wallets."),
_("It sends and receives partially signed transactions from/to your cosigner wallet."),
_("Transactions are encrypted and stored on a remote server.")
])
... | pknight007/electrum-vtc | plugins/cosigner_pool/__init__.py | Python | mit | 391 |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Stany MARCEL <stanypub@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 withou... | ynsta/steamcontroller | src/cheader.py | Python | mit | 5,714 |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from datetime import datetime
from datetime import date
from twilio.rest.resources import parse_date
from twilio.rest.resources import transform_params
from twilio.rest.resources import convert_keys
from twilio.rest.reso... | schwardo/chicago47-sms | tests/test_core.py | Python | mit | 2,358 |
from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes
# I cant figure out how the hell to import this so I'm just gonna forget it for now
def apigen_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""Link to API Docs page.
Returns 2 part tuple containing lis... | deni-zen/csvelte | docs/_contrib/apigenrole.py | Python | mit | 2,618 |
# -*- coding: utf-8 -*-
"""Secondary movement commands."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from .. import Command, COMMANDS
from ...characters import CharacterShell
... | whutch/cwmud | cwmud/core/commands/movement/secondary.py | Python | mit | 2,232 |
from bibliopixel.colors import COLORS as _COLORS
from bibliopixel.colors.arithmetic import color_scale
from bibliopixel.animation.strip import Strip
import random
class Searchlights(Strip):
"""Three search lights sweeping at different speeds"""
COLORS = [_COLORS.MediumSeaGreen, _COLORS.MediumPurple,
... | ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Searchlights.py | Python | mit | 2,221 |
# coding: utf8
from __future__ import unicode_literals
# Adding a lemmatizer lookup table
# Documentation: https://spacy.io/docs/usage/adding-languages#lemmatizer
# Entries should be added in the following format:
LOOKUP = {
"آ": "آنا",
"آْباد": "آْباد",
"آثار": "آثار",
"آثارِ": "آثارِ",
"آثارالصنادید": ... | recognai/spaCy | spacy/lang/ur/lemmatizer.py | Python | mit | 921,455 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from .models import *
from .forms import *
from comunicacion.lugar.models import *
from mapeo.models import *
from django.http import HttpResponse
from django.db.models import Sum, Count, Avg
import collections
import numpy as np
# Create your views here.
def... | ErickMurillo/ciat_plataforma | ficha_granos_basicos/views.py | Python | mit | 17,583 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-12 07:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mords_api', '0021_learningword'),
]
operations = [
migrations.RenameField(
... | TeppieC/M-ords | mords_backend/mords_api/migrations/0022_auto_20161212_0008.py | Python | mit | 441 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | janusnic/dj-21v | unit_10/mysite/mysite/settings.py | Python | mit | 3,736 |
#### 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_armor_mandalorian_bracer_r.iff"
r... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_armor_mandalorian_bracer_r.py | Python | mit | 473 |
from decimal import Decimal
import mock
from unittest2 import TestCase
from restorm.clients.jsonclient import JSONClient, JSONClientMixin
class JSONClientTests(TestCase):
def setUp(self):
self.client = JSONClient()
@mock.patch('httplib2.Http.request')
def test_get(self, request):
... | joeribekker/restorm | restorm/clients/tests/test_jsonclient.py | Python | mit | 2,145 |
#!/usr/bin/env python
"""Example code of learning a large scale convnet from ILSVRC2012 dataset.
Prerequisite: To run this example, crop the center of ILSVRC2012 training and
validation images and scale them to 256x256, and make two lists of space-
separated CSV whose first column is full path to image and second colu... | ttakamura/chainer | examples/imagenet/train_imagenet.py | Python | mit | 9,557 |
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | martbhell/wasthereannhlgamelastnight | src/lib/google/api_core/rest_helpers.py | Python | mit | 2,929 |
import unittest
from palindromes import is_palindrome
cases = (
('lsdkjfskf', False),
('radar', True),
('racecar', True),
)
class TestCorrectness(unittest.TestCase):
def test_identifies_palindromes(self):
for word, expectation in cases:
self.assertEqual(is_palindrome(word), expec... | Bradfield/algorithms-and-data-structures | book/deques/palindromes_test.py | Python | cc0-1.0 | 328 |
from django.contrib import admin
from models.snippets import Contact
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
pass
| kave/cfgov-refresh | cfgov/v1/admin.py | Python | cc0-1.0 | 143 |
"""
Contains the manager class and exceptions for handling the mappings between
repositories and content units.
"""
from gettext import gettext as _
import logging
import sys
from celery import task
import pymongo
from pulp.plugins.conduits.unit_import import ImportUnitConduit
from pulp.plugins.config import PluginCa... | beav/pulp | server/pulp/server/managers/repo/unit_association.py | Python | gpl-2.0 | 21,921 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | rodrigc/buildbot | master/buildbot/test/unit/www/test_avatar.py | Python | gpl-2.0 | 24,990 |
from ConfigParser import DEFAULTSECT
from cmd import Cmd
import logging
import sys
import subprocess
import argparse
import datetime
from fibbing import FibbingManager
import fibbingnode
from fibbingnode.misc.utils import dump_threads
import signal
log = fibbingnode.log
CFG = fibbingnode.CFG
class FibbingCLI(Cmd):
... | lferran/FibbingNode | fibbingnode/southbound/main.py | Python | gpl-2.0 | 7,223 |
# -*- coding: utf-8 -*-
"""
This plugin is 3rd party and not it is not part of the plexus-streams addon
Torrent-tv.ru (All categories)
"""
import sys,os
current_dir = os.path.dirname(os.path.realpath(__file__))
basename = os.path.basename(current_dir)
core_dir = current_dir.replace(basename,'').replace('parsers','... | repotvsupertuga/tvsupertuga.repository | plugin.video.plexus-streams/resources/core/parsers/torrenttvruall/main.py | Python | gpl-2.0 | 3,711 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | andrebellafronte/stoq | stoq/gui/test/test_purchase.py | Python | gpl-2.0 | 11,536 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or ... | kaplun/Invenio-OpenAIRE | modules/bibformat/lib/bibformat_regression_tests.py | Python | gpl-2.0 | 20,498 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doExtractProj.py
---------------------
Date : August 2011
Copyright : (C) 2011 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
************... | camptocamp/QGIS | python/plugins/GdalTools/tools/doExtractProj.py | Python | gpl-2.0 | 7,191 |
'''
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
For example,
Given nums = [1,3,-1,-3,5,3,6,7], and k = 3.
Window position ... | mornsun/javascratch | src/topcoder.py/xSlidingWindowMaximum.py | Python | gpl-2.0 | 1,886 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FixedDistanceBuffer.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... | luofei98/qgis | python/plugins/processing/algs/qgis/ftools/FixedDistanceBuffer.py | Python | gpl-2.0 | 3,213 |
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | google/rekall | rekall-core/rekall/plugins/response/forensic_artifacts.py | Python | gpl-2.0 | 37,683 |
# This file is part of the Anitya project.
# Copyright (C) 2017 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 ... | release-monitoring/anitya | anitya/wsgi.py | Python | gpl-2.0 | 835 |
import re
import django.core.exceptions
import productstatus.core.models
UUID_REGEX = re.compile('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
def get_objects_from_field(field, value):
results = []
for subclass in productstatus.core.models.BaseModel.__subclasses__():
try:
... | metno/modelstatus | productstatus/core/lookup.py | Python | gpl-2.0 | 1,218 |
import attr
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from cfme.common import Taggable
from cfme.common import TagPageView
from cfme.containers.provider import ContainerObjectAllBaseView
from cfme.containers.provider import ContainerObjectDetailsBaseView
from cfme.containers.pro... | nachandr/cfme_tests | cfme/containers/service.py | Python | gpl-2.0 | 4,417 |
# -*- coding: utf-8 -*-
#
# libmypaint documentation build configuration file, created by
# sphinx-quickstart2 on Wed Jun 13 23:40:45 2012.
#
# 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.
#
#... | kragniz/mypaint | brushlib/doc/source/conf.py | Python | gpl-2.0 | 8,376 |
# -*- coding: utf-8 -*-
""" Tests used to check the operation of log collecting.
Author: Milan Falešník <mfalesni@redhat.com>
Since: 2013-02-20
"""
from datetime import datetime
import fauxfactory
import pytest
import re
from cfme import test_requirements
from cfme.configure import configuration as configure
from ut... | jteehan/cfme_tests | cfme/tests/configure/test_log_depot_operation.py | Python | gpl-2.0 | 12,788 |
# -----------------------------------------------------------
# compares the creation of sorted lists using the python
# bisect module, and the "usual" way
#o
# (C) 2015 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# --------------------------------------------... | plasmashadow/training-python | time/sorted-list.py | Python | gpl-2.0 | 1,566 |
#coding=utf8
def hello(instr):
bufstr = " helloWorld!"
return (instr + bufstr), 123
if __name__ == "__main__":
k = "yzh"
print hello(k)
| gdefias/StudyC | VS/test_CcallPY/Test_ccallpy/helloWorld.py | Python | gpl-2.0 | 153 |
import os
import sys
import warnings
import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib
# Important! To work on pypy, this must be a module that resides in the
# lib-python/modified-x.y.z directory
dirname = os.path.dirname
distutils_path = os.path.join... | mmccollow/TSV-Convert | lib/python2.6/distutils/__init__.py | Python | gpl-2.0 | 3,677 |
"""
KeepNote Extension
new_file
Extension allows adding new filetypes to a notebook
"""
#
# KeepNote
# Copyright (c) 2008-2011 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@mit.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publi... | reshadh/Keepnote-LaTeX | keepnote/extensions/new_file/__init__.py | Python | gpl-2.0 | 17,272 |
#!/usr/bin/python
import libploop
import shutil
import io
import os
import socket
import time
import subprocess as sp
import unittest
import hashlib
sleep_sec = 3
def hashfile(afile, hasher, blocksize=65536):
buf = afile.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(blocksize)
print (... | rootfs/ploop | test/test-pcopy.py | Python | gpl-2.0 | 3,109 |
[] = c
y = []
for [] in x:
BLOCK
[] = []
| zrax/pycdc | tests/input/unpack_empty.py | Python | gpl-3.0 | 45 |
from __future__ import print_function
from numpy import int16
import time
def connect(route,**args):
'''
route can either be I.I2C , or a radioLink instance
'''
return SHT21(route,**args)
class SHT21():
RESET = 0xFE
TEMP_ADDRESS = 0xF3
HUMIDITY_ADDRESS = 0xF5
selected=0xF3
NUMPLOTS=1
PLOTNAMES = ['Data']
... | jithinbp/SEELablet | SEEL/SENSORS/SHT21.py | Python | gpl-3.0 | 2,349 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
def get_color(color):
if 'default'==color:
return '\x1b[39;01m'
elif 'black'==color:
return '\x1b[30;01m'
elif 'red'==color:
return '\x1b[31;01m'
elif 'green'==color:
return ... | 0x47d/atd.id | src/print.py | Python | gpl-3.0 | 989 |
# Kevin Nash (kjn33)
# EECS 293
# Assignment 12
from entity import Entity
from random import randint
class Passenger(Entity):
""" Entities that need to be checked in following queueing """
def __init__(self):
"""
Passengers follow Entity initialization,
are randomly given special par... | Fullbiter/EECS-293 | pa12-13/airville/src/passenger.py | Python | gpl-3.0 | 1,260 |
#!/usr/bin/env python
data = {
"default_prefix": "OSVC_COMP_REMOVE_FILES_",
"example_value": """
[
"/tmp/foo",
"/bar/to/delete"
]
""",
"description": """* Verify files and file trees are uninstalled
""",
"form_definition": """
Desc: |
A rule defining a set of files to remove, fed to the 'remove_files' co... | tanji/replication-manager | share/opensvc/compliance/com.replication-manager/remove_files.py | Python | gpl-3.0 | 2,367 |
#!/usr/bin/env python
###############################################################################
#
# SageMathCloud: A collaborative web-based interface to Sage, IPython, LaTeX and the Terminal.
#
# Copyright (C) 2014, William Stein
#
# This program is free software: you can redistribute it and/or modify
# ... | shubham0d/smc | salvus/admin.py | Python | gpl-3.0 | 66,944 |
from dipde.internals.internalpopulation import InternalPopulation
from dipde.internals.externalpopulation import ExternalPopulation
from dipde.internals.network import Network
from dipde.internals.connection import Connection as Connection
# from dipde.profiling import profile_simulation, extract_value
from mongodistri... | AllenInstitute/dipde | dipde/experimental/distributed_mongo.py | Python | gpl-3.0 | 3,737 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import os
os.system('cp config/.lircrc ~/.lircrc')
os.system('cp config/hardware.conf /etc/lirc/hardware.conf')
os.system('cp config/lircd.conf /etc/lirc/lircd.conf')
os.system('cp config/lircmd.conf /etc/lirc/lircmd.conf')
os.system('mkdir ... | Slightgen/SG-remote | setup.py | Python | gpl-3.0 | 1,378 |
import gc
import os
import signal
from datetime import datetime
from errbot import BotPlugin, botcmd, arg_botcmd
from errbot.plugin_manager import global_restart
from errbot.utils import format_timedelta
class Health(BotPlugin):
@botcmd(template='status')
def status(self, mess, args):
""" If I am ali... | mrshu/err | errbot/core_plugins/health.py | Python | gpl-3.0 | 3,841 |
from django.conf.urls import url
from fir_artifacts import views
app_name='fir_artifacts'
urlpatterns = [
url(r'^(?P<artifact_id>\d+)/detach/(?P<relation_name>\w+)/(?P<relation_id>\d+)/$', views.detach_artifact, name='detach'),
url(r'^(?P<artifact_id>\d+)/correlations/$', views.artifacts_correlations, name='... | certsocietegenerale/FIR | fir_artifacts/urls.py | Python | gpl-3.0 | 738 |
# Copyright (C) 2010-2014 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... | Erethon/synnefo | snf-astakos-app/astakos/im/views/target/redirect.py | Python | gpl-3.0 | 4,711 |
../../../../../../../share/pyshared/orca/scripts/apps/packagemanager/script_settings.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/orca/scripts/apps/packagemanager/script_settings.py | Python | gpl-3.0 | 87 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Gestión de parámetros de configuración - xbmc
#------------------------------------------------------------
# tvalacarta
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#--------------------------------------------------------... | conejoninja/pelisalacarta | python/version-xbmc-09-plugin/core/config.py | Python | gpl-3.0 | 5,454 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@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) an... | dlundquist/ansible | lib/ansible/runner/__init__.py | Python | gpl-3.0 | 55,816 |
""" Test class for SiteDirector
"""
# pylint: disable=protected-access
# imports
import datetime
import pytest
from mock import MagicMock
from DIRAC import gLogger
# sut
from DIRAC.WorkloadManagementSystem.Agent.SiteDirector import SiteDirector
mockAM = MagicMock()
mockGCReply = MagicMock()
mockGCReply.return_valu... | fstagni/DIRAC | WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py | Python | gpl-3.0 | 9,622 |
########################################################################
# $Id$
########################################################################
""" A set of common tools to be used in pilot commands
"""
import sys
import time
import os
import pickle
import getopt
import imp
import types
import urllib2
import... | Andrew-McNab-UK/DIRAC | WorkloadManagementSystem/PilotAgent/pilotTools.py | Python | gpl-3.0 | 18,034 |
from __future__ import print_function
import numpy as np
a = np.arange(9)
print("Reduce", np.add.reduce(a))
print("Accumulate", np.add.accumulate(a))
print("Reduceat", np.add.reduceat(a, [0, 5, 2, 7]))
print("Reduceat step I", np.add.reduce(a[0:5]))
print("Reduceat step II", a[5])
print("Reduceat step III", np.add.re... | moonbury/notebooks | github/Numpy/Chapter5/ufuncmethods.py | Python | gpl-3.0 | 428 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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... | harwee/electrum-xvg-tor | lib/wallet.py | Python | gpl-3.0 | 73,225 |
# This is an auto-generated file. Use admin/change-versions to update.
from twisted.python import versions
version = versions.Version(__name__[:__name__.rfind('.')], 0, 6, 0)
| kenorb-contrib/BitTorrent | twisted/web/_version.py | Python | gpl-3.0 | 175 |
"""
Bot wide hook opt-out for channels
"""
import asyncio
from collections import defaultdict
from fnmatch import fnmatch
from functools import total_ordering
from threading import RLock
from sqlalchemy import Table, Column, String, Boolean, PrimaryKeyConstraint, and_
from cloudbot import hook
from cloudbot.hook impo... | weylin/CloudBot | plugins/core/optout.py | Python | gpl-3.0 | 8,268 |
import moose
foo = moose.Pool('/foo1', 500)
bar = moose.vec('/foo1')
assert len(bar) == 500
| subhacom/moose-core | tests/python/test_vec.py | Python | gpl-3.0 | 92 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eithe... | paour/weblate | weblate/trans/management/commands/commit_pending.py | Python | gpl-3.0 | 1,898 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
# $URI:$
__version__=''' $Id$ '''
__doc__='''Gazillions of miscellaneous internal utility functions'''
import os, sys, imp, time, types
from base64 import decodestring as base64_decodestring, encodestring as base64_encodestring
try:
fr... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/reportlab/lib/utils.py | Python | gpl-3.0 | 45,338 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from urllib.parse import urljoin, urlsplit
from django.db import migrations, models
def forwards(apps, schema_editor):
MenuItem = apps.get_model('external_services', 'MenuItem')
items = (MenuItem.objects.all()
.exclude(service=None)
... | teemulehtinen/a-plus | external_services/migrations/0011_menuitem_menu_url.py | Python | gpl-3.0 | 1,720 |
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('sqlite:////db/cities.sqlite', convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=False,
... | mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.05 - REST API - Server & Clients/code/servers/old/database/database.py | Python | gpl-3.0 | 736 |
class RegMagic:
fixed_registers = []
regmagic = RegMagic()
__all__ = ['regmagic']
| svp-dev/slcore | slc/tools/slc/mt/mipsel/regdefs.py | Python | gpl-3.0 | 87 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@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) an... | ilpianista/ansible | lib/ansible/playbook/task.py | Python | gpl-3.0 | 20,951 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Mon Jan 25 18:31:00 2010
# by: The Resource Compiler for PyQt (Qt v4.6.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x07\xd1\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00... | Amir-Tb/steganogra-py | Steganograpy/GUI/Steg_rc.py | Python | gpl-3.0 | 41,317 |
#by mamat and tsaylor on djangosnippets.org
import re
from django.conf.urls.defaults import patterns, url
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.utils.functional import update_wrapper
class Button(object):
def __init__(self, func):
self.func_name = func.fun... | Genovo/OTPSetup | otpsetup/client/lib/buttonable_model_admin.py | Python | gpl-3.0 | 2,534 |
#!/usr/bin/env python
# Copyright (c) 2009, 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. 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 sour... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/tool/commands/upload.py | Python | gpl-3.0 | 22,709 |
from SerialBus import SerialBus
serialbus = SerialBus(baud = 19200, serialnum="ABCD")
while True:
cmd = input('Send: ')
answer = serialbus.send_request_wait(10, bytes(cmd, 'ascii'))
answer_str = "";
for char in answer:
answer_str += (chr(char))
print(answer_str)
| marplaa/SerialBus | python_lib/test_script/echo.py | Python | gpl-3.0 | 294 |
# -*- coding: cp1252 -*-
import urllib,re,string,sys,os
import xbmc,xbmcgui,xbmcaddon,xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
art = main.art
prettyName = 'WatchSeries'
def MAINWATCHS():
main.addDir('Sear... | marduk191/plugin.video.movie25 | resources/libs/plugins/watchseries.py | Python | gpl-3.0 | 22,128 |
import os
import time
import io
import requests
from django.contrib.auth.models import User
from guardian.shortcuts import remove_perm, assign_perm
from rest_framework import status
from rest_framework.test import APIClient
import worker
from app.cogeo import valid_cogeo
from app.models import Project
from app.models... | pierotofy/WebODM | app/tests/test_api_task_import.py | Python | mpl-2.0 | 6,442 |
import struct
def validate_transaction_id(request_mbap, response):
""" Check if Transaction id in request and response is equal. """
assert struct.unpack('>H', request_mbap[:2]) == \
struct.unpack('>H', response[:2])
def validate_protocol_id(request_mbap, response):
""" Check if Protocol id in r... | AdvancedClimateSystems/python-modbus | tests/system/validators.py | Python | mpl-2.0 | 2,302 |
import os
import errno
import fcntl
from contextlib import contextmanager
from time import time, sleep
@contextmanager
def wlock(filename, retry_interval=0.05):
# returns: write, exists, fd
try:
with open(filename, 'rb+') as lock:
try:
fcntl.flock(lock, fcntl.LOCK_EX | fcnt... | sebest/katana | katana/utils.py | Python | mpl-2.0 | 2,188 |
import ddt
from django.core.management import call_command
from django.core.management.base import CommandError
from mock import patch
from oscar.core.loading import get_model
from ecommerce.extensions.test.factories import create_order
from ecommerce.tests.factories import PartnerFactory
from ecommerce.tests.testca... | edx/ecommerce | ecommerce/extensions/order/management/commands/tests/test_update_order_lines_partner.py | Python | agpl-3.0 | 2,921 |
# -*- coding: utf-8 -*-
"""
Acc Lib
- Used by
account contasis pre
account line pre
Created: 11 oct 2020
Last up: 29 mar 2021
"""
import datetime
class AccFuncs:
@staticmethod
def static_method():
# the static method gets passed nothing
return "I am a static method"
@classmethod
def class_meth... | gibil5/openhealth | models/order/commons/acc_lib.py | Python | agpl-3.0 | 2,687 |
from amcat.tools import toolkit
from amcat.tools.table.table3 import ObjectColumn
import logging; log = logging.getLogger(__name__)
class FieldColumn(ObjectColumn):
"""ObjectColumn based on a AnnotationSchemaField"""
def __init__(self, field, article=None, fieldname=None, label=None, fieldtype=None):
... | tschmorleiz/amcat | amcat/models/coding/fieldcolumn.py | Python | agpl-3.0 | 1,767 |
import config, json, cgi, sys, Websheet, re, os
def grade(reference_solution, student_solution, translate_line, websheet, student):
if not re.match(r"^\w+$", websheet.classname):
return ("Internal Error (Compiling)", "Invalid overridden classname <tt>" + websheet.classname + " </tt>")
dump = {
... | dz0/websheets | grade_java.py | Python | agpl-3.0 | 5,860 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Library
from ..models import Espacio
register = Library()
@register.inclusion_tag('espacios/_otros_espacios.html', takes_context=True)
def otros_espacios(context):
qs = Espacio.objects.all()
if 'espacio' in context:
... | andensinlimite/metaespacio | metaespacio/espacios/templatetags/espacios.py | Python | agpl-3.0 | 441 |
import json
import logging
import traceback
from lxml import etree
from xmodule.timeinfo import TimeInfo
from xmodule.capa_module import ComplexEncoder
from xmodule.progress import Progress
from xmodule.stringify import stringify_children
from xmodule.open_ended_grading_classes import self_assessment_module
from xmod... | TangXT/GreatCatMOOC | common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py | Python | agpl-3.0 | 49,426 |
import time
import random
from cloudbrain.connectors.ConnectorInterface import Connector
from cloudbrain.utils.metadata_info import get_num_channels
class MockConnector(Connector):
def __init__(self, publishers, buffer_size, device_name, device_port='mock_port', device_mac=None):
"""
:return:
... | alessiodm/cloudbrain | cloudbrain/connectors/MockConnector.py | Python | agpl-3.0 | 1,191 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_patient/seq/clv_patient_category_seq.py | Python | agpl-3.0 | 3,797 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Omar Castiñeira Saavedra$ <omar@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it ... | Comunitea/alimentacion | automatic_update_cost_from_bom/__openerp__.py | Python | agpl-3.0 | 1,451 |
from __future__ import division
# The Hazard Library
# Copyright (C) 2012-2016 GEM Foundation
#
# This program 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 y... | rcgee/oq-hazardlib | openquake/hazardlib/tests/source/point_test.py | Python | agpl-3.0 | 31,027 |
import io
import os
import difflib
import pytest
from jinja2 import Template
import testutils
securedrop_test_vars = testutils.securedrop_test_vars
testinfra_hosts = [securedrop_test_vars.monitor_hostname]
@pytest.mark.skip_in_prod
def test_mon_iptables_rules(host):
local = host.get_host("local://")
time_... | conorsch/securedrop | molecule/testinfra/mon/test_mon_network.py | Python | agpl-3.0 | 3,154 |
"""
This file shows how to use pyDatalog using facts stored in datalog.
It has 3 parts:
1. create facts for 2 employees in the datalog engine
2. define business rules
3. Query the datalog engine
"""
from pyDatalog import pyDatalog
""" 1. create facts for 3 employees in the datalog engine """
pyDatalog.cre... | jcdouet/pyDatalog | pyDatalog/examples/datalog.py | Python | lgpl-2.1 | 2,172 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Unit tests for the `corpora.Dictionary` class.
"""
from collections import Mapping
import logging
import unittest
import codecs
import os
import os.path
import scipy
import gensim
from gens... | mattilyra/gensim | gensim/test/test_corpora_dictionary.py | Python | lgpl-2.1 | 12,494 |
## \file config_options.py
# \brief python package for config
# \author T. Lukaczyk, F. Palacios
# \version 6.1.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the open-source community.
#
# The ma... | drewkett/SU2 | SU2_PY/SU2/io/config_options.py | Python | lgpl-2.1 | 6,581 |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Original Developers: Dr. Francisco D. Palacios.
# Dr. Thomas D. Economon.
#
# SU2 Developers: Prof. Juan J. Alonso's group at St... | pawhewitt/Dev | SU2_PY/SU2/run/adaptation.py | Python | lgpl-2.1 | 2,501 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Jan lehnardt <jan@apache.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Simple functional test for the replication notification trigger"""
imp... | kotejante/light-distribution-platform | libs/couchdb/tools/replication_helper_test.py | Python | lgpl-2.1 | 1,676 |
# ***************************************************************************
# * *
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | usakhelo/FreeCAD | src/Mod/Fem/PyGui/_CommandFemMaterialMechanicalNonlinear.py | Python | lgpl-2.1 | 4,731 |
# RUN: %python -m artiq.compiler.testbench.signature %s >%t
# RUN: OutputCheck %s --file-to-check=%t
# CHECK-L: f: ()->NoneType delay(30 mu)
def f():
for _ in range(10):
delay_mu(3)
# CHECK-L: g: ()->NoneType delay(60 mu)
def g():
for _ in range(10):
for _ in range(2):
delay_mu(3)
| JQIamo/artiq | artiq/test/lit/iodelay/loop.py | Python | lgpl-3.0 | 320 |
"""
WSGI config for opendai_lleida_web project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | open-dai/bcn-lleida-opendai-pilots | web-geo-server/admin_web/wsgi.py | Python | lgpl-3.0 | 1,160 |
###############################################################################
# volumina: volume slicing and editing library
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# modify it und... | jakirkham/volumina | tests/layerwidget_test.py | Python | lgpl-3.0 | 4,634 |
# -*- coding: utf-8 -*-
try:
import re2 as re
except ImportError:
import re
from lib.cuckoo.common.abstracts import Signature
class Silverlight_JS(Signature):
name = "silverlight_js"
description = "执行伪装过的包含一个Silverlight对象的JavaScript,可能被用于漏洞攻击尝试"
weight = 3
severity = 3
categories = ["explo... | lixiangning888/whole_project | modules/signatures_merge_tmp/ek_silverlight.py | Python | lgpl-3.0 | 1,071 |