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 2008 the Melange 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... | rhyolight/nupic.son | app/soc/models/timeline.py | Python | apache-2.0 | 1,497 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | asimshankar/tensorflow | tensorflow/python/keras/engine/saving_test.py | Python | apache-2.0 | 38,194 |
from django.db import models
from solo.models import SingletonModel
class Configuration(SingletonModel):
auv_id = models.UUIDField(blank=True, null=True)
auth_token = models.CharField(max_length=1024, blank=True)
update_frequency = models.DecimalField(blank=True, null=True,
... | adrienemery/auv-control-pi | auv_control_pi/models.py | Python | mit | 2,514 |
import sys
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
version = "{}.{}".format(sys.version_info.major, sys.version_info.minor)
message = "Hello World from Nginx uWSGI Python {} app in a Docker container".format(
version
)
return message
| tiangolo/uwsgi-nginx-docker | tests/test_02_app/app_with_installs/app/main.py | Python | apache-2.0 | 313 |
from abc import ABCMeta, abstractmethod
class BaseClass(metaclass=ABCMeta):
@property
@abstractmethod
def abstract_property(self):
pass
class SubClass(BaseClass):
abstract_property = 5
class SubSubClass(SubClass):
pass | jwren/intellij-community | python/testData/inspections/PyAbstractClassInspection/overriddenAsFieldInAncestor.py | Python | apache-2.0 | 249 |
#!/usr/bin/env python
from setuptools import setup
setup(
name="depigraph",
version="0.6.0",
description="Draw dependency graphs for python distributions",
author="Brian Warner",
author_email="warner-depigraph@lothar.com",
license="MIT",
url="https://github.com/warner/depigraph",
py_mo... | warner/depigraph | setup.py | Python | mit | 499 |
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/django.db'
INSTALLED_APPS = ['django_app_template']
ROOT_URLCONF = 'django_app_template.testurls'
| svetlyak40wt/django-app-template | django_app_template/testsettings.py | Python | bsd-3-clause | 148 |
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
from TreeNode import TreeNode
class Solution(object):
def sortedArrayToBST(self, nums):
if not nums : return None
n = len(nums)
if n == 1:
return TreeNode(nums[0])
mid = TreeNode(nums[n // 2])
... | menghanY/LeetCode-Python | Tree/ConvertSortedArrayToBinarySearchTree.py | Python | mit | 452 |
# (C) Copyright 2017-2018, 2020 by Rocky Bernstein
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This progr... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/xdis/opcodes/opcode_3x.py | Python | mit | 9,639 |
#! /usr/bin/env python
import numpy as np
import time
RISKFREE = 0.02
VOLATILITY = 0.30
def cnd(d):
A1 = 0.31938153
A2 = -0.356563782
A3 = 1.781477937
A4 = -1.821255978
A5 = 1.330274429
RSQRT2PI = 0.39894228040143267793994605993438
K = 1.0 / (1.0 + 0.2316419 * np.abs(d))
ret_val = (... | pombredanne/numba | examples/blackscholes/blackscholes.py | Python | bsd-2-clause | 2,024 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyXlrd(PythonPackage):
"""Library for developers to extract data from Microsoft Excel (tm)... | rspavel/spack | var/spack/repos/builtin/packages/py-xlrd/package.py | Python | lgpl-2.1 | 564 |
class Employee(object):
"""This is a constructor to initialize what an Employee has"""
def __init__(self, firstname, lastname, gender):
self.firstname = firstname
self.lastname = lastname
self.gender = gender
class Permanent__Employee(Employee):
"""Permanent__Employee(child class... | anthonyndunguwanja/Anthony-Ndungu-bootcamp-17 | Day 2/Real_World_Problem.py | Python | mit | 1,232 |
#!/usr/bin/python
#coding=utf-8
'''
技术因子接口
'''
import TushareBasedata as TushareBasedata
class TechFactorService(object):
'''
ma
行情列:如:收盘价\最高价\最低价
n1上穿n2,金叉
n2上穿n1,死叉
type : 1、金叉 2、死叉
'''
def ma(self, codelist, col, tradedate, n1, n2, type):
stocklist = []
tbd = Tu... | X-martin/robot_quant | common/TechFactorService.py | Python | mit | 1,315 |
from multiprocessing import Pool, get_start_method
from multiprocessing.pool import Pool as PWL
import os
import numpy as np
from numpy.testing import assert_equal, assert_
import pytest
from pytest import raises as assert_raises, deprecated_call
import scipy
from scipy._lib._util import (_aligned_zeros, check_random... | aeklant/scipy | scipy/_lib/tests/test__util.py | Python | bsd-3-clause | 6,323 |
from check_grad import check_grad
from utils import *
from logistic import *
import matplotlib.pyplot as plt
def run_logistic_regression(hyperparameters):
# TODO specify training data
train_inputs, train_targets = load_train()
valid_inputs, valid_targets = load_valid()
# N is number of examples; M i... | ouyangyike/Machine-Learning-and-Data-Mining | Logistic Regression/logistic_regression_rate2.py | Python | mit | 6,098 |
from django.conf.urls import url, include
from .views import BotairView
urlpatterns = [
url(r'^7a312b084fc7d66e792da1bc79a082d3f953142e3a947fa050/?$', BotairView.as_view())
] | itucsProject2/Proje2 | botair/urls.py | Python | unlicense | 190 |
import os
import subprocess
import threading
import http.server, ssl
def domake():
# build directory
#os.chdir("./../")
server_address = ('localhost', 7443)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
... | 40423248/2017springcd_hw | localhttp.py | Python | agpl-3.0 | 706 |
#!/usr/bin/env python
import os
import numpy as np
from xmap_netcdf_reader import DetectorData
import readMDA
from memoize_core import Memoizer
store = {}
expiring_memoize = Memoizer(store)
from utils import memoize
#
# set up a CLASS for detector pixels
#
"""
This module provides an interface to a DetectorData ne... | Peter--K/Sakura | get_netcdf.py | Python | bsd-3-clause | 11,656 |
# watch.py
# usage: watch.py [-h] [-c COUNT] [-i INTERVAL] [-d] command
#
# This script displays the output of a specified CLI command every n seconds
# Example "run script watch.py "show port packet no-ref""
#
# positional arguments:
# command Command to iterate. Should be enclosed in quotes (i.e.
# ... | extremenetworks/xkit | EXOS/Python/watch/watch.py | Python | bsd-2-clause | 5,605 |
import os
import subprocess
import sys
import tempfile
import time
import re
timeout_seconds = 4
def nocomments(s):
rx = re.compile("^//.*$", re.MULTILINE)
return "".join(re.split(rx, s))
# Sophisticated Ph.D level error detection solution: string matching
# Patent Pending
parseerror = "XXXParseErrorXXX"
passe... | logchi/LambdaS5 | tests/test262/single_test.py | Python | bsd-3-clause | 4,435 |
from itertools import permutations
from math import sqrt
def satisfies(ab):
a, b = ab
c = sqrt(a*a + b*b)
return a<b<c and a + b + c == 1000
ab_pairs = set(permutations(range(1, 1000), 2))
ab_pairs = filter(satisfies, ab_pairs)
a, b = ab_pairs[0]
c = int(sqrt(a*a + b*b))
print 'a =', a
print 'b =', b
print 'c =... | davidxmoody/kata | project-euler/completed/first-attempt/euler9.py | Python | mit | 353 |
"""SCons.SConf
Autoconf-like configuration support.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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 ... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/SConf.py | Python | bsd-3-clause | 39,708 |
#!/usr/bin/python
from pcitweak.bitstring import BitString
for n in range(0x10):
b = BitString(uint=n, length=4)
print " % 3d 0x%02x %s" % (n, n, b.bin)
| luken/pcitweak | examples/printbin.py | Python | mit | 166 |
# -*- coding: utf-8 -*-
def parse_search_input(search_input):
search_terms = []
term = u''
COMPOUND_TERM = False
for char in search_input:
if (char == '"' and not COMPOUND_TERM):
search_terms.append(term)
term = ''
COMPOUND_TERM = True
elif (char ==... | nathaliaspatricio/febracev | search/utils.py | Python | gpl-2.0 | 684 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any l... | grimoirelab/perceval | setup.py | Python | gpl-3.0 | 3,763 |
#!/usr/bin/env python
"""Prepare interaction matrix from interaction list."""
from __future__ import print_function
import argparse
import sys
import numpy as np
import pandas as pd
__author__ = "Gianluca Corrado"
__copyright__ = "Copyright 2016, Gianluca Corrado"
__license__ = "MIT"
__maintainer__ = "Gianluca Co... | gianlucacorrado/RNAcommender | rnacommender/interactions.py | Python | mit | 4,316 |
"""
Copyright (c) 2016 Genome Research Ltd.
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, distr... | jeremymcrae/denovoFilter | denovoFilter/check_independence.py | Python | mit | 3,991 |
class WidgetBase(object):
""" Abstract base class for all widgets
"""
def __init__(self, x, y):
self.left = int(x)
self.top = int(y)
def process_input(self, events, pressed_keys):
# This method will receive all the events that happened since the last frame
print("uh-oh,... | zachdj/ultimate-tic-tac-toe | widgets/WidgetBase.py | Python | mit | 799 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Comunitea Servicios Tecnológicos All Rights Reserved
# $Kiko Sánchez <kiko@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... | jgmanzanas/CMNT_004_15 | project-addons/product_outlet_loss/wizard/product_outlet_wizard.py | Python | agpl-3.0 | 8,607 |
from veriocheck import veriocheck | veriocheck/veriocheck-python | veriocheck/__init__.py | Python | mit | 33 |
from flask import Blueprint, jsonify, request
import json
from bson import ObjectId
mod = Blueprint('db_operations', __name__)
from slideatlas import models
@mod.route('/modify')
def modify():
"""
Locates a record based on ID and modifies a particular field to new value
"""
# Get the parameters
id... | SlideAtlas/SlideAtlas-Server | slideatlas/views/db_operations.py | Python | apache-2.0 | 1,436 |
"""Test the Netatmo config flow."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.netatmo import config_flow
from homeassistant.components.netatmo.const import (
CONF_NEW_AREA,
CONF_WEATHER_AREAS,
DOMAIN,
OAUTH2_AUTHORIZE,... | lukas-hetzenecker/home-assistant | tests/components/netatmo/test_config_flow.py | Python | apache-2.0 | 6,885 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | python/tvm/topi/testing/lrn_python.py | Python | apache-2.0 | 2,543 |
from decimal import Decimal
from psi.app import const
from psi.app.models.data_security_mixin import DataSecurityMixin
from psi.app.service import Info
from psi.app.utils.format_util import format_decimal
from sqlalchemy import Column, Integer, ForeignKey, Numeric, Text, DateTime, select, func
from sqlalchemy.ext.hybr... | betterlife/psi | psi/app/models/inventory_in_out_link.py | Python | mit | 1,883 |
from collections import OrderedDict
import pytest
from ucca import textutil
from ucca.constructions import CATEGORIES_NAME, DEFAULT, CONSTRUCTIONS, extract_candidates
from .conftest import PASSAGES, loaded, loaded_valid, multi_sent, crossing, discontiguous, l1_passage, empty
"""Tests the constructions module functio... | danielhers/ucca | ucca/tests/test_constructions.py | Python | gpl-3.0 | 2,357 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Gael Varoquaux <gael.varoquaux@inria.fr>
#
# License: BSD 3 clause
import sys
import warnings
from abc import ABCMeta, abstractmethod
import n... | 0asa/scikit-learn | sklearn/linear_model/coordinate_descent.py | Python | bsd-3-clause | 71,569 |
"""
Plugin Name : Tournament
Plugin Version : 0.1
Description:
Provides basic utility commands, e.g., coin flips.
Contributors:
- Popguin / Euklyd
License:
Arcbot is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public L... | euklyd/PenguinBot3K | plugins/Tournament.py | Python | gpl-3.0 | 8,258 |
import unittest
from galry import *
from test import GalryTest
class PM(PaintManager):
def initialize(self):
# we first add a plot with square coordinates but black
self.add_visual(PlotVisual, x=[-.5, .5, .5, -.5, -.5],
y=[-.5, -.5, .5, .5, -.5], color=(0.,) * 4)
# add a new... | rossant/galry | galry/test/plot_ref_test.py | Python | bsd-3-clause | 766 |
# Simple tests for an adder module
import os
import sys
import cocotb
import logging
from cocotb.result import TestFailure
#from cocotb.triggers import ClockCycles
from cocotb.triggers import RisingEdge
from cocotb.triggers import ReadOnly
from cocotb.clock import Clock
import time
from array import array as Array
fro... | CospanDesign/nysa-verilog | verilog/wishbone/master/wb_master_test/cocotb/test_dut.py | Python | mit | 4,684 |
from django.conf.urls.defaults import patterns, url, include
urlpatterns = patterns('',
url(r'static/', include('core.registration.static.urls')),
)
| mozilla/inventory | core/registration/urls.py | Python | bsd-3-clause | 154 |
# pylint: disable=g-bad-file-header
# Copyright 2020 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/... | deepmind/dm_c19_modelling | evaluation/baseline_models_test.py | Python | apache-2.0 | 4,866 |
from ..drivers import stepper
class StepperAxis:
""" Represents an axis controlled by a stepper motor """
def __init__(self, dir_pin, step_pin, enable_pin, max_translation_mm, speed=60,
inc_clockwise=True, rotations_per_mm = (float(8)/256.5)):
self.stepper = stepper.StepperMotor(dir_pin, step_p... | srikary/sous-chef | modules/submodules/stepper_axis.py | Python | gpl-2.0 | 3,308 |
#!/usr/bin/env python
#coding=utf-8
#======================================================================
#Program: Diffusion Weighted MRI Reconstruction
#Module: $RCSfile: ipmi07_exp.py,v $
#Language: Python
#Author: $Author: bjian $
#Date: $Date: 2009/06/21 18:11:17 $
#Version: $Revision: ... | matthew-brett/diffusion_mri | Python/ipmi07_exp.py | Python | mit | 5,329 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='Reconbot',
version='1.0',
license='MIT License',
description='Reconbot for Eve Online',
packages=[
'reconbot',
'reconbot.notifiers',
'reconbot.notificationprinters',
]
)
| flakas/reconbot | setup.py | Python | mit | 288 |
#!/usr/bin/env python
import json
from base_filter import BaseFilter
class FakeTimestampFilter(BaseFilter):
def filter(self, message):
if "fields" in message and "timestamp" in message["fields"]:
message["timestamp"] = message["fields"]["timestamp"]
yield message
| weapp/miner | filters/fake_timestamp_filter.py | Python | mit | 297 |
# Copyright 2018 TWO SIGMA OPEN SOURCE, 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 agre... | twosigma/beaker-notebook | beakerx/beakerx_magics/__init__.py | Python | apache-2.0 | 881 |
from util import create_array
from util import JPEG_NATURAL_ORDER
class Huffman(object):
BITS_DC_LUMINANCE = [0x00, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x00]
BITS_DC_CHROMINANCE = [0x01, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0x00]
BITS_AC_LUMINANCE = [0x10, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5,... | tkadur/PennApps-XV | steg/huffman.py | Python | mit | 6,339 |
"""
Copyright 2017 Mellanox Technologies. All rights reserved.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
yotamg@mellanox.com (Yotam Gigi)
"""
from lnst.Controller.Task import ctl
from lnst.Common.Consts import M... | jiriprochazka/lnst | recipes/switchdev/mr-002-simple_route.py | Python | gpl-2.0 | 2,350 |
from fvh import MyTurtle
import math
def one(starth=0, startpos=(0,0), lm=None, cube=60):
if not lm:
lm=MyTurtle()
lm.ht()
#lm.tracer(False)
lm.pu()
lm.goto(startpos)
lm.seth(starth)
unit=float(cube)/12
lm.pd()
lm.fd(6*unit)
lm.right(90)
lm.fd(unit)
lm.right(90)
... | jeremiahmarks/dangerzone | scripts/python/clock/romans.py | Python | mit | 4,084 |
#!/usr/bin/env python
import os
import sys
import imp
import uuid
import argparse
import subprocess
# ==============================================================================
def _find_files(path, recursive=True):
found_files = []
for root, folders, files in os.walk(path):
for file_name in fi... | aqualid/aqualid | run_ci.py | Python | mit | 9,110 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home),
url(r'^interviewer/$', views.interviewer),
url(r'^candidate/$', views.candidate),
]
| VRSandeep/icrs | website/urls.py | Python | mit | 191 |
# Python module for parsing and generating the Subunit protocol
# (Samba-specific)
# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
#
# 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; ... | sYnfo/samba | selftest/subunithelper.py | Python | gpl-3.0 | 22,606 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | tests/testing/test_embed.py | Python | bsd-3-clause | 3,025 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'chaser.views.home', name='home'),
# url(r'^chaser/', include('chaser.foo.urls')),
# Un... | yaybu/chaser | chaser/urls.py | Python | apache-2.0 | 556 |
# -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from splinter.driver import ElementAPI
from splinter.element_list import ElementList
class FindElementsTest:
def test_finding_by_c... | cobrateam/splinter | tests/find_elements.py | Python | bsd-3-clause | 10,402 |
# -*- coding: utf-8 -*-
# strsync - Automatically translate and synchronize .strings files from defined base language.
# Copyright (c) 2015 metasmile cyrano905@gmail.com (github.com/metasmile)
from __future__ import print_function
import strparser, strparser_intentdefinition, strlocale, strtrans
import time, os, sys, ... | metasmile/strsync | strsync/strsync.py | Python | gpl-3.0 | 26,146 |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | gwq5210/litlib | thirdparty/sources/protobuf/python/mox.py | Python | gpl-3.0 | 38,238 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, 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',
... | kbrebanov/ansible | lib/ansible/modules/network/iosxr/iosxr_logging.py | Python | gpl-3.0 | 10,230 |
import bpy
import mathutils
from .util import *
def ObjectHasMergingGroup(self):
for group in self.users_group:
if group.doMerge:
return group
return None
bpy.types.Object.hasMergingGroup = ObjectHasMergingGroup
def SceneDependencies(self):
dependencies = EmptyDependencies()
for ob in self.obje... | baoboa/Crystal-Space | scripts/blender/io_scene_cs/io/scene.py | Python | lgpl-2.1 | 6,732 |
import datetime
import os
import re
from collections import defaultdict
from json import JSONDecodeError
from json import loads as json_loads
from typing import Any, Callable, Dict, List, Match, Optional, Pattern, Union
from urllib.parse import parse_qsl, urlparse
import jsonschema
from jsonschema import ValidationErr... | Flexget/Flexget | flexget/config_schema.py | Python | mit | 16,053 |
import matplotlib.pyplot as plt
f = lambda y: y * y
sqr = map(f,range(1,21))
plt.plot(range(1,21),sqr)
plt.show()
| dcabalas/UNI | SN/Python/seis.py | Python | gpl-3.0 | 114 |
import json
import logging
from community_csdt.src.models import database
class Page(object):
def __init__(self, parent, name):
self.__parent__ = parent
self.__name__ = name
def __getitem__(self, key):
log = logging.getLogger('csdt')
log.info("Page.__getitem__()")
log.... | electricity345/community.csdt | src/community_csdt/community_csdt/src/models/pages/page.py | Python | mit | 374 |
#!/usr/bin/python
import urllib2
import re
def GetBlog():
mainUrl = 'http://www.zreading.cn/archives/'
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = { 'User-Agent' : user_agent}
for i in range(6,20):
url = mainUrl+ str(i) +'.html'
print 'visiting...' + url
req = urllib2.Request(url... | yingao163/blogCrawler | crawler03.py | Python | gpl-2.0 | 1,189 |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2018 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
#
# Authors: Eben Kenah
# Aric Hagberg (hagberg@lanl.gov)
# Christopher Ellison
"""Connected... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/algorithms/components/connected.py | Python | gpl-3.0 | 4,701 |
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from numpy.testing import assert_raises
from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix,
dok_matrix, lil_matrix)
from scipy.spatial import cKDTree
from sklearn import neighbors,... | ominux/scikit-learn | sklearn/neighbors/tests/test_neighbors.py | Python | bsd-3-clause | 13,497 |
import numpy as np
def extrapolate(xs_name):
"""Extrapolate cross section based on thermal salt expansion feedback.
Extrapolates cross section data at 900 K to 1500 K at 50 K intervals
based on the thermal salt expansion feedback formula from [1]. Writes
the extrapolated data back into the .txt cross... | arfc/moltres | property_file_dir/cnrs-benchmark/feedback.py | Python | lgpl-2.1 | 2,292 |
from __future__ import division
# import sys
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy import create_engine, MetaData, inspect, Table
if __name__ == '__main__':
# if len(sys.argv) != 2:
# print("ERROR: You need to give me a .db file. For example:")
# print("python prin... | Eilon17-meet/Personal-Project-Meet | print_databases.py | Python | mit | 2,109 |
from collections import OrderedDict
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth import get_user_model
from django.core.validators import MinValueValidator
from django.db.models import... | pcolmant/repanier | repanier/admin/group.py | Python | gpl-3.0 | 13,606 |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from datetime import timedelta
import asyncio
from tornado import gen
from tornado import ioloop
from aspectlib import debug
def test_decorate_asyncio_coroutine():
buf = StringIO()
@asyncio.coroutine
@debug.log(print... | svetlyak40wt/python-aspectlib | tests/test_integrations_py3.py | Python | bsd-2-clause | 999 |
# Copyright 2011 The greplin-tornado-kissmetrics 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 ... | Cue/greplin-tornado-kissmetrics | src/greplin/__init__.py | Python | apache-2.0 | 701 |
# Copyright (c) 2014 Yubico AB
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program... | Yubico/yubioath-desktop-dpkg | yubioath/gui/messages.py | Python | gpl-3.0 | 5,776 |
from optparse import make_option
from datetime import datetime
import os
import re
import sys
import socket
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp import run, WSGIServerException, get_internal_wsgi_application
from django.utils import autoreload
naiveip_re ... | adambrenecki/django | django/core/management/commands/runserver.py | Python | bsd-3-clause | 5,656 |
# paintroller.py 12/03/2016 D.J.Whale
from microbit import *
import random
import math
# Game parameters
MAX_GAME_TIME = 60000
# Animations
SPLASH_SCREEN = [ ] #TODO
START_GAME = [ ] #TODO
END_GAME = [ ] #TODO
ROLLER_MOVE = [ ] #TODO
def splash_screen():
button_b.reset_presses()
while not button... | whaleygeek/microbit_python | paintroller/paintroller.py | Python | mit | 2,301 |
from polyphony import testbench
class C:
def __init__(self, x):
self.x = x
def alias01(x):
c0 = C(x)
c1 = c0
c2 = c1
result0 = c2.x == x and c1.x == x and c0.x == x
c2.x = 10
result1 = c2.x == 10 and c1.x == 10 and c0.x == 10
return result0 and result1
@testbench
def test():
... | ktok07b6/polyphony | tests/class/alias01.py | Python | mit | 393 |
import sys
import unittest
import tempfile
from seqmagick.scripts import cli
from seqmagick.test.integration import data_path
class ExtractIdsMixin(object):
expected = """test1
test2
test3
"""
expected_desc = """test1 test sequence 1
test2 test sequence 2
test3 sequence 3
"""
def setUp(self):
s... | fhcrc/seqmagick | seqmagick/test/integration/test_extract_ids.py | Python | gpl-3.0 | 1,213 |
#############################################################################
#############################################################################
import os,xbmc,xbmcgui,xbmcaddon,sys,logging,re,urllib,urllib2,htmllib,xbmcplugin,xbmcvfs,string,StringIO,random,array,time,datetime,mimetypes
try: from addon.co... | HIGHWAY99/plugin.a.web.server | common.py | Python | gpl-2.0 | 20,531 |
# Custom GPAW setup for Sisu (Cray XC40)
import os
# compiler and linker
compiler = './gcc.py'
mpicompiler = './gcc.py'
mpilinker = 'cc'
extra_compile_args = ['-std=c99', '-O3', '-fopenmp-simd']
# libraries
libraries = ['z']
# libxc
library_dirs += [os.environ['LIBXCDIR'] + '/lib']
include_dirs += [os.environ['LIBXC... | mlouhivu/build-recipes | gpaw/setup/customize-sisu.py | Python | mit | 611 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2012 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | parinporecha/backend_gtgonline | GTG/gtk/backends_dialog/addpanel.py | Python | gpl-3.0 | 7,067 |
#!/usr/bin/env python
# vi: sw=4 et
# Copyright 2008 by Kate Scheppke and Wade Brainerd.
# This file is part of Typing Turtle.
#
# Typing Turtle 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... | godiard/typing-turtle-activity | editlessonscreen.py | Python | gpl-3.0 | 23,971 |
# -*- coding: utf-8 -*-
import yaml
import mysql.connector
from mysql.connector import errorcode
with open("config.yaml", 'r') as ymlfile:
cfg = yaml.load(ymlfile)
TABLES = {}
TABLES['ZL_Room'] = (
"CREATE TABLE `ZL_Room` ("
" `ID` SMALLINT NOT NULL,"
" `Description` VARCHAR(2000),"
" `Sta... | AriMartti/ZhaltraucsLair | functions/database.py | Python | mit | 21,065 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/docuploader | docuploader/tar.py | Python | apache-2.0 | 2,102 |
# encoding: utf-8
# module _dbus_bindings
# from /usr/lib/python2.7/dist-packages/_dbus_bindings.so
# by generator 1.135
"""
Low-level Python bindings for libdbus. Don't use this module directly -
the public API is provided by the `dbus`, `dbus.service`, `dbus.mainloop`
and `dbus.mainloop.glib` modules, with a lower-le... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/_dbus_bindings/__init__.py | Python | gpl-2.0 | 6,829 |
import json
import logging
import asyncio
import random
import socket
from hbmqtt.client import MQTTClient, ClientException
from hbmqtt.mqtt.constants import QOS_1
logging.basicConfig(format='%(asctime)s - %(name)14s - '
'%(levelname)5s - %(message)s')
logger = logging.getLogger("mqtt_test_... | pyaiot/pyaiot | utils/mqtt/mqtt-test-node.py | Python | bsd-3-clause | 5,525 |
def parse_to_xml(data):
return str(data)
def oai_factory(info):
def _render(value, system):
request = system.get('request')
if request is not None:
response = request.response
response.charset = 'utf-8'
response.content_type = 'application/xml'
re... | scieloorg/books-oai | booksoai/renderers.py | Python | bsd-2-clause | 364 |
# Test 64-bit COMPARE IMMEDIATE AND BRANCH in cases where the sheer number of
# instructions causes some branches to be out of range.
# RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
# Construct:
#
# before0:
# conditional branch to after0
# ...
# beforeN:
# conditional branch to after0
# main:
# ... | endlessm/chromium-browser | third_party/swiftshader/third_party/llvm-7.0/llvm/test/CodeGen/SystemZ/Large/branch-range-06.py | Python | bsd-3-clause | 3,613 |
import re
uuid_regex = re.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
| alphagov/notify-api | tests/app/main/views/__init__.py | Python | mit | 99 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: zengchunyun
"""
# from salt_mq import MQServer
# import time
#
#
# def run(q, w, e, t):
# global a
# print(t)
# a.channel.close()
# a.close()
#
#
# while True:
# m = MQServer("127.0.0.1", exchange="auth", exchange_type="topic")
# m.publ... | zengchunyun/s12 | day9/temp/p1.py | Python | gpl-2.0 | 1,334 |
# -*- coding: 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):
# Deleting field 'ContentTag.id'
db.delete_column(u'alexander_contenttag', u'id')
# Changing field... | CityOfPhiladelphia/myphillyrising | website/alexander/migrations/0003_auto__del_field_contenttag_id__chg_field_contenttag_label__add_unique_.py | Python | gpl-3.0 | 3,173 |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "pysymemu",
version = "0.0.1-alpha",
author = "Felipe Andres Manzano",
author_email = "feliam@binamuse.com",
description = ("A tool for symbolic execution of... | feliam/pysymemu | setup.py | Python | bsd-3-clause | 1,306 |
from django.contrib import admin
from .models import Concept, ConceptSection
class ConceptSectionInline(admin.StackedInline):
model = ConceptSection
extra = 0
class ConceptAdmin(admin.ModelAdmin):
inlines = [ConceptSectionInline]
admin.site.register(Concept, ConceptAdmin)
| pixyj/feel | django-server/feel/concept/admin.py | Python | mit | 292 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import ast
import inspect
import re
from copy import copy
from sacred.config.config_summary import ConfigSummary
from sacred.config.utils import dogmatize, normalize_or_die, recursive_fill_in
__sacred__ = True
cl... | kudkudak/sacred | sacred/config/config_scope.py | Python | mit | 4,982 |
"""
Common test code for course_experience, like shared base classes.
"""
from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.courseware.courses import get_course_info_usage_key
from xmodule.modulestore import ModuleStoreEn... | eduNEXT/edx-platform | openedx/features/course_experience/tests/__init__.py | Python | agpl-3.0 | 4,886 |
# 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 model 'Role'
db.create_table('serie_role', (
('id', self.gf('django.db.models.fields.... | alabs/petateca | petateca/apps/serie/migrations/0005_auto__add_role__add_field_serie_rating__add_field_serie_rating_count__.py | Python | agpl-3.0 | 10,398 |
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from bedrock.pocketfeed.models import PocketArticle
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('-q', '--quiet', action='store_true', dest='quiet', default=False,
... | ericawright/bedrock | bedrock/pocketfeed/management/commands/update_pocketfeed.py | Python | mpl-2.0 | 1,108 |
import numpy as np
import pandas
import scipy, scipy.spatial
import sklearn
import sys
from sklearn import linear_model
from sklearn.metrics import precision_score, recall_score, f1_score
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('train', help='Training Data')
p... | mirjalil/ml-visual-recognition | codes/logisticRegression.py | Python | apache-2.0 | 3,262 |
from django.test import TestCase
from ddt import ddt, data
from btcrpc.utils import btc_rpc_call
from btcrpc.utils.config_file_reader import ConfigFileReader
from btcrpc.utils.timeUtil import TimeUtils
from btcrpc.utils.log import *
from btcrpc.vo.check_multi_receives import *
log = get_log("test_address_receive")
y... | BTCX/BTCX_blockchain | btcxblockchainapi/btcrpc/test/test_address_receive.py | Python | mit | 6,461 |
# -*- coding: utf-8 -*-
"""
Create course and answer a problem to test raw grade CSV
"""
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from courseware.tests.test_submitting_problems import TestSubmittingProblems
from student.roles import ... | tiagochiavericosta/edx-platform | lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py | Python | agpl-3.0 | 2,477 |
import femagtools.femag
def test_run_script(monkeypatch, tmpdir):
def mock_run(*args, **kwargs):
return
monkeypatch.setattr(femagtools.femag.Femag, "run", mock_run)
femag = femagtools.femag.Femag(str(tmpdir))
r = femag(dict(), dict())
assert r['status'] == 'ok'
assert tmpdir.join("fema... | SEMAFORInformatik/femagtools | tests/test_femag.py | Python | bsd-2-clause | 340 |
# coding: utf-8
import sys
import django
import mock
from publisher.models import PublisherStateModel
from publisher_test_project.publisher_test_app.models import PublisherTestModel
from publisher_tests.base import ClientBaseTestCase
class AdminLoggedinTests(ClientBaseTestCase):
"""
Some basics test with... | wearehoods/django-model-publisher-ai | publisher_tests/test_publisher_admin.py | Python | bsd-3-clause | 3,410 |
#!/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.
import unittest
from app_yaml_helper import AppYamlHelper
from file_system import FileNotFoundError
from host_file_system_creator impo... | GeyerA/android_external_chromium_org | chrome/common/extensions/docs/server2/app_yaml_helper_test.py | Python | bsd-3-clause | 5,945 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.