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 |
|---|---|---|---|---|---|
import agents as ag
import envgui as gui
# change this line ONLY to refer to your project
import submissions.Karman.vacuum2 as v2
# ______________________________________________________________________________
# Vacuum environment
class Dirt(ag.Thing):
pass
class VacuumEnvironment(ag.XYEnvironment):
"""The... | JoeLaMartina/aima-python | submissions/Karman/vacuum2Runner.py | Python | mit | 6,342 |
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The facts class for eos
this file validates each subset of facts and selectively
calls the appropriate facts gathering function
"""
from __future__ import (absolute_import, ... | simonwydooghe/ansible | lib/ansible/module_utils/network/eos/facts/facts.py | Python | gpl-3.0 | 2,719 |
import inspect
import sys
from collections import namedtuple
###############
# Structs #
###############
# Request payloads
ProduceRequest = namedtuple("ProduceRequest",
["topic", "partition", "messages"])
FetchRequest = namedtuple("FetchRequest",
["topic", "... | DadanielZ/incubator-eagle | eagle-external/hadoop_jmx_collector/lib/kafka-python/kafka/common.py | Python | apache-2.0 | 4,849 |
import unittest
import pickle
import cPickle
import StringIO
import cStringIO
import pickletools
import copy_reg
from test.test_support import TestFailed, have_unicode, TESTFN
# Tests that try a number of pickle protocols should have a
# for proto in protocols:
# kind of outer loop.
assert pickle.HIGHEST_PROTOCOL... | antb/TPT----My-old-mod | src/python/stdlib/test/pickletester.py | Python | gpl-2.0 | 39,620 |
"""
A few practical conventions common to all printers.
"""
from __future__ import print_function, division
import re
import collections
_name_with_digits_p = re.compile(r'^([a-zA-Z]+)([0-9]+)$')
def split_super_sub(text):
"""Split a symbol name into a name, superscripts and subscripts
The first part ... | NikNitro/Python-iBeacon-Scan | sympy/printing/conventions.py | Python | gpl-3.0 | 2,504 |
#!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
#
# This module 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 ve... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/openstack/os_project_facts.py | Python | bsd-3-clause | 5,044 |
# $Id: 969e4c5fd51bb174563d06c1357489c2742813ec $
"""
Base classes for enhanced DB drivers.
"""
from __future__ import absolute_import
__docformat__ = "restructuredtext en"
# ---------------------------------------------------------------------------
# Imports
# ------------------------------------------------------... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/grizzled/grizzled/db/base.py | Python | bsd-3-clause | 32,027 |
# coding: utf-8
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
class TVLandIE(MTVServicesInfoExtractor):
IE_NAME = 'tvland.com'
_VALID_URL = r'https?://(?:www\.)?tvland\.com/(?:video-clips|episodes)/(?P<id>[^/?#.]+)'
_FEED_URL = 'http://www.tvland.com/feeds/mrss/'
_... | nandhp/youtube-dl | youtube_dl/extractor/tvland.py | Python | unlicense | 2,568 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Flag.testing'
db.add_column('waffle_flag', 'testing', self.gf('django.db.models.fields.Boo... | mark-adams/django-waffle | waffle/south_migrations/0004_auto__add_field_flag_testing.py | Python | bsd-3-clause | 5,923 |
from distutils import sysconfig
NAME = 'gevent'
CFLAGS = [
'-I' + sysconfig.get_python_inc(),
'-I' + sysconfig.get_python_inc(plat_specific=True)
]
LDFLAGS = []
LIBS = []
GCC_LIST = ['gevent', 'hooks']
| goal/uwsgi | plugins/gevent/uwsgiplugin.py | Python | gpl-2.0 | 213 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks 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
import os
import json
import pytest
import sys
if sys.version_info < (2... | resmo/ansible | test/units/modules/network/f5/test_bigip_appsvcs_extension.py | Python | gpl-3.0 | 2,904 |
from Screens.Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Components.FileList import FileList
from Components.Sources.StaticText import StaticText
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigYesNo, ConfigDirectory
from Components.ConfigList impo... | kingvuplus/EGAMI-D | lib/python/Plugins/Extensions/MediaPlayer/settings.py | Python | gpl-2.0 | 5,014 |
#!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
#
# This module 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 ve... | kaarolch/ansible | lib/ansible/modules/cloud/openstack/os_project_facts.py | Python | gpl-3.0 | 4,920 |
class Comment(object):
# See documentation at https://api.imgur.com/ for available fields
def __init__(self, *initial_data, **kwargs):
for dictionary in initial_data:
for key in dictionary:
setattr(self, key, dictionary[key])
for key in kwargs:
setattr(se... | atareao/nautilus-imgur-uploader | src/imgurpython/imgur/models/comment.py | Python | gpl-3.0 | 342 |
def main(request, response):
headers = {
# CORS-safelisted
"content-type": "text/plain",
"cache-control": "no cache",
"content-language": "en",
"expires": "Fri, 30 Oct 1998 14:19:41 GMT",
"last-modified": "Tue, 15 Nov 1994 12:45:26 GMT",
"pragma": "no-cache",
... | paulrouget/servo | tests/wpt/web-platform-tests/xhr/resources/access-control-basic-whitelist-response-headers.py | Python | mpl-2.0 | 571 |
"""This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the TimeSeries class which lets you build your TimeSeries charts just
passing the arguments to the Chart class and calling the proper functions.
"""
#-----------------------------------------------------... | carlvlewis/bokeh | bokeh/charts/builder/timeseries_builder.py | Python | bsd-3-clause | 6,252 |
#===========================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope tha... | flexiant/xen | tools/python/xen/util/xsm/acm/acm.py | Python | gpl-2.0 | 56,344 |
"""The scene tests for the myq platform."""
from homeassistant.const import STATE_CLOSED
from .util import async_init_integration
async def test_create_covers(hass):
"""Test creation of covers."""
await async_init_integration(hass)
state = hass.states.get("cover.large_garage_door")
assert state.st... | jawilson/home-assistant | tests/components/myq/test_cover.py | Python | apache-2.0 | 1,603 |
# Copyright (c) 2013 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
#
# Unless required by applicable law or agreed to... | shakamunyi/neutron-vrrp | neutron/tests/unit/linuxbridge/test_agent_scheduler.py | Python | apache-2.0 | 1,192 |
"""
Exceptions
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
import sys
from ._compat import PY3_OR_LATER
class JoblibException(Exception):
"""A simple exception with an error message that you can get to."""
def __init__(se... | kashif/scikit-learn | sklearn/externals/joblib/my_exceptions.py | Python | bsd-3-clause | 3,690 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import sys
from waflib import ConfigSet,Logs,Options,Scripting,Task,Build,Configure,Node,Runner,TaskGen,Utils,Errors,Context
sys.modules['Environment']=ConfigSet
ConfigSet.Env... | sinpantuflas/aubio | waflib/extras/compat15.py | Python | gpl-3.0 | 7,478 |
if True:
print "a<caret>bc" | siosio/intellij-community | python/testData/breadcrumbs/if.py | Python | apache-2.0 | 31 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/callback/full_skip.py | Python | bsd-3-clause | 2,289 |
"""
figleaf is another tool to trace Python code coverage.
figleaf uses the sys.settrace hook to record which statements are
executed by the CPython interpreter; this record can then be saved
into a file, or otherwise communicated back to a reporting script.
figleaf differs from the gold standard of Python coverage t... | hornn/interviews | tools/bin/ext/figleaf/__init__.py | Python | apache-2.0 | 8,016 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
import os.path
parent = os.path.dirname
test_dir = parent(os.path.abspath(__file__))
sdk_root = parent... | willium/browser-extension | tools/addon-sdk-1.16/python-lib/cuddlefish/tests/test_licenses.py | Python | mit | 3,564 |
from datetime import datetime
from openerp.tests.common import TransactionCase
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
class TestOnchangeProductId(TransactionCase):
"""Test that when an included tax is mapped by a fiscal position, the included tax must be
subtracted to the price of the product... | vileopratama/vitech | src/addons/purchase/tests/test_onchange_product_id.py | Python | mit | 3,448 |
"""Tests for the alert component."""
| fbradyirl/home-assistant | tests/components/alert/__init__.py | Python | apache-2.0 | 37 |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Traverses the source tree, parses all found DEPS files, and constructs
a dependency rule table to be used by subclasses.
The format... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/buildtools/checkdeps/builddeps.py | Python | mit | 15,226 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jss-emr/openerp-7-src | openerp/addons/account_budget/wizard/account_budget_crossovered_summary_report.py | Python | agpl-3.0 | 2,217 |
# Copyright (C) 2001-2010 Python Software Foundation
# Contact: email-sig@python.org
# email package unit tests
import os
import sys
import time
import base64
import difflib
import unittest
import warnings
import textwrap
from cStringIO import StringIO
import email
from email.Charset import Charset
from email.Header... | teeple/pns_server | work/install/Python-2.7.4/Lib/email/test/test_email.py | Python | gpl-2.0 | 130,364 |
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
import re
from waflib import Utils
from waflib.Tools import fc,fc_config,fc_scan
from waflib.Configure import conf
from waflib.Tools.compiler_fc import fc_compiler
fc_compiler['linux'].append('fc_solstudio')
@conf
def find_solstudio(conf):
"""Find the... | hmgaudecker/econ-project-templates | {{cookiecutter.project_slug}}/.mywaflib/waflib/extras/fc_solstudio.py | Python | bsd-3-clause | 1,642 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
qualities,
str_or_none,
)
class ReverbNationIE(InfoExtractor):
_VALID_URL = r'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$'
_TESTS = [{
'url': 'http://www.reverbnation.com/alkilad... | fluxw42/youtube-dl | youtube_dl/extractor/reverbnation.py | Python | unlicense | 1,627 |
"""
====================================================================
Linear and Quadratic Discriminant Analysis with confidence ellipsoid
====================================================================
Plot the confidence ellipsoids of each class and decision boundary
"""
print(__doc__)
from scipy import lin... | mayblue9/scikit-learn | examples/classification/plot_lda_qda.py | Python | bsd-3-clause | 5,046 |
def foo():
#noinspection PyUnusedLocal
status = None
| asedunov/intellij-community | python/testData/inspections/suppress/suppressedUnusedLocal.py | Python | apache-2.0 | 61 |
"""
Test Suites
"""
from __future__ import generators
import sys
import unittest
from nose_helper.case import Test
from nose_helper.config import Config
from nose_helper.util import isclass, resolve_name, try_run
PYTHON_VERSION_MAJOR = sys.version_info[0]
class LazySuite(unittest.TestSuite):
"""A suite that may us... | akiokio/centralfitestoque | src/.pycharm_helpers/pycharm/nose_helper/suite.py | Python | bsd-2-clause | 10,424 |
import base64
import os
import random
import sys
import time
from datetime import datetime, timedelta
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.hashcompat import md5_constructor
# Us... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/contrib/sessions/backends/base.py | Python | bsd-3-clause | 9,240 |
import sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
locals())
print(cur.fetchone())
| invisiblek/python-for-android | python3-alpha/python3-src/Doc/includes/sqlite3/execute_3.py | Python | apache-2.0 | 212 |
"""
Various complex queries that have been problematic in the past.
"""
from __future__ import unicode_literals
import threading
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class DumbCategory(models.Model):
pass
class ProxyCategory(Du... | rapilabs/django | tests/queries/models.py | Python | bsd-3-clause | 17,751 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/mrp/wizard/mrp_price.py | Python | apache-2.0 | 2,132 |
#!/usr/bin/env python
# Copyright (C) 2011 Igalia S.L.
#
# 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; either
# version 2 of the License, or (at your option) any later version.
#
# This... | klim-iv/phantomjs-qt5 | src/webkit/Tools/efl/common.py | Python | bsd-3-clause | 1,100 |
#!/usr/bin/env python
# Copyright (C) 2012 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 ... | nawawi/wkhtmltopdf | webkit/Source/WebCore/make-file-arrays.py | Python | lgpl-3.0 | 5,529 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
from __future__ import unicode_literals
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATE... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/conf/locale/de_CH/formats.py | Python | gpl-3.0 | 1,445 |
import pytest
from punch import vcs_configuration as vc
@pytest.fixture
def global_variables():
return {
'serializer': '{{ major }}.{{ minor }}.{{ patch }}',
'mark': 'just a mark'
}
@pytest.fixture
def vcs_config_dict():
return {
'name': 'git',
'commit_message': "Version... | lgiordani/punch | tests/test_vcs_configuration.py | Python | isc | 7,655 |
"""Tests for `gryaml` module."""
from __future__ import print_function
from textwrap import dedent
from typing import Callable, List, Union
import pytest
import yaml
from boltons.iterutils import first
import gryaml
import py2neo_compat
# noinspection PyProtectedMember
from gryaml.pyyaml import _unregister as gryam... | wcooley/python-gryaml | tests/test_gryaml.py | Python | mit | 18,899 |
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
__author__ = "Ole Christian Weidner"
__copyright__ = "Copyright 2012, Ole Christian Weidner"
__license__ = "MIT"
import sys, time, uuid
import getpass
import bliss.saga as saga
def run(remote_base_url, local_file_to_copy):
"""Test... | saga-project/bliss | test/compliance/file/03_copy_local_remote_etc.py | Python | mit | 2,709 |
from marshmallow import Schema, fields, post_load
from marshmallow_enum import EnumField
from enum import IntFlag
from .. import models
from commandment.inventory import models as inventory_models
class ErrorChainItem(Schema):
LocalizedDescription = fields.String()
USEnglishDescription = fields.String()
E... | mosen/commandment | commandment/mdm/response_schema.py | Python | mit | 10,132 |
import random
from pokemongo_bot import logger
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.human_behaviour import sleep
class CompleteTutorial(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
def initialize(self):
self.api = self.bo... | Compjeff/PokemonGo-Bot | pokemongo_bot/cell_workers/complete_tutorial.py | Python | mit | 4,839 |
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | darcyliu/storyboard | boto/rds/parametergroup.py | Python | mit | 7,126 |
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: bool
"""
def dfs(s, d):
if s in d:
return True
for i in xrange(len(s)):
if s[:i] in d:
... | quake0day/oj | wordbreak__.py | Python | mit | 501 |
from .sendable import sendable
from .timer import timer, Timer
from .chunk import chunk
| mynameisfiber/pymicha | pymicha/utils/__init__.py | Python | mit | 88 |
# -------------------------------------------------------------------#
# Released under the MIT license (https://opensource.org/licenses/MIT)
# Contact: mrinal.haloi11@gmail.com
# Enhancement Copyright 2016, Mrinal Haloi
# -------------------------------------------------------------------#
import random
import os
impo... | n3011/deeprl | train_dqn.py | Python | mit | 1,042 |
from util_arp import *
import os
from capability import *
#masq_ip: ip we masquerade as.
#masc_mac: Masqueraded mac address
#source_mac: Our mac address
#Dest IP: target ip
#Dest Mac: target mac address
#ex: arpSpoof("10.0.0.1", "00:0c:29:5f:e7:50", "b8:27:eb:c2:1c:52", "10.0.0.57", "00:0c:29:08:45:1a")
class arpDos(C... | ecthros/pina-colada | capabilities/arp/arpDos.py | Python | mit | 2,614 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... | rwl/PyCIM | CIM15/CDPSM/Geographical/IEC61970/__init__.py | Python | mit | 1,545 |
from db import conn
import json
#Format "Name":"Desc"
achievement_metadata = {}
def first_edit(wpusername):
first_edit.name = "Your First Edit"
achievement_metadata[first_edit.name] = "Awarded for your first edit after signing up for wedge"
query = "SELECT score FROM edits WHERE username=%s"
cur = co... | tjcsl/wedge | achievements.py | Python | mit | 1,867 |
'''
PipelineEnrichmentGSEA.py
=============================================
:Tags: Python
Usage
-----
This pipeline is a wrapper of script runGSEA.py (enrichment analysis
by using GSEA. Further
description is provided
... | AntonioJBT/CGATPipeline_core | CGATPipelines/PipelineEnrichmentGSEA.py | Python | mit | 13,384 |
# Generated by Django 3.0.6 on 2020-08-02 19:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0003_auto_20200802_1205'),
('accounts', '0003_auto_20180505_1902'),
]
operations = [
mi... | cnobile2012/inventory | inventory/accounts/migrations/0004_auto_20200802_1525.py | Python | mit | 729 |
"""
This module provides more sophisticated flow tracking and provides filtering and interception facilities.
"""
from __future__ import absolute_import
from abc import abstractmethod, ABCMeta
import hashlib
import Cookie
import cookielib
import os
import re
from netlib import odict, wsgi, tcp
import netlib.http
fr... | bltb/mitmproxy | libmproxy/flow.py | Python | mit | 30,125 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Application template.
"""
# Import standard packages.
import inspect
import logging
# Import installed packages.
import matplotlib.pyplot as plt
import seaborn as sns
# Import local packages.
from .. import utils
# Define module exports:
__all__ =... | stharrold/demo | demo/app_template/template.py | Python | mit | 1,935 |
#!/usr/bin/env python3
# Copyright (c) 2015-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 multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... | s-crow-project/s-crow | test/functional/multi_rpc.py | Python | mit | 6,041 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_category_resource.py | Python | mit | 1,650 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import local.minecraft as minecraft # import modułu minecraft
import local.block as block # import modułu block
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNAME"] = "mykomp" # nazwa komputera
# utworzenie połaczenia z symulatore... | koduj-z-klasa/python101 | docs/mcpi/figury/mcsim-2dKzK.py | Python | mit | 1,853 |
from batchq.core import batch
class Pipeline(object):
def hello_world(self):
print "Hello world"
def hello_batchq(self):
print "Hello BatchQ"
class HelloWorld(batch.BatchQ):
ctrl = batch.Controller(Pipeline)
fnc = batch.Function().hello_world().hello_batchq()
instance = HelloWorld()
... | troelsfr/BatchQ | batchq/contrib/examples/tutorial2_hello_world.py | Python | mit | 335 |
#!/bin/python
# lw.py
# Create a Lone Wolf character.
# System errors:
# 1 - Erronous arguments given.
# 2 - Command line syntax error.
# 3 - Specified file already exists.
import os
import sys
import argparse
import wolfy_util
import wolfy_config
argparser = argparse.ArgumentParser(prog='lw', description=
... | CaterHatterPillar/wolfy | lw.py | Python | mit | 2,977 |
import util
import numpy as np
import pytest
import tensorflow as tf
def test_acorr():
x = np.random.normal(0, 1, 1000)
y = util.acorr(x)
assert x.size - 1 == y.size, "unexpected autocorrelation size"
@pytest.mark.parametrize('value, desired', [
('Hello World!', False),
([1, 2, 3], True),
((... | tillahoffmann/util | tests/test_util.py | Python | mit | 757 |
from sqlalchemy.orm import eagerload_all
from src.com.mailsystem.orm import User
class UserService:
@staticmethod
def listAll(db_users):
s = db_users.session()
ret = s.query(User).all()
s.close()
return ret
@staticmethod
def selectById(db_users, iduserthu):
s = ... | jstoja/TsinghuaMailSystem | src/com/mailsystem/services/UserService.py | Python | mit | 1,800 |
# -*- mode: python; coding: utf-8; -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class KeyValueSerializer(object):
def __init__(self, event, inline=()):
self.event = event
self.inline = inli... | oxyum/python-tlogger | tlogger/serializers.py | Python | mit | 668 |
#!/usr/bin/env python3
import stringcase
from generator.Field import Field
class OneOfField:
def __init__(self, oneof_name, oneof_fields, context):
self.name = oneof_name
# Some booleans to describe the type
self.one_of = True
self.type = 'OneOf{}'.format(stringcase.pascalcase(... | Fastcode/NUClearExample | nuclear/message/generator/OneOfField.py | Python | mit | 936 |
from provy.core import Role
from provy.more.debian.package.aptitude import AptitudeRole
'''
Roles in this namespace are meant to provide `iptables <http://www.netfilter.org/>`_ management utilities for Debian distributions.
'''
class IPTablesRole(Role):
'''
This role provides `iptables <http://www.netfilter.... | python-provy/provy | provy/more/debian/security/iptables.py | Python | mit | 10,980 |
from selenium.webdriver.common.by import By
from . import base
class Home(base.Page):
scene_links = base.make_elements(By.CSS_SELECTOR, "ul.scenes li a")
| alviproject/alvi | alvi/tests/pages/home.py | Python | mit | 161 |
"""
This module replaces blockexplorer functions with RPC calls to addrindex-enabled saffroncoind.
Module configuration:
blockchain-service-name=addrindex
blockchain-service-connect=http://RPC_USER:RPC_PASSWORD@RPC_HOST:RPC_PORT
"""
import decimal
import json
import re
import time
from lib import config, util, util_bi... | saffroncoin/csfrblockd | lib/blockchain/addrindex.py | Python | mit | 8,675 |
##
## File: user_stats.py
##
## Author: Schuyler Martin <sam8050@rit.edu>
##
## Description: Python class that defines a datagram for storing statistics
## on users
##
from datagrams.datagram import Datagram
class UserStats(Datagram):
'''
Class for storing statistics on a user
'''
de... | RIT-CS-Mentoring-Center-Queueing/mmcga_project | server/datagrams/user_stats.py | Python | mit | 2,044 |
import pickle
import scipy.misc
import numpy as np
from sys import argv
def plot_25_figure(images, output_name, num_channels = 1):
HEIGHT, WIDTH = images.shape[1], images.shape[2]
if num_channels == 1:
images = images.reshape((5,5,HEIGHT,WIDTH))
# rowx, rowy, height, width -> rowy, height, rowx, width
images =... | kundan2510/pixelCNN | plot_images.py | Python | mit | 1,614 |
import gmpy2
def decrypt(N, d, c):
m = pow(c, d, N)
return m
def crack(N, e, c, factor_function):
factors = factor_function(N)
if factors == None:
return None
p, q = factors
assert p*q == N
totient = (p - 1)*(q - 1)
d = gmpy2.invert(e, totient)
return decrypt(N, d, c) | juampi/crypto | rsa.py | Python | mit | 316 |
import taichi as ti
from tests import test_utils
@test_utils.test(exclude=[ti.opengl])
def test_ret_write():
@ti.kernel
def func(a: ti.i16) -> ti.f32:
return 3.0
assert func(255) == 3.0
@test_utils.test(exclude=[ti.opengl])
def test_arg_read():
x = ti.field(ti.i32, shape=())
@ti.kernel... | yuanming-hu/taichi | tests/python/test_arg_alignment.py | Python | mit | 418 |
# 16-ValleyBot drive.py
'''
Created on Mar 13, 2016
@author: Dead Robot Society
'''
import constants as c
# from sensors import DEBUG
from wallaby import motor
from wallaby import msleep
from wallaby import ao
from wallaby import seconds
from sensors import onBlackFront, onBlackBack
def driveTim... | gras/16-ValleyBot | src/drive.py | Python | mit | 2,528 |
import time
import datetime
import oauth2 as oauth
from provider import scope as oauth2_provider_scope
from rest_framework.test import APIClient
from rest_framework_oauth.authentication import (
oauth2_provider,
OAuthAuthentication,
OAuth2Authentication
)
from rest_framework import status, permissions
from ... | jlafon/django-rest-framework-oauth | tests/test_oauth.py | Python | mit | 19,202 |
import time
import unittest
from collections import OrderedDict
from conans.model.ref import ConanFileReference
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.test.utils.tools import TestClient, TestServer, TurboTestClient, GenConanfile
from conans.util.env_reader import get_env
from co... | memsharded/conan | conans/test/integration/install_outdated_test.py | Python | mit | 8,169 |
import sys
import json
from tkinter import filedialog
def getFiles(failedargs):
newfiles = []
if failedargs:
if failedargs == -1:
answer = input("""\
You didn't specify any files as input, would you like to continue? y/n
>""")
if answer in ["n", ""]:
raise S... | maseaver/todomaker | todomaker.py | Python | mit | 13,220 |
from flask import Blueprint
log_analyzer = Blueprint('log_analyzer', __name__)
from . import views
| DonYum/LogAna | app/log_analyzer/__init__.py | Python | mit | 101 |
#from {{appname}}.handlers.base import BaseHandler
from {{appname}}.handlers.powhandler import PowHandler
from {{appname}}.models.{{model_type}}.{{handler_name}} import {{handler_model_class_name}}
from {{appname}}.config import myapp, database
from {{appname}}.application import app
import tornado.web
@app.add_rest_r... | pythononwheels/pow_clean | start/stubs/rest_handler_template.py | Python | mit | 2,856 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
def tdata():
userid = st... | zhangyubaka/tweepy_favbot | bot.py | Python | mit | 923 |
from pandac.PandaModules import *
from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPGlobals
import random
Props = ((5, 'partyBall', 'partyBall'),
(5,
'feather',
'feather-mod',
'feather-chan'),
(5, 'lips', 'lips'),
(5, 'lipstick', 'lipstick'),
(5, 'hat... | Spiderlover/Toontown | toontown/battle/BattleProps.py | Python | mit | 13,189 |
"""Active Directory authentication backend."""
import itertools
import logging
import dns
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
try:
import ldap
from ldap.dn import dn2s... | reviewboard/reviewboard | reviewboard/accounts/backends/ad.py | Python | mit | 18,842 |
from redis import Redis
from basic import conn
def reflashState(client,count=None,network=None):
prefix = "client:"
if not client:
return False
x = dict()
if count:
conn().hset(prefix+client,"count",count)
if network:
conn().hset(prefix+client,"network",network)
| vinthony/racpider | src/redistool/clientinfo.py | Python | mit | 280 |
import base64
from flask import request, jsonify, session as flask_session
from flask.ext.login import login_user, LoginManager, current_user, current_app
from flexget.api import api, APIResource, app
from flexget.webserver import User
from flexget.utils.database import with_session
login_manager = LoginManager()
lo... | tsnoam/Flexget | flexget/api/authentication.py | Python | mit | 3,365 |
import json
import random
import time
import re
try:
from StringIO import StringIO # Python 2
except ImportError:
from io import BytesIO as StringIO # Python 3
from datetime import date, datetime, timedelta
import requests
from requests.adapters import HTTPAdapter
try:
from requests.packages.urlli... | jbms/mintapi | mintapi/api.py | Python | mit | 25,488 |
import urllib.request
import json
# This URL returns all stock tickers in JSON format
TICKER_URL = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.industry%20where%20id%20in%20%28select%20industry.id%20from%20yahoo.finance.sectors%29&format=json&env=store%3A%2F%2Fdatatables.org%2Falltable... | hsdistefa/MarketQuotes | symbol_downloader.py | Python | mit | 1,466 |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from ocfnet.database import Model
from ocfnet.media.models import *
from ocfnet.user.models import *
try:
from config import DATABASE_URL
except:
from configd... | oregoncountryfair/ocfnet | ocfnet/migrations/env.py | Python | mit | 2,236 |
#!/usr/bin/env python
'''
https://projecteuler.net/problem=7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
'''
import math
def prime(n):
# we start with the knowledge of at least one prime
primes = [2]
# and the next po... | ArthurZey/toyproblems | projecteuler/0007_10001st_prime.py | Python | mit | 1,337 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Exercise',
fields=[
('id', models.AutoField(ser... | vakila/de-stress | testproject/testapp/migrations/0001_initial.py | Python | mit | 1,334 |
##!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Две модели биноминального распределения (N=2 и N=40)
Запуск:
python ./binominal.py
Пример визуализации возникновения событий в соответствии с биноминальным распределением.
Биномиальное распределение представляется как сумма исходов событий, которые следуют распреде... | vpv11110000/pyss | other/binominal.py | Python | mit | 4,240 |
# coding: utf-8
from nose.tools import assert_equal # @UnresolvedImport
from clinvoc.icd10 import ICD10CM, ICD10PCS
from clinvoc.icd9 import ICD9CM, ICD9PCS
from clinvoc.ubrev import UBREV
from clinvoc.hcpcs import HCPCS, HCPCSModifier
from clinvoc.ndc import NDC
from clinvoc.loinc import LOINC
def test_icd10_cm_no_d... | jcrudy/clinvoc | clinvoc/test/test_code_systems.py | Python | mit | 4,969 |
# -*- coding: utf-8 -*-
# This file is meant to test that we can also load rules from __init__.py files, this was an issue with pypy before.
from gitlint.rules import CommitRule
class InitFileRule(CommitRule):
name = "my-init-cömmit-rule"
id = "UC1"
options_spec = []
def validate(self, _commit):
... | jorisroovers/gitlint | gitlint-core/gitlint/tests/samples/user_rules/parent_package/__init__.py | Python | mit | 336 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from api.account.views import RegistrationAPI, LoginAPI, LogoutAPI, UpdatePasswordAPI, UpdateProfileAPI
urlpatterns = [
url(r'^registration/$', RegistrationAPI.as_view(), name='registration'),
url(r'^login/$', LoginAPI.as_view(), name='login'),
url... | doraemonext/DEOnlineJudge | api/account/urls.py | Python | mit | 541 |
"""Space switching without constraints or extra DAG nodes.
Contains functions to create a space switching network as well as seamlessly switching
between spaces.
Example Usage
=============
::
import cmt.rig.spaceswitch as spaceswitch
# Create the space switch
spaceswitch.create_space_switch(
p... | chadmv/cmt | scripts/cmt/rig/spaceswitch.py | Python | mit | 4,654 |
#!/usr/bin/env python3
import torch
from ..distributions import Delta, MultivariateNormal
from ..variational.grid_interpolation_variational_strategy import GridInterpolationVariationalStrategy
class AdditiveGridInterpolationVariationalStrategy(GridInterpolationVariationalStrategy):
def __init__(
self, ... | jrg365/gpytorch | gpytorch/variational/additive_grid_interpolation_variational_strategy.py | Python | mit | 2,968 |
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView
from .mixins import GenerateActionMixin
class DetailViewWithActionStream(GenerateActionMixin, DetailView):
def dispatch(self, request, *args, **kwargs):
if not self.request.user.is_anonymous... | JoshStegmaier/django-nimbus | nimbus/views/generic.py | Python | mit | 1,761 |
#!/usr/bin/python
#########################################################
# CaesarWrap Minecraft Wrapper #
# #
# Wraps the minecraft server so that users can do stuff #
# Also allows for commands to be executed from OUTSIDE #
# via a "RPC... | Crypt0s/CaesarWrap | mc.py | Python | mit | 10,800 |
NAME='gif'
GCC_LIST=['gif']
| unbit/uwsgi-gif | uwsgiplugin.py | Python | mit | 28 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .base import CreditCardProvider
from .gencc import visaPrefixList
from .gencc import credit_card_number
from random import Random
class VisaProvider(CreditCardProvider):
def __init__(self, *args, **kwargs):
super(VisaProvider, self).__init__(*args, **kwa... | ryankanno/vor | vor/backends/cc/visa.py | Python | mit | 463 |