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 |
|---|---|---|---|---|---|---|
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
distribution = ClaytonCopula(1.5)
size = 1000
sample = distribution.getSample(size)
factory = ClaytonCopulaFactory()
estimatedDistribution = factory.build(sample)
print "distribution=", repr(distribu... | sofianehaddad/ot-svn | python/test/t_ClaytonCopulaFactory_std.py | Python | mit | 1,214 | 0.000824 |
# -*- coding: utf-8 -*-
#
# Copyright 2011, Alexandre Strzelewicz
# Licensed under the MIT Version
#
#########################################################
#
# Widget generic controller
#
#########################################################
xss = local_import('xss')
def can_modify():
if session.can_mo... | Unitech/Skytoop | controllers/widget.py | Python | mit | 3,369 | 0.006827 |
"""
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's complement method is used.
Note:
All letters in hexadecimal (a-f) must be in lowercase.
The hexadecimal string must not contain extra leading 0s.
If the number is zero, it is represented by a single zero character '0';... | danielsunzhongyuan/my_leetcode_in_python | convert_a_number_to_hexadecimal_405.py | Python | apache-2.0 | 1,152 | 0.005208 |
import pysam
from readtagger.pysamtools_view import view
INPUT = 'tagged_dm6.bam'
def test_pysamtoolsview(datadir_copy, tmpdir): # noqa: D103
input_bam = str(datadir_copy[INPUT])
output_bam = tmpdir.join('out.bam').strpath
region = '3R:8121625-8121731'
view(input_bam=input_bam, output_bam=output_ba... | bardin-lab/readtagger | tests/test_pysamtools_view.py | Python | mit | 404 | 0 |
#!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# plot.py
# Purpose: plot Temp of running LIGGGHTS simulation via GnuPlot in Pizza.py
# Syntax: plot.py in.liggghts Nfreq Nsteps compute-ID
# in.liggghts = LIGGGHTS input script
# Nfreq = plot data point every thi... | CFDEMproject/LIGGGHTS-PUBLIC | python/examples/plot.py | Python | gpl-2.0 | 1,885 | 0.015385 |
import codecs
from uuid import uuid4
from io import BytesIO
import six
from six import b
from .fields import RequestField
writer = codecs.lookup('utf-8')[3]
def choose_boundary():
"""
Our embarassingly-simple replacement for mimetools.choose_boundary.
"""
return uuid4().hex
def iter_field_objects... | Mapotempo/mapotempo-qgis-plugin | urllib3/filepost.py | Python | gpl-2.0 | 2,256 | 0.000887 |
from functools import wraps
from uuid import uuid4
from app.globals import get_session_store
from app.utilities.schema import load_schema_from_session_data
def with_schema(function):
"""Adds the survey schema as the first argument to the function being wrapped.
Use on flask request handlers or methods called... | ONSdigital/eq-survey-runner | app/helpers/schema_helpers.py | Python | mit | 4,296 | 0.002793 |
# login methods are dynamically imported if auth is enabled
import logging
from .logout import Logout
import tornado.web
import _
@_.components.Register('auth')
class Authentication(tornado.web.RequestHandler):
@classmethod
def _pyConfig(cls, config):
cls.URL = config.pop('login_page', '/login')
| moertle/_.py | _/web/auth/__init__.py | Python | mit | 318 | 0.003145 |
from __future__ import print_function
import numpy as np
import theano
from theano import tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from scipy.io import wavfile
import os
import sys
from kdllib import audio_file_iterator
from kdllib import numpy_one_hot, apply_quantize_preproc
from kd... | kastnerkyle/crikey | ishaan_model/ishaan_baseline.py | Python | bsd-3-clause | 13,070 | 0.000995 |
from Components.ActionMap import ActionMap
from Components.Sensors import sensors
from Components.Sources.Sensor import SensorSource
from Components.Sources.StaticText import StaticText
from Components.ConfigList import ConfigListScreen
from Components.config import getConfigListEntry
from Screens.Screen import Screen... | bally12345/enigma2 | lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py | Python | gpl-2.0 | 10,581 | 0.019941 |
# -*- encoding: UTF-8 -*-
import sys
import motion
import almath
from naoqi import ALProxy
def StiffnessOn(proxy):
# We use the "Body" name to signify the collection of all joints
pNames = "Body"
pStiffnessLists = 1.0
pTimeLists = 1.0
proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLi... | KellyChan/python-examples | python/aldebaran/hana/hana/motion/cartesian/motion_hulaHoop.py | Python | mit | 2,824 | 0.009561 |
'''
Input : n=1
Output: {}
Input : n=2
Output:
{}{}
{{}}
https://www.geeksforgeeks.org/print-all-combinations-of-balanced-parentheses/
'''
def printParenthesis(string, openP, closeP):
if(openP==0 and closeP==0):
# all opening and closing are done
print string
else:
if(openP>closeP):
... | saurabhkumar1989/programming_question_python | my_question/all-valid-bracket-permutation.py | Python | apache-2.0 | 545 | 0.029358 |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from distutils import core
from distutils.command.install import install
import sys, os, subprocess
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def git(*args):
return subproce... | MinnowBoard/minnow-maker | setup.py | Python | mit | 1,963 | 0.028018 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/eventhubs/tests/latest/test_eventhub_commands_namespace_premium_test.py | Python | mit | 4,228 | 0.004257 |
# Copyright (c) 2015 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | paninetworks/neutron | neutron/db/db_base_plugin_common.py | Python | apache-2.0 | 12,074 | 0.000166 |
import keras
from keras.optimizers import SGD, adadelta, rmsprop, adam
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import np_utils
from keras.metrics import matthews_correlation, precision, recall
import keras.backend as K
import cPickle
import numpy as np
import getpass
username = getpa... | santiagolopezg/MODS_ConvNet | test_lillabcrossval_network.py | Python | mit | 4,398 | 0.033197 |
# http://codingbat.com/prob/p184853
def big_diff(nums):
max_num = nums[0]
min_num = nums[0]
for num in nums:
max_num = max(num, max_num)
min_num = min(num, min_num)
return abs(max_num - min_num)
| dvt32/cpp-journey | Python/CodingBat/big_diff.py | Python | mit | 220 | 0.027273 |
"""Public interface managing the workflow for peer assessments.
The Peer Assessment Workflow API exposes all public actions required to complete
the workflow for a given submission.
"""
import logging
from django.db import DatabaseError, IntegrityError, transaction
from django.utils import timezone
from dogapi impo... | Edraak/edx-ora2 | openassessment/assessment/api/peer.py | Python | agpl-3.0 | 37,163 | 0.001453 |
import datetime
from dateutil.relativedelta import *
## give final date and time after parsing by changing current date-time
def change_datetime ( c="0", y=0, mt=0, w=0, d=0, h=0, m=0, s=0):
#mt = mt + 12*y
#d = d + 30*mt
now = datetime.datetime.now()
change = relativedelta( years =+ y, months =+ mt, weeks... | Chirayu-sopho/Hindi-DateTime-Parser | functions.py | Python | mit | 4,957 | 0.047004 |
from cocosCairo.cocosCairo import * # Convenience module to import all other modules
from splash import *
BACKGROUND_COLOR = Color(0.1, 0.3, 0.7)
MAZE_PATHS = ["maze01.maze", "maze02.maze", "maze03.maze"] # an ordered list of the maze files
PATH_INDEX = 0 # the index of the next maze file to load
class MazeScene(Sce... | jeremyflores/cocosCairo | oldTests/maze.py | Python | mit | 9,600 | 0.030417 |
#!/usr/bin/python
# Copyright (c) 2016 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.
"""
A chain with four possible intermediates with different notBefore and notAfter
dates, for testing path bulding prioritization.
"""
... | endlessm/chromium-browser | net/data/path_builder_unittest/validity_date_prioritization/generate-certs.py | Python | bsd-3-clause | 1,833 | 0.001091 |
# 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... | twilio/twilio-python | twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py | Python | mit | 16,185 | 0.00451 |
#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes :
#python_version : 3.5.0
#Reference : http://www.psy... | yakupc/Artificial-Intelligence | Algorithms/SolveTSPSimulatedAnnealing/SolveTSPSimulatedAnnealing.py | Python | mit | 4,196 | 0.023832 |
import math
import sys
from functools import lru_cache
from typing import Optional, Union # noqa
import urwid
from mitmproxy import contentviews
from mitmproxy import http
from mitmproxy.tools.console import common
from mitmproxy.tools.console import layoutwidget
from mitmproxy.tools.console import flowdetailview
fr... | cortesi/mitmproxy | mitmproxy/tools/console/flowview.py | Python | mit | 8,005 | 0.001749 |
#!/usr/bin/env python
"""
cpuinfo
Copyright 2002 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) license. See LICENSE.txt that came with
this distribution for specifics.
NO WARRANTY IS EXP... | MSeifert04/numpy | numpy/distutils/cpuinfo.py | Python | bsd-3-clause | 23,013 | 0.00491 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Above the run-comment and file encoding comment.
# TODO FIXME XXX
# Keywords
with break continue del exec return pass print raise global assert lambda yield
for while if elif else import from as try except finally and in is not or
yield from
def functionname
class ... | mumuxme/vim-config | test/test.py | Python | gpl-3.0 | 2,612 | 0.005393 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-22 22:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('socialnet', '0029_auto_20161121_0543'),
]
operations = [
migrations.AddFiel... | CMPUT404F16T06/CMPUT404Project | mysite/socialnet/migrations/0030_author_displayname.py | Python | apache-2.0 | 480 | 0 |
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import EmailMessage, EmailMultiAlternatives
import base64
from postmark.core import PMMail, PMBatchMail
class PMEmailMessage(EmailMessage):
de... | themartorana/python-postmark | postmark/django_backend.py | Python | mit | 6,739 | 0.00089 |
import os
import os.path as osp
import shutil
import subprocess
from .. api import Installer, parse_version
from .. toolbox import find_executable, pushd
class StowInstaller(Installer):
name = 'stow'
def __init__(self, provider, release, config):
super(StowInstaller, self).__init__(provider, releas... | cogniteev/easy-upgrade | easy_upgrade/lib/stow.py | Python | apache-2.0 | 2,651 | 0 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
import os
from PyQt4 import QtGui, Qt, QtCore
from opus_gui.general_manager.views.ui_dependency_viewer import Ui_DependencyViewer
class DependencyViewer(QtGui.QDialog, Ui_DependencyViewer):
def _... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_gui/general_manager/controllers/dependency_viewer.py | Python | gpl-2.0 | 1,509 | 0.003976 |
"""
These are the functions used to process medline (pubmed) files at the backend. They are meant for use internal use by metaknowledge.
"""
from .recordMedline import MedlineRecord, medlineRecordParser
from .medlineHandlers import isMedlineFile, medlineParser
from .tagProcessing.tagNames import tagNameDict, authorBase... | networks-lab/metaknowledge | metaknowledge/medline/__init__.py | Python | gpl-2.0 | 458 | 0.004367 |
# coding=utf-8
"""Module of Data Types (eg. Temperature, Area, etc.)
Possesses capabilities for unit conversions and range checks.
It also includes descriptions of the data types and the units.
Properties:
TYPES: A tuple indicating all currently supported data types.
BASETYPES: A tuple indicating all base ty... | ladybug-analysis-tools/ladybug-core | ladybug/datatype/__init__.py | Python | gpl-3.0 | 901 | 0.00111 |
from engine.services.lib.debug import check_if_debugging
check_if_debugging()
import inspect
import logging
import os
import sys
import traceback
from logging.handlers import RotatingFileHandler
from subprocess import check_call, check_output
from flask import Flask
## Moved populate & upgrade from webapp
from init... | isard-vdi/isard | engine/engine/start.py | Python | agpl-3.0 | 2,127 | 0.007522 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import settings
#----------------------------------------
# globals
#----------------------------------------
web = settings.web
stow = web.utils.storage
#----------------------------------------
# 初始化菜单 权限控制
#----------------------------------------
def init_menus():
_... | liangtianyou/ST | stclient/menus.py | Python | gpl-3.0 | 3,290 | 0.024443 |
from .cluster_pb2 import FLNodeDef, FLClusterDef
from .cluster_spec import FLClusterSpec
| bytedance/fedlearner | fedlearner/fedavg/cluster/__init__.py | Python | apache-2.0 | 90 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP streaming toolbox with flow control, written in Python.
:copyright: (c) 2014 Runzhou Li (Leo)
:license: The MIT License (MIT), see LICENSE for details.
"""
__title__ = 'tidehunter'
__version__ = '1.0.1'
VERSION = tuple(map(int, __version__.split('.')))
__author_... | woozyking/tidehunter | tidehunter/__init__.py | Python | mit | 858 | 0.002331 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Customer, Session, CompanyProfile
class CustomerUpdateForm(forms.ModelForm):
"""
Update Customer form
Field enhancements:
* therapyCategory uses forms.TypedChoiceField.
"""
class Meta:
... | ylitormatech/terapialaskutus | therapyinvoicing/customers/forms.py | Python | bsd-3-clause | 7,087 | 0.001978 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | pratikmallya/heat | heat/engine/resources/openstack/keystone/role_assignments.py | Python | apache-2.0 | 15,791 | 0 |
# Copyright (C) 2007-2018 David Aguilar and contributors
"""Miscellaneous Qt utility functions."""
from __future__ import division, absolute_import, unicode_literals
import os
from qtpy import compat
from qtpy import QtGui
from qtpy import QtCore
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from qtpy.QtCore i... | antoniodemora/git-cola | cola/qtutils.py | Python | gpl-2.0 | 30,765 | 0.000163 |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify impo... | victorkeophila/alien4cloud-cloudify3-provider | src/test/resources/outputs/blueprints/openstack/tomcat/wrapper/Tomcat/tosca.interfaces.node.lifecycle.Standard/create/artifacts/tomcat-war-types/scripts/_a4c_tomcat_install.py | Python | apache-2.0 | 14,972 | 0.004542 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.usage}, a command line option parsing library.
"""
from twisted.trial import unittest
from twisted.python import usage
class WellBehaved(usage.Options):
optParameters = [['long', 'w', 'default', 'and a docstri... | nlloyd/SubliminalCollaborator | libs/twisted/test/test_usage.py | Python | apache-2.0 | 19,879 | 0.001811 |
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Justin Vincent
# Lars Buitinck
# License: BSD 3 clause
import pickle
import numpy as np
import pytest
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.fixes import MaskedArray
from sklearn.utils.fixes import _joblib... | chrsrds/scikit-learn | sklearn/utils/tests/test_fixes.py | Python | bsd-3-clause | 2,534 | 0 |
# -*- test-case-name: txdav.who.test.test_augment -*-
##
# Copyright (c) 2013-2017 Apple 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/li... | macosforge/ccs-calendarserver | txdav/who/augment.py | Python | apache-2.0 | 18,083 | 0.000608 |
#
#
#
from BCDataStream import *
from enumeration import Enumeration
from base58 import public_key_to_bc_address, hash_160_to_bc_address
import logging
import socket
import time
from util import short_hex, long_hex
def parse_CAddress(vds):
d = {}
d['nVersion'] = vds.read_int32()
d['nTime'] = vds.read_uint32()
... | radare/bitcointools | deserialize.py | Python | mit | 11,831 | 0.021384 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Integrates the web-platform-tests test runner with mach.
from __future__ import absolute_import, unicode_literals, pr... | Yukarumya/Yukarum-Redfoxes | testing/web-platform/mach_commands.py | Python | mpl-2.0 | 13,041 | 0.00207 |
#
# 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... | wooga/airflow | airflow/providers/facebook/ads/hooks/ads.py | Python | apache-2.0 | 5,572 | 0.001436 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-21 15:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0006_auto_20160221_1241'),
]
operations = [
migrations.AlterField(
... | 501code/Fletcher-Street-Urban-Riding-Club | pages/migrations/0007_auto_20160221_1533.py | Python | mit | 473 | 0 |
# imports/modules
import os
import random
import json
import collections
from PIL import Image
# Convert (r, g, b) into #rrggbb color
def getRGBstring( (r, g, b) ):
s = "#"
s = s + format(r, '02x')
s = s + format(g, '02x')
s = s + format(b, '02x')
return s
def do_compute():
# Open the image
origImgFile = ... | CS205IL-sp15/workbook | demo_colorFreq_start/py/compute.py | Python | mit | 594 | 0.065657 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.colors
import sys
matplotlib.rc('text', usetex=True)
fontsize = 22
font = {'family' : 'serif',
'serif' : 'Times Roman',
'size' : fontsize}
matplotlib.rc('font', **font)
output_dir = "doc/naacl201... | patverga/torch-relation-extraction | bin/analysis/plot-pr-curve.py | Python | mit | 1,479 | 0.01217 |
import numpy as n
import scipy.interpolate
import scipy.ndimage
def congrid(a, newdims, method='linear', centre=False, minusone=False):
'''Arbitrary resampling of source array to new dimension sizes.
Currently only supports maintaining the same number of dimensions.
To use 1-D arrays, first promote them to... | martindurant/misc | congrid.py | Python | mit | 3,851 | 0.014801 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_documents_reload_document_async.py | Python | apache-2.0 | 1,621 | 0.000617 |
from kona.linalg.matrices.hessian.basic import BaseHessian
class ReducedSchurPreconditioner(BaseHessian):
"""
An IDF-Schur preconditioner designed to precondition the KKT system for
multidisciplinary design optimization problems formulated using the IDF
architecture.
The preconditioner solves a sy... | OptimalDesignLab/Kona | src/kona/linalg/matrices/preconds/idf_schur.py | Python | lgpl-3.0 | 5,770 | 0.00312 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('artwork', '0011_auto_20160217_1921'),
]
operations = [
migrations.AlterModelOptions(
name='artwork',
... | rogerhil/flaviabernardes | flaviabernardes/flaviabernardes/artwork/migrations/0012_auto_20160831_2148.py | Python | apache-2.0 | 376 | 0 |
# Copyright (c) 2015 Cisco Systems
#
# 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 writ... | openstack/barbican | functionaltests/api/v1/functional/test_acls_rbac.py | Python | apache-2.0 | 13,953 | 0 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 is distributed in the hope that it ... | obsoleter/suds | suds/mx/typer.py | Python | lgpl-3.0 | 4,234 | 0.003779 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='my_project',
version='0.1.0',
packages=['my_project'],
entry_points={
'console_scripts': [
'my_project = crawler.__main__:main'
]
},
install_requires='requests'
... | Huai-Xv/CSU_FreeClassroom | setup.py | Python | gpl-3.0 | 322 | 0 |
from distutils.dir_util import copy_tree, remove_tree
import os
import shutil
def _copy_function(source, destination):
print('Bootstrapping project at %s' % destination)
copy_tree(source, destination)
def create_app():
cwd = os.getcwd()
game_logic_path = os.path.join(cwd, 'game_logic')
game_app_... | kollad/turbo-ninja | tools/bootstrap.py | Python | mit | 1,403 | 0.001426 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud 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 Free Software Foundation, either v... | sixuanwang/SAMSaaS | wirecloud-develop/src/wirecloud/fiware/marketAdaptor/views.py | Python | gpl-2.0 | 5,496 | 0.00455 |
# 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 'Country'
db.create_table('locations_country', (
('id', self.gf('django.db.mode... | MauHernandez/cyclope | cyclope/apps/locations/migrations/0001_initial.py | Python | gpl-3.0 | 2,676 | 0.007848 |
class intSet(object):
"""An intSet is a set of integers
The value is represented by a list of ints, self.vals.
Each integer in the set occurs in self.vals exactly once."""
def __init__(self):
"""Create an empty set of integers"""
self.vals = []
def __str__(self):
"""Returns... | pparacch/PlayingWithPython | computationAndProgrammingUsingPython/src/classesAndObjects/week6_L11_part05.py | Python | mit | 1,393 | 0.010768 |
# -*- coding: utf-8 -*-
import os
import unittest
from manolo_scraper.spiders.mincu import MincuSpider
from utils import fake_response_from_file
class TestMincuSpider(unittest.TestCase):
def setUp(self):
self.spider = MincuSpider()
def test_parse_item(self):
filename = os.path.join('data/mi... | aniversarioperu/django-manolo | scrapers/tests/test_mincu_spider.py | Python | bsd-3-clause | 1,379 | 0.002913 |
# Copyright (c) 2020, DjaoDjin 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-survey | survey/urls/api/__init__.py | Python | bsd-2-clause | 1,664 | 0.000601 |
import unittest
import pandas as pd
from pandas_schema import Column
from pandas_schema.validation import CanConvertValidation, LeadingWhitespaceValidation, TrailingWhitespaceValidation
class SingleValidationColumn(unittest.TestCase):
"""
Test a column with one single validation
"""
NAME = 'col1'
... | TMiguelT/PandasSchema | test/test_column.py | Python | gpl-3.0 | 2,051 | 0.003901 |
"""Executor util helpers."""
from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
import contextlib
import logging
import queue
import sys
from threading import Thread
import time
import traceback
from .thread import async_raise
_LOGGER = logging.getLogger(__name__)
MAX_LOG_ATTEMPTS ... | home-assistant/home-assistant | homeassistant/util/executor.py | Python | apache-2.0 | 3,555 | 0 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^new', views.add_post_form, name='add'),
url(r'^post/(?P<slug>[\w-]+)/$', views.post_view, name='post'),
]
| CallMeMhz/megablog | src/blog/urls.py | Python | gpl-3.0 | 235 | 0 |
#!/usr/bin/env python
#coding: utf8
#get the list of the scanned election results papers ( proces verbaux )
# sudo apt-get install python-setuptools
# easy_install beautifulsoup4
import urllib2
from bs4 import BeautifulSoup
from string import maketrans
from string import whitespace
import csv
import time
import json... | radproject/protocols | script.py | Python | cc0-1.0 | 3,299 | 0.036072 |
from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
from treemap.models import ITreeCodeOverride, ITreeRegion, User
UDFS = {
'plot': {
'owner_additional_id': {
'udf.name': 'Owner Additional Id'
},
'owner_additional_properties': {
'udf.name': 'Own... | johnsonc/OTM2 | opentreemap/otm1_migrator/migration_rules/philadelphia.py | Python | gpl-3.0 | 3,768 | 0.000531 |
#!/usr/bin/python -u
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | kun--hust/sccloud | test/probe/test_object_failures.py | Python | apache-2.0 | 7,804 | 0 |
# -*- coding: utf-8 -*-
"""
pyvisa.visa
~~~~~~~~~~~
Module to provide an import shortcut for the most common VISA operations.
This file is part of PyVISA.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see COPYING for more details.
"""
from __future__ import... | MatthieuDartiailh/pyvisa | visa.py | Python | mit | 1,581 | 0.003163 |
from cornflake import fields
from cornflake.exceptions import ValidationError
from cornflake.sqlalchemy_orm import ModelSerializer, ReferenceField
from cornflake.validators import max_length, min_, none_if_blank, optional, required
from radar.api.serializers.common import (
MetaMixin,
PatientMixin,
SourceM... | renalreg/radar | radar/api/serializers/medications.py | Python | agpl-3.0 | 4,625 | 0.002162 |
__author__ = 'j'
from tkinter import ttk
from tkinter import *
from TreeView import *
def buildFrame(root):
sub_1 = Frame(root)
sub_1.pack(side=LEFT,anchor = 'w', fill='both', expand=True)
sub_1_1 = Frame(sub_1)
sub_1_1.pack(side=TOP, anchor='n',fill='both',expand=True)
sub_1_2 = Frame(sub_1)
... | PalmDr/XRD-Data-Analysis-Toolkit | Beta1.3/Builder.py | Python | apache-2.0 | 2,100 | 0.012857 |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import urllib
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import CONF_HOST, CONF_USERN... | deisi/home-assistant | homeassistant/components/device_tracker/unifi.py | Python | mit | 2,645 | 0 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingAverage/cycle_12/ar_12/test_artificial_128_Logit_MovingAverage_12_12_100.py | Python | bsd-3-clause | 267 | 0.086142 |
"""
Django settings for becours project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | eedf/becours | becours/settings.py | Python | mit | 3,562 | 0.001123 |
#=======================================================================
# Author: Donovan Parks
#
# Sequence histogram plot.
#
# Copyright 2011 Donovan Parks
#
# This file is part of STAMP.
#
# STAMP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | dparks1134/STAMP | stamp/plugins/samples/plots/SeqHistogram.py | Python | gpl-3.0 | 9,822 | 0.032376 |
# Copyright (c) 2012-2016 Seafile Ltd.
import seahub.settings as settings
# OfficeOnlineServer, OnlyOffice, CollaboraOffice
OFFICE_SERVER_TYPE = getattr(settings, 'OFFICE_SERVER_TYPE', '')
OFFICE_WEB_APP_BASE_URL = getattr(settings, 'OFFICE_WEB_APP_BASE_URL', '')
WOPI_ACCESS_TOKEN_EXPIRATION = getattr(settings, 'WOPI... | miurahr/seahub | seahub/wopi/settings.py | Python | apache-2.0 | 1,424 | 0.005618 |
import sys
import signal
from threading import Thread
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class PUTHandler(BaseHTTPRequestHandler):
def do_PUT(self):
print "----- SOMETHING WAS PUT!! ------"
print self.headers
length = int(self.headers['Content-Length'])
co... | fp7-netide/Tools | traffem/apps/http/serverPUT.py | Python | epl-1.0 | 819 | 0.006105 |
"""
Support for Xiaomi Mi WiFi Repeater 2.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/device_tracker.xiaomi_miio/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tra... | persandstrom/home-assistant | homeassistant/components/device_tracker/xiaomi_miio.py | Python | apache-2.0 | 2,487 | 0 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | chetan51/neon | neon/layers/__init__.py | Python | apache-2.0 | 1,116 | 0.001792 |
from datetime import datetime
from google.appengine.ext import db
from django.utils import simplejson as json
from couch import errors
from couch.models.util import gen_uuid
class DocumentRoot(db.Model):
''' Controls document '''
revno = db.IntegerProperty(default = 0)
revsuffix = db.StringProperty()
d... | yssk22/gaecouch | couch/models/document.py | Python | apache-2.0 | 708 | 0.011299 |
import sys
from cyvcf2 import VCF
from collections import defaultdict
def parse_caller_vcfs(sample_dict, caller_list):
caller_vcf_records = defaultdict(lambda: dict())
for caller in caller_list:
parse_vcf(sample_dict[caller], caller, caller_vcf_records)
return caller_vcf_records
def parse_vcf(v... | GastonLab/ddb-mongodb | vcf_parsing.py | Python | mit | 11,779 | 0.000679 |
#
# 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... | airbnb/airflow | airflow/providers/google/cloud/example_dags/example_dataflow_sql.py | Python | apache-2.0 | 2,471 | 0.000809 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/option/srcdir.py | Python | mit | 1,950 | 0.006667 |
"""
Q4- Write a Python function, odd, that takes in one number and returns True when the number is odd and False otherwise. You should use the % (mod) operator, not if. This function takes in one number and returns a boolean
"""
def odd( number ):
return number % 2 == 1
number = int( input( "Enter a number: ") )
p... | SuyashD95/python-assignments | Assignment 3/odd.py | Python | mit | 403 | 0.044665 |
import contextlib
import gzip
import hashlib
import io
import mmap
from builtins import (
map as imap,
)
def gzip_compress(data, compresslevel=6):
compressed = io.BytesIO()
with gzip.GzipFile(fileobj=compressed,
mode="wb",
compresslevel=compresslevel) as comp... | nanshe-org/nanshe_workflow | nanshe_workflow/util.py | Python | apache-2.0 | 733 | 0.001364 |
from .views import PageView
from django.urls import path
urlpatterns = [
path('<path:path>/', PageView.as_view(), name='page_detail'),
]
| manhhomienbienthuy/pythondotorg | pages/urls.py | Python | apache-2.0 | 142 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/npc/droid/crafted/shared_droideka_advanced.iff"
result.attribute_te... | anhstudios/swganh | data/scripts/templates/object/creature/npc/droid/crafted/shared_droideka_advanced.py | Python | mit | 474 | 0.046414 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ella.core.models import Publishable
class XArticle(Publishable):
"""
``XArticle`` is extra publishable descendant for testing.
Is used for possibility testing descendants of publishable
with different content ty... | MichalMaM/ella | test_ella/test_app/models.py | Python | bsd-3-clause | 487 | 0 |
from django import forms
from lists.models import Item
EMPTY_LIST_ERROR = "You can't have an empty list item"
class ItemForm(forms.models.ModelForm):
class Meta:
model = Item
fields = ('text',)
widgets = {
'text': forms.fields.TextInput(attrs={
'placeholder': 'Enter a to-do item',
'class': 'form... | rmelchorv/TDD-Cuervos | lists/forms.py | Python | mit | 435 | 0.034483 |
# -*- coding: utf-8 -*-
"""
logbook._fallback
~~~~~~~~~~~~~~~~~
Fallback implementations in case speedups is not around.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from itertools import count
from logbook.helpers import get_iterator_next_... | agustinhenze/logbook.debian | logbook/_fallback.py | Python | bsd-3-clause | 6,767 | 0.000591 |
#!/usr/bin/env python
# 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
# "L... | kou/arrow | cpp/src/arrow/util/bpacking_simd_codegen.py | Python | apache-2.0 | 6,630 | 0.001056 |
from SubChoosers.ISubStagesChooser import ISubStagesChooser
from SubRankers.ByFullNameSubStagesRanker import ByFullNameSubStagesRanker
from Utils import WriteDebug
class FirstInCertainSubStagesChooser(ISubStagesChooser):
""" Implementation of ISubStagesChooser. This chooser return results after
ranki... | yosi-dediashvili/SubiT | src/SubChoosers/FirstInCertainSubStagesChooser.py | Python | gpl-3.0 | 2,895 | 0.005181 |
#!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import *
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
... | lilydjwg/you-get | src/you_get/extractors/acfun.py | Python | mit | 3,211 | 0.005308 |
# -*- coding: utf-8 -*-
#
# Slave, (c) 2014, see AUTHORS. Licensed under the GNU GPL.
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.builtins import *
from slave.lakeshore import LS340, LS370
from slave.transport import SimulatedTransport
de... | therealpyro/slave | slave/test/test_lakeshore.py | Python | gpl-3.0 | 488 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, GeekChimp - Franck Nijhof <franck@geekchimp.com>
#
# 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 you... | kaarolch/ansible | lib/ansible/modules/system/osx_defaults.py | Python | gpl-3.0 | 14,430 | 0.003119 |
from __future__ import print_function
import pytest
from website.app import init_app
from tests.json_api_test_app import JSONAPITestApp
@pytest.fixture()
def app():
return JSONAPITestApp()
# NOTE: autouse so that ADDONS_REQUESTED gets set on website.settings
@pytest.fixture(autouse=True, scope='session')
def a... | Johnetordoff/osf.io | api_tests/conftest.py | Python | apache-2.0 | 378 | 0.002646 |
# -*- coding: UTF-8 -*-
# COPYRIGHT (c) 2016 Cristóbal Ganter
#
# GNU AFFERO GENERAL PUBLIC LICENSE
# Version 3, 19 November 2007
#
# 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 Free Software Foundation, eit... | TelematicaUSM/EduRT | src/wsclass.py | Python | agpl-3.0 | 8,134 | 0 |
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | CompassionCH/compassion-switzerland | partner_communication_switzerland/__init__.py | Python | agpl-3.0 | 468 | 0 |
class Foo(object):
def set(self, value):
self.field = value
def get(self):
return self.field
a = Foo()
a.set("hello world")
z = a.get()
print z
z
a
| retoo/pystructure | s101g/examples/simple/simple.py | Python | lgpl-2.1 | 195 | 0.025641 |
#
# Copyright (C) 2012-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it wi... | atodorov/anaconda | pyanaconda/ui/gui/xkl_wrapper.py | Python | gpl-2.0 | 15,372 | 0.003578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.