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 |
|---|---|---|---|---|---|
"""Post data to S3."""
import boto3
import os
import pickle
from src.config import CACHE_PATH, FINDINGS_S3_BUCKET
from src.single_layer_network import list_findings
from src.training_data import load_all_training_tiles, tag_with_locations
from src.training_visualization import render_results_for_analysis
def post_f... | andrewljohnson/Deep-Trails | src/s3_client_deeposm.py | Python | mit | 2,080 |
from django.db import models
from datetime import datetime
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.contrib.auth.models import User
import urllib, hashlib, binascii
class Message(models.Model):
user = models.CharField(max_length=200)
message = models.TextField(max_length=... | bardia-heydarinejad/Graph | chat/models.py | Python | mit | 1,269 |
# -*- coding: utf-8 -*-
import abc
class walker(object):
"""Basic API specification of the walker object.
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
"""Instantiate a walker object.
"""
return None
@abc.abstractmethod
def get_position(self):
"""Return ... | jtempkin/enhanced-sampling-toolkit | est/walker/walker_base.py | Python | mit | 4,100 |
#!/usr/bin/env python
# Copyright (c) 2014-2018 Florian Brucker (www.florianbrucker.de)
#
# 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 th... | torfuspolymorphus/service | src/service/__init__.py | Python | mit | 20,051 |
__author__ = 'katharine'
class ToolError(Exception):
pass
class MissingSDK(ToolError):
pass
class MissingEmulatorError(MissingSDK):
pass
class BuildError(ToolError):
pass
class PebbleProjectException(ToolError):
pass
class InvalidProjectException(PebbleProjectException):
pass
class... | gregoiresage/pebble-tool | pebble_tool/exceptions.py | Python | mit | 487 |
from rpython.rlib.rarithmetic import intmask
from rpython.rlib.objectmodel import specialize
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.jit.backend.llsupport.descr import CallDescr
class UnsupportedKind(Exception):
pass
def get_call_descr_dynamic(cpu, cif_description, extrainfo):
"""Get... | oblique-labs/pyVM | rpython/jit/backend/llsupport/ffisupport.py | Python | mit | 3,664 |
"""
This module is used to fake the original hyperion functions
Created on 27.11.2014
@author: Fabian Hertwig
"""
import imp
import json_client
ledCount = 0
# the data as set in the hypercon application
horizontal = 0
vertical = 0
first_led_offset = 0
clockwise_direction = False
corner_leds = False
# the dictionary... | siam28/hyperion_effects_dev_kit | hyperion.py | Python | mit | 2,270 |
#!/usr/bin/env python
#
# Sfml
#
# The sfml installer.
#
# Author O Wasalski - 07/06/2012 <wasalski@berkeley.edu> : First revision, new file
# Author P G Jones - 23/06/2012 <p.g.jones@qmul.ac.uk> : Refactor of Package Structure
# Author P G Jones - 22/09/2012 <p.g.jones@qmul.ac.uk> : Major refactor of snoing.
########... | mjmottram/snoing | packages/sfml.py | Python | mit | 2,259 |
# coding=utf-8
from decimal import Decimal
from .. import BaseProvider
localized = True
class Provider(BaseProvider):
"""
land_coords data extracted from geonames.org, under the Creative Commons Attribution 3.0 License.
Coordinates are in decimal format for mapping purposes.
Country code is in Alpha... | deanishe/alfred-fakeum | src/libs/faker/providers/geo/__init__.py | Python | mit | 70,121 |
# -*- coding: utf-8 -*-
# Este archivo simula que un usuario usó su NFC o RFID para entrar o salir de
# algún lugar
# Ejemplo de uso:
# $ python pub-local.py -p CICI -d puerta1 -t ABCDEF -k 123456
# Para verificar su funcionamiento, se puede crear una suscripción al canal
# $ mosquitto_sub -h localhost -t 'lugares/acce... | smartcities-livinglab-udg/APP-SmartCheckIn | app/modules/MQTT/pub-local-example.py | Python | mit | 2,306 |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import c... | JackKelly/neuralnilm_prototype | scripts/e82.py | Python | mit | 4,091 |
#!/usr/bin/env python
#
# GrovePi Project for a Plant monitoring project.
# * Reads the data from moisture, light, temperature and humidity sensor
# and takes pictures from the Pi camera periodically and logs them
# * Sensor Connections on the GrovePi:
# -> Grove Moisture sensor - Port A1
# -> Grove light sensor ... | penoud/GrovePi | Projects/plant_monitor/plant_project.py | Python | mit | 4,476 |
"""Torrenting utils, mostly for handling bencoding and torrent files."""
# Torrent decoding is a short fragment from effbot.org. Site copyright says:
# Test scripts and other short code fragments can be considered as being in the public domain.
from __future__ import unicode_literals, division, absolute_import
from bui... | jawilson/Flexget | flexget/utils/bittorrent.py | Python | mit | 11,767 |
"""
Copyright (c) 2016, Marcelo Leal
Description: Simple Azure Media Services Python library
License: MIT (see LICENSE.txt file for details)
"""
import os
import json
import amspy
import time
#import pytz
import logging
import datetime
###################################################################################... | johndeu/amspy | amspy/examples/list_media_asset.py | Python | mit | 2,469 |
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | uber/thriftrw-python | tests/spec/test_hashable.py | Python | mit | 3,457 |
__version__ = "2.0.0.dev2"
| kerstin/moviepy | moviepy/version.py | Python | mit | 27 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 21 17:27:53 2016
Updated 2016 Aug 4 to include WIRC points
Updated 2016 Sep 7 to reformat
@author: stephaniekwan
IC-10 X-2 Spitzer IRAC light curves. Updated on August 4th to include July 18th
Palomar JHK band measurements.
Coordinates: 0:20:20.940 +59:17:59.00
Circle rad... | skkwan/IC10X2 | infrared_and_lightcurve/fluxes_with_xdates_170314.py | Python | mit | 18,310 |
# Generated by Django 2.2.13 on 2020-11-13 11:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openstack', '0013_securitygrouprule_direction'),
]
operations = [
migrations.AddField(
model_name='securitygrouprule',
... | opennode/nodeconductor-assembly-waldur | src/waldur_openstack/openstack/migrations/0014_securitygrouprule_ethertype.py | Python | mit | 534 |
# -*- coding: utf-8 -*-
"""
babel.messages
~~~~~~~~~~~~~~
Support for ``gettext`` message catalogs.
:copyright: (c) 2013-2018 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
from babel.messages.catalog import *
| lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/babel/messages/__init__.py | Python | mit | 254 |
#!/usr/bin/env python
# - coding: utf-8 -
# Copyright (C) 2014 Toms Baugis <toms.baugis@gmail.com>
"""Exploring symmetry. Feel free to add more handles!"""
import math
import random
from collections import defaultdict
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject
from gi.repository... | projecthamster/apx | apx/splash.py | Python | mit | 10,155 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/dynamics_source.py | Python | mit | 2,144 |
# -*- coding: utf-8 -*-
class DoubanBaseError(Exception):
def __str__(self):
return "***%s (%s)*** %s" % (self.status, self.reason, self.msg)
class DoubanOAuthError(DoubanBaseError):
def __init__(self, status, reason, msg={}):
self.status = status
self.reason = reason
self.ms... | zangzhe/douban-review-api-testing | douban_client/api/error.py | Python | mit | 498 |
#!/usr/bin/env python
""" lk_tracker.py - Version 1.1 2013-12-20
Based on the OpenCV lk_track.py demo code
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2011 Patrick Goebel. All rights reserved.
This program is free software; you can redistribute it and/or modify
it... | fujy/ROS-Project | src/rbx1/rbx1_vision/src/rbx1_vision/lk_tracker.py | Python | mit | 6,007 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... | alecalve/bitcoin | test/functional/test_runner.py | Python | mit | 30,190 |
"""
Contains class for gaussian process hyperparameter optimizations.
"""
import os
import logging
import tempfile
from typing import Dict, List, Optional, Tuple, Union, Any
from deepchem.data import Dataset
from deepchem.trans import Transformer
from deepchem.metrics import Metric
from deepchem.hyper.base_... | deepchem/deepchem | deepchem/hyper/gaussian_process.py | Python | mit | 14,955 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_giant_sand_beetle.iff"
result.attribute_template_id = 9
resul... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_giant_sand_beetle.py | Python | mit | 440 |
# -*- coding: utf-8 -*-
from flask import json
from nose import tools as nose
from tests.integration.resource import ResourceTestCase
class PlaylistsResourceTestCase(ResourceTestCase):
"""
GET /playlists/ [user=<int>] [track=<int>]
200 OK
401 Unauthorized
POST /playlists/ name=<str>
... | maurodelazeri/shiva-server | tests/integration/resource-playlists-test.py | Python | mit | 7,712 |
#
# pyrope module
# | rgravina/Pyrope | pyrope/tests/__init__.py | Python | mit | 19 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/pet_deed/shared_snorbal_deed.iff"
result.attribute_template_id... | anhstudios/swganh | data/scripts/templates/object/tangible/deed/pet_deed/shared_snorbal_deed.py | Python | mit | 687 |
import platform
import icontroller
from constants import *
system = platform.system()
if system == "Windows":
from windows.control import *
def controllers():
devices = []
for i in range(4):
try:
devices.append(Controller(i))
except:
pass
return devices
| michaelneu/threesixty | threesixty/__init__.py | Python | mit | 319 |
import test_runner
import time
import math
import os
import numpy as np
from odrive.enums import *
from test_runner import *
teensy_code_template = """
void setup() {
analogWriteResolution(10);
// base clock of the PWM timer is 150MHz (on Teensy 4.0)
int freq = 150000000/1024; // ~146.5kHz PWM frequency
an... | madcowswe/ODriveFirmware | tools/odrive/tests/analog_input_test.py | Python | mit | 4,676 |
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template import TemplateDoesNotExist
from django.template.backends.base import BaseEngine
from django.template.backends.django import Template as DjangoTemplate, reraise, get_installed_libraries
from django.template.engine ... | ui/django-post_office | post_office/template/backends/post_office.py | Python | mit | 2,177 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the pruning code.
WARNING:
This test uses 4GB of disk space.
This test takes 30 mins or more (up ... | Anfauglith/iop-hd | test/functional/pruning.py | Python | mit | 21,272 |
'''
PIL: PIL image loader
'''
__all__ = ('ImageLoaderPIL', )
try:
from PIL import Image as PILImage
except:
import Image as PILImage
from kivy.logger import Logger
from kivy.core.image import ImageLoaderBase, ImageData, ImageLoader
class ImageLoaderPIL(ImageLoaderBase):
'''Image loader based on the PIL... | darkopevec/kivy | kivy/core/image/img_pil.py | Python | mit | 3,534 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/shared_barrel_blaster.iff"
result.attribute_template_id =... | obi-two/Rebelion | data/scripts/templates/object/tangible/component/shared_barrel_blaster.py | Python | mit | 457 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-06-02 18:38
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | ncrmro/reango | server/polls/migrations/0002_auto_20170602_1838.py | Python | mit | 1,124 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__vers... | davidharvey1986/pyRRG | unittests/bugFixPyRRG/lib/python3.7/site-packages/pip/_vendor/packaging/__about__.py | Python | mit | 744 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import Count
import json
def maintainers_from_property(apps, schema_editor):
# We can't import the models directly as they may be a newer
# version than this migration expects. We use the hi... | patchew-project/patchew | api/migrations/0025_populate_project_maintainers.py | Python | mit | 1,869 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Report generator module based on **Jinja2**
"""
import codecs
import datetime as dt
from os import path
import six
import tqdm
import jinja2
from t4mon import gen_plot, arguments
from matplotlib import pyplot as plt
from t4mon.logger import init_logger
# from ast ... | fernandezcuesta/pySMSCMon | t4mon/gen_report.py | Python | mit | 8,298 |
# -*- coding: utf-8 -*-
from collections import Counter
from threading import Lock, Thread
from time import sleep
import sys
if sys.version[0] == '2':
from Queue import Queue
else:
from queue import Queue
total_workers = 3 # Maximum number of threads chosen arbitrarily
class LetterCounter:
def __init__... | behrtam/xpython | exercises/parallel-letter-frequency/example.py | Python | mit | 1,637 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
NumberInputPanel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | AsgerPetersen/QGIS | python/plugins/processing/gui/NumberInputPanel.py | Python | gpl-2.0 | 6,584 |
import argparse
import asyncio
import logging
import sesamecontract.util.logging as logutil
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class SesameServerProtocol(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
self.peer = transport.get_... | EaterOA/sesamecontract | sesamecontract/sesameserver.py | Python | gpl-2.0 | 1,025 |
"""
Contains unit tests for the DB models
"""
__author__ = 'Michal Kononenko'
| MichalKononenko/OmicronAPI | tests/unit/test_database/test_models/__init__.py | Python | gpl-2.0 | 78 |
"""Common tests for infrastructure provider"""
import pytest
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
pytest_generate_tests = testgen.generate([OpenstackInfraProvider],
... | dajohnso/cfme_tests | cfme/tests/openstack/infrastructure/test_provider.py | Python | gpl-2.0 | 1,069 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014 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 th... | mvesper/invenio | modules/webmessage/lib/webmessage.py | Python | gpl-2.0 | 19,737 |
#!/usr/bin/python -O
#PBS -N myjob
#PBS -l select=1:ncpus=9:mem=12GB
#PBS -l walltime=70:00:00
import subprocess
import os
import sys
def module_add(modulen... | ThomasCarroll/mrcchip | pairedAlign.py | Python | gpl-2.0 | 2,281 |
# Clock Example by Ralph Glass
# http://ralph-glass.homepage.t-online.de/clock/readme.html
from gi.repository import PangoCairo
from gi.repository import GObject
from gi.repository import Gtk
import math
import time
from gramps.gen.constfunc import is_quartz
TEXT = 'cairo'
BORDER_WIDTH = 10
class ClockWidget(Gtk.Dr... | gramps-project/addons-source | ClockGramplet/ClockGramplet.py | Python | gpl-2.0 | 3,298 |
# -*- coding: utf-8 -*-
##
## This file is part of INSPIRE.
## Copyright (C) 2014 CERN.
##
## INSPIRE 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) a... | ioannistsanaktsidis/inspire-next | inspire/modules/deposit/config.py | Python | gpl-2.0 | 1,199 |
# CTK: Cherokee Toolkit
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# ... | chetan/cherokee | admin/CTK/CTK/AjaxUpload.py | Python | gpl-2.0 | 3,039 |
import json
dumpStr = json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
print(dumpStr)
f = open('test.json', "w")
pathdict = {}
pathdict["corpus"] = "/home/corpus"
pathdict["intput"] = "/home/input"
path = json.dump(pathdict, f)
f.close()
f = open('test.json', 'r')
pathhook = json.load(f)
for key in pathhook:
... | Og192/Python | pythonLearning/json/jsonTest.py | Python | gpl-2.0 | 352 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('QuickBooking', '0012_auto_20150704_2004'),
]
operations = [
migrations.AlterField(
model_name='bustype',
... | noorelden/QuickBooking | QuickBooking/migrations/0013_auto_20150704_2007.py | Python | gpl-2.0 | 441 |
#!/usr/bin/env python
import os, sys
def main():
if len(sys.argv) != 2:
print "Usage: %s <launchpad-download-folder>" % sys.argv[0]
return
files_to_merge = []
reldir = sys.argv[1]
for name in os.listdir(reldir):
if name.endswith(".po") and os.path.exists(os.path.join(reldir, name)):
dl_file = os.path.j... | mjumbewu/jokosher | locale/src/rosetta-merge.py | Python | gpl-2.0 | 1,107 |
from django.contrib import admin
from .models import *
from main import opengain_admin
@admin.register(Ticket, site=opengain_admin)
class TicketAdmin(admin.ModelAdmin):
list_display = ('user', 'subject', 'created', 'is_closed')
list_editable = ('is_closed',)
list_filter = ('is_closed',)
search_fields ... | null-none/OpenGain | default_set/tickets/admin.py | Python | gpl-2.0 | 621 |
#!/usr/bin/python
# -*- coding: UTF-* -*-
import sys
import re
trans_table = {
# dos newlines
"\r\n" : "\n",
# polish characters
"_a" : "ą",
"_c" : "ć",
"_e" : "ę",
"_l" : "ł",
"_n" : "ń",
"_o" : "ó",
"_s" : "ś",
"_z" : "ż",
"_x" : "ż",
"_A" : "Ą",
"_C" : "Ć",
"_E" : "Ę",
"_L" : "Ł",
"_N" : "Ń",
"_O" : "Ó",
"_S" : "Ś... | saper/em400 | tools/derep.py | Python | gpl-2.0 | 1,654 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# 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 Foun... | knabar/openmicroscopy | components/tools/OmeroWeb/test/unit/test_render_response.py | Python | gpl-2.0 | 3,836 |
import numpy as np
from flopy.mbase import Package
from flopy.utils import util_2d,util_3d
class Mt3dRct(Package):
'''
Chemical reaction package class
'''
def __init__(self, model, isothm=0, ireact=0, igetsc=1, rhob=1.8e3,
prsity2=0.1, srconc=0.0, sp1=0.0, sp2=0.0, rc1=0.0, rc2... | mjasher/gac | original_libraries/flopy-master/flopy/mt3d/mtrct.py | Python | gpl-2.0 | 5,665 |
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This program is free software: you can redistribute it and/or modify
# ... | pwyliu/cloud-init-0.6.3 | cloudinit/CloudConfig/cc_ssh.py | Python | gpl-3.0 | 4,064 |
# 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-cyclades-app/synnefo/quotas/management/commands/enforce-resources-cyclades.py | Python | gpl-3.0 | 13,112 |
# Copyright (c) 2018, Ansible Project
# Copyright (c) 2018, Abhijeet Kasurde (akasurde@redhat.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Parameters for DigitalOcean modules
DOCUMENTATION = '''
options:
oauth_token:
... | wrouesnel/ansible | lib/ansible/utils/module_docs_fragments/digital_ocean.py | Python | gpl-3.0 | 919 |
#!/usr/bin/env python2
import redis
import string
import random
KEYS_COUNT = 10000
def random_string(length):
return ''.join(random.choice(string.ascii_letters) for m in xrange(length))
def test():
r = redis.StrictRedis(host='localhost', port=6379, db=0)
for x in range(KEYS_COUNT / 2):
r.set(... | fastogt/fastonosql | tests/redis_test_many_keys.py | Python | gpl-3.0 | 588 |
from cjdnsadmin.cjdnsadmin import connect
cjdns = connect("127.0.0.1", 11234, "NONE")
print(cjdns.Sign_checkSig(
'test message',
'0ytl2njc1hy86tlxtc2zc3449up47uqb0u04kcy233d7zrn2cwh1_y96duzwpvmslj8b7pnk2b32m0rhs738yujwtrtlcq81r0u114svygwn56phn9yncpyzhswpj3bd808lgd5bknlj8xwf7purl0r0hc30')) | cjdelisle/cjdns | contrib/python3/sign_example.py | Python | gpl-3.0 | 297 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3
import base64
import datetime
from http.client import CannotSendRequest
import io
import logging
import re
from socket import error as SocketError
import string
import time
from urllib.error import HTTPError
from urllib.parse i... | subdownloader/subdownloader | subdownloader/provider/opensubtitles.py | Python | gpl-3.0 | 37,191 |
## \example modeller/imp_restraints_in_modeller.py
# This demonstrates using IMP.Restraints as additional energy terms in the
# Modeller scoring function, so that IMP scoring terms can be incorporated into
# existing comparative modeling pipelines.
#
import modeller
import IMP
import IMP.core
import IMP.modeller
impor... | shanot/imp | modules/modeller/examples/imp_restraints_in_modeller.py | Python | gpl-3.0 | 1,441 |
#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
try:
from hashlib import md5
except:
from md5 import md5
from reportlab.lib.logger import warnOnce
fro... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/thirdparty/src/reportlab/lib/utils.py | Python | gpl-3.0 | 39,368 |
#!/usr/bin/env python3
## Copyright (C) 2021 David Miguel Susano Pinto <carandraug@gmail.com>
##
## This file is part of Microscope.
##
## Microscope 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 v... | carandraug/microscope | microscope/lasers/toptica.py | Python | gpl-3.0 | 907 |
import re
from core import plugins
class Plugin:
"""Triggering plugin attributes.
Get attributes of the currently running plugin.
This object is generally imported like this:
>>> from api import plugin
The following attributes descriptions include some
examples, based on an imaginative plug... | 0x0mar/phpsploit | src/api/plugin.py | Python | gpl-3.0 | 1,672 |
# -*- coding: utf-8 -*-
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own lic... | kvar/ansible | lib/ansible/module_utils/acme.py | Python | gpl-3.0 | 40,296 |
../../../../share/pyshared/orca/outloud.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/orca/outloud.py | Python | gpl-3.0 | 42 |
import unittest
from math import sqrt
import numpy as np
from geomalgo import Point2D, Line2D
class TestLine2D(unittest.TestCase):
def test_create_line(self):
A = Point2D(1,2)
B = Point2D(3,4)
# ======================
# Create line2d.
# ======================
lin... | dfroger/geomalgo | test/base2d/test_line2d.py | Python | gpl-3.0 | 1,777 |
# Copyright (C) 2016 Canonical Ltd.
# Copyright (C) 2016 VMware Inc.
#
# Author: Sankar Tanguturi <stanguturi@vmware.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
class GuestCustStateEnum(object):
"""Specifies different states of Guest Customization engine"""
GUESTCUST_S... | larsks/cloud-init | cloudinit/sources/helpers/vmware/imc/guestcust_state.py | Python | gpl-3.0 | 388 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------- #
# #
# Plugin for iSida Jabber Bot #
# Copyright (C) diSabler <dsy@dsy.... | disabler/isida3 | plugins/execute.py | Python | gpl-3.0 | 4,289 |
"""
Tuple astroid node
This node represents the Python tuple objects.
Attributes:
- elts (List[Expr])
- The elements in this tuple, which can be any expression.
- ctx (class[expr_context])
- The context in which this list is to be used, either Load or Store.
Example 1:
- elts -> []
... | RyanDJLee/pyta | nodes/Tuple.py | Python | gpl-3.0 | 563 |
import os
import datetime
import lib.maglib as MSG
#这是一个对结果进行初步处理的库
#用来分离抓取结果,作者,发帖时间
#抓取结果应该储存在【用户端根目录】并以result命名
#在测试情况下,抓取结果文件为results.txt
#重要全局变量
PATH_SUFFIX = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
PATH_SUFFIX = PATH_SUFFIX[:len(PATH_SUFFIX)-8]
PATH_RESULT_FILE = PATH_SUFFI... | ankanch/tieba-zhuaqu | user-application/KCrawlerControal/Debug/plugins/wordstimeline/lib/result_functions_file.py | Python | gpl-3.0 | 4,862 |
"""
Dyson equation
==============
A dyson equation.
"""
import matplotlib.pyplot as plt
from feynman import Diagram
# Set up the figure and ax
fig = plt.figure(figsize=(10,1.5))
ax = fig.add_axes([.0,.0,1.,1.], frameon=False)
ax.set_xlim(0, 1.0)
ax.set_ylim(0, .15)
l = 0.15 # Length of the propagator
txt_l = 0.05 ... | GkAntonius/feynman | examples/Solid_State_Physics/plot_Dyson.py | Python | gpl-3.0 | 1,267 |
#!/usr/bin/env python
"""
CPAchecker is a tool for configurable software verification.
This file is part of CPAchecker.
Copyright (C) 2007-2014 Dirk Beyer
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 obt... | nishanttotla/predator | cpachecker/scripts/cpa_cloud.py | Python | gpl-3.0 | 2,148 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os, cPickle, subprocess
from setup import Command
import __builtin__
def... | yeyanchao/calibre | setup/check.py | Python | gpl-3.0 | 4,465 |
"""
relatorio
=========
A templating library which provides a way to easily output all kind of
different files (odt, ods, png, svg, ...). Adding support for more filetype is
easy: you just have to create a plugin for this.
relatorio also provides a report repository allowing you to link python objects
and report toge... | bitsworking/relatorio | relatorio/__init__.py | Python | gpl-3.0 | 494 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
NBSP = '\xa0'
def mergeable(previous, current):
if previous... | jelly/calibre | src/calibre/ebooks/docx/cleanup.py | Python | gpl-3.0 | 7,809 |
# -*- coding: utf-8 -*-
bold = '\033[1m'
white = '\033[3m'
red = '\033[31m'
green = '\033[32m'
yellow = '\033[33m'
blue = '\033[34m'
reset = '\033[0m'
def error(msg):
print("[%sERROR%s] %s" % (red, reset, msg))
def warning(msg):
print("[%sWARNING%s] %s" % (yellow, reset, msg))
def info(msg):
print("[... | libcrack/iker | iker/color.py | Python | gpl-3.0 | 424 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#Autor: Antoine "0x010C" Lamielle
#Date: 2 April 2016
#License: GNU GPL v3
import sys
import time
import json
from datetime import date, timedelta
import requests
import urllib
import pywiki
DAYS = 10
def json_findall(v, k):
r = []
if type(v) == type({}):
for k1 in v:... | 0x010C/Pywikibot-scripts | archivage_forum_relecture.py | Python | gpl-3.0 | 2,697 |
# fix a bug in uuid, import it first !!
import uuid
import os
import sys
import time
import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
import datetime
import types
import cuon.DMS.documentTools
class misc:
def __init__(self):
pass
def getRandomFilename(self, sPrefix='.tmp'):
... | BackupTheBerlios/cuon-svn | cuon_client/cuon/Misc/misc.py | Python | gpl-3.0 | 4,038 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | tareqalayan/ansible | lib/ansible/modules/network/junos/junos_facts.py | Python | gpl-3.0 | 12,532 |
# -*- coding: utf-8 -*-
# pylint: disable=bad-whitespace
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests.common import Form
from odoo.tests import tagged
from odoo import fields, Command
@tagged('post_install', '-at_install')
class TestAccountMoveOutRefundOnchanges(AccountTestI... | jeremiahyan/odoo | addons/account/tests/test_account_move_out_refund.py | Python | gpl-3.0 | 34,577 |
from odoo import models, fields
import logging
# from dateutil.relativedelta import relativedelta
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
# TODO renombrar campo
arba_alicuot_ids = fields.One2many(
'res.partner.arba_alicuot',
'partner_... | ingadhoc/odoo-argentina | l10n_ar_account_withholding/models/res_partner.py | Python | agpl-3.0 | 6,436 |
import unittest
from mock import Mock
from opaque_keys.edx.locator import CourseLocator
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds
from xmodule.html_module import CourseInfoModule, HtmlDescriptor, HtmlModule
from . import get_test_descriptor_system, get_test_system
def instantia... | Lektorium-LLC/edx-platform | common/lib/xmodule/xmodule/tests/test_html_module.py | Python | agpl-3.0 | 9,284 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from frappe.desk.reportview import get_match_cond
import frappe
@frappe.whitelist()
def get_items(price_list, sales_or_purchase, item=None):
company =... | gangadharkadam/saloon_erp_install | erpnext/accounts/doctype/sales_invoice/pos.py | Python | agpl-3.0 | 3,588 |
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business involves the administration of students, teachers,
# courses, progr... | uclouvain/OSIS-Louvain | program_management/ddd/validators/_fill_check_tree_from.py | Python | agpl-3.0 | 3,276 |
# This file is part of Fedora Community.
# Copyright (C) 2008-2010 Red Hat, Inc.
#
# 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 your option) ... | Fale/fedora-packages | fedoracommunity/connectors/jsonconnector.py | Python | agpl-3.0 | 2,157 |
__doc__ = """
+-------+-----------------+----------------+-------------------+-------------+-----------------+
| step | owner | R1 | R2 | R3 | R4 |
+-------+-----------------+----------------+-------------------+-------------+-----------------+
| 2 | creat... | owncloud/smashbox | lib/owncloud/test_sharePropagationInside.py | Python | agpl-3.0 | 20,720 |
#!/usr/bin/env python
import mclevelbase
import mclevel
import infiniteworld
import sys
import os
from box import BoundingBox, Vector
import numpy
from numpy import zeros, bincount
import logging
import itertools
import traceback
import shlex
import operator
import codecs
from math import floor
try:
import readlin... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/Cura/util/pymclevel/mce.py | Python | agpl-3.0 | 47,733 |
class ProxyQuestion:
def __init__(self, *args, **kwargs):
self._meta.get_field("type").default = self.proxy_name
super().__init__(*args, **kwargs)
class Meta:
proxy = True
| project-callisto/callisto-core | callisto_core/wizard_builder/model_helpers.py | Python | agpl-3.0 | 205 |
from openquake.commonlib.tests.calculators import CalculatorTestCase
class HelloTestCase(CalculatorTestCase):
def test(self):
out = self.run_calc(__file__, 'hello.ini')
self.assertGot('hello world', out['hello'])
| raoanirudh/oq-risklib | docs/hello_test.py | Python | agpl-3.0 | 235 |
from main import *
class DateViewResearch(TemplatePage):
cacheName = "DateViewResearch"
def generateContent(self):
s = """<div class="tocbox">
<ul>
<li><a href="/bydate" title="Recent posts">All</a> </li>
<li><a href="/byresearchdate" title="Recent posts in Research">Researchers</a>
... | fbreuer/mathblogging | dateviewresearch.py | Python | agpl-3.0 | 1,631 |
# -*- coding: utf-8 -*-
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import res_partner
| open-synergy/account-payment | account_payment_extension/models/__init__.py | Python | agpl-3.0 | 167 |
from pymongo import Connection
import gridfs
from gridfs.errors import NoFile
from xmodule.modulestore import Location
from xmodule.modulestore.mongo.base import location_to_query
from xmodule.contentstore.content import XASSET_LOCATION_TAG
import logging
from .content import StaticContent, ContentStore, StaticConte... | morpheby/levelup-by | common/lib/xmodule/xmodule/contentstore/mongo.py | Python | agpl-3.0 | 9,173 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | ddd/logic/learning_unit/builder/ucl_entity_builder.py | Python | agpl-3.0 | 2,078 |
"""Auth pipeline definitions."""
from social.pipeline import partial
@partial.partial
def step(*args, **kwargs):
"""Fake pipeline step; just throws loudly for now."""
raise NotImplementedError('%s, %s' % (args, kwargs))
| jswope00/GAI | common/djangoapps/third_party_auth/pipeline.py | Python | agpl-3.0 | 231 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superd... | petrjasek/superdesk-core | tests/sequences_test.py | Python | agpl-3.0 | 2,014 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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, eit... | gst/alignak | alignak/misc/regenerator.py | Python | agpl-3.0 | 45,353 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.safestring import mark_safe
from django_jinja import libr... | janusnic/shoop | shoop/admin/templatetags/shoop_admin.py | Python | agpl-3.0 | 950 |