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 |
|---|---|---|---|---|---|
# Copyright (C) 2009 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# 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
# ... | veusz/veusz | veusz/document/emf_export.py | Python | gpl-2.0 | 14,778 |
# Copyright (c) 2013 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 ... | Stavitsky/neutron | neutron/tests/unit/scheduler/test_l3_agent_scheduler.py | Python | apache-2.0 | 75,255 |
import os, sys, tempfile, urllib2, sys
from fabric.api import env, local, lcd, prefix
from fabric.colors import red, green
from contextlib import contextmanager
test_root = '~/tmp'
test_root = os.path.expanduser(test_root)
test_root = os.path.expandvars(test_root)
project_name = 'testproject'
config_dir = '~/tmp/confi... | yadudoc/skeleton | tests/test-aws-env.py | Python | mit | 3,436 |
'''
Created on 13. jan. 2012
@author: pcn
'''
class TemplateList(object):
def __init__(self):
pass
class ConfigurationTemplatesX(object):
def __init__(self, configurationTree):
self._configurationTree = configurationTree
def _getConfiguration(self):
self.loadMediaF... | perchrn/TaktPlayer | src/configuration/ConfigurationTemplates.py | Python | gpl-2.0 | 764 |
from django.contrib.auth import get_user_model
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse
from misago.core import errorpages, mail
from misago.core.decorators import require_POST
from misago.core.shortcuts import paginate, validate_slug
from misago.core.testprojec... | leture/Misago | misago/core/testproject/views.py | Python | gpl-2.0 | 2,044 |
# Copyright (c) 2010-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
#
# Unless required by applicable law or agree... | nadeemsyed/swift | swift/common/memcached.py | Python | apache-2.0 | 19,482 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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
#
#... | coolsvap/dox | dox/tests/config/test_commands.py | Python | apache-2.0 | 3,021 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from distutils.version import StrictVersion
from nose.plugins.skip import SkipTest
from elasticsearch import (
Elasticsearch
)
ELASTICSEARCH_URL = "localhost"
conn = Elasticsearch(ELASTICSEARCH_URL)
index_name = "foo"
default_... | Yipit/pyeqs | tests/helpers.py | Python | mit | 2,682 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation
#
# 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
... | kickstandproject/wildcard | wildcard/dashboards/project/queues/tests.py | Python | apache-2.0 | 5,919 |
# -*- coding: utf-8 -*-
"""Given an int32 number, print it in English."""
def _num2text(num):
d = { 0 : 'sıfır', 1 : 'bir', 2 : 'iki', 3 : 'üç', 4 : 'dört', 5 : 'beş',
6 : 'altı', 7 : 'yedi', 8 : 'sekiz', 9 : 'dokuz', 10 : 'on',
11 : 'on bir', 12 : 'on iki', 13 : 'on üç', 14 : 'on dört',
... | evrenesat/genesis | genesis/com/num2text.py | Python | gpl-3.0 | 1,718 |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | artemsok/sockeye | test/unit/test_translate.py | Python | apache-2.0 | 3,120 |
from typing import List, Dict, Set
import pandas as pd
from ray.data import Dataset
from ray.ml.preprocessor import Preprocessor
class OrdinalEncoder(Preprocessor):
"""Encode values within columns as ordered integer values.
Currently, order within a column is based on the values from the fitted
dataset... | ray-project/ray | python/ray/ml/preprocessors/encoder.py | Python | apache-2.0 | 5,304 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Konubinix/qutebrowser | qutebrowser/mainwindow/statusbar/__init__.py | Python | gpl-3.0 | 839 |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class HiSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy acts ... | tansuo1989/mydemo | python/scrapy/hi/hi/middlewares.py | Python | mit | 3,589 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo import tools, _
from odoo.exceptions import ValidationError
import requests
import json
import logging
_logger = logging.getLogger(__name__)
from datetime import datetime
... | rockcesar/odoo_addons | website_pinetwork_odoo/models/admin_apps.py | Python | agpl-3.0 | 16,696 |
#!/usr/bin/env python
import logging
import time
import pymongo
from pyfocas.Collector import Collector
from pyfocas.Machine import Machine
from FanucImplementation.DriverImplementations import Fanuc30iDriver
from pyfocas import Exceptions
THREE_SIXTEEN = "10.108.7.41"
THREE_TWENTY = "10.108.7.42"
THREE_TWENTY_TWO ... | monkpit/pyfocas | aggregator.py | Python | mit | 3,926 |
"""
Implements NotebookArchive used to automatically capture notebook data
and export it to disk via the display hooks.
"""
import time, sys, os, traceback
from IPython import version_info
from IPython.display import Javascript, display
from .preprocessors import Substitute
# Import appropriate nbconvert machinery
i... | basnijholt/holoviews | holoviews/ipython/archive.py | Python | bsd-3-clause | 12,255 |
import logging
logger = logging.getLogger(__name__)
class SyncSectors:
def __init__(self, sector_model, sectors, disable_on=None, simulate=False):
self.sector_model = sector_model
self.sectors = sectors
self.disable_on = disable_on
self.simulate = simulate
def log(self, msg,... | UKTradeInvestment/export-wins-data | mi/sync_sectors.py | Python | gpl-3.0 | 2,373 |
"""
`Cargo SQL Fields`
``Field-type classes for the Cargo SQL ORM``
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
Creates a model with three fields
..
from cargo import *
# Model object
class UserModel(Model):
# Field objects
uid = Int(primary=Tru... | jaredlunde/cargo-orm | cargo/fields/__init__.py | Python | mit | 2,138 |
#@result Submitted a few seconds ago • Score: 10.00 Status: Accepted Test Case #0: 0s Test Case #1: 0.01s Test Case #2: 0s Test Case #3: 0s Test Case #4: 0.01s Test Case #5: 0s
for i in range(int(raw_input())): #More than 4 lines will result in 0 score. Blank lines won't be counted.
a = int(raw_input()); A = set(r... | FeiZhan/Algo-Collection | answers/hackerrank/Check Subset.py | Python | mit | 423 |
# Create your views here.
from django.shortcuts import render_to_response
from django.conf import settings
from django.template import RequestContext
from django import http
from django.utils import translation
from models import Page
def page(request, page_to_render):
try:
p = Page.objects.get(slug=page_... | seantis/seantis-questionnaire | questionnaire/page/views.py | Python | bsd-3-clause | 1,332 |
"""
Functions in the ``as*array`` family that promote array-likes into arrays.
`require` fits this category despite its name not matching this pattern.
"""
from __future__ import division, absolute_import, print_function
from .overrides import set_module
from .multiarray import array
__all__ = [
"asarray", "asa... | jorisvandenbossche/numpy | numpy/core/_asarray.py | Python | bsd-3-clause | 9,940 |
#!/usr/bin/python
#
# 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) any later version.
#
# Ansible is distribut... | pdellaert/ansible | lib/ansible/modules/network/cloudengine/ce_link_status.py | Python | gpl-3.0 | 22,137 |
#!/usr/bin/env python
"""Displays the status of the build using these hip new shields everyone uses
"""
from shields import ShieldStatusResource
def bind(webstatus, path="badge", left_text=None, left_color=None,
template=None, font_face=None, font_size=None, color_scheme=None):
"""Installs the ShieldStat... | thefinn93/BuildbotStatusShields | BuildbotStatusShields/__init__.py | Python | gpl-2.0 | 1,425 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
from random import randint
import time
import unittest
from qa.web_tests import config
class TestRenameInstance(unit... | paypal/aurora | qa/web_tests/tests/instances/test_rename_instance.py | Python | apache-2.0 | 3,630 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import platform
import distro
def get_os():
if distro_info := f'{distro.name()} {distro.version()}'... | pferreir/indico | indico/util/system.py | Python | mit | 473 |
#!/usr/bin/env python
import glob
import copy
import cv2
import cv_bridge
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import Int32, Float32, String
import rospkg
class Hear_orders:
def __init__(self):
self.speech_subscriber = rospy.Subscriber("/speech_recognition", String, self.publi... | UCRoboticsLab/BaxterTictactoe | src/baxter_face_animation/src/baxter_face_animation/hear_words.py | Python | apache-2.0 | 926 |
from __future__ import unicode_literals
import logging
import six
from rbtools.api.errors import APIError
from rbtools.clients.errors import MergeError, PushError
from rbtools.commands import Command, CommandError, Option, RB_MAIN
from rbtools.utils.commands import (build_rbtools_cmd_argv,
... | reviewboard/rbtools | rbtools/commands/land.py | Python | mit | 16,983 |
"""
The latest version of this package is available at:
<http://github.com/jantman/biweeklybudget>
################################################################################
Copyright 2016 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of biweeklybudget, also known as bi... | jantman/biweeklybudget | biweeklybudget/flaskapp/views/__init__.py | Python | agpl-3.0 | 2,136 |
####Python Script to find the IMDB rating of movies and TV series#####
import requests
import bs4 as bs
####Function to confirm the name of movie or Tv series to get the correct rating####
def cnfm_page(link):
try:
name_link = 'https://www.imdb.com'+link
req2 = requests.get(name_link)
soup2 = bs... | Kuldip397/My_Scrapers | imdbRating.py | Python | mit | 1,914 |
from setuptools import setup
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='FlowIO',
version='0.9.14',
packages=['flowio'],
package_data={'': []},
description='FlowIO is a Python library for reading / writing Flow Cytometry Standard (FCS) files',
long_descript... | whitews/FlowIO | setup.py | Python | bsd-3-clause | 795 |
#
# Histogram.py -- Histogram plugin for Ginga fits viewer
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy
from ginga.misc import Widgets, Plot
from ginga... | bsipocz/ginga | ginga/misc/plugins/Histogram.py | Python | bsd-3-clause | 14,394 |
"""
Base and utility classes for pandas objects.
"""
from __future__ import annotations
import textwrap
from typing import (
TYPE_CHECKING,
Any,
Generic,
Hashable,
Literal,
TypeVar,
cast,
final,
)
import numpy as np
import pandas._libs.lib as lib
from pandas._typing import (
Arra... | dsm054/pandas | pandas/core/base.py | Python | bsd-3-clause | 37,574 |
from io import StringIO
from unittest.mock import Mock, patch
# pylint:disable=import-error
import pytest
from _pytest.runner import CallInfo
# pylint:enable=import-error
from flaky import flaky
from flaky import _flaky_plugin
from flaky.flaky_pytest_plugin import (
runner,
FlakyPlugin,
FlakyXdist,
PLUG... | box/flaky | test/test_pytest/test_flaky_pytest_plugin.py | Python | apache-2.0 | 15,590 |
import asyncio
import discord
import datetime
import pytz
from discord.ext import commands
from Cogs import FuzzySearch
from Cogs import Settings
from Cogs import DisplayName
from Cogs import Message
from Cogs import Nullify
class Time:
# Init with the bot reference, and a reference to the s... | TheMasterGhost/CorpBot | Cogs/Time.py | Python | mit | 8,457 |
import pyblish.api
@pyblish.api.log
class ValidateDeadlineFramePadding(pyblish.api.Validator):
""" Validates the existence of four digit frame padding
('%04d or ####') in output.
"""
families = ['deadline.render']
label = 'Frame Padding'
optional = True
def process(self, instance):
... | ProgressiveFX/pyblish-pfx | pyblish_pfx/plugins/bin/validate_deadline_frame_padding.py | Python | lgpl-3.0 | 862 |
# Copyright 2019 The dm_env Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | deepmind/dm_env | examples/__init__.py | Python | apache-2.0 | 662 |
import logging
import warnings
import salt.utils.url
from salt.serializers.yamlex import deserialize
log = logging.getLogger(__name__)
def render(sls_data, saltenv="base", sls="", **kws):
"""
Accepts YAML_EX as a string or as a file object and runs it through the YAML_EX
parser.
:rtype: A Python da... | saltstack/salt | salt/renderers/yamlex.py | Python | apache-2.0 | 735 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from ..services.invoiceGenerator import *
from wallaby.common.document import *
import wallaby.backends.couchdb as couchdb
def run(appPath, options):
if options.db == None and not options.fx:
print "The --db options is requir... | FreshXOpenSource/wallaby-app-crm | wallaby/apps/crm/scripts/invoiceGenerator.py | Python | bsd-2-clause | 1,712 |
import optparse
import os
import shutil
import sys
import unittest
from itertools import izip
from . import util
from . import stats
#=============================================================================
# common utility functions for testing
def clean_dir(path):
if os.path.exists(path):
shutil... | wutron/compbio | rasmus/testing.py | Python | mit | 3,789 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 merkleblock fetch/validation
#
from test_framework.test_framework import BitcoinTestFramework
f... | trading-dev/trading-coin | qa/rpc-tests/merkle_blocks.py | Python | mit | 4,051 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | yfried/ansible | lib/ansible/modules/network/f5/bigip_gtm_monitor_https.py | Python | gpl-3.0 | 30,003 |
from task_board.tasks.models import Task
def create_sample_tasks(owner=None, count=15):
assert owner, "Please specify the owner for tasks."
for idx in range(count):
task_data = dict(
name='Task number %d' % (idx + 1),
description='Cras sit amet nibh libero, in gravida nulla. N... | AlexanderKaluzhny/taskboard | task_board/tasks/utils.py | Python | mit | 699 |
#!/usr/bin/python
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security
libcloud.security.VERIFY_SSL_CERT = False
auth_username = 'admin'
auth_password = 'thepassword'
auth_url = 'http://172.18.0.10:5000'
project_name = 'admin'
provider = get_driver(P... | kionetworks/openstack-api-scripts | libcloud/flavors.py | Python | apache-2.0 | 819 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | wheeler-microfluidics/microdrop | microdrop/_version.py | Python | bsd-3-clause | 18,457 |
from abc import ABCMeta, abstractmethod
from opencog_b.python.blending.util.blend_logger import blend_log
from opencog_b.python.blending.util.general_util import *
from opencog_b.python.blending.util.blend_config import BlendConfig
__author__ = 'DongMin Kim'
class BaseMaker(object):
"""
:type a: opencog.ato... | kim135797531/opencog-python-blending | opencog_b/python/blending/maker/base_maker.py | Python | agpl-3.0 | 1,977 |
#!/usr/bin/env python2
#
# Wikipedia queries generator
# developed by Alex Mayer (2014)
#
import re
import helpers
import urllib2
from random import randint, shuffle
from datetime import date
from bingRewards import BingRewards
MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", ... | amayer5125/BingRewards | pkg/queryGenerators/wikipedia.py | Python | lgpl-3.0 | 4,912 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.nzb.base import NZBProvider
from couchpotato.environment import Env
import re
import traceback
log = CP... | rooi/CouchPotatoServer | couchpotato/core/providers/nzb/binsearch/main.py | Python | gpl-3.0 | 3,668 |
from __future__ import division
from random import choice
from moi import r_client
from tornado.gen import coroutine, Task
from qiita_db.util import get_count
from qiita_db.study import Study
from qiita_db.util import get_lat_longs
from .base_handlers import BaseHandler
class StatsHandler(BaseHandler):
def _ge... | RNAer/qiita | qiita_pet/handlers/stats.py | Python | bsd-3-clause | 2,904 |
# Copyright 2012,2013 Christoph Reiter
#
# 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.
import sys
from typing import ... | ptitjes/quodlibet | quodlibet/operon/base.py | Python | gpl-2.0 | 2,693 |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
import chainer.functions as F
from chainer.functions.connection import deconvolution_2d
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
from chainer.te... | cemoody/chainer | tests/chainer_tests/functions_tests/connection_tests/test_deconvolution_2d.py | Python | mit | 5,913 |
import os, sys, random, argparse, time, math, gzip
import cPickle as pickle
from collections import Counter
import numpy as np
import scipy
from sklearn.cross_validation import train_test_split
from sklearn.decomposition import PCA
import theano
import theano.tensor as T
sys.path.append('../')
sys.path.append('../../... | youyanggu/rcnn | code/adulteration/main.py | Python | apache-2.0 | 40,708 |
# -*- coding: utf-8 -*-
from datetime import timedelta
from unittest import mock
from uuid import UUID
from django.test import TestCase
from sesam import SesamStudent, StudentNotFound
from .. import factories
from ..models import Student
def sesam_response_factory(student):
# Factory function useful together wi... | karservice/kobra | kobra/tests/test_sesam.py | Python | mit | 4,475 |
# ulno_iot display
from machine import Pin, I2C
import ssd1306
CHAR_WIDTH = 128 // 8
CHAR_HEIGHT = 64 // 8
present = False
_y = 0
_x = 0
# test if lcd is responding
i2c = I2C(sda=Pin(4), scl=Pin(14))
try:
display = ssd1306.SSD1306_I2C(128, 64, i2c)
display.fill(0)
display.text("iot.ulno.net", 16, 4)
... | ulno/micropython-extra-ulno | examples/obsolete/device_types/devkit1/ulno_iot_display.py | Python | mit | 2,413 |
#!/usr/bin/env python
"""cflib.vcf
==============
This module provides functions to read, write and access vcf files.
Objects
-------
Classes:
- :class:`NucBase`, store a nucleotide base
- :class:`VCFStream`, a variant call format (VCF) stream object
- :class:`VCFSeq`, a VCF file sequence object
Exception Cla... | pomo-dev/cflib | cflib/vcf.py | Python | mit | 16,699 |
import unittest
from .... import examples as pysal_examples
from ..pyDbfIO import DBF
import tempfile
import os
class test_DBF(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal_examples.get_path('10740.dbf')
self.dbObj = DBF(test_file, 'r')
def test_len(self):
s... | sjsrey/pysal_core | pysal_core/io/IOHandlers/tests/test_pyDbfIO.py | Python | bsd-3-clause | 3,946 |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="value",
parent_name="treemap.marker.colorbar.tickformatstop",
**kwargs
):
super(ValueValidator, self).__init__(
plotly_na... | plotly/plotly.py | packages/python/plotly/plotly/validators/treemap/marker/colorbar/tickformatstop/_value.py | Python | mit | 464 |
# Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
'''
>>> from class_ext import *
Ensure sanity:
>>> x = X(42)
>>> x_function(x)
42
Demonstrate extraction in the presence of metaclass changes:
>>> ... | NixaSoftware/CVis | venv/bin/libs/python/test/class.py | Python | apache-2.0 | 881 |
"""
ASGI config for shopify_django_app project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('D... | Shopify/shopify_django_app | shopify_django_app/asgi.py | Python | mit | 413 |
from __future__ import unicode_literals
import time
from datetime import datetime, timedelta
import json
import requests
import calendar
import difflib
import hashlib
from random import uniform
from operator import itemgetter, methodcaller
from itertools import izip
from pokemongo_bot import inventory
from pokemongo_b... | goedzo/PokemonGo-Bot | pokemongo_bot/cell_workers/sniper.py | Python | mit | 34,433 |
#!/usr/bin/python2.7
#coding:utf-8
def main():
"""
TODO main
"""
# print dir(m1)
for key in dir(m1):
print key, getattr(m1, key)
# print dir(m2) # 错误 m2模块对象并没有导入该符号表中
f1 = m1.fun1
f2 = m1.fun2
print f1(8)
print f2(8)
print fun3(10)
print f4(10)
b1.b1_fun()
... | qrsforever/workspace | python/learn/base/module/l1/main.py | Python | mit | 613 |
import base64
import hashlib
import hmac
import uuid
import json
import mimetypes
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import permission_classes
from rest_framework.permissions import IsAuthenticated
A... | anush0247/django-fine-uploader-s3 | django_fine_uploader_s3/views.py | Python | mit | 6,074 |
from __future__ import division
"""
Contains
========
* Connector
"""
class Connector:
"""
This class is the primary medium for data transfer. Objects of this
class can be connected to any digital object.
Example
=======
>>> from BinPy import *
>>> conn = Connector(1) #Initializing c... | coder006/BinPy | BinPy/Gates/connector.py | Python | bsd-3-clause | 2,623 |
'''
@date Aug 28, 2010
@author: Matthew A. Todd
This file is part of Test Parser
by Matthew A. Todd
Test Parser 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... | matcatc/Test_Parser | src/TestParser/View/Tkinter/__init__.py | Python | gpl-3.0 | 714 |
#! /usr/bin/env python
from __future__ import division
# System imports
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [int(d) for d in np.__version__.split(".")[:2]]
if major == 0:
BadListError = TypeError
else:
BadListError = ValueError
import SuperTensor
###################... | DailyActie/Surrogate-Model | 01-codes/numpy-master/tools/swig/test/testSuperTensor.py | Python | mit | 16,499 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/python-logging | samples/snippets/usage_guide.py | Python | apache-2.0 | 15,618 |
#!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
from os.path import join
def configuration(parent_package='', top_path=None):
import warnings
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFo... | gigglesninja/senior-design | MissionPlanner/Lib/site-packages/scipy/odr/setup.py | Python | gpl-2.0 | 1,297 |
# -*- coding: utf-8 -*-
import XiteWin
if __name__ == "__main__":
XiteWin.main("")
| sdottaka/mruby-bin-scite-mruby | tools/scintilla/test/xite.py | Python | mit | 86 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... | fujicoin/fujicoin | test/functional/wallet_coinbase_category.py | Python | mit | 2,302 |
#
# __COPYRIGHT__
#
# 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,
# distribute, sublicen... | Distrotech/scons | src/setup.py | Python | mit | 16,346 |
# Copyright 2012, SIL International
# All rights reserved.
#
# 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.1 of License, or
# (at your option) any lat... | silnrsi/graide | lib/graide/utils.py | Python | lgpl-2.1 | 15,696 |
#!/usr/bin/env python
from Globber import match
import unittest
class TestGlobber(unittest.TestCase):
def test_star(self):
self.assertTrue(match('*', ''))
self.assertTrue(match('*2*', '123'))
self.assertTrue(match('*3', '123'))
self.assertTrue(match('*', 'IOUJHG234*#$^%'))
... | blopker/Globber | GlobberTest.py | Python | mit | 1,281 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import logging
import argparse
import tgcli
logging.basicConfig(stream=sys.stdout, format='%(asctime)s [%(levelname)s] %(message)s', level=logging.INFO)
def export_avatar_peer(tc, peertype, pid, filename):
peername = '%s#id%d' % (peertype, pid)... | gumblex/tg-export | avatar.py | Python | lgpl-3.0 | 2,554 |
from __future__ import unicode_literals
import cgi
import codecs
import logging
import re
import sys
from io import BytesIO
from threading import Lock
from django import http
from django.conf import settings
from django.core import signals
from django.core.handlers import base
from django.urls import set_script_prefi... | vincepandolfo/django | django/core/handlers/wsgi.py | Python | bsd-3-clause | 9,300 |
#!/usr/bin/env python3
# coding: utf-8
# iOS specific imports
import keychain
import stringutils as su
import jumon
keychain_service = 'jumon'
keychain_account = 'secret'
# Clears saved secret
def clearSecret():
keychain.delete_password(keychain_service, keychain_account)
print('Done.')
def updateSecret(s... | daniel-jozsef/Pythonista | jumon_iOS.py | Python | gpl-3.0 | 638 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/command_modules/azure-cli-extension/azure/cli/command_modules/extension/__init__.py | Python | mit | 698 |
# -*- coding: utf-8 -*-
""" RESTful Search Methods
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
@requires: U{B{I{gluon}} <http://web2py.com>}
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files... | vgupta6/Project-2 | modules/s3/s3search.py | Python | mit | 99,058 |
#
# The Python Imaging Library.
# $Id$
#
# Windows Cursor support for PIL
#
# notes:
# uses BmpImagePlugin.py to read the bitmap data.
#
# history:
# 96-05-27 fl Created
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1996.
#
# See the README file for information on usage and redist... | zhaochl/python-utils | verify_code/Imaging-1.1.7/build/lib.linux-x86_64-2.7/CurImagePlugin.py | Python | apache-2.0 | 2,002 |
#!/usr/bin/python2.7
# encoding: utf-8
# Copyright 2010 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 ... | gimite/personfinder | tests/server_test_cases/photo_tests.py | Python | apache-2.0 | 7,029 |
import pytest
from spacy.matcher import Matcher
from spacy.errors import MatchPatternError
from spacy.schemas import validate_token_pattern
# (pattern, num errors with validation, num errors identified with minimal
# checks)
TEST_PATTERNS = [
# Bad patterns flagged in all cases
([{"XX": "foo"}], 1, 1),
([... | spacy-io/spaCy | spacy/tests/matcher/test_pattern_validation.py | Python | mit | 2,754 |
#!/usr/bin/env python
# encoding: utf-8
#
# rbootstrap - Install RPM based Linux into chroot jails
# Copyright (C) 2014 Lars Michelsen <lm@larsmichelsen.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 Softwar... | LaMi-/rbootstrap | rbootstrap/jail.py | Python | gpl-2.0 | 8,982 |
from docopt import docopt
from .utils import prepare_objective
from .algorithms.evolutionary_algorithm import Population
from .algorithms.particle_swarm_optimization import PSO
def parse_arguments(doc, version=None):
arguments = docopt(doc, version=version)
try:
algorithm = arguments["--algorithm"].lo... | Axelrod-Python/axelrod-evolver | src/axelrod_dojo/arguments.py | Python | mit | 2,985 |
# -*- coding: utf-8 -*-
# 226. Invert Binary Tree
#
# Invert a binary tree.
#
# 4
# / \
# 2 7
# / \ / \
# 1 3 6 9
#
# to
#
# 4
# / \
# 7 2
# / \ / \
# 9 6 3 1
#
# Trivia:
# This problem was inspired by this original tweet by Max Howell:
#
# Google: 90% of our engineers u... | gengwg/leetcode | 226_invert_binary_tree.py | Python | apache-2.0 | 1,673 |
#!/usr/bin/python
import os
import sys
import time
import numpy
from numpy.random import randn
def run_dgemv(N,l):
A = randn(N,N).astype('float64')
B = randn(N).astype('float64')
start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*N*N) *l... | ryanrhymes/openblas | lib/OpenBLAS-0.2.19/benchmark/scripts/NUMPY/dgemv.py | Python | bsd-3-clause | 946 |
for i in range (10):
print i
| montgok/Python_Class | python_test2.py | Python | apache-2.0 | 31 |
from myfecviz.tests import FlaskClientTestCase
class FECViewTest(FlaskClientTestCase):
def test_get_home(self):
"""Verify home page loads."""
res = self.client.get('/')
self.assertEqual(200, res.status_code)
def test_summed_transactions(self):
"""Verify summed transaction vie... | sg95/FEC-Data-Visualization | myfecviz/tests/test_fec_views.py | Python | mit | 765 |
# Copyright 2017 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... | tensorflow/nmt | nmt/nmt.py | Python | apache-2.0 | 29,369 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Subscription',
fields=[
('id', models.AutoField... | byteweaver/django-newsletters | newsletters/migrations/0001_initial.py | Python | bsd-3-clause | 503 |
from django.http import HttpResponse
from models import CeleryHealthCheck
def CeleryHealthCheckView(request):
return HttpResponse(CeleryHealthCheck.get_healthcheck_string())
| globocom/database-as-a-service | dbaas/system/views.py | Python | bsd-3-clause | 180 |
import sys
import unittest
import tutil
import webvulnscan
FORM_HTML = b'''<html>this is a form:
<form action="./delete" method="post">
<input type="submit" />
</form>
</html>'''
class ClickjackTest(unittest.TestCase):
attack = webvulnscan.atta... | hhucn/webvulnscan | test/test_clickjack.py | Python | mit | 3,145 |
#!/usr/bin/env python3
import os
import io
import json
import requests
__configfile_fd = os.open("eddnlistener-config.json", os.O_RDONLY)
__configfile = os.fdopen(__configfile_fd)
__config = json.load(__configfile)
os.close(__configfile_fd)
for s in __config['schemas']:
r = requests.get(s['message_schema'])
if (... | Athanasius/eddn-listener | scripts/update-schemas.py | Python | mit | 438 |
"""
WSGI config for timberline project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | micolous/timberline | timberline/wsgi.py | Python | agpl-3.0 | 1,142 |
#/* author:@shivkrthakur */
# Enter your code here. Read input from STDIN. Print output to STDOUT
inputNumber = int(raw_input().strip())
list = []
while inputNumber != 0:
input = raw_input().split(' ');
if input[0] == 'insert':
list.insert(int(input[1]),int(input[2]))
elif input[0] == 'print':
... | shivkrthakur/HackerRankSolutions | Practice/AllDomains/Languages/Python/BasicDataTypes/Lists.py | Python | mit | 644 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, 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 ... | darren-wang/ksc | keystoneclient/exceptions.py | Python | apache-2.0 | 3,002 |
# pylint: disable=invalid-name
import ast
from warning import Warnings
from backend import visit_expression, assign, unify_types, ExtendedContext, \
Scope, static_evaluate, UnknownValue, NoneType, Bool, List, Instance, \
Class, Unknown, maybe_inferences, Symbol, type_subset, Context, \
construct_function_ty... | clark800/pystarch | visitor.py | Python | mit | 9,484 |
from datetime import datetime
from urllib.request import urlopen, Request
from django.db import transaction
from bs4 import BeautifulSoup
from mutual_funds.finance.models import NAV
class FundParser:
"""
Class for updating history data with bs4 and urllib
"""
def __init__(self, fund):
self... | ArtemBernatskyy/FundExpert.NET | mutual_funds/finance/parsers/funds_updater.py | Python | gpl-3.0 | 2,438 |
#
# Copyright 2013 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... | pcostell/google-cloud-datastore | python/googledatastore/__init__.py | Python | apache-2.0 | 3,958 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | SteveHNH/ansible | lib/ansible/module_utils/basic.py | Python | gpl-3.0 | 112,311 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
core.sshd_guard.guard
~~~~~~~~~~~~~~~~~~~~~
Watch SSHD's event and make honeypots.
:author: lightless <root@lightless.me>
:homepage: https://github.com/LiGhT1EsS/kokkuri
:license: GPL-3.0, see LICENSE for more details.
:copyright: Co... | LiGhT1EsS/kokkuri | Kokkuri-server/core/sshd_guard/guard.py | Python | gpl-3.0 | 3,844 |
# -*- coding: utf-8 -*-
from flask import Flask
from flask import render_template, jsonify
from random import randint
# Connects the board
from teensyserial import TeensySerial
teensy_board = TeensySerial(115200)
app = Flask(__name__)
@app.route('/data', methods=['GET'])
def get_temp():
"""Get the temperature f... | fazedores/termo-flask | termoflask.py | Python | mit | 709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.