code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Miscellaneous helper functions.
The formatter for ANSI colored console output is heavily based on Pygments
terminal colorizing code, originally by Georg Brandl.
"""
import os
import re
import sys
import logging
from datetime import timedelta, datetime, time
from dateutil import relativedelt... | bretth/django-pq | pq/utils.py | Python | bsd-2-clause | 7,624 |
import time
import uuid
from unittest import skipIf
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import TestCase, override_settings
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django... | 1024inc/django-rq | django_rq/tests/tests.py | Python | mit | 31,271 |
__author__ = 'colinc'
from django.contrib import admin
from teams.models import Team
admin.site.register(Team)
| ColCarroll/bugbug | teams/admin.py | Python | mit | 113 |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import read_data
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
datafile = "../data/lorenz.dat"
datacols = [2, 3, 4]
data = read_data.read_cols(datafile, cols=datacols, header=1)
ax.plot(... | zhengfaxiang/Runge-Kutta-Fehlberg | src/plot_data_3d.py | Python | mit | 726 |
# -*- coding: utf-8 -*-
# note that internally 'yes'/False are converted to True/False; and so one can use 'yes'/False
# but definitely *do not* use 'True'/'False' since they are not the same as True/False...
# TLGASSUMESBETACODE means that if you only have the TLG active
# typing 'ball' is like typing 'βαλλ' and 'ba... | e-gun/HipparchiaServer | server/sample_settings/inputsettings.py | Python | gpl-3.0 | 643 |
from __future__ import unicode_literals
import frappe
def execute():
domain_settings = frappe.get_doc('Domain Settings')
active_domains = [d.domain for d in domain_settings.active_domains]
for domain_name in ('Education', 'Healthcare', 'Hospitality'):
if frappe.db.exists('Domain', domain_name) and domain_name no... | adityahase/frappe | frappe/patches/v9_1/revert_domain_settings.py | Python | mit | 416 |
#!/usr/bin/python2
# Copyright (c) 2015 Kenneth Henderick <kenneth@ketronic.be>
#
# 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
... | khenderick/zfs-snap-manager | tools/distribute.py | Python | mit | 2,014 |
from setuptools import setup, find_packages
from codecs import open
import os
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "version"), "r") as version_handle:
version = version_handle.read().strip()
setup(
name = "cujo",
version = version,
description = "A library for managing... | HurricaneLabs/cujo | setup.py | Python | mit | 600 |
from __future__ import print_function
import zmq
import socket
import dill
import uuid
from collections import defaultdict
import itertools
from multiprocessing.pool import ThreadPool
import random
from datetime import datetime
from threading import Thread, Lock
from contextlib import contextmanager
import traceback
i... | marianotepper/dask | dask/distributed/scheduler.py | Python | bsd-3-clause | 24,150 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/genomics/v1/position.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import ... | google/genomics-protos | google/genomics/v1/position_pb2.py | Python | apache-2.0 | 2,933 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
... | dmsimard/ansible | lib/ansible/plugins/doc_fragments/default_callback.py | Python | gpl-3.0 | 3,513 |
try:
VERSION = __import__('pkg_resources').get_distribution('plugin_manager').version
except Exception as e:
VERSION = 'unknown' | ahharu/plugin-manager | plugin_manager/__init__.py | Python | mit | 136 |
#!/usr/bin/env python
import GeePea
import numpy as np
#first define mean function in correct format
my_mean_func = lambda p,x: p[0] + p[1] * x
#create test data
x = np.linspace(0,1,50)
y = my_mean_func([1.,3.],x) + np.sin(2*np.pi*x) + np.random.normal(0,0.1,x.size)
#define mean function parameters and hyperparamet... | nealegibson/GeePea | examples/mean_function.py | Python | gpl-3.0 | 592 |
import json
import socket
import time
class Position:
'''
A position, represented as latitude, longitude, and altitude (relative to
the starting position of the quadcopter, in meters)
'''
def __init__(self, lat, lon, alt):
self.lat = lat
self.lon = lon
self.alt = alt
... | GaloisInc/planning-synthesis | sitl_client/sitl_client.py | Python | bsd-2-clause | 3,646 |
from __future__ import absolute_import
from collections import defaultdict
import six
from sentry.api.serializers import register, serialize, Serializer
from sentry.incidents.models import (
AlertRuleTrigger,
AlertRuleTriggerAction,
AlertRuleTriggerExclusion,
)
from sentry.utils.compat import zip
from se... | beeftornado/sentry | src/sentry/api/serializers/models/alert_rule_trigger.py | Python | bsd-3-clause | 2,392 |
class Analysis(object):
def __init__(self,t):
if type(t) != tuple:
raise AttributeError("Failed to init Analysis, parameter is not tuple")
self.id = t[0]
self.tags = t[1]
self.payload = t[2]
self.status = t[3]
def __getattr__(self, attr):
return se... | Xarxa6/hackathon | src/model.py | Python | mit | 1,305 |
import grokcore.component as grok
import zeit.content.cp.blocks.block
import zeit.content.cp.interfaces
import zeit.edit.interfaces
# XXX Should we inherit from TeaserBlock?
class AutomaticTeaserBlock(zeit.content.cp.blocks.block.Block):
grok.implements(zeit.content.cp.interfaces.IAutomaticTeaserBlock)
type ... | ZeitOnline/zeit.content.cp | src/zeit/content/cp/blocks/automatic.py | Python | bsd-3-clause | 3,593 |
#!/usr/bin/env python
# =========================================================================
#
# Copyright NumFOCUS
#
# 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:/... | richardbeare/SimpleITK | Examples/Python/CannyEdge.py | Python | apache-2.0 | 1,302 |
#!/usr/bin/python
#
# Copyright (C) 2007, 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | matclayton/OpenSocial-Python | tests/opensocial_tests/orkut_test.py | Python | apache-2.0 | 3,250 |
# -*- encoding: utf-8 -*-
"""
synthetic.py : To obtain the characteristic size of the point spread function
(PSF) of a microscope system, and to generate simulated images containing one
or multiple spots (PSF's).
Copyright (C) 2021 Andries Effting, Delmic
This program is free software; you can redistribute it and/or... | pieleric/odemis | src/odemis/util/synthetic.py | Python | gpl-2.0 | 4,092 |
# -*- coding: utf-8 -*-
#
# audioanalysis documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 19 00:41:42 2016.
#
# 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.... | jpalpant/audioanalysis | docs/source/conf.py | Python | gpl-3.0 | 9,275 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################
# Copyright/License Notice (Modified BSD License) #
#########################################################################
###################################################... | knaggsy2000/stormforce-mq | plugins/plugin_core_serverdetails.py | Python | bsd-3-clause | 8,457 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SmartTrainer.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cffls/SmartTrainnerServer | SmartTrainer/manage.py | Python | mit | 255 |
###########################################################################
#
# Copyright 2020 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
#
# https://www.apache.org/l... | google/starthinker | starthinker/task/cm_to_dv/dv_partner.py | Python | apache-2.0 | 2,503 |
#!/usr/bin/python
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import sys
import time
import datetime
parser = argparse.ArgumentParser()
parser.add_argument('logfile', nargs='?', type=argparse.FileType('r'),
defaul... | solarnz/battery-status | battery-status-graph.py | Python | gpl-2.0 | 3,651 |
# Code to handle displaying and logging of results.
# Anything in binwalk that prints results to screen should use this class.
import sys
import csv as pycsv
import datetime
import binwalk.core.common
from binwalk.core.compat import *
class Display(object):
'''
Class to handle display of output and writing ... | sundhaug92/binwalk | src/binwalk/core/display.py | Python | mit | 9,100 |
Skip to content
Search or jump to…
Pull requests
Issues
Marketplace
Explore
@zhejoe
9
3028PacktPublishing/Intelligent-Projects-Using-Python
Code Issues 0 Pull requests 0 Wiki Security Insights
Intelligent-Projects-Using-Python/Chapter02/TransferLearning.py
@santanupattanayak santanupattanayak chapter02 changes
67a... | zhejoe/my1stRepository | text.py | Python | gpl-2.0 | 10,082 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | airbnb/airflow | airflow/hooks/http_hook.py | Python | apache-2.0 | 1,123 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-20 11:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.RenameField(
... | ravisvi/OSCM | oscm_backend/backend/migrations/0002_auto_20160220_1153.py | Python | gpl-3.0 | 789 |
# Copyright (C) 2010, 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribut... | Distrotech/bzr | bzrlib/tests/test_library_state.py | Python | gpl-2.0 | 1,870 |
'''
Inspired by jtauber's django-email-confirmation.
(https://github.com/jtauber/django-email-confirmation/)
'''
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models
from djan... | drawquest/drawquest-web | website/apps/user_settings/models.py | Python | bsd-3-clause | 4,920 |
from smt.surrogate_models import RMTB
from smt.examples.one_D_step.one_D_step import get_one_d_step, plot_one_d_step
xt, yt, xlimits = get_one_d_step()
interp = RMTB(num_ctrl_pts=100, xlimits=xlimits, nonlinear_maxiter=20,
solver_tolerance=1e-16, energy_weight=1e-14, regularization_weight=0.)
interp.set_training_... | hwangjt/SMT | smt/examples/one_D_step/run_one_D_step_rmtb.py | Python | bsd-3-clause | 392 |
# Copyright 2012-2014 Ravello Systems, 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 or agree... | ryran/python-sdk | tests/flow_keypair.py | Python | apache-2.0 | 3,500 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import sys
from response import Response
def run(response, args=[]):
response_obj = Response(sys.modules[__name__])
cb = ChatBot('PantherBot')
cb.set_trainer(ChatterBotCorpu... | PantherHackers/PantherBot | scripts/talk.py | Python | mpl-2.0 | 935 |
'''Ensure that pylint finds the exported methods from flask.ext.'''
from flask.ext.wtf import Form
MYFORM = Form
| jschaf/pylint-flask | test/input/func_noerror_flask_ext_long.py | Python | gpl-2.0 | 115 |
import glob
import os
import shlex
import re
import sys
from cStringIO import StringIO
from twisted.internet import reactor, protocol
from twisted.internet.defer import Deferred
from twisted.internet.error import ProcessDone
from gadget import AuthenticationError, WaitingForAuthenticationNotice
from gadget.globals im... | Yoplitein/gadget | gadget/commands.py | Python | bsd-2-clause | 6,432 |
__client__ = "pyrc"
__version__ = "2.0"
__all__ = ['clients', ]
| CMU-Robotics-Club/pyrc | rc/__init__.py | Python | mit | 65 |
# Python - 3.6.0
Test.describe('Pernicious numbers')
Test.assert_equals(pernicious(4), [3])
Test.assert_equals(pernicious(5), [3, 5])
Test.assert_equals(pernicious(232), [3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 31, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 47, 48, 49, 50, 52, 55, 56, 5... | RevansChen/online-judge | Codewars/7kyu/pernicious-numbers/Python/test.py | Python | mit | 1,347 |
import sys
from services.housing import HouseTemplate
from engine.resources.scene import Point3D
def setup(housingTemplates):
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_corellia_house_large_style_02_deed.iff", "object/building/player/shared_player_house_generic_large_style_02.iff", 5... | agry/NGECore2 | scripts/houses/player_house_corellia_large_style_02.py | Python | lgpl-3.0 | 706 |
# Author: Nyaran <nyayukko@gmail.com>
#
# This file is part of SickRage.
#
# SickRage 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.
#... | gborri/SickRage | sickrage/notifiers/synology.py | Python | gpl-3.0 | 2,646 |
import xml.sax, re, sys, xml.sax.saxutils
from gourmet.importers import xml_importer
from gourmet.gdebug import debug
import base64
from gettext import gettext as _
unquoteattr = xml_importer.unquoteattr
class RecHandler (xml_importer.RecHandler):
def __init__ (self, total=None, conv=None, parent_thread=None):
... | Lamecarlate/gourmet | gourmet/plugins/import_export/gxml_plugin/gxml_importer.py | Python | gpl-2.0 | 4,604 |
import clientsubnetoption
import dns
import os
import socket
import struct
import threading
import time
import unittest
from authtests import AuthTest
from proxyprotocol import ProxyProtocol
class TestProxyProtocolLuaRecords(AuthTest):
_config_template = """
launch=bind
any-to-tcp=no
proxy-protocol-from=127.0.0.1... | Habbie/pdns | regression-tests.auth-py/test_ProxyProtocol.py | Python | gpl-2.0 | 7,217 |
import math
MIN_NUM = float('-inf')
MAX_NUM = float('inf')
class PID(object):
def __init__(self, kp, ki, kd, mn=MIN_NUM, mx=MAX_NUM):
self.kp = kp
self.ki = ki
self.kd = kd
self.min = mn
self.max = mx
self.int_val = 0.
self.last_error = None
def rese... | alex-n-braun/carla.hal | ros/src/twist_controller/pid.py | Python | gpl-3.0 | 1,359 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from menu import models
# Register your models here.
class MenuAdmin(admin.ModelAdmin):
ordering = ['parent']
list_filter = ['name']
list_display = [
'name', 'parent', 'show', 'url', 'priority', 'code... | linzhiming0826/cms | menu/admin.py | Python | mit | 483 |
""".. Ignore pydocstyle D400.
===========
Serializers
===========
"""
from rest_framework import serializers
from resolwe.rest.serializers import SelectiveFieldMixin
from .models import Feature, Mapping
class FeatureSerializer(SelectiveFieldMixin, serializers.ModelSerializer):
"""Serializer for feature."""
... | genialis/resolwe-bio | resolwe_bio/kb/serializers.py | Python | apache-2.0 | 1,086 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-06 11:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ip', '0031_auto_20170306_1212'),
]
operations = [
migrations.RemoveField(
... | ESSolutions/ESSArch_Core | ESSArch_Core/ip/migrations/0032_auto_20170306_1213.py | Python | gpl-3.0 | 681 |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 2 09:34:30 2017
@author: rstreet
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from events.models import ObsRequest
from scripts import query_db
class Command(BaseCommand):
args = ''
help = ''
def _... | ytsapras/robonet_site | events/management/commands/fetch_tap_list.py | Python | gpl-2.0 | 535 |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2018, 2019, 2021 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Job-Controller errors."""
class ComputingBackendSubmissionError(Excepti... | tiborsimko/reana-job-controller | reana_job_controller/errors.py | Python | mit | 388 |
# -*- coding: utf-8 -*-
try:
import re2 as re
except ImportError:
import re
from lib.cuckoo.common.abstracts import Signature
class Java_JS(Signature):
name = "java_js"
description = "执行伪装过的包含Java小型应用程序的JavaScript,可能被用于漏洞攻击尝试"
weight = 3
severity = 3
categories = ["exploit_kit", "java"]
... | lixiangning888/whole_project | modules/signatures_merge_tmp/ek_javaapplet.py | Python | lgpl-3.0 | 992 |
# 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)
from spack import *
class Log4cxx(AutotoolsPackage):
"""A C++ port of Log4j"""
homepage = "https://logging.apac... | iulian787/spack | var/spack/repos/builtin/packages/log4cxx/package.py | Python | lgpl-2.1 | 933 |
from fabric.api import *
import os
import re
import utility
@task
def enable(module_name, module_version="", pid=""):
"""
Enables a REDCap module.
"""
utility.write_remote_my_cnf()
enable_module = """
namespace ExternalModules\ExternalModules; require '/var/www/redcap/external_modules/class... | ctsit/redcap_deployment | module.py | Python | bsd-3-clause | 1,793 |
# This file is part of Indico.
# Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
#
# Indico 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... | nop33/indico-plugin-chat | indico_chat/views.py | Python | gpl-3.0 | 1,614 |
import numpy as np
import abc
class ProbabilityType(object):
SOFTMAX = "softmax"
PREDICT = "predict"
class ComputeProbability(object):
__metaclass__ = abc.ABCMeta
def compute_probability(self, input_matrix):
raise NotImplementedError
@classmethod
def minimize_vector(cls, vector):
... | ADozois/ML_Challenge | logreg/models/feature_computers/prediction_computer.py | Python | mit | 1,807 |
# -*- coding: utf-8 -*-
# Copyright 2011 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 require... | imzers/gsutil-with-php | gslib/commands/mv.py | Python | apache-2.0 | 5,678 |
import models
from django.contrib import admin
class ThumbnailInline(admin.StackedInline):
model = models.Thumbnail
fk_name = 'video'
extra = 0
class VideoAdmin(admin.ModelAdmin):
readonly_fields = ('video_id', 'youtube_url', 'swf_url',)
inlines = [ThumbnailInline]
list_filter = ('title', 'u... | laplacesdemon/django-youtube | django_youtube/admin.py | Python | bsd-3-clause | 684 |
import gdb
# this test should test the gdb pretty printers of the nim
# library. But be aware this test is not complete. It only tests the
# command line version of gdb. It does not test anything for the
# machine interface of gdb. This means if if this test passes gdb
# frontends might still be broken.
gdb.execute("s... | dom96/Nim | tests/untestable/gdb/gdb_pretty_printer_test.py | Python | mit | 1,587 |
from .vidispine_api import VSApi,VSException,VSNotFound
import xml.etree.ElementTree as ET
import re
from pprint import pprint
class VSUserGroup(VSApi):
def __init__(self,*args,**kwargs):
super(VSUserGroup, self).__init__(*args,**kwargs)
self.dataContent = None
def populateFromXML(self,xmlNod... | fredex42/gnmvidispine | gnmvidispine/vs_user.py | Python | gpl-2.0 | 5,073 |
# coding=utf-8
"""Smoke tests for the ``UI`` end-to-end scenario.
@Requirement: Ui endtoend
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: UI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from fauxfactory import gen_string, gen_ipaddr
from robottelo import manifests
from robot... | Ichimonji10/robottelo | tests/foreman/endtoend/test_ui_endtoend.py | Python | gpl-3.0 | 17,545 |
#!/usr/bin/env python3 -tt
"""
File: lol_sync.py
-----------------
@author Jason Lin, jason0@stanford.edu
Notifies you when your friends are finished with their League of Legends game
and are ready to play!
"""
import requests
import time
import calendar
from blessings import Terminal
import os
import subprocess
term... | jason2249/LoLSync | lol_sync/lol_sync.py | Python | mit | 3,893 |
# encoding: utf-8
# module _codecs_tw
# from /usr/lib/python2.7/lib-dynload/_codecs_tw.x86_64-linux-gnu.so
# by generator 1.135
# no doc
# no imports
# functions
def getcodec(*args, **kwargs): # real signature unknown
""" """
pass
# no classes
# variables with complex values
__map_big5 = None # (!) real va... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/_codecs_tw.py | Python | gpl-2.0 | 377 |
# Author: seedboy
# URL: https://github.com/seedboy
#
# This file is part of SickRage.
#
# SickRage 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 la... | srluge/SickRage | sickbeard/providers/iptorrents.py | Python | gpl-3.0 | 7,334 |
import unittest
import asyncio
from pulsar import send
from pulsar.apps.test import test_timeout
from .manage import DiningPhilosophers
class TestPhylosophers(unittest.TestCase):
app_cfg = None
concurrency = 'thread'
@classmethod
@asyncio.coroutine
def setUpClass(cls):
app = DiningPhilo... | dejlek/pulsar | examples/philosophers/tests.py | Python | bsd-3-clause | 1,021 |
from math import sqrt
class Rocket():
# Rocket simulates a rocket ship for a game,
# or a physics simulation.
def __init__(self, x=0, y=0):
# Each rocket has an (x,y) position.
self.x = x
self.y = y
def move_rocket(self, x_increment=0, y_increment=1):
# Mo... | leriomaggio/python-in-a-notebook | rocket.py | Python | mit | 1,006 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Stephen Fromm <sfromm@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: group
v... | indrajitr/ansible | lib/ansible/modules/group.py | Python | gpl-3.0 | 19,765 |
import openid
if openid.__version__ < '2.0.0':
raise ImportError, 'You need python-openid 2.0.0 or newer'
elif openid.__version__ < '2.1.0':
from openid import sreg as oidsreg
else:
from openid.extensions import sreg as oidsreg
from openid.extensions import pape as oidpape
from openid.extensions im... | i-dotcom/django-openid-consumer | django_openid_consumer/util.py | Python | bsd-2-clause | 4,342 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | ntt-sic/nova | nova/api/ec2/apirequest.py | Python | apache-2.0 | 4,960 |
#!/bin/env python
# Needs Net-SNMP Python bindings
from optparse import OptionParser
import sys
import os
import netsnmp
import pickle
import socket
import struct
import time
os.environ['MIBS'] = 'all' # install F5 mibs in net-snmp mibs directory
# usually /usr/share/snmp/mibs
package = (... | linkslice/graphite-tools | emcisilon_tempsensor.py | Python | mit | 4,700 |
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
import time
import json
from datetime import datetime
from django.conf import settings
from django.views.generic import ListView, DetailView, View
from django.utils import timezone
from django.shortcuts import redirect, reverse
from .models import Task
f... | choldrim/jumpserver | apps/ops/views.py | Python | gpl-2.0 | 2,912 |
import os
import codecs
import argparse
import csv
import simplejson as json
import uuid
from datetime import datetime
from couchbase.bucket import Bucket
def ask_to_continue(prompt):
while True:
if not str(input(prompt+'\npress [y] to continue or ctrl-c to abort\n')) == 'y':
continue
... | simonwoerpel/cb-csv-input | csvtocouchbase.py | Python | mit | 10,826 |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... | matthiaskramm/corepy | examples/spu_interspu.py | Python | bsd-3-clause | 5,421 |
import struct
import os
def u8(data):
if not 0 <= data <= 255:
print("u8 out of range: %s" % data, "INFO")
data = 0
return struct.pack(">B", data)
def u16(data):
if not 0 <= data <= 65535:
print("u16 out of range: %s" % data, "INFO")
data = 0
return struct.pack(">H", ... | RiiConnect24/File-Maker | Channels/Nintendo_Channel/ninch_thumb.py | Python | agpl-3.0 | 2,681 |
# The MIT License (MIT)
# Copyright (c) 2015 Breschine Cummins
# 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, m... | goullet/DSGRN | software/Python/PatternMatching/fileparsers.py | Python | mit | 2,607 |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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
#
# U... | opalmer/deprecated-pyfarm-models | tests/test_core_functions.py | Python | apache-2.0 | 2,828 |
from django.contrib.redirects.models import Redirect
from django import http
from django.conf import settings
class RedirectMiddleware(object):
def process_request(self, request):
path = request.get_full_path()
try:
r = Redirect.objects.get(site__id__exact=settings.SITE_ID, old_path=pat... | redsolution/django-redirect-middleware | redirects/middleware.py | Python | bsd-3-clause | 957 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-02 04:50
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... | bestafubana/blogn | blogn/blogn/posts/migrations/0002_post_author.py | Python | gpl-3.0 | 674 |
from app import app
from app import APP_STATIC
import os
import json
from flask.ext.restful.reqparse import RequestParser
from flask import jsonify
from context import campaignadvisor
map_data_name = campaignadvisor.dataframe_holder.MAP_DATA
map_data = campaignadvisor.dataframe_holder.get_dataframe(map_data_name)
@app... | srwareham/CampaignAdvisor | webapp/app/routes/index.py | Python | mit | 1,408 |
import numpy as np
from ..utils import check_random_state
class ChainWorld(object):
def __init__(self, left_length, left_reward, right_length, right_reward, on_chain_reward, p_return_to_start, random_state=None):
self.left_length = left_length
self.left_reward = left_reward
self.right_lengt... | dustinvtran/bayesrl | bayesrl/environments/chainworld.py | Python | mit | 1,441 |
# -*- coding: utf-8 -*-
#
# frisk-docs documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 26 14:48:24 2015.
#
# 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.
#
... | Adamtaranto/frisk | docs/conf.py | Python | gpl-3.0 | 9,292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# ChemPy - A chemistry toolkit for Python
#
# Copyright (c) 2010 by Joshua W. Allen (jwallen@mit.edu)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# co... | jwallen/ChemPy | setup.py | Python | mit | 2,948 |
# -*- coding: utf-8 -*-
# Scrapy settings for liferay project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest... | caihaoyu/scrapy-liferay | liferay/settings.py | Python | mit | 2,132 |
from bs4 import BeautifulSoup
import sys
import requests
import os
def run_application():
page_in_html = download_page()
images_links = find_images(page_in_html)
download_images('images', images_links)
def download_page():
address = r"http://www.filmweb.pl/ranking/film"
response = requests.get(a... | Adamage/python-training | WebApps_01_http_client/image_downloader/downloader.py | Python | apache-2.0 | 1,322 |
#!/usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
setup(
name = 'Spayify',
version = '0.1a',
description = 'Allows you to convert a spotify playlist in to MP3s you can buy.',
author = 'Matt Copperwaite',
author_email = 'matt@copperwaite.net',
url = 'ht... | yamatt/spayify | setup.py | Python | agpl-3.0 | 698 |
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | fluxer/spm | nuitka/nuitka/tree/ComplexCallHelperFunctions.py | Python | gpl-2.0 | 102,656 |
from six import string_types
from .base import ResourceWithID
class SSHKey(ResourceWithID):
"""
An SSH key resource, representing an SSH public key that can be
automatically added to the :file:`/root/.ssh/authorized_keys` files of new
droplets.
New SSH keys are created via the :meth:`doapi.creat... | jwodder/doapi | doapi/ssh_key.py | Python | mit | 3,006 |
# -*- coding: utf-8 -*-
# Aualé oware graphic user interface.
# Copyright (C) 2014-2020 Joan Sala Soler <contact@joansala.com>
#
# 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... | joansalasoler/auale | src/auale/gui/services/match_manager.py | Python | gpl-3.0 | 6,787 |
"""
Jutda Helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
urls.py - Mapping of URL's to our various views. Note we always used NAMED
views for simplicity in linking later on.
"""
from django.conf import settings
from d... | justquick/jutdahelpdesk | urls.py | Python | bsd-3-clause | 4,607 |
from __future__ import annotations
import logging
import math
from itertools import product
import pygame
from pygame.rect import Rect
from tuxemon import prepare
from tuxemon.graphics import ColorLike
from tuxemon.sprite import Sprite
from typing import Callable, Sequence, Optional, Tuple, Generator, Iterable,\
... | Tuxemon/Tuxemon | tuxemon/ui/draw.py | Python | gpl-3.0 | 7,860 |
import facebook
from functools import update_wrapper, wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.utils.decorators import available_attrs
from django.utils.http import urlquote
from django.conf import settings
... | srijanmishra/django-facebook | django_facebook/decorators.py | Python | mit | 2,793 |
# Copyright (C) 2011 Bheesham Persaud
# The license is available in LICENSE
from __future__ import division
import re
from includes.functions import *
class fileserve_com:
def init( self ):
self.url_pattern = re.compile( r'(http://www\.fileserve\.com/file/([A-Za-z0-9]+))', re.I )
self.result_pattern = re.compile... | bheesham/PyLinkChecker | hosts/fileserve_com.py | Python | bsd-3-clause | 1,325 |
# -*- coding: utf-8 -*-
#
# This file is part of LoL Server Status
#
# LoL Server Status 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
# any later version.
#
# LoL Server ... | LuqueDaniel/LoL-Server-Status | lol_server_status/gui/widgets/about.py | Python | gpl-3.0 | 2,800 |
# Fill in with the APIC admin userid
LOGIN = 'ro_apiuser'
# Fill in with the APIC admin password
PASSWORD = 'ro_apiuser'
# Fill in with the APIC IP address
IPADDR = '10.93.130.125'
# URL = 'http://' + IPADDR + ''
URL = 'https://' + IPADDR + ''
| tigelane/web2aci | credentials.py | Python | gpl-2.0 | 244 |
import logging
import json
'''
A class dedicated to work on place recognition logic.
'''
#Logging
logger = logging.getLogger(__name__)
class Feature:
def __init__(self):
#init vars
self._coords = []
self._type = ""
self._km = 0.00
self._co2 = 0.00
self._calories... | apps8os/trip-chain-game | tripchaingame/web/feature.py | Python | mit | 3,780 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016, 2017, 2018 Guenter Bartsch
#
# 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... | gooofy/nlp | zamiaai/skills/transport/__init__.py | Python | lgpl-3.0 | 740 |
#!/usr/bin/env python3
# Copyright (c) 2013-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.
SRCDIR="/home/simon/Workspaces/coin-all/patched_bitcoin_client_cpp"
BUILDDIR="/home/simon/Workspaces/coin... | simonmulser/bitcoin | qa/pull-tester/tests_config.py | Python | mit | 499 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tqchen/tvm | tests/python/relay/test_dataflow_pattern.py | Python | apache-2.0 | 45,896 |
""" docstring for file clientmodule.py """
from data.suppliermodule_test import Interface, DoNothing
class Ancestor(object):
""" Ancestor method """
__implements__ = (Interface,)
def __init__(self, value):
local_variable = 0
self.attr = 'this method shouldn\'t have a docstring'
sel... | dbbhattacharya/kitsune | vendor/packages/pylint/test/data/clientmodule_test.py | Python | bsd-3-clause | 757 |
# Copyright 2017 reinforce.io. 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... | lefnire/tensorforce | tensorforce/core/explorations/epsilon_anneal.py | Python | apache-2.0 | 2,208 |
class Solution:
def removeOuterParentheses(self, S):
s, p = 0, -1
ans, tmp = "", ""
for i, x in enumerate(S):
if x == "(": s += 1
else:
s -= 1
if s == 0:
ahttps://map.naver.com/?query=&searchCoord=&street=on&tab=1&l... | zuun77/givemegoogletshirts | leetcode/python/5016_remove-outermost-parentheses.py | Python | apache-2.0 | 936 |
def f(a):
while a:
<caret> | asedunov/intellij-community | python/testData/postfix/while/function_after.py | Python | apache-2.0 | 38 |
# -*- coding: utf-8 -*-
import pyodbc
cs = {
'server':'ahwsqlinind019.ind1.stvincent.org',
'database':'st2cpr1.tst_153',
#'database':'st1bprvb.st1',
'user':'scmis',
'pw':'year04',
}
conn = pyodbc.connect(
driver='{SQL Server}',
server=cs['server'],
uid=cs['user'],
pwd=cs['pw'],
)
... | whichwit/scm-stv | mlms/_get-mlms.py | Python | gpl-2.0 | 725 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.