text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Simple implementation of a json test runner to run the test against json-py.
import sys
import os.path
import json
import types
if len(sys.argv) != 2:
print "Usage: %s input-json-file", sys.argv[0]
sys.exit(3)
input_path = sys.argv[1]
base_path = os.path.splitext(input_path)[0]
actual_path... | EijiSugiura/sstoraged | src/json/unittest/jsontestrunner.py | Python | gpl-2.0 | 2,199 | 0.032287 |
"""Utilities to help Computing Element Queues manipulation
"""
from __future__ import absolute_import
from __future__ import division
import six
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Utilities.List import fromChar
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
from DIRAC.ConfigurationSystem.C... | fstagni/DIRAC | WorkloadManagementSystem/Utilities/QueueUtilities.py | Python | gpl-3.0 | 8,673 | 0.01153 |
# -*- coding: utf-8 -*-
"""
Pygments
~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter for general use in all kinds of software
such as forum systems, wikis or other applications that need to prettify
source code. Highlights are:
* a ... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygments/__init__.py | Python | gpl-2.0 | 2,974 | 0.000336 |
import shelve
shelve_name = "data"
def savePref(user, key, value):
d = shelve.open(shelve_name)
d[str(user) + '.' + str(key)] = value
d.close()
def openPref(user, key, default):
d = shelve.open(shelve_name)
if (str(user) + '.' + str(key)) in d:
return d[str(user) + '.' + str(key)]
e... | bronydell/VK-GFC-bot | saver.py | Python | mit | 348 | 0 |
#!/usr/bin/python
''' this file contains functions for experimenting with the different players and for running many trials and averaging results '''
from Player import RandomPlayer
from MCPlayer import MCPlayer, PNGSPlayer, GreedyPlayer
import Board
import sys, traceback
import time
def runRandomPlayerFirstSol(file... | ajstarna/RicochetRobots | Brobot/experimentsFirstSolution.py | Python | bsd-2-clause | 6,257 | 0.032603 |
#!/usr/bin/python
# Copyright 2014 Justin Cano
#
# This is a simple Python program of the game Blackjack
# (http://en.wikipedia.org/wiki/Blackjack), developed for
# a coding challenge from the 2014 Insight Data Engineering
# Fellows Program application.
#
# Licensed under the GNU General Public License, version 2.0
# ... | bumrush/blackjack | blackjack.py | Python | gpl-2.0 | 8,652 | 0.035483 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Serpent Consulting Services Pvt. Ltd. (<http://www.serpentcs.com>)
# Copyright (C) 2016 FairCoop (<http://fair.coop>)
#
# This program is f... | Punto0/addons-fm | website_product_brand/__openerp__.py | Python | agpl-3.0 | 1,807 | 0.003874 |
(S'9d1d8dee18e2f5e4bae7551057c6c474'
p1
(ihappydoclib.parseinfo.moduleinfo
ModuleInfo
p2
(dp3
S'_namespaces'
p4
((dp5
(dp6
tp7
sS'_import_info'
p8
(ihappydoclib.parseinfo.imports
ImportInfo
p9
(dp10
S'_named_imports'
p11
(dp12
sS'_straight_imports'
p13
(lp14
sbsS'_filename'
p15
S'Gnuplot/setup.py'
p16
sS'_docstring'
p1... | mads-bertelsen/McCode | meta-pkgs/windows/Support/gnuplot-py-1.8/.happydoc.setup.py | Python | gpl-2.0 | 645 | 0.103876 |
#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: magic
"""
from django.contrib import admin
from blog.models import User
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext, ugettext_lazy as _
class BlogUserAdmin(UserAdmin):
filesets = (
(None, {'fields': ... | csunny/blog_project | source/apps/blog/admin/user.py | Python | mit | 863 | 0.002317 |
import csv
from datetime import datetime
from matplotlib import pyplot as plt
# Get dates, high, and low temperatures from file.
filename = 'sitka_weather_2017.csv'
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
dates, highs, lows = [], [], []
for row in reader:
cu... | helanan/Panda_Prospecting | panda_prospecting/prospecting/insights/high_lows.py | Python | mit | 966 | 0 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/callback/full_skip.py | Python | bsd-3-clause | 2,289 | 0.001747 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, Centre National de la Recherche Scientifique (CNRS)
#
# Licensed under the Apache License, Vers... | StratusLab/client | cli/user/code/main/python/stratuslab/cmd/stratus_detach_volume.py | Python | apache-2.0 | 3,765 | 0.003187 |
# Copyright (c) 2019 PaddlePaddle 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 appli... | luotao1/Paddle | python/paddle/fluid/contrib/layers/metric_op.py | Python | apache-2.0 | 7,067 | 0.000849 |
# coding=utf-8
import operator
import json
import falcon
import peewee
import dateutil
from models import models_api
from utils.myjson import JSONEncoderPlus
from utils.mypeewee import ts_match
class ProveedorId(object):
"""Endpoint para un proveedor en particular, identificado por ID"""
@models_api.databa... | ComprasTransparentes/api | endpoints/proveedor.py | Python | gpl-3.0 | 22,914 | 0.00358 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 CERN.
##
## Invenio 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 ... | fjorba/invenio | modules/websearch/lib/websearch_templates.py | Python | gpl-2.0 | 196,591 | 0.005458 |
from django import forms
class SelectModelForm(forms.Form):
app_label = forms.CharField(
label="App label",
required=True)
model_name = forms.CharField(
label="Model name",
required=True)
| botswana-harvard/edc-describe | edc_describe/forms/select_model_form.py | Python | gpl-2.0 | 232 | 0 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# daemon/daemon.py
# Part of python-daemon, an implementation of PEP 3143.
#
# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2004–2005 Chad J. Schroeder
# Copyright © 2003... | candlepin/virt-who | virtwho/daemon/daemon.py | Python | gpl-2.0 | 25,080 | 0 |
import base64
import itertools
import json
import logging
import os
import re
import time
from .buckets import get_bucket_client
from .params import get_param_client
from .secrets import get_secret_client
logger = logging.getLogger("zentral.conf.config")
class Proxy:
pass
class EnvProxy(Proxy):
def __init... | zentralopensource/zentral | zentral/conf/config.py | Python | apache-2.0 | 9,328 | 0.000858 |
#! /use/bin/env python
# -*- coding: utf-8 -*-
'''/* generateSintagmaProblem_6WP.py
*
* Copyright (C) 2016 Gian Paolo Ciceri
*
* 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... | gpciceri/milagathos | SixWeeksPreparationForReadingCaesar/pgm/generateSintagmaProblem_6WP.py | Python | lgpl-3.0 | 3,153 | 0.024738 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/bandwidth/auto_bandwidth/underflow/state/__init__.py | Python | apache-2.0 | 29,125 | 0.001373 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^robots.txt', 'django.views.generic.simple.direct_to_template', {'template': 'robots.txt'}),
)
| h3/django-webcore | webcore/urls/robots.py | Python | bsd-3-clause | 172 | 0.011628 |
# -*- coding: utf-8 -*-
import hashlib
import binascii
from thrift.transport.THttpClient import THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from evernote.edam.userstore import UserStore
from evernote.edam.notestore import NoteStore
import evernote.edam.type.ttypes as Types
import evernote.... | shurain/archiver | archiver/sink.py | Python | mit | 4,439 | 0.003379 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from fabric.api import reboot, sudo, settings
logging.basicConfig(level=logging.INFO)
def ssserver(port, password, method):
try:
sudo('hash yum')
sudo('hash python')
sudo('yum -y update 1>/dev/null')
sudo('yum -y insta... | yingxuanxuan/fabric_script | shadowsocks.py | Python | apache-2.0 | 2,157 | 0.001391 |
"""
Compute a harmonic 1-cochain basis for a square with 4 holes.
"""
from numpy import asarray, eye, outer, inner, dot, vstack
from numpy.random import seed, rand
from numpy.linalg import norm
from scipy.sparse.linalg import cg
from pydec import d, delta, simplicial_complex, read_mesh
def hodge_decomposition(omega):... | pkuwwt/pydec | Examples/HodgeDecomposition/driver.py | Python | bsd-3-clause | 2,724 | 0.020558 |
# pylint:disable=line-too-long
import logging
from ...sim_type import SimTypeFunction, SimTypeShort, SimTypeInt, SimTypeLong, SimTypeLongLong, SimTypeDouble, SimTypeFloat, SimTypePointer, SimTypeChar, SimStruct, SimTypeFixedSizeArray, SimTypeBottom, SimUnion, SimTypeBool
from ...calling... | angr/angr | angr/procedures/definitions/win32_aclui.py | Python | bsd-2-clause | 1,451 | 0.004824 |
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/configuration/tests/test_conditions.py | Python | gpl-3.0 | 3,562 | 0.000842 |
from django.core.exceptions import ValidationError
from amweekly.slack.tests.factories import SlashCommandFactory
import pytest
pytest.mark.unit
def test_slash_command_raises_with_invalid_token(settings):
settings.SLACK_TOKENS = ''
with pytest.raises(ValidationError):
SlashCommandFactory()
| akrawchyk/amweekly | amweekly/slack/tests/test_models.py | Python | mit | 313 | 0 |
from mitxmako.shortcuts import render_to_response
from django.http import HttpResponse
from .models import poll_store
from datetime import datetime
from django.utils import timezone
import json
import urllib2
from math import floor
def poll_form_view(request, poll_type=None):
if poll_type:
return render_t... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/polls/views.py | Python | agpl-3.0 | 3,557 | 0.001125 |
from __future__ import absolute_import
import six
import copy
from six.moves import zip
from . import backend as K
from .utils.generic_utils import serialize_keras_object
from .utils.generic_utils import deserialize_keras_object
if K.backend() == 'tensorflow':
import tensorflow as tf
def clip_norm(g, c, n):
... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/keras/optimizers.py | Python | mit | 25,887 | 0.000579 |
#!/usr/bin/python
from pyb import I2C
import time
# ===========================================================================
# BMP085 Class
# Based mostly on Adafruit_BMP085.py
# For use with a Micro Python pyboard http://micropython.org
# and a BMP180 Barometric Pressure/Temperature/Altitude Sensor
# tested with ... | BobStevens/micropython | BMP085/BMP085.py | Python | mit | 8,779 | 0.015947 |
import math
import re
from collections import defaultdict
def matches(t1, t2):
t1r = "".join([t[-1] for t in t1])
t2r = "".join([t[-1] for t in t2])
t1l = "".join([t[0] for t in t1])
t2l = "".join([t[0] for t in t2])
t1_edges = [t1[0], t1[-1], t1r, t1l]
t2_edges = [t2[0], t2[-1], t2[0][::-1],... | BrendanLeber/adventofcode | 2020/20-jurassic_jigsaw/code.py | Python | mit | 5,544 | 0.002345 |
import subprocess
import os
pathToGrabber = os.path.abspath("grab.mk")
def getVariable(var):
proc = subprocess.Popen(["make", "--silent", "-f", pathToGrabber, "GETVAR", "VARNAME=%s" % var], stdout = subprocess.PIPE)
return proc.communicate()[0].strip()
def getVariableList(var):
return [item.strip() for item in getVa... | rpavlik/chromium | grabcmake.py | Python | bsd-3-clause | 3,469 | 0.025368 |
#coding=utf-8
import sys
import pygame
from bullet import Bullet
from alien import Alien
from time import sleep
def check_key_down_events(event,ai_settings, screen, stats, play_button, ship,
aliens, bullets):
"""响应按键"""
if event.key == pygame.K_RIGHT:
#向右移动飞船
ship.movin... | kexiaojiu/alien_invasion | game_functions.py | Python | gpl-3.0 | 11,663 | 0.009822 |
# -*- coding: utf-8 -*-
# Release information about mse
version = '1.0'
# description = "Your plan to rule the world"
# long_description = "More description about your plan"
# author = "Your Name Here"
# email = "YourEmail@YourDomain"
# copyright = "Copyright 2011 - the year of the Rabbit"
# Of it's open source, you... | jinmingda/MicroorganismSearchEngine | mse/release.py | Python | mit | 449 | 0 |
#!/usr/bin/env python
"""
Unit tests for the assets module
"""
# TODO: Write actual tests.
import unittest
import assets
class TestAssets(unittest.TestCase):
def setUp(self):
pass
def test_getImage(self):
pass
| ArmchairArmada/COS125Project01 | src/tests/test_assets.py | Python | mit | 239 | 0.004184 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Project',
'version': '1.1',
'website': 'https://www.odoo.com/page/project-management',
'category': 'Operations/Project',
'sequence': 10,
'summary': 'Organize and schedule your projects ... | t3dev/odoo | addons/project/__manifest__.py | Python | gpl-3.0 | 1,315 | 0 |
from yade import export,polyhedra_utils
mat = PolyhedraMat()
O.bodies.append([
sphere((0,0,0),1),
sphere((0,3,0),1),
sphere((0,2,4),2),
sphere((0,5,2),1.5),
facet([Vector3(0,-3,-1),Vector3(0,-2,5),Vector3(5,4,0)]),
facet([Vector3(0,-3,-1),Vector3(0,-2,5),Vector3(-5,4,0)]),
polyhedra_utils.polyhedra(mat,(1,2,3),... | ThomasSweijen/yadesolute2 | examples/test/vtk-exporter/vtkExporter.py | Python | gpl-2.0 | 976 | 0.067623 |
#!/usr/bin/env python3
inputFilename='../3-db.out/db.sql'
outputDirectory='../4-xls.out'
import os
if not os.path.exists(outputDirectory):
os.makedirs(outputDirectory)
from decimal import Decimal
import collections
import copy
import sqlite3
import xlwt3 as xlwt
import xlsxwriter
class LevelTable:
def __init__(se... | AntonKhorev/spb-budget-db | 4-xls/main.py | Python | bsd-2-clause | 21,223 | 0.05248 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" This custom XRCED launcher allows a small wx function to be wrapped
so it provides a little extra needed functionality.
XRC sometimes need to check if a node contains a filename. It does so by
checking node types. This works fine, until we start working with custom
co... | ktsitsikas/odemis | util/launch_xrced.py | Python | gpl-2.0 | 1,995 | 0.002506 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Some multiclient flows aka hunts."""
import re
import stat
import logging
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import cron
from grr.lib import data_store
from grr.lib import flow
from grr.lib import rdfv... | MiniSEC/GRR_clone | lib/hunts/standard.py | Python | apache-2.0 | 36,298 | 0.00697 |
# Copyright 2017-2019 Tom Eulenfeld, MIT license
"""Stack correlations"""
import numpy as np
import obspy
from obspy import UTCDateTime as UTC
from yam.util import _corr_id, _time2sec, IterTime
def stack(stream, length=None, move=None):
"""
Stack traces in stream by correlation id
:param stream: |Stream... | trichter/yam | yam/stack.py | Python | mit | 3,034 | 0 |
# -*- coding: UTF-8 -*-
# Copyright 2011-2015 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""
The :xfile:`models.py` module for :ref:`cosi`.
This is empty.
"""
| lsaffre/lino-cosi | lino_cosi/lib/cosi/models.py | Python | agpl-3.0 | 213 | 0.004695 |
"""Color palettes in addition to matplotlib's palettes."""
from typing import Mapping, Sequence
from matplotlib import cm, colors
# Colorblindness adjusted vega_10
# See https://github.com/theislab/scanpy/issues/387
vega_10 = list(map(colors.to_hex, cm.tab10.colors))
vega_10_scanpy = vega_10.copy()
vega_10_scanpy[2] ... | theislab/scanpy | scanpy/plotting/palettes.py | Python | bsd-3-clause | 4,616 | 0.000867 |
# -*- coding:utf-8 -*-
'''
Test
'''
import sys
sys.path.append('.')
from tornado.testing import AsyncHTTPSTestCase
from application import APP
class TestSomeHandler(AsyncHTTPSTestCase):
'''
Test
'''
def get_app(self):
'''
Test
'''
return APP
def test_index(sel... | bukun/TorCMS | tester/test_handlers/test_index_handler.py | Python | mit | 448 | 0.004464 |
#-------------------------------------------------------------------------------
#
# This file is part of pygimplib.
#
# Copyright (C) 2014, 2015 khalim19 <khalim19@gmail.com>
#
# pygimplib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | Buggaboo/gimp-plugin-export-layers | export_layers/pygimplib/objectfilter.py | Python | gpl-3.0 | 11,296 | 0.015935 |
from orotangi.models import Books, Notes
from rest_framework import serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = '__all__'
class BookSerializer(serializers.ModelSerializer):
class Meta:
... | foxmask/orotangi | orotangi/api/serializers.py | Python | bsd-3-clause | 597 | 0 |
#!/usr/bin/env python
"""
m2g.utils.qa_utils
~~~~~~~~~~~~~~~~~~~~
Contains small-scale qa utilities
"""
import numpy as np
def get_min_max(data, minthr=2, maxthr=95):
"""
A function to find min,max values at designated percentile thresholds
Parameters
-----------
data: np array
3-d regmri... | neurodata/ndmg | m2g/utils/qa_utils.py | Python | apache-2.0 | 2,414 | 0.010356 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | tantexian/sps-2014-12-4 | sps/openstack/common/db/sqlalchemy/session.py | Python | apache-2.0 | 35,114 | 0 |
"""
==============================
Generate simulated evoked data
==============================
"""
# Author: Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from... | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/examples/simulation/plot_simulate_evoked_data.py | Python | bsd-3-clause | 2,787 | 0.000359 |
import datetime
import arrow
def arrow_datetime(value, name):
try:
value = arrow.get(value).datetime
except Exception as e:
raise ValueError(e)
return value
class BaseFilter(object):
# TODO: Move this class to be part of API FiltrableResource
# Leaving implementation to be... | sebastiandev/biyuya | biyuya/models/filters.py | Python | mit | 2,106 | 0.00095 |
#!/usr/bin/python
import sys
import re
import string
import httplib
import urllib2
import re
def StripTags(text):
finished = 0
while not finished:
finished = 1
start = text.find("<")
if start >= 0:
stop = text[start:].find(">")
if stop >= 0:
text ... | knightmare2600/d4rkc0de | others/goog-mail.py | Python | gpl-2.0 | 2,312 | 0.014273 |
from django.test import TestCase, tag
from member.tests.test_mixins import MemberMixin
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from django.urls.base import reverse
from enumeration.views import DashboardView, ListBoardView
class TestEnumeration(MemberMixin, TestCas... | botswana-harvard/bcpp | bcpp/tests/test_views/test_enumeration.py | Python | gpl-3.0 | 3,020 | 0.001987 |
"""
arc - dead simple chat
Copyright (C) 2017 Jewel Mahanta <jewelmahanta@gmail.com>
This file is part of arc.
arc 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 opt... | lap00zza/arc | api_server/arc_api/snowflake.py | Python | gpl-3.0 | 2,140 | 0.000935 |
import json
data = '''{
"name" : "Chuck",
"phone": {
"type" : "int1",
"number" : "+1 734 303 4456"
},
"email": {
"hide" : "yes"
}
}'''
info = json.loads(data)
print('Name:',info["name"])
print('Hide:',info["email"]["hide"])
| crookedreyes/py4e-specialization | course-3/chapter-13/json1.py | Python | lgpl-2.1 | 269 | 0.007435 |
# This file is part of beets.
# Copyright 2014, Adrian Sampson.
#
# 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, ... | DxCx/nzbToMedia | libs/beets/mediafile.py | Python | gpl-3.0 | 56,908 | 0.000914 |
"""
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 use this ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-START/scripts/params.py | Python | apache-2.0 | 9,467 | 0.007711 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Smile (<http://www.smile.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... | tiexinliu/odoo_addons | smile_log/tools/db_logger.py | Python | agpl-3.0 | 2,985 | 0.00067 |
import datetime
from django.contrib.auth.models import User
from django.core.management import call_command
from django.utils import timezone
from io import StringIO
from oppia.models import Tracker
from oppia.test import OppiaTestCase
class DataRetentionTest(OppiaTestCase):
fixtures = ['tests/test_user.json'... | DigitalCampus/django-oppia | tests/oppia/management/test_data_retention.py | Python | gpl-3.0 | 2,111 | 0 |
# Alien Blaster
# Demonstrates object interaction
class Player(object):
""" A player in a shooter game. """
def blast(self, enemy):
print("The player blasts an enemy.\n")
enemy.die()
class Alien(object):
""" An alien in a shooter game. """
def die(self):
print("The alien gasps ... | bohdan-shramko/learning-python | source/chapter09/alien_blaster.py | Python | mit | 656 | 0.009146 |
from django import forms
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from guardian.admin import GuardedModelAdmin
from uploader.projects.models import FileSystem, Project
class FileSystemAdminForm(forms.ModelForm):
class Meta:
model = FileSystem
class ProjectAdmin(Guarde... | stfc/cvmfs-stratum-uploader | uploader/projects/admin.py | Python | apache-2.0 | 642 | 0 |
"""Tests for distutils.command.build_scripts."""
import os
import unittest
from distutils.command.build_scripts import build_scripts
from distutils.core import Distribution
import sysconfig
from distutils.tests import support
from test.test_support import run_unittest
class BuildScriptsTestCase(suppor... | ktan2020/legacy-automation | win/Lib/distutils/tests/test_build_scripts.py | Python | mit | 3,712 | 0.000808 |
def kth_smallest(arr, k):
n = len(arr)
a = 0
b = n
while a < b:
piv = a
for i in range(a, b):
if arr[piv] > arr[i]:
arr[i], arr[piv] = arr[piv], arr[i]
piv = i
if piv == k:
return arr[piv]
elif piv < k:
a... | stevetjoa/algorithms | kth_smallest_loop.py | Python | mit | 470 | 0.002128 |
#!/usr/bin/python
import json
class Client():
def __init__(self, clientHostName, clientPort, channel):
self.clientHostName = clientHostName
self.clientPort = clientPort
self.clientType = self.getClientType()
self.channel = channel
# TO DO implement this method properly
def... | lyubomir1993/AlohaServer | Client.py | Python | apache-2.0 | 616 | 0.008117 |
from __future__ import unicode_literals
from django.contrib.auth.forms import AuthenticationForm
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, HTML, Field
from authtools import forms as authtoolsforms
from django.contrib.auth import forms as authform... | arocks/edge | src/accounts/forms.py | Python | mit | 3,105 | 0.000966 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blocks', '0004_auto_20160305_2025'),
]
operations = [
migrations.AddField(
model_name='blockmodel',
... | effa/flocs | blocks/migrations/0005_blockmodel_difficulty.py | Python | gpl-2.0 | 475 | 0.002105 |
# Copyright (c) 2017, Lenovo. 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 ... | lenovo-network/networking-lenovo | networking_lenovo/db/migration/alembic_migrations/__init__.py | Python | apache-2.0 | 639 | 0 |
az.plot_kde(mu_posterior, cumulative=True)
| mcmcplotlib/mcmcplotlib | api/generated/arviz-plot_kde-7.py | Python | apache-2.0 | 43 | 0 |
import pandas as pd
import numpy as np
import cobra
from pyefm.ElementaryFluxModes import EFMToolWrapper
from tqdm import tqdm
class EFVWrapper(EFMToolWrapper):
def create_matrices(self, extra_g=None, extra_h=None):
""" Initialize the augmented stoichiometric matrix.
extra_g: (n x nr) array
... | pstjohn/pyefm | pyefm/ElementaryFluxVectors.py | Python | bsd-2-clause | 5,857 | 0.002733 |
# coding=utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import re
from io import StringIO
from .strings import escape
EMBEDDED_NEWLINE_MATCHER = re.compile(r'[^\n]\n+[^\n]')
class PoFile(object):
def __init__(self):
self.header... | kmichel/po-localization | po_localization/po_file.py | Python | mit | 6,436 | 0.001709 |
# pylint: disable=W0611
'''
Kivy Base
=========
This module contains the Kivy core functionality and is not intended for end
users. Feel free to look through it, but bare in mind that calling any of
these methods directly may result in an unpredictable behavior as the calls
access directly the event loop of an applica... | inclement/kivy | kivy/base.py | Python | mit | 19,012 | 0 |
import wx
import listControl as lc
import getPlugins as gpi
from decimal import Decimal
import os
class Plugin():
def OnSize(self):
# Respond to size change
self.bPSize = self.bigPanel.GetSize()
self.list.SetSize((self.bPSize[0] - 118, self.bPSize[1] - 40))
self.ButtonShow(False)
... | fxb22/BioGUI | plugins/Views/BLASTView.py | Python | gpl-2.0 | 5,154 | 0.005627 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/xcb-util-wm/package.py | Python | lgpl-2.1 | 1,996 | 0.000501 |
#!/usr/bin/env python
import sys
import optparse
import socket
def main():
p = optparse.OptionParser()
p.add_option("--port", "-p", default=8888)
p.add_option("--input", "-i", default="test.txt")
options, arguments = p.parse_args()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.... | johnbellone/gtkworkbook | etc/socketTest.py | Python | gpl-2.0 | 626 | 0.01278 |
"""
This file is part of the splonebox python client library.
The splonebox python client 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 3 of the License or any later version.
It i... | splone/splonebox-client | test/functional/test_complete_call.py | Python | lgpl-3.0 | 4,205 | 0 |
# -*- coding: utf-8 -*-
"""
github-indicator options
Author: Gabriel Patiño <gepatino@gmail.com>
License: Do whatever you want
"""
import optparse
import os
import xdg.BaseDirectory
from ghindicator import language
__version__ = (0, 0, 4)
# Hack to fix a missing function in my version of xdg
if not hasattr(xdg.Ba... | gepatino/github-indicator | ghindicator/options.py | Python | gpl-3.0 | 1,950 | 0.001539 |
# Test for behaviour of combined standard and extended block device
try:
import uos
uos.VfsFat
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class RAMBlockDevice:
ERASE_BLOCK_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * s... | trezor/micropython | tests/extmod/vfs_blockdev.py | Python | mit | 1,588 | 0.003778 |
#!/usr/bin/env python
'''
Solves Constrainted Toy Problem Storing Optimization History.
min x1^2 + x2^2
s.t.: 3 - x1 <= 0
2 - x2 <= 0
-10 <= x1 <= 10
-10 <= x2 <= 10
'''
# =============================================================================
# Standard Python modules
# ===========================... | hschilling/pyOpt | examples/history.py | Python | gpl-3.0 | 1,731 | 0.023108 |
# Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | stackforge/ec2-api | ec2api/cmd/api_metadata.py | Python | apache-2.0 | 1,007 | 0 |
##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/m/metavelvet.py | Python | gpl-2.0 | 2,000 | 0.0025 |
#!/usr/bin/python3
# This script will compare the versions of ebuilds in the funtoo portage tree against
# the versions of ebuilds in the target portage tree. Any higher versions in the
# target Portage tree will be printed to stdout.
import portage.versions
import os,sys
import subprocess
import json
from merge_ut... | Tassie-Tux/funtoo-overlay | funtoo/scripts/gentoo-compare-json.py | Python | gpl-2.0 | 4,518 | 0.035414 |
# -*- coding: utf-8 -*-
#
# ribolands documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 18 15:59:48 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | bad-ants-fleet/ribolands | docs/conf.py | Python | mit | 8,549 | 0.005966 |
# adapters/tensorflow module initialization goes here...
| jensenbox/singnet | agent/adapters/tensorflow/__init__.py | Python | mit | 57 | 0 |
default_app_config = 'wiki.plugins.links.apps.LinksConfig'
| floemker/django-wiki | src/wiki/plugins/links/__init__.py | Python | gpl-3.0 | 59 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Sketches/MPS/Old/SoC/simplecube.py | Python | apache-2.0 | 4,689 | 0.025592 |
import codecs
import os
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
VERSION = (0, 3, 9)
version = '.'.join(map(str, VERSION))
setup(
name='python-qu... | emburse/python-quickbooks | setup.py | Python | mit | 1,374 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-11 07:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0032_history_json_args'),
]
operations = [
migrations.AddField(
... | vstconsulting/polemarch | polemarch/main/migrations/0033_auto_20171211_0732.py | Python | agpl-3.0 | 628 | 0 |
# Import the old tracking id from the RCM file for period 19660101-19701231,
# as it is the first used file to create historical indices:
# (e.g. tasmin_EUR-44_IPSL-IPSL-CM5A-MR_historical_r1i1p1_SMHI-RCA4_v1_day_19660101-19701231.nc)
#track_GCM_indice=$(
import netCDF4
from netCDF4 import Dataset
import ctypes
imp... | igryski/Indices_icclim_ClipC | src/PRECIP/get_put_invar_tracking_id_python_PRECIP.py | Python | gpl-3.0 | 11,422 | 0.036508 |
# Класс-помощник для работы с сессией
class SessionHelper:
def __init__(self, app):
self.app = app
# Функция входа на сайт
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name... | kochetov-a/python_training | fixture/session.py | Python | apache-2.0 | 2,654 | 0.001881 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/eager/lift_to_graph_test.py | Python | apache-2.0 | 3,531 | 0.004815 |
from django.conf.urls.defaults import *
from indivo.views import *
from indivo.lib.utils import MethodDispatcher
urlpatterns = patterns('',
(r'^$', MethodDispatcher({
'DELETE' : carenet_delete})),
(r'^/rename$', MethodDispatcher({
'POST' : carenet_rename})),
(r'^/record$', ... | sayan801/indivo_server | indivo/urls/carenet.py | Python | gpl-3.0 | 1,997 | 0.022534 |
# This is just a simple example of how to inspect ASTs visually.
#
# This can be useful for developing new operators, etc.
import ast
from cosmic_ray.mutating import MutatingCore
from cosmic_ray.operators.comparison_operator_replacement import MutateComparisonOperator
code = "((x is not y) ^ (x is y))"
node = ast.par... | sixty-north/cosmic-ray | tools/inspector.py | Python | mit | 491 | 0.002037 |
N, K = map(int, input().split())
R = sorted(map(int, input().split()))
ans = 0
for r in R[len(R)-K:]:
ans = (ans + r) / 2
print(ans)
| knuu/competitive-programming | atcoder/abc/abc003_c.py | Python | mit | 137 | 0 |
#!/usr/bin/env python3
import re
text = 'This is some text -- with punctuation.'
pattern = 'is'
print('Text :', text)
print('Pattern:', pattern)
m = re.match(pattern, text)
print('Match :', m)
s = re.search(pattern, text)
print('Search :', s)
pattern = re.compile(r'\b\w*is\w*\b')
print('Text:', text)
pos = 0
w... | eroicaleo/ThePythonStandardLibraryByExample | ch01Text/1.3re/ConstrainSearch.py | Python | mit | 508 | 0 |
#!/usr/bin/python
import sys
import os
import re
sys.path.append('/home/al/sites')
os.environ['DJANGO_SETTINGS_MODULE'] = '__main__'
DEFAULT_CHARSET = "utf-8"
TEMPLATE_DEBUG = False
LANGUAGE_CODE = "en"
INSTALLED_APPS = (
'django.contrib.markup',
)
TEMPLATE_DIRS = (
'/home/al/sites/liquidx/templates',
... | imownbey/dygraphs | plotkit_v091/doc/generate.py | Python | mit | 867 | 0.00692 |
import json
from collections import OrderedDict
from inspect import signature
from warnings import warn
import numpy as np
from sklearn.base import BaseEstimator
class Configuration(object):
def __init__(self, name, version, params):
if not isinstance(name, str):
raise ValueError()
if... | allenai/document-qa | docqa/configurable.py | Python | apache-2.0 | 6,024 | 0.001992 |
"""
Send and receive pre-defined messages through the Bohrium component stack
=========================================================================
"""
from ._bh_api import message as msg
def statistic_enable_and_reset():
"""Reset and enable the Bohrium statistic"""
return msg("statistic_enable_and_reset... | madsbk/bohrium | bridge/py_api/bohrium_api/messaging.py | Python | apache-2.0 | 934 | 0.001071 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# SoundConverter - GNOME application for converting between audio formats.
# Copyright 2004 Lars Wirzenius
# Copyright 2005-2020 Gautier Portet
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | kassoulet/soundconverter | setup.py | Python | gpl-3.0 | 2,521 | 0.000793 |
"""The tests for the GeoNet NZ Quakes Feed integration."""
import datetime
from unittest.mock import patch
from homeassistant.components import geonetnz_quakes
from homeassistant.components.geonetnz_quakes import DEFAULT_SCAN_INTERVAL
from homeassistant.components.geonetnz_quakes.sensor import (
ATTR_CREATED,
... | sander76/home-assistant | tests/components/geonetnz_quakes/test_sensor.py | Python | apache-2.0 | 4,517 | 0.001328 |
import pyfits
from numpy import *
if __name__ == '__main__':
W,H = 10,10
sigma = 1.
X,Y = meshgrid(range(W), range(H))
img = 50 + 200 * exp(-0.5 * ((X - W/2)**2 + (Y - H/2)**2)/(sigma**2))
pyfits.writeto('tstimg.fits', img, clobber=True)
| blackball/an-test6 | util/tstimg.py | Python | gpl-2.0 | 249 | 0.052209 |
# Copyright 2015 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 agreed ... | googledatalab/pydatalab | datalab/bigquery/commands/_bigquery.py | Python | apache-2.0 | 43,171 | 0.012161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.