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 -*-
import sys
sys.path.append('../browser_interface/browser')
class BrowserFactory(object):
def create(self, type, *args, **kwargs):
return getattr(__import__(type), type)(*args, **kwargs)
| xtuyaowu/jtyd_python_spider | browser_interface/browser/BrowserFactory.py | Python | mit | 225 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, 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... | colincsl/pyKinectTools | pyKinectTools/utils/pointcloud_conversions.py | Python | bsd-2-clause | 9,466 |
#!/usr/bin/env python
import json, sys, time
def isint(x):
try:
int(x)
return True
except:
return False
if len(sys.argv) > 2 and isint(sys.argv[1]) and isint(sys.argv[2]):
sys.argv.pop(1)
count = int(sys.argv[1])
for n in sys.argv[2:]:
print '%s:' % n
start = time.time()... | tolysz/prepare-ghcjs | spec-lts8/aeson/benchmarks/parse.py | Python | bsd-3-clause | 485 |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = '7c1f9184'.decode('hex')
P2P_PORT = 9335
ADDRESS_VERSION = 0
RPC_PORT = 9334
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'hawaiicoinaddress' in (yi... | CohibAA/p2pool-doge1-8 | p2pool/bitcoin/networks/hawaiicoin.py | Python | gpl-3.0 | 1,221 |
from horizon import views
from horizon import tables
from openstack_dashboard.dashboards.tasks.completed.tables import CompletedTasksTable
from openstack_dashboard.api.salt_database_api import get_all_records,task_body_harp,get_all_records_mod
#
#
from django.utils.translation import ugettext_lazy as _
from horizon.uti... | icloudrnd/automation_tools | openstack_dashboard/dashboards/tasks/completed/views.py | Python | apache-2.0 | 2,082 |
from selectable.base import ModelLookup
from selectable.registry import registry
from timepiece.crm.models import Project
from timepiece.entries.models import Activity
class ActivityLookup(ModelLookup):
model = Activity
search_fields = ('name__icontains', )
def get_query(self, request, term):
re... | caktus/django-timepiece | timepiece/entries/lookups.py | Python | mit | 807 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | cmvelo/ansible | lib/ansible/playbook/task.py | Python | gpl-3.0 | 17,005 |
import random
import re
from util import hook, http
@hook.command
def suggest(inp, inp_unstripped=None):
".suggest [#n] <phrase> -- gets a random/the nth suggested google search"
if inp_unstripped is not None:
inp = inp_unstripped
m = re.match("^#(\d+) (.+)$", inp)
num = 0
if m:
... | jmgao/skybot | plugins/suggest.py | Python | unlicense | 798 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | davidam/python-examples | basics/profile_factorial_raw.py | Python | gpl-3.0 | 1,099 |
# (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# 3p
import mock
# project
from checks import AGENT_METRICS_CHECK_NAME
from tests.checks.common import AgentCheckTest, load_check
MOCK_CONFIG = {
'instances': [
{'process_metrics': [
{
... | serverdensity/sd-agent-core-plugins | agent_metrics/test_agent_metrics.py | Python | bsd-3-clause | 4,404 |
# -*- test-case-name: nevow.test.test_livepage -*-
# Copyright (c) 2004 Divmod.
# See LICENSE for details.
"""
Previous generation Nevow Comet support. Do not use this module.
@see: L{nevow.athena}
"""
import itertools, types
import warnings
from zope.interface import implements, Interface
from twisted.internet i... | UstadMobile/exelearning-ustadmobile-work | nevow/livepage.py | Python | gpl-2.0 | 30,194 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
N=int(raw_input())
nums=map(int,raw_input().split(" "))
nums=sorted(nums, reverse=True)
for i in xrange(1,len(nums)):
if nums[i]<nums[0]:
print nums[i]
break
| shree-shubham/Unitype | Find the Second Largest Number.py | Python | gpl-3.0 | 248 |
"""Config flow for Vizio."""
import copy
import logging
import socket
from typing import Any, Dict, Optional
from pyvizio import VizioAsync, async_guess_device_type
from pyvizio.const import APP_HOME
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.media_player import DE... | sdague/home-assistant | homeassistant/components/vizio/config_flow.py | Python | apache-2.0 | 18,537 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-19 20:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20160307_1903'),
]
operations = [
migrations.AddField(
... | telminov/personnel-testing | core/migrations/0003_userexamination_must_finished_at.py | Python | mit | 529 |
from questionnaire.features.pages.base import PageObject
class ThemePage(PageObject):
url = "/themes/" | eJRF/ejrf | questionnaire/features/pages/theme.py | Python | bsd-3-clause | 108 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/tools/monitor/__init__.py | Python | apache-2.0 | 663 |
# coding: utf-8
# pylint: disable=invalid-name, protected-access, too-many-arguments, global-statement
"""Symbolic configuration API."""
from __future__ import absolute_import as _abs
import ctypes
from ..base import _LIB
from ..base import c_array, c_str, mx_uint
from ..base import SymbolHandle
from ..base import ch... | danithaca/mxnet | python/mxnet/_ctypes/symbol.py | Python | apache-2.0 | 4,211 |
"""Order a duplicate block storage volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()}
@click.command(context_settings=CONTEXT_SETTINGS)
@c... | softlayer/softlayer-python | SoftLayer/CLI/block/duplicate.py | Python | mit | 4,531 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import sys
parser = argparse.ArgumentParser(description='Calibre Web is a web app'
' providing a interface for browsing, reading and downloading eBooks\n', prog='cps.py')
parser.add_argument('-p', metavar='path', help='path an... | issmirnov/calibre-web | cps/cli.py | Python | gpl-3.0 | 1,534 |
"""
Tests for the Split Testing Module
"""
import ddt
import lxml
from mock import Mock, patch
from fs.memoryfs import MemoryFS
from xmodule.partitions.tests.test_partitions import StaticPartitionService, PartitionTestCase, MockUserPartitionScheme
from xmodule.tests.xml import factories as xml
from xmodule.tests.xml i... | beni55/edx-platform | common/lib/xmodule/xmodule/tests/test_split_test_module.py | Python | agpl-3.0 | 23,315 |
from _common import *
_truths = ['nprongs']
truths = {_truths[x]:x for x in xrange(len(_truths))}
def get_dims(coll):
coll.objects['train']['particles'].load(memory=False)
dims = coll.objects['train']['particles'].data.data.shape
dims = (dims[0], dims[1], dims[2]-1) # need to exclude the last column
... | sidnarayanan/BAdNet | python/subtlenet/generators/gen_4vec.py | Python | mit | 4,220 |
import random
def seed(z):
"""
Sets all seeds used to generate random number streams.
Currently contains:
- random library
Previously contained:
- numpy
"""
random.seed(z)
def random_choice(array, probs=None):
"""
This function takes in an array of values to make a choice from,
and an pdf corresponding t... | CiwPython/Ciw | ciw/auxiliary.py | Python | mit | 1,525 |
"""Enum values for HSA
Note that Python namespacing could be used to avoid the C-like
prefixing, but we choose to keep the same names as found in the C
enums, in order to match the documentation.
"""
import ctypes
HSA_LARGE_MODEL = ctypes.sizeof(ctypes.c_void_p) == 8
# hsa_status_t
# The function has been executed... | jriehl/numba | numba/roc/hsadrv/enums.py | Python | bsd-2-clause | 22,011 |
## For Python v3.5.2
##
## N=3: 40 configurations
## N=4: 454 configurations
## N=5: 13,098 configurations (0.56 seconds)
## N=6: 1,214,975 configurations (89.5 seconds)
## N=7: 110,483,315 configurations (3.60 hours)
## N=8:
##
from timeit import default_timer as timer
BigN=8
tile_count=int(BigN*(BigN+1)/2)
board_s... | Munklar/Partridge-Number | PartNum-Py3.5.2.py | Python | mit | 4,257 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_py3.py | Python | mit | 1,474 |
import json
from respite.serializers.jsonserializer import JSONSerializer
class JSONPSerializer(JSONSerializer):
def serialize(self, request):
data = super(JSONPSerializer, self).serialize(request)
if 'callback' in request.GET:
callback = request.GET['callback']
else:
... | jgorset/django-respite | respite/serializers/jsonpserializer.py | Python | mit | 391 |
import sqlite3
class database:
def __init__(self, filename):
self.db = sqlite3.connect(filename)
self.cur = self.db.cursor()
def __del__(self):
self.close()
def commit(self):
self.db.commit()
def close(self):
if hasattr(self,"db"):
self.db.close()
... | xavierskip/LANinfo | db.py | Python | mit | 1,171 |
import warnings
from django import template
from django.utils.safestring import mark_safe
from wagtail.wagtailembeds.embeds import get_embed
register = template.Library()
@register.filter
def embed(url, max_width=None):
embed = get_embed(url, max_width=max_width)
try:
if embed is not None:
... | jorge-marques/wagtail | wagtail/wagtailembeds/templatetags/wagtailembeds_tags.py | Python | bsd-3-clause | 420 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from itertools import product, chain
from ..misc.misc import indent, compose
import copy
import inspect
class Function(object):
r"""
Define el arreglo n dimensional que se usan para tener operaciones y relaciones n-arias.
Necesariamente toma numeros desde 0
... | pablogventura/sagepkg | definability/functions/functions.py | Python | gpl-3.0 | 9,180 |
import time
import io
from collections import ChainMap
from jinja2 import Undefined, FileSystemLoader, environment
from jinja2.utils import missing, object_type_repr
from jinja2.exceptions import TemplateNotFound, TemplateSyntaxError
import os
import sqlite3
database_cursor = None
class Environment(environ... | shankj3/flask_version | render_with_jinja/test.py | Python | mit | 2,183 |
import json
import stripe
from datetime import datetime, timedelta
from django.conf import settings
from django.core import mail
from django.test import Client, TestCase
from django.utils.timezone import now
from cl.donate.management.commands.cl_send_donation_reminders import Command
from cl.donate.models import Dona... | brianwc/courtlistener | cl/donate/tests.py | Python | agpl-3.0 | 6,484 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2013-06-25 21:56:55
# @Author : Xero
# @Link : https://github.com/Johnzero
# @Version : $Id$
import socket,threading,struct,sys,base64,hashlib
from time import sleep
# If flash Socket The policy that is sent to the clients.
POLICY = """<cross-d... | Johnzero/titanium-websocket | flask/InitTestWebSocketServer.py | Python | apache-2.0 | 5,551 |
# -*- 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... | trabacus-softapps/openerp-8.0-cc | openerp/addons/event/event.py | Python | agpl-3.0 | 21,331 |
# -*- coding: utf-8 -*-
CooMax= 10
import xc_base
import geom
import xc
import math
from model.sets import sets_mng as sUtils
__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "l.pereztato@gmail.com"
feProblem= xc.FEProblem()
preprocessor= ... | lcpt/xc | verif/tests/preprocessor/sets/sets_boolean_operations_01.py | Python | gpl-3.0 | 1,078 |
"""Component to count within automations."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_EDITABLE,
CONF_ICON,
CONF_ID,
CONF_MAXIMUM,
CONF_MINIMUM,
CONF_NAME,
)
from homeassistant.core import HomeAssistant, callback
from hom... | aronsky/home-assistant | homeassistant/components/counter/__init__.py | Python | apache-2.0 | 9,477 |
import os
import re
import datetime
from django.conf import settings
from ietf.doc.models import Document, State, DocAlias, DocEvent, DocumentAuthor
from ietf.doc.models import NewRevisionDocEvent, save_document_in_history
from ietf.doc.models import RelatedDocument, DocRelationshipName
from ietf.doc.utils import add... | wpjesus/codematch | ietf/submit/utils.py | Python | bsd-3-clause | 16,013 |
print("In Python, what do you call a 'box' used to store data?")
answer = input()
if answer == "variable":
print(" :) ")
else:
print(" :( ")
print("Thank you for playing!")
print('''
Q1 - In Python, what do you call a 'box' used to store data?
a - text
b - variable
c - a shoe box
''')
answer = in... | arve0/example_lessons | src/python/lessons/Quiz/Project Resources/Quiz.py | Python | cc0-1.0 | 553 |
#! /usr/bin/env python
import vcsn
from test import *
algos = ['distance', 'inplace', 'separate']
# check INPUT EXP ALGORITHM
# -------------------------
def check_algo(i, o, algo):
i = vcsn.automaton(i)
o = vcsn.automaton(o)
print("using algorithm: ", algo)
print("checking proper")
# We call sort().stri... | pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn | tests/python/proper.py | Python | gpl-3.0 | 11,408 |
# -*- coding: utf-8 *-*
"""
@author: López Ricardo Ezequiel
@license: GNU GENERAL PUBLIC LICENSE
@contact: mail@lopezezequiel.com
"""
| lopezezequiel/fractalZE | FractalZE/__init__.py | Python | gpl-2.0 | 135 |
from django import http
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.utils.cache import add_never_cache_headers
from django.utils.translation import ugettext_lazy as _
from hyperadmin.links import Link
class ConditionalAccessMixin(object):
... | webcube/django-hyperadmin | hyperadmin/views.py | Python | bsd-3-clause | 5,021 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | Zaneh-/bearded-tribble-back | taiga/hooks/api.py | Python | agpl-3.0 | 2,881 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import time
import cachetools
from apex.aprs import util as aprs_util
from .util im... | Syncleus/apex | src/apex/buffers.py | Python | apache-2.0 | 6,760 |
#!/usr/bin/python2.4
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio project reader/writer."""
import common
import xml.dom
import xml.dom.minidom
#------------------------------------------... | gvaf/breakpad | src/tools/gyp/pylib/gyp/MSVSToolFile.py | Python | bsd-3-clause | 2,430 |
# Bayes' Theorem
# P(A|B) = P(B|A) P(A) / P(B)
# A = "like"
# B = has key value B
# P(A) = |liked| / |url|
# P(B) = |key| / |url|
# P(B|A) = |liked from B| / |liked|
# P(A|B) = ((|liked from B| / |liked|) (|liked| / |url|)) / (|key| / |url|)
# = (|liked from B| / |url|) / (|key| / |url|) = |liked from B| / |key|... | TobyRoseman/PS4M | engine/analyzers/bayesScorer.py | Python | mit | 3,041 |
from abc import ABCMeta, abstractmethod, abstractproperty
from contextlib import contextmanager
from functools import wraps
import gzip
from inspect import getargspec
from itertools import (
combinations,
count,
product,
)
import operator
import os
from os.path import abspath, dirname, join, realpath
import... | bartosh/zipline | zipline/testing/core.py | Python | apache-2.0 | 47,174 |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | deepmind/acme | acme/agents/tf/bcq/discrete_learning_test.py | Python | apache-2.0 | 2,614 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
from openerp.addon... | ddico/odoomrp-wip | stock_picking_package_info/models/stock_picking.py | Python | agpl-3.0 | 6,517 |
#!/usr/bin/env python
__author__ = 'Rolf Jagerman'
from PySide import QtGui
import os
from authentication import AuthenticationListener, AuthenticationClient
from loadui import loadUi
from config import UI_DIRECTORY
from drawers import Drawers
class RetrieveDelivery(QtGui.QFrame, AuthenticationListener):
"""
... | MartienLagerweij/aidu | aidu_gui/src/aidu_gui/retrieve_delivery.py | Python | mit | 2,907 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | ankur-gupta91/horizon-net-ip | openstack_dashboard/settings.py | Python | apache-2.0 | 12,704 |
# Copyright (c) 2015 Cisco Systems, 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 re... | openstack/neutron-lib | neutron_lib/exceptions/vlantransparent.py | Python | apache-2.0 | 902 |
# Copyright (C) 2013 Nippon Telegraph and Telephone 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
#
# Unless required by applicab... | mikhaelharswanto/ryu | ryu/lib/ofctl_v1_2.py | Python | apache-2.0 | 27,009 |
### import ####################################################################
import pycmds.project.classes as pc
import pycmds.hardware.hardware as hw
import pathlib
import appdirs
import toml
import yaqc
### driver ####################################################################
class Driver(hw.Driver):
... | wright-group/PyCMDS | pycmds/hardware/spectrometers.py | Python | mit | 2,840 |
#
# Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | pyzoo/test/zoo/chronos/model/test_prophet.py | Python | apache-2.0 | 4,374 |
from peewee import MySQLDatabase
DB = MySQLDatabase('db_name',
user='DB_user',
password='db_Password',
host='DB_URL') | vincentdavis/Colorado-Property-Data | dbconfig_pro.py | Python | mit | 174 |
#!/usr/bin/python
from execrunner import o, selo, selmo, cmdList, f
import subprocess, argparse
# Dataset prefix
dp = '/u/nlp/data/smart-autocomplete/datasets/'
constants = {
'python': '/u/nlp/packages/python-2.7.4/bin/python2.7',
'statePath': '/u/nlp/data/smart-autocomplete/state'
}
def main():
parser = \
... | pokey/smartAutocomplete | pythonServer/iterateRuns.py | Python | mit | 3,283 |
# pylint: disable = C0301
from bs4 import BeautifulSoup
from urllib2 import urlopen
import pandas as pd
pos_idx_map = {
'qb': 2,
'rb': 3,
'wr': 4,
'te': 5,
}
def make_url(pos, wk):
ii = pos_idx_map[pos]
fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1... | yikelu/nfl_fantasy_data | htmls2csvs.py | Python | gpl-2.0 | 2,265 |
import _plotly_utils.basevalidators
class LenmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="lenmode", parent_name="barpolar.marker.colorbar", **kwargs
):
super(LenmodeValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/barpolar/marker/colorbar/_lenmode.py | Python | mit | 546 |
"""WSGI Middleware components
NERC Data Grid Project"""
__author__ = "P J Kershaw"
__date__ = "27/05/08"
__copyright__ = "(C) 2009 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = '$Id$'
import logging
log ... | philipkershaw/ndg_security_server | ndg/security/server/wsgi/__init__.py | Python | bsd-3-clause | 18,251 |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/experiment/signal_calculator.py | Python | apache-2.0 | 9,205 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_web_site_management_client.py | Python | mit | 9,664 |
x = {"hi": "there", "yo": "I'm a dawg"}
print x.items()
print x.keys()
print x.values()
| ArcherSys/ArcherSys | skulpt/test/run/t263.py | Python | mit | 88 |
#!/usr/bin/env python
# encoding:utf8
"""
Created on 2016年1月9日
@author: zengchunyun
"""
class HAproxy(object):
def __init__(self, fb, ):
import re
self.re_match = re.compile('\w+.*$')
self.re_match_line = re.compile('^\w+.*$') # 针对行查找非空白特殊字符
self.file = fb # 传入一个文件
self.... | zengchunyun/s12 | day3/haproxy/HAproxy/HAproxy.py | Python | gpl-2.0 | 6,032 |
from chapman.task import Barrier
from chapman import model as M
from .test_base import TaskTest
class TestBarrier(TaskTest):
def test_ignore_sub_results(self):
t = Barrier.n(
self.doubler.n(),
self.doubler.n())
t.start(2)
self._handle_messages()
t.refresh(... | synappio/chapman | chapman/tests/test_barrier.py | Python | mit | 483 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from math import sqrt, exp
import random
import scipy.stats
class Estimator(object):
def __init__(self):
self._n = 0
self._M = 0
self._S = 0
def __str__(self):
return '\t{:.4f}\t{:.4f}'.format(self._mean, self.confidence())
de... | bradfordboyle/python-projects | graph-sampling/Estimator.py | Python | mit | 3,929 |
class ListResource(object):
def __init__(self, version):
"""
:param Version version:
"""
self._version = version
""" :type: Version """
| tysonholub/twilio-python | twilio/base/list_resource.py | Python | mit | 180 |
#!/usr/bin/env python
# finds prime numbers in the interval [2, 9]
for n in range(2, 10):
for x in range(2, n):
if n % x == 0:
print n, 'equals', x, '*', n/x
break
# the else clause belongs to the for loop, not to the if statement
# the else clause is terminated through th... | mileiio/pywebpr | breakcontinue.py | Python | apache-2.0 | 475 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | aam-at/tensorflow | tensorflow/python/ops/array_grad.py | Python | apache-2.0 | 44,769 |
__author__ = 'matti'
from common.database import db
class VideoModel(db.Model):
__tablename__ = 'video'
id = db.Column(db.Integer, primary_key=True)
views = db.Column(db.Integer)
title = db.Column(db.String(80))
description = db.Column(db.Text)
nicoid = db.Column(db.S... | melonmanchan/gachimuch.io-api | api/models/video.py | Python | mit | 1,086 |
# -*- coding: UTF-8 -*-
# Copyright 2016 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""The :xfile:`models.py` module for `lino.modlib.wkhtmltopf`.
Does not define any modules. Just to have it as a Django app.
"""
from .choicelists import *
| lino-framework/lino | lino/modlib/wkhtmltopdf/models.py | Python | bsd-2-clause | 294 |
total = 0.0
with open('../data/portfolio.csv', 'r') as f:
heades = next(f) # skip header
for line in f:
line = line.strip()
parts = line.split(',')
parts[0] = parts[0].strip('"')
parts[1] = parts[1].strip('"')
parts[2] = int(parts[2])
parts[3] = float(parts[3])
... | jcontesti/python-programming-language-livelessons-projects | 03/port.py | Python | gpl-3.0 | 385 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import calendar
import fnmatch
import logging
import os
from codecs import open
from collections import defaultdict
from functools import partial
from itertools import chain, groupby
from operator import attrgetter
from jinja2 import (Bas... | Rogdham/pelican | pelican/generators.py | Python | agpl-3.0 | 31,246 |
#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 2005-2006 Al Riddoch (See the file COPYING for details).
from atlas import *
from physics import *
from physics import Quaternion
from physics import Vector3D
from random import *
import server
class Combat(server.Task):
... | alriddoch/cyphesis | rulesets/mason/world/tasks/Combat.py | Python | gpl-2.0 | 6,055 |
"""
A script to create some dummy users
"""
from django.core.management.base import BaseCommand
from student.models import CourseEnrollment
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from student.views import _do_creat... | geekaia/edx-platform | common/djangoapps/student/management/commands/create_random_users.py | Python | agpl-3.0 | 1,412 |
#!/usr/bin/env python
# -*- coding:gbk -*-
import sys
import re
import os
import time
import string
import datetime
import getopt
import tushare as ts
sys.path.append('.')
from internal.common_inf import *
from internal.dfcf_inf import *
from internal.ts_common import *
def rt_quotes(dtFrame, source, qt_stage):
print... | yudingding6197/fin_script | debug/qiang_ruo_trace.py | Python | gpl-2.0 | 6,469 |
import json
import operator
import os
import postgres
from fuzzywuzzy import fuzz
def search_nhd(name, lat, lon, limit=10):
"""Search the National Hydrograpy Dataset (stored in postgres)"""
# lat and lon must be able to be coerced to floats
try:
lat = float(lat)
lon = float(lon)
exce... | JeffPaine/nhd_search | search/utils.py | Python | mit | 2,035 |
import logging
from typing import cast, List, Union
import numpy
from cephlib.common import float2str
from cephlib.texttable import Texttable
from cephlib.statistic import calc_norm_stat_props, calc_histo_stat_props
from .stage import Stage, StepOrder
from .test_run_class import TestRun
from .result_classes import S... | Mirantis/disk_perf_test_tool | wally/console_report.py | Python | apache-2.0 | 2,980 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-21 11:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('collection', '0001_initial'),
]
operations = [
migrations.AddField(
... | Rawtechio/oscar | oscar/collection/migrations/0002_missed_notes.py | Python | mit | 436 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-07-13 08:44
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... | TheWebMonks/equipo | app/freelancers/migrations/0045_auto_20170713_0844.py | Python | apache-2.0 | 4,747 |
#!/usr/bin/env python
#
# 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 applicable law o... | adviti/melange | thirdparty/google_appengine/lib/protorpc/protorpc/transport.py | Python | apache-2.0 | 12,773 |
import brain
import data
import backtest
import time
import logging
# Windows
# datadir = r'C:\Users\craig\Desktop\BOT Project'
# keyfile = r'C:\Users\craig\Desktop\BOT Project\kraken.key'
# Linux
datadir = r'/home/craig/KrakenBot/Data/'
keyfile = r'/home/craig/KrakenBot/Key/kraken.key'
# Set up logging
# logging.ba... | CeramicDingo/KrakenBot | local_app.py | Python | mit | 1,598 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tongwang01/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py | Python | apache-2.0 | 44,822 |
#
# 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 us... | mxm/incubator-beam | sdks/python/apache_beam/metrics/metric_test.py | Python | apache-2.0 | 5,639 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from app import settings
from home import views
urlpatterns = patterns('',
url(r'^$', views.login, name='login'),
url(r'^home$', views.home, name='home'),
url(r'^profile', views.profile, name='profil... | twitterdev/django-rest-apis | app/urls.py | Python | mit | 963 |
from collections import defaultdict
import nltk
from src.Documents import Document
from src.Tokenizers.Tokenizer import Tokenizer
class BigramTokenizer(Tokenizer):
@property
def name(self):
return 'BigramTokenizer'
def __init__(self):
self.tokenizer = nltk.tokenize.TreebankWordTokenizer... | xyryx/SentimentAnalysis | src/Tokenizers/BigramTokenizer.py | Python | mit | 868 |
#! /usr/bin/env python
"""
File: fit_pendulum_data.py
Copyright (c) 2016 Austin Ayers
License: MIT
Course: PHYS227
Assignment: 5.18
Date: Feb 11, 2016
Email: ayers111@mail.chapman.edu
Name: Austin Ayers
Description: Implementing a prime sieve
"""
import sympy as sp
import matplotlib.pyplot as plt
from numpy import p... | chapman-phys227-2016s/hw-2-C0deMonkee | fit_pendulum_data.py | Python | mit | 1,298 |
# rndpic - an App Engine app to display random pictures from Picasa Web.
# Copyright (C) 2011 Patrick Moor <patrick@moor.ws>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... | pmoor/rndpic | json_handler.py | Python | gpl-3.0 | 1,508 |
from pyb import RTC
import os
from utils.airpy_config_utils import load_config_file
AIRPY_SYSTEM = 4
AIRPY_ERROR = 3
AIRPY_WARNING = 2
AIRPY_DEBUG = 1
AIRPY_INFO = 0
LOGGER_GLOBAL_REF = 0
class airpy_logger:
def __init__(self, priority, caching_enabled=False):
"""
Logger entry point
:pa... | Sokrates80/air-py | utils/airpy_logger.py | Python | mit | 5,862 |
# This file is part of Py6S.
#
# Copyright 2012 Robin Wilson and contributors listed in the CONTRIBUTORS file.
#
# Py6S 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 3 of the License, o... | robintw/Py6S | Py6S/Params/aeroprofile.py | Python | lgpl-3.0 | 12,953 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import pytest
from translate.convert import dtd2po, po2dtd, test_convert
from translate.misc import wStringIO
from translate.storage import dtd, po
class TestPO2DTD:
def setup_method(self, method):
warnings.resetwarnings()
def teardown... | whip112/Whip112 | vendor/packages/translate/convert/test_po2dtd.py | Python | mpl-2.0 | 22,776 |
import os
import sys
import traceback
from .. import constants, logger, exceptions, dialogs
from . import scene, geometry, api, base_classes
def _error_handler(func):
def inner(filepath, options, *args, **kwargs):
level = options.get(constants.LOGGING, constants.DEBUG)
version = options.get('... | meizhoubao/three.js | utils/exporters/blender/addons/io_three/exporter/__init__.py | Python | mit | 2,661 |
import webapp2, urllib, jinja2, os
from google.appengine.api import taskqueue
from google.appengine.api import urlfetch
from apikeys import * # contains api key for YOIN15MIN,YOIN30MIN,YOINANHOUR
SINGLE_YO_API = "http://api.justyo.co/yo/"
jinja_environment = jinja2.Environment(autoescape=True,
loader=jinja2.Fi... | yasszoug/yoreminder | main.py | Python | mit | 1,860 |
from django import forms
from .models import Dataset
class DatasetForm(forms.ModelForm):
class Meta:
model = Dataset
| dpelc/qPRC | qPRC/apps/datasets/forms.py | Python | agpl-3.0 | 132 |
import unittest
import karmatrain.db_management as db_management
# CONSTANTS FOR TESTING
SD1 = {"title": "title1", "selftext": "selftext1", "subreddit": "brasil", "time": 1234, "thread_id": "1DFGG"}
SD2 = {"title": "title2", "selftext": "selftext1", "subreddit": "brasil2", "time": 1234, "thread_id": "2DFGG"}
SD3 = {... | andredriem/KarmaTrain | tests/db_management_test.py | Python | gpl-3.0 | 2,951 |
from django.test import TestCase
from django_mailbox.models import Message
from batch_apps.models import App, Day, Execution
from batch_apps.generator import get_current_date_in_gmt8
from batch_apps.integration import (
execute_end_to_end_tasks,
get_unexecuted_due_executions,
get_unprocessed_unmatched_ema... | azam-a/batcher | batch_apps/tests/test_integrations.py | Python | mit | 9,337 |
## Auto-contained SimpleJSON encoder
## Brewed by: Alvaro Lopez Ortega, 2010
# Copyright (c) 2006 Bob Ippolito
#
# 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, includin... | helix84/activae | src/CTK_trunk/CTK/json_embedded.py | Python | bsd-3-clause | 20,102 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base... | tysonholub/twilio-python | twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.py | Python | mit | 17,559 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | FederatedAI/FATE | python/fate_client/pipeline/param/sqn_param.py | Python | apache-2.0 | 1,812 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Tests for grr.lib.objectfilter."""
import unittest
from grr.lib import objectfilter
attr1 = "Backup"
attr2 = "Archive"
hash1 = "123abc"
hash2 = "456def"
filename = "boot.ini"
class DummyObject(object):
def __init__(self, key, value):... | statik/grr | lib/objectfilter_test.py | Python | apache-2.0 | 19,241 |
"""
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... | mikaelboman/home-assistant | homeassistant/components/dweet.py | Python | mit | 1,961 |
#!/usr/bin/python
import os
import time
import Bio.SubsMat.MatrixInfo
import Bio.Blast.NCBIWWW
import Bio.Blast.NCBIXML
from Bio import Entrez
#run ncbi blast
entrez_query = '"serum albumin"[Protein name] AND mammals[Organism]'
ncbi = Bio.Blast.NCBIWWW.qblast(program = "blastp",
databa... | jauler/VU_MIF_tasks | BakalauroStudijos/BioInformatika/2uzd.py | Python | gpl-2.0 | 3,860 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.