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 python
#
# submit_details_EI.py
#
# Submit job(s) to the cluster/workstation: parameter sweep detailed plots
# (noise)
#
# Copyright (C) 2012 Lukas Solanka <l.solanka@sms.ed.ac.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/submit_details_EI.py | Python | gpl-3.0 | 2,420 |
# Copyright 2014 Kevin L. Mitchell
# 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 require... | klmitch/fstree | tests/unit/test_tarname.py | Python | apache-2.0 | 12,751 |
#
# Copyright (C) 2011 Anders Hammarquist <iko@iko.pp.se>
#
# 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 pro... | bewest/glucodump | glucodump/test/test_usbcomm.py | Python | gpl-2.0 | 3,460 |
#!/usr/bin/env python3
#
# This file is part of sarracenia.
# The sarracenia suite is Free and is proudly provided by the Government of Canada
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2008-2015
#
# Questions or bugs report: dps-client@ec.gc.ca
# sarracenia repository: git://git.code... | petersilva/metpx-sarracenia | sarra/sr_util.py | Python | gpl-2.0 | 15,680 |
# 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/operation.py | Python | mit | 1,655 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2007 Donald N. Allingham
#
# 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 t... | Forage/Gramps | gramps/gen/datehandler/_date_sl.py | Python | gpl-2.0 | 10,756 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Use Google geocoding service
https://developers.google.com/maps/documentation/geocoding/intro
to locate germplasm accessions which are missing lat/lng coordinates.
"""
from urllib import urlencode
import requests
import psycopg2
import time
import argparse
import petl... | legumeinfo/lis_gis | scripts/geocode.py | Python | gpl-3.0 | 8,062 |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: aws_ses_identity
short_de... | thaim/ansible | lib/ansible/modules/cloud/amazon/aws_ses_identity.py | Python | mit | 23,233 |
from __future__ import unicode_literals, print_function
import os
import sys
import subprocess
import json
from ape import feaquencer
from ape import tasks
from .exceptions import ContainerError, ContainerNotFound, ProductNotFound
class Config(object):
APE_ROOT = os.environ['APE_ROOT_DIR']
SOURCE_HEADER = '#... | henzk/ape | ape/container_mode/tasks.py | Python | mit | 12,347 |
# Copyright 2014 Netflix, 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... | lucab/security_monkey | security_monkey/views/__init__.py | Python | apache-2.0 | 4,454 |
""" ASOS Daily Summary Message Parser ingestor """
# 3rd Party
import pytz
from twisted.internet import reactor
from pyiem.nws.products.dsm import parser
from pyiem.util import get_dbconn, LOG
# Local
from pywwa import common
from pywwa.ldm import bridge
from pywwa.database import get_database
# database timezones t... | akrherz/pyWWA | parsers/pywwa/workflows/dsm_parser.py | Python | mit | 1,603 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Article.content_list'
db.alter_column(u'articles_artic... | AmandaCMS/amanda-cms | amanda/articles/migrations/0013_auto__chg_field_article_content_list.py | Python | mit | 8,183 |
# vim:set et sts=4 sw=4:
#
# Zanata Python Client
#
# Copyright (c) 2011 Jian Ni <jni@redhat.com>
# Copyright (c) 2011 Red Hat, Inc.
#
# This library 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; eith... | zanata/zanata-python-client | zanataclient/zanatalib/versionservice.py | Python | lgpl-2.1 | 1,420 |
from functools import (partial)
import os
import time
import boto.ec2
from fabric.api import (
abort,
env,
hide,
run,
sudo
)
from fabric.context_managers import (
quiet,
settings
)
CLOUD_INIT_TMPL = """#cloud-config
ssh_authorized_keys:
- {0}
packages:
- git
runcmd:
- apt-key adv ... | loads/tc-builder | fabfile.py | Python | apache-2.0 | 4,398 |
import unittest
from .storage_test_tables import StorageTestTables
from .storage_test_methods import StorageTestMethods
try:
from builtins import range
except ImportError:
pass
import tempfile
import os
from sqlalchemy import create_engine, MetaData
import time
from flask_prose import Storage
class StorageTes... | slippers/Flask-Prose | tests/test_sqlite_storage.py | Python | mit | 936 |
# The MIT License (MIT)
# Copyright (c) 2014-2017 University of Bristol
#
# 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 us... | IRC-SPHERE/HyperStream | hyperstream/factor/factor.py | Python | mit | 26,798 |
from rsqueakvm.model.numeric import W_Float, W_SmallInteger
from rsqueakvm.plugins.ruby.model import W_RubyObject
from rsqueakvm.plugins.ruby.objspace import ruby_space
from rsqueakvm.model.variable import W_BytesObject
from topaz.objects.arrayobject import W_ArrayObject as WR_ArrayObject
from topaz.objects.floatobjec... | HPI-SWA-Lab/RSqueak | rsqueakvm/plugins/ruby/utils.py | Python | bsd-3-clause | 2,666 |
# -*- coding: utf-8 -*-
import logging
import requests
import requests_cache
import re
import dateutil.parser
from datetime import datetime, timedelta
import time
from django.utils.html import strip_tags
from .base import Importer, register_importer, recur_dict
from .yso import KEYWORDS_TO_ADD_TO_AUDIENCE
from events.... | City-of-Helsinki/linkedevents | events/importer/helmet.py | Python | mit | 21,946 |
from .app import Config
__all__ = ('Config', ) | avanov/solo | solo/config/__init__.py | Python | mit | 47 |
import boto3
import json
from moto import mock_iot
@mock_iot
def test_create_job():
client = boto3.client("iot", region_name="eu-west-1")
name = "my-thing"
job_id = "TestJob"
# thing# job document
# job_document = {
# "field": "value"
# }
thing = client.create_thing(th... | spulec/moto | tests/test_iot/test_iot_jobs.py | Python | apache-2.0 | 11,995 |
default_app_config = 'openedx.features.partners.apps.PartnersConfig'
| philanthropy-u/edx-platform | openedx/features/partners/__init__.py | Python | agpl-3.0 | 69 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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
#
# Unle... | dsiddharth/access-keys | keystone/auth/routers.py | Python | apache-2.0 | 1,667 |
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import os
from StringIO import StringIO
import tarfile
from textwrap import dedent
from bzrlib.bzrdir import BzrDir
from lpbuildd.pottery.intltool import (
check_potfiles... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/translations/tests/test_pottery_detect_intltool.py | Python | agpl-3.0 | 21,171 |
from core import * | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pandoc/__init__.py | Python | agpl-3.0 | 18 |
from queue import Queue
from bears.dart.DartLintBear import DartLintBear
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
from tests.LocalBearTestHelper import verify_local_bear, LocalBearTestHelper
from tests.BearTestHelper import generate_skip_decorator
good_file = """
printN... | sounak98/coala-bears | tests/dart/DartLintBearTest.py | Python | agpl-3.0 | 1,555 |
#!/usr/bin/env python
"""A small example showing how to list a directory in
Manta using the python-manta client. Usage:
python ls-directory.py
python ls-directory.py -v # for verbose output
"""
import logging
import os
from pprint import pprint
import sys
# Import the local manta module.
sys.path.insert(0,... | joyent/python-manta | examples/ls-directory.py | Python | mit | 1,841 |
# -*- coding: utf-8 -*-
import riprova
# Store number of function calls for error simulation
calls = 0
# Register retriable operation with custom evaluator
@riprova.retry
def mul2(x):
global calls
if calls < 3:
calls += 1
raise RuntimeError('simulated call error')
return x * 2
# Run t... | h2non/riprova | examples/decorator.py | Python | mit | 376 |
"""
Django settings for cms project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths in... | linuxsoftware/mamc-wagtail-site | cms/settings/base.py | Python | mit | 3,622 |
# Copyright 2019 The TensorFlow Authors. 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 applica... | chemelnucfin/tensorflow | tensorflow/lite/testing/toco_convert.py | Python | apache-2.0 | 6,291 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. 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.
from .detail import LoginAsUserView, UserDetailView
from .list import UserListView
from .p... | suutari-ai/shoop | shuup/admin/modules/users/views/__init__.py | Python | agpl-3.0 | 603 |
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self, parent, ID, title, pos=wxDefaultPosition,
size=(200, 200), style=wxDEFAULT_FRAME_STYLE):
wxFrame.__init__(self, parent, ID, title, pos, size, style)
panel = wxPanel(self, -1)
button = wxButton(panel, 1003... | skeenp/Roam | libs/py2exe-0.6.9/py2exe/samples/extending/test_wx.py | Python | gpl-2.0 | 1,025 |
# Watchdog - Building supervision with Raspberry Pi
# (C)2017 - Norbert Huffschmid
# email plugin
import ConfigParser
import dbus
import dbus.mainloop.glib
import gobject
import logging
import os
import signal
import subprocess
logger = logging.getLogger('watchdog.plugin.email') # __name__ is __main__
CONFIG_FILE =... | long-exposure/watchdog | plugin/email/daemon/__main__.py | Python | gpl-3.0 | 3,528 |
#
# Copyright 2014 OpenStack Foundation
# 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 req... | froyobin/ironic | ironic/common/swift.py | Python | apache-2.0 | 8,033 |
import makerController
import makerErrorReport
import makerBugReport
class Controller(makerController.SuperController):
def drawDialog(self):
self.dialog = makerErrorReport.xrcErrorDialog(self.view)
self.dialog.Cancel.Bind(self.view.wx.EVT_BUTTON,
self.close)... | kublaj/the-maker | makerErrorHandler.py | Python | gpl-3.0 | 1,012 |
from . import api
class DeltaDatasets():
# DeltaDatasets.Delta_ModuleTimeTable
def delta_module_timetable(self, lastModified, moduleCode=None, auth=True):
params = {'LastModified': lastModified, 'ModuleCode': moduleCode}
return api.call('Delta_ModuleTimeTable', params, auth)
| karen/ivle-bot | pyivle/helpers/delta_datasets.py | Python | mit | 301 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_channels.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sourcelair-blueprints/django-channels-chat | manage.py | Python | mit | 258 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 I.A.S. INGENIERÍA, APLICACIONES Y SOFTWARE Johan Alejandro Olano (<http:http://www.ias.com.co).
#
# This program is free software: you can r... | Jgarcia-IAS/SAT | openerp/addons-extra/l10n_co_vat/__openerp__.py | Python | agpl-3.0 | 1,679 |
import time
import futils.util as futil
import segmentor as v_seg
import keras.backend as K
K.set_learning_phase(1)
#LOAD THE MODEL
segment = v_seg.v_segmentor(batch_size=1, model='models/final.h5', ptch_sz=128, z_sz=64)
#LOAD THE CT_SCAN
scan_file = 'VESSEL12_15.mhd'
ct_scan, origin, spacing, orientation = futil.... | hoffba/cmi_R2015a | pycode/run_single_segmentation.py | Python | gpl-2.0 | 788 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py | Python | mit | 860 |
''' Django notifications admin file '''
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Notification
class NotificationAdmin(admin.ModelAdmin):
raw_id_fields = ('recipient',)
list_display = ('recipient', 'actor',
'level', 'target', 'unread', 'public')
list_... | lukeburden/django-notifications | notifications/admin.py | Python | bsd-3-clause | 576 |
# Copyright 2021 PeppyMeter peppy.player@gmail.com
#
# This file is part of PeppyMeter.
#
# PeppyMeter 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) a... | project-owner/Peppy | scripts/screensaverstart.py | Python | gpl-3.0 | 1,158 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-11 12:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fcm_app', '0028_auto_20180925_1731'),
]
operations = [
migrations.AddField(
... | gtsapelas/TRANSrisk_fcm_project | fcm_app/migrations/0029_fcm_image_url.py | Python | mit | 443 |
# Copyright 2018 The TensorFlow Authors 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 applicab... | alexgorban/models | research/cvt_text/cvt.py | Python | apache-2.0 | 2,501 |
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Choroplethmapbox(_BaseTraceType):
# class properties
# --------------------
_parent_path_str = ""
_path_str = "choroplethmapbox"
_valid_props = {
"autocolorscale",
"below",
"colorax... | plotly/python-api | packages/python/plotly/plotly/graph_objs/_choroplethmapbox.py | Python | mit | 76,685 |
from django.db import models
class Funday(models.Model):
# meta data
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
# details
description = models.TextField()
name = models.CharField(max_length=255)
video = models.URLField()
# filtera... | wraithan/funday | anyday/core/models.py | Python | mit | 821 |
from serverinstallation import *
from concurrentusage import *
from clusterusage import *
| motivator/clusto | src/clusto/test/usage/__init__.py | Python | bsd-3-clause | 91 |
#!/usr/bin/env python
'''
Javanicus - a WebHDFS FUSE driver
https://github.com/rascalking/javanicus
The name Javanicus comes from googling for "elephant snake", eg.
http://www.iucnredlist.org/details/176718/0
A simple ls command will be tranlsated to:
$ curl -i -X GET "http://localhost:50070/webhdfs/v1/?op=LISTSTAT... | rascalking/javanicus | javanicus.py | Python | gpl-3.0 | 23,386 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | mmnelemane/nova | nova/tests/unit/scheduler/test_scheduler_options.py | Python | apache-2.0 | 5,307 |
# Volatility
# Copyright (C) 2007,2008 Volatile Systems
#
# Derived from source in PyFlag developed by:
# Copyright 2004: Commonwealth of Australia.
# Michael Cohen <scudette@users.sourceforge.net>
# David Collett <daveco@users.sourceforge.net>
#
# ******************************************************
# Version: FLA... | halbbob/dff | modules/mem/Volatility-1.3_Beta/forensics/registry.py | Python | gpl-2.0 | 10,968 |
from chainer_wing.data_fetch import DataManager
import numpy as np
if __name__ == '__main__':
expect_x = np.array([[3., 4.],
[3., 5.],
[2., 6.],
[2., 7.],
[1., 8.],
[1., 9.]])
expect_y =... | fukatani/CW_gui | chainer_wing/test/test_data_fetch.py | Python | bsd-3-clause | 730 |
# start by importing version, because for some weird reason, I sometimes get
# networkx as over-riding the version here (no idea why...)
try:
# should work if installed through normal means: setup.py-based with
# pip, conda, easy_install, etc.
from . import version
except ImportError: # pragma: no cover
... | choderalab/openpathsampling | openpathsampling/__init__.py | Python | lgpl-2.1 | 6,715 |
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import random
from seesaw.config import realize, NumberConfigValue
from seesaw.item import ItemInterpolation, ItemValue
from seesaw.task import SimpleTask, LimitConcurrent
from seesaw.tracker import GetItemFromTrac... | ArchiveTeam/jux-grab | pipeline.py | Python | unlicense | 9,468 |
# Copyright 2015-present Palo Alto Networks, 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... | PaloAltoNetworks/minemeld-core | minemeld/flask/configdataapi.py | Python | apache-2.0 | 13,739 |
from flask import (render_template,
redirect,
url_for,
request
)
from sqlalchemy.orm.exc import (
NoResultFound,
)
from . import blogs
from ..models.post import Post
from ..utils import (load_page_meta,
NotSetup,
... | Gateswong/GatesBlog | blog/blogs/routes.py | Python | mit | 1,892 |
"""Utils for Magic Home."""
from __future__ import annotations
from flux_led.aio import AIOWifiLedBulb
from flux_led.const import COLOR_MODE_DIM as FLUX_COLOR_MODE_DIM, MultiColorEffects
from homeassistant.components.light import (
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
COLOR_MODE_WHITE,
)
from homeassi... | rohitranjan1991/home-assistant | homeassistant/components/flux_led/util.py | Python | mit | 3,868 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/r-a4classif/package.py | Python | lgpl-2.1 | 2,046 |
from django.contrib.admin import ModelAdmin
from django.utils.encoding import smart_text
class OimModelAdmin(ModelAdmin):
""" OimModelAdmin"""
def has_module_permission(self, request):
user = request.user
if user.is_superuser:
return True
if user.is_staff:
if ... | rockychen-dpaw/oim-cms | registers/utils.py | Python | apache-2.0 | 806 |
#
# Copyright 2013 Julien Danjou
# Copyright 2014 Red Hat, Inc
#
# Authors: Julien Danjou <julien@danjou.info>
# Eoghan Glynn <eglynn@redhat.com>
# Nejc Saje <nsaje@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | cernops/ceilometer | ceilometer/agent/manager.py | Python | apache-2.0 | 20,287 |
import cPickle as pickle
import numpy as np
import os
def load_CIFAR_batch(filename):
""" load single batch of cifar """
with open(filename, 'rb') as f:
datadict = pickle.load(f)
X = datadict['data']
Y = datadict['labels']
X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype("float")
Y = n... | akshaycool/drawing_ml | data_utils.py | Python | mit | 717 |
#!/usr/bin/python
import sys
import json
import re
sys.path.append('../py-trello')
from trello import TrelloClient
sys.path.append('../python-geojson')
#import cartodb
import secrets
client = TrelloClient(
api_key=secrets.trello_key,
api_secret=secrets.trello_secret,
token=secrets.trello_oauth_token,... | h4ck3rm1k3/codefortrenton-geocoder | trello_geojson.py | Python | gpl-3.0 | 3,549 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random
import string
def activation_code(chars = string.ascii_uppercase + string.digits, length=16):
return ''.join([random.choice(chars) for i in range(length)])
if __... | Show-Me-the-Code/python | pylyria/0001/0001_1.py | Python | mit | 651 |
from pwn import Thread, sleep, pause
def f(n):
try:
while True:
sleep(0.001)
finally:
print 'EXIT', n
ts = [Thread(target = f, args = (n,)) for n in range(10)]
for t in ts:
t.start()
pause()
for t in ts:
t.sigterm()
for t in ts:
t.join()
| Haabb/pwnfork | pwn/test/thread.py | Python | mit | 291 |
# Copyright (c) 2017 Claudiu Popa <pcmanticore@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""Astroid hooks for the UUID module."""
from astroid import MANAGER
from astroid import nodes
... | AtomLinter/linter-pylama | bin/deps/astroid/brain/brain_uuid.py | Python | mit | 572 |
from boto.s3.connection import S3Connection
import boto
from boto.s3.key import Key
from socket import gaierror
from ConfigParser import NoOptionError
import settings
import logger
l = logger.setup(__name__)
def connect():
"""
Return a connected S3 bucket based on settings in
config.cfg.
"""
# Red... | achavez/photostreamer-pi | s3.py | Python | mit | 1,953 |
# This file is part of cldoc. cldoc 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 even the ... | jessevdk/cldoc | cldoc/comment.py | Python | gpl-2.0 | 14,766 |
import itertools
import pytest
import logging
from cassandra.query import dict_factory
from dtest import RUN_STATIC_UPGRADE_MATRIX, Tester
from thrift_bindings.thrift010 import Cassandra
from thrift_bindings.thrift010.Cassandra import (Column, ColumnDef,
ColumnParent, Consis... | aweisberg/cassandra-dtest | upgrade_tests/thrift_upgrade_test.py | Python | apache-2.0 | 26,089 |
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2012 ##
## ... | tkasp/osmose-backend | plugins/Structural_Useless_Relation.py | Python | gpl-3.0 | 3,480 |
import os
import numpy as np
import orca
import pandas as pd
from activitysim import activitysim as asim
from .util.misc import add_dependent_columns
from activitysim.util import reindex
from .util.non_mandatory_tour_frequency import process_non_mandatory_tours
"""
This model predicts the frequency of making non-ma... | bhargavasana/activitysim | activitysim/defaults/models/non_mandatory_tour_frequency.py | Python | agpl-3.0 | 3,497 |
import subprocess
import sys
import os
resultDir = os.environ.get('RESULTS')
if resultDir == None :
print "WARNING! $RESULTS not set! Attempt to write results will fail!\n"
timeInterval = 60000.0
fileInfo = sys.argv[1]
resultsPlace = resultDir+"/"+fileInfo+"/"
if not os.path.exists(resultsPlace):
print"WARNI... | joshuahellier/PhDStuff | codes/kmc/periodicBehaviour/grandPostProcessor.py | Python | mit | 1,191 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Implementation of Spack imports that uses imp underneath.
``imp`` is deprecated in newer versions of Python, but is th... | rspavel/spack | lib/spack/spack/util/imp/imp_importer.py | Python | lgpl-2.1 | 2,014 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import cm
import operator
import os
import ConfigParser
import string
config = ConfigP... | andydrop/x17papertrail | abook2pdf.py | Python | gpl-3.0 | 3,106 |
#!/usr/bin/python
import Queue
import threading
import time
import json
import commands
import sys, os
import MySQLdb as mysql
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from nbNet.nbNet import *
db = mysql.connect(user="reboot", passwd="reboot123", \
db="sys_song", charset="utf8")
db.autocommit(True)... | liuziping/simpleMon | db/framework.py | Python | apache-2.0 | 1,453 |
class ConfigurationError(Exception):
def __init__(self, key, error):
self.key = key
self.error = error
def __str__(self):
return "%s: %s" % (self.key, self.error)
def parse_config(config, spec, root=None):
parsed = {}
for key, parser_or_spec in spec.iteritems():
if roo... | spladug/sutro | sutro/config.py | Python | bsd-3-clause | 1,192 |
# Copyright 2015 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... | sachinpro/sachinpro.github.io | tensorflow/python/framework/importer.py | Python | apache-2.0 | 15,940 |
# -*- coding: utf-8 -*-
"""Family module for Wikinews."""
#
# (C) Pywikibot team, 2005-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import family
# The Wikimedia family that is known as Wikinews
class Family(family.SubdomainFamily,... | Wesalius/EloBot | pywikibot/families/wikinews_family.py | Python | gpl-3.0 | 1,567 |
"""
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size
>= capacity / 10), we should double the size of the hash table and rehash every keys. Say you have a hash table looks
like below:
size=3, capacity=4
[null, 21->9->null, 14->null, null]
The hash f... | algorhythms/LintCode | Rehashing.py | Python | apache-2.0 | 2,076 |
# -*- coding:utf-8 -*-
"""
Check if github repository release is updated.
"""
from urllib import parse
import json
import re
import requests
from six.moves import zip
def _compare_tag(l_tag, c_tag, split='.'):
tag_pattern = re.compile(r'((?:\d*\%s){0,4}\d+)' % split)
l_list = re.search(tag_pattern, l_tag).... | chroming/pdfdir | src/isupdated.py | Python | gpl-3.0 | 2,881 |
# -*- coding: utf-8 -*-
# Copyright 2016 Antonio Espinosa (http://github.com/antespi)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
__author__ = 'Antonio Espinosa'
__email__ = 'antespi@gmail.com'
__version__ = '0.0.1'
__doc__ = """A library for making Odoo ETL script easily."""
__license__ = "AGPL-3"... | antespi/odoo-etl | odooetl/__init__.py | Python | agpl-3.0 | 321 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | ricorx7/rti_python | PlanR/backend/WebsocketServer.py | Python | bsd-3-clause | 2,562 |
# provide email related functionality.
# user send email, whose subject should be: "request", body include:
# "yourskypename".
import time
import email, imaplib, os, random
import smtplib
import subprocess
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
... | magicle/Facet | src/EmailService.py | Python | gpl-3.0 | 5,853 |
"""
This script calculates solutions to some of the problems from the
"Many Digits" competition:
http://www.cs.ru.nl/~milad/manydigits/problems.php
Run with:
python manydigits.py
"""
from __future__ import print_function
from mpmath import *
from mpmath.libmp import to_fixed, bin_to_radix
dps = 100
mp.dps = dp... | JensGrabner/mpmath | demo/manydigits.py | Python | bsd-3-clause | 2,354 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
RELATIVE_URLS = False
DELETE_OUTPUT_DIRECTORY = True
P... | kura/kura.io | publishconf.py | Python | mit | 344 |
#complex math
import math
import cmath
mathe = None
v = None
w = None
x = None
y = None
z = None
print('''Complex math!
What would you like to do?
[P]owers/Roots
[Q]uadratics
''')
power = {'p','P', 'powers', 'power', 'root', 'roots', 'Powers/Roots', 'powers/roots', 'Root... | tjboyette/pyrot | commath.py | Python | gpl-2.0 | 2,827 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017 Chris Fournier. All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found
# in the LICENSE file.
from __future__ import unicode_literals
import codecs
import os
import pytest
import stat
from important.parse import _imports, p... | cfournie/important | tests/important/test_parse.py | Python | mit | 6,383 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-04-03 13:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('estoque', '0011_movstq_tipo_mov_init'),
]
operati... | anselmobd/fo2 | src/estoque/migrations/0012_movstq_tipo_mov_null.py | Python | mit | 593 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | centricular/cerbero | cerbero/commands/cleanone.py | Python | lgpl-2.1 | 2,001 |
from pyxb_114.bundles.opengis.gml_3_3.raw.lro import *
| msherry/PyXB-1.1.4 | pyxb_114/bundles/opengis/gml_3_3/lro.py | Python | apache-2.0 | 55 |
from __future__ import absolute_import
from typing import Optional, Tuple, Mapping, Any, Text
from django.utils.translation import ugettext as _
from django.conf import settings
from django.template.defaultfilters import slugify
from django.core.files import File
from django.http import HttpRequest
from jinja2 import ... | samatdav/zulip | zerver/lib/upload.py | Python | apache-2.0 | 18,689 |
#!/usr/bin/python
#
# Copyright (c) 2009 Google 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 source code must retain the above copyright
# notice, this list of ... | rflament/loggedfs | vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py | Python | apache-2.0 | 182,210 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...drawing import Drawing
class TestWriteXdrcNvGraphicFrameP... | jmcnamara/XlsxWriter | xlsxwriter/test/drawing/test_write_c_nv_graphic_frame_pr.py | Python | bsd-2-clause | 882 |
# -*- coding: utf8 -*-
r"""
Attributes
There are several builtin-attributes which have a predefined meaning in \Mathics.
However, you can set any symbol as an attribute, in contrast to \Mathematica.
"""
from mathics.builtin.base import Predefined, Builtin
from mathics.core.expression import Symbol, Expression
from m... | lidavidm/mathics-heroku | mathics/builtin/attributes.py | Python | gpl-3.0 | 7,870 |
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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; version 2 of the License.
#
# This program is distributed in th... | dannykopping/mysql-utilities | mysql-test/suite/replication/t/check_gtid_version.py | Python | gpl-2.0 | 4,375 |
import inspect
import logging
import os
import re
import shlex
import subprocess
import sys
import textwrap
import time
from datetime import datetime
from email.utils import formatdate as format_rfc2822
from io import StringIO
from urllib.parse import quote
import aiohttp
import discord
import psutil
import pytz
from ... | s0hvaperuna/Not-a-bot | cogs/utils.py | Python | mit | 28,689 |
# -*- coding: utf-8 -*-
#
# mailbot documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 23 17:31:52 2013.
#
# 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.
#
# All... | magopian/mailbot | docs/source/conf.py | Python | bsd-3-clause | 7,865 |
# -*- coding: utf-8 -*-
"""
anparser - an Open Source Android Artifact Parser
Copyright (C) 2015 Preston Miller
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
(a... | anparser/anparser | anparser/plugins/sqlite_plugins/android_chrome.py | Python | gpl-3.0 | 4,303 |
"""Compute images."""
# :license: MIT, see LICENSE for more details.
from SoftLayer.CLI import formatting
MASK = ('id,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,'
'imageType')
DETAIL_MASK = MASK + (',children[id,blockDevicesDiskSpaceTotal,datacenter],'
'note,create... | skraghu/softlayer-python | SoftLayer/CLI/image/__init__.py | Python | mit | 467 |
"""
Individual is a class that keep together id, dna and neural networks.
"""
from itertools import islice, chain
from collections import defaultdict
import tergraw
from neural_world import actions
from neural_world import default
from neural_world import commons
from neural_world.commons import Direction
from neura... | Aluriak/neural_world | neural_world/individual.py | Python | gpl-2.0 | 4,436 |
import pytest
from flask_restful import fields
from flask_restful_swagger import swagger
@pytest.mark.parametrize(
"case_name, test_input, expected",
[
("Null", None, None),
("Simple False", False, "boolean"),
("Simple True", True, "boolean"),
("Integer", 1, "integer"),
... | rantav/flask-restful-swagger | tests/test_deduce_swagger_type_flat.py | Python | mit | 1,887 |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
from pimlico.core.modules.map import skip_invalid
from pimlico.core.modules.map.multiproc import multiprocessing_executor_factory
def preprocess(executor):
... | markgw/pimlico | src/python/pimlico/modules/corpora/vocab_mapper/execute.py | Python | gpl-3.0 | 1,531 |
# (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... | pe-suke/ansible | lib/ansible/vars/__init__.py | Python | gpl-3.0 | 16,447 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.