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 |
|---|---|---|---|---|---|---|
__author__ = 'tilmannbruckhaus'
from collections import defaultdict
class TenThousandFirstPrime:
# 10001st prime
# Problem 7
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?
LIMIT = 1000000
TARGET = 10... | bruckhaus/challenges | python_challenges/project_euler/p007_ten_thousand_first_prime.py | Python | mit | 873 | 0.001145 |
# Under the PySpark shell, type:
# execfile('q4_clustering_kMeans_spark.py')
#from pyspark import SparkContext, SparkConf
# conf = SparkConf()
# conf.setMaster("local")
# conf.setAppName("Recommendation System")
# conf.set("spark.executor.memory", "16g")
#sc = SparkContext(conf=conf)
#################################... | xjlin0/cs246 | w2015/hw2/q4_clustering_kMeans_spark.py | Python | mit | 2,787 | 0.011123 |
#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# 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,... | knipknap/exscript | Exscript/util/url.py | Python | mit | 7,356 | 0.001767 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-07 16:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0016_remove_site_domain_old'),
]
operations = [
migrations.AlterFi... | tjcsl/director | web3/apps/sites/migrations/0017_auto_20170707_1608.py | Python | mit | 572 | 0.001748 |
#!/usr/bin/python3
#
# Simple AWS automation script - Patrick Lambert - http://dendory.net
# Prerequisites: `pip3 install boto3` and `aws configure`
#
import os
import sys
import json
import time
cfgfile = os.path.join(os.path.expanduser("~"), ".aws.templates")
#
# Internal functions
#
def fail(msg):
if os.name != "n... | dendory/scripts | aws.py | Python | mit | 22,042 | 0.032937 |
#!/usr/bin/python3
#
# By Reynaldo R. Martinez P.
# Sept 09 2016
# TigerLinux AT Gmail DOT Com
# Sa sample with some operations including usage of
# a library import and some operations
#
#
#
# Here, weproceed to import the "SYS" library
import sys
# Next, we print the "sys.platform" information. Th... | tigerlinux/tigerlinux-extra-recipes | recipes/misc/python-learning/CORE/0002-Print-and-Import-and-some-operations/print-and-import.py | Python | gpl-3.0 | 1,618 | 0.038937 |
"""94. Binary Tree Inorder Traversal
https://leetcode.com/problems/binary-tree-inorder-traversal/
Given a binary tree, return the in-order traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,3,2]
Follow up: Recursive solution is trivial, could you do it iteratively?... | isudox/leetcode-solution | python-algorithm/leetcode/problem_94.py | Python | mit | 1,229 | 0 |
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from omeroweb.webgateway.views import getBlitzConnection, _session_logout
from omeroweb.webgateway import views as webgateway_views
import settings
import logging
impor... | joshmoore/openmicroscopy | components/tools/OmeroWeb/omeroweb/webmobile/views.py | Python | gpl-2.0 | 20,846 | 0.012952 |
# -*- coding=utf-8 -*-
"""
All entry points for API are defined here.
Attributes:
mod (Blueprint): Flask Blueprint object used to separate api from
website code.
"""
from flask import Blueprint, request, send_from_directory
from flask_restful import Api, Resource
import os
fr... | Pseudonick47/sherlock | backend/api/data.py | Python | gpl-3.0 | 37,646 | 0.003294 |
import os
import pytest
from seleniumbase import BaseCase
class ImageTests(BaseCase):
@pytest.mark.run(order=1)
def test_pull_image_from_website(self):
""" Pull an image from a website and save it as a PNG file. """
self.open("https://xkcd.com/1117/")
selector = "#comic"
file_n... | seleniumbase/SeleniumBase | examples/image_test.py | Python | mit | 2,523 | 0 |
#!/usr/bin/env python2
from eagle import *
def changed(app, entry, value):
print "app %s, entry %s, value %r" % (app.id, entry.id, value)
App(title="Entries Test",
center=(Entry(id="single"),
Entry(id="multi", multiline=True),
Entry(id="non-editable",
label="non-edi... | ramalho/eagle-py | tests/entries.py | Python | lgpl-2.1 | 572 | 0.001748 |
#!/usr/bin/python
from setuptools import setup, find_packages
setup(
name='plumber',
version='0.0.1-alpha',
description='simple, mundane script to build and publish containers to marathon/mesos',
author='Giuseppe Lavagetto',
author_email='glavagetto@wikimedia.org',
url='https://github.com/lava... | lavagetto/plumber | setup.py | Python | gpl-3.0 | 589 | 0.001698 |
import zmq
import numpy as np
import theano
import theano.gpuarray
try:
from pygpu import collectives as gpu_coll
except ImportError as exc:
gpu_coll = None
from .reducers import reducers
sync = None
cpu = None
gpu = None
def connect_as_master(n_parallel, rank, master_rank, use_gpu,
m... | astooke/synkhronos | synkhronos/comm.py | Python | mit | 13,018 | 0.000615 |
import os
# ParserTools class
class ParserTools(object):
def __init__(self):
self.qset = None
self.template = None
# Called before running any PT functions in a term definition.
def term_focus(self, term):
self.qset = term.qset
self.template = term.template
# C... | anyweez/regis | face/offline/ParserTools/ParserTools.py | Python | gpl-2.0 | 1,892 | 0.005814 |
x = 10
print("id(x) is ", id(x))
y = 20
print("id(y) is ", id(y))
print("id(x) == id(y): ", id(x) == id(y))
| padmacho/pythontutorial | objects/id_demo.py | Python | apache-2.0 | 113 | 0 |
# 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, ... | tseaver/gcloud-python | firestore/tests/unit/gapic/v1beta1/test_firestore_client_v1beta1.py | Python | apache-2.0 | 20,576 | 0 |
from django.contrib.auth.decorators import user_passes_test, login_required
from profiles.models import Musician, NonMusician
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
# import login_required user_passes_test
# these functions are made to be passed into user_passes_tes... | lancekrogers/music-network | cleff/custom_wrappers.py | Python | apache-2.0 | 1,287 | 0.006216 |
#!/usr/bin/python
__author__ = 'Ben "TheX1le" Smith'
__email__ = 'thex1le@gmail.com'
__website__= 'http://trac.aircrack-ng.org/browser/trunk/scripts/airgraph-ng/'
__date__ = '03/02/09'
__version__ = ''
__file__ = 'airgraph-ng'
__data__ = 'This is the main airgraph-ng file'
"""
Welcome to airgraph written by TheX1le
Sp... | esurharun/aircrack-ng-cell | scripts/airgraph-ng/airgraph-ng.py | Python | gpl-2.0 | 16,007 | 0.03892 |
global mods
mods = []
| TheCherry/ark-server-manager | src/config.py | Python | gpl-2.0 | 22 | 0 |
from core.models import Application as Image, BootScript
from rest_framework import serializers
from api.v2.serializers.summaries import UserSummarySerializer
from api.v2.serializers.fields import (
ImageVersionRelatedField, TagRelatedField)
from api.v2.serializers.fields.base import UUIDHyperlinkedIdentityField
... | CCI-MOC/GUI-Backend | api/v2/serializers/details/image.py | Python | apache-2.0 | 1,518 | 0 |
from __future__ import print_function
import numpy
import random
import scipy.stats
"""
This is the source code for the paper entitled
"Beyond Equilibrium: Revisiting Two-Sided Markets from an Agent-Based Modeling Perspective"
published in the International Journal of Computational Economics and Econometrics.
Authors: ... | graebnerc/Beyond_Equilibrium | tsm-src.py | Python | mit | 83,029 | 0.005095 |
import traceback
from util import *
import importlib
class DefaultLoader(object):
def __init__(self):
self.fixtures = {}
def load(self, name):
org_name = name
fixture = self.fixtures.get(name)
if fixture:
print 'already exists, return'
return fixture
... | epronk/pyfit2 | engines.py | Python | gpl-2.0 | 3,171 | 0.005361 |
#==============================================================================
# Copyright 2019-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | tensorflow/ngraph-bridge | tools/log_parser.py | Python | apache-2.0 | 6,884 | 0.002905 |
# -*- coding: utf-8 -*-
#
# 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
... | easytaxibr/airflow | tests/core.py | Python | apache-2.0 | 93,982 | 0.001734 |
import base64
import logging
import re
import subprocess
from typing import Optional
import orjson
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import authenticated_json_view
from zerver.lib.ccache import ma... | brainwane/zulip | zerver/views/zephyr.py | Python | apache-2.0 | 2,693 | 0.001857 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.tools import float_compare
class StockWarnInsufficientQty(models.AbstractModel):
_name = 'stock.warn.insufficient.qty'
_description = 'Warn Insufficient Quantity'
... | t3dev/odoo | addons/stock/wizard/stock_warn_insufficient_qty.py | Python | gpl-3.0 | 1,401 | 0.002141 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(self, plotly_name="color", parent_name="contourcarpet.line", **kwargs):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/contourcarpet/line/_color.py | Python | mit | 411 | 0.002433 |
import os
from sqs import (make_SQS_connection, get_queue, queue_size, )
from cloudwatch import (make_CW_connection, update_metric, )
from threading import Timer
# Define AWS credentials
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
REGION = 'us-west-2'... | recombinators/autoscaling | checker.py | Python | mit | 2,410 | 0.000415 |
sum=0
for x in range(0,1000):
if(x%3==0 or x%5==0):
sum+=x
print(sum)
| scottnm/ProjectEuler | python/Problem1-Multiples_of_3_&_5.py | Python | apache-2.0 | 82 | 0.085366 |
#
# Copyright 2009 Andrei <vish@gravitysoft.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; either version 2 of the License, or
# (at your opti... | barmalei/primus | lib/primus/fileartifact.py | Python | lgpl-3.0 | 6,594 | 0.014407 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-05 14:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gradapp', '0027_auto_20161109_0925'),
]
operations = [
migrations.AlterFiel... | classgrade/classgrade | classgrade/gradapp/migrations/0028_auto_20170105_1435.py | Python | mit | 486 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
class SetupProgress(Document):
pass
def get_setup_progress():
if not ... | ovresko/erpnext | erpnext/setup/doctype/setup_progress/setup_progress.py | Python | gpl-3.0 | 1,811 | 0.027057 |
# (C) British Crown Copyright 2013 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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
# (at your option) any l... | decvalts/iris | lib/iris/experimental/concatenate.py | Python | gpl-3.0 | 1,615 | 0 |
from django.conf import settings
from django.http import HttpResponseServerError, HttpResponse
from django.utils import simplejson
class JsonResponse(HttpResponse):
def __init__(self, data, status=200):
HttpResponse.__init__(self,
content=simplejson.dumps(data),
content_type='application/json; charset=UTF-8',... | django-bft/django-bft | bft/utils/json_utils.py | Python | gpl-3.0 | 765 | 0.035294 |
# Andrew Rosen
# performs Romberg Integration
# Usage python numhw3.py
from math import *
def extrapolate(f,a,b, depth):
R = []
for i in range(0, depth):
R.append([None]*(depth))
R[0][0] = ((b-a)*.5)*(f(a)+ f(b))
for n in range(1, depth):
h_n = (b-a)/(2.0**(n))
points = [0]
... | abrosen/numerical-analysis | numhw3.py | Python | lgpl-3.0 | 910 | 0.023077 |
import _plotly_utils.basevalidators
class TicktextValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="ticktext", parent_name="densitymapbox.colorbar", **kwargs
):
super(TicktextValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_ticktext.py | Python | mit | 436 | 0.002294 |
#!/usr/bin/env python
from __future__ import division
import krpc
import vlc
import time
import random
import yaml
import os
import socket
import math
import logging
import sys
from collections import deque
import argparse
class Player(object):
def __init__(self, path, preload=True):
self.instance = vlc.In... | FenixFeather/ksp-music-hack | music_hack.py | Python | gpl-3.0 | 12,698 | 0.003229 |
# -*- coding: utf-8 -*-
import numpy as np
import csv
import feature
import config
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int... | DeveloperJose/Vision-Rat-Brain | feature_matching_v1/scripts_batch_processing/batch_warp.py | Python | mit | 2,630 | 0.009132 |
import pytest
from transmute_core import NoSerializerFound, SerializationException
def test_default_serializer_json(serializer_set):
frm, expected_to = {"foo": "bar"}, b'{"foo": "bar"}'
serializer = serializer_set["application/json"]
assert serializer.dump(frm) == expected_to
assert serializer.load(ex... | toumorokoshi/transmute-core | transmute_core/tests/contenttype_serializers/test_default_serializer_set.py | Python | mit | 1,393 | 0.000718 |
# Generator package
| brextonpham/python-Ultron | python-vlc-master/generator/__init__.py | Python | mit | 20 | 0 |
# This file is part of Rubber and thus covered by the GPL
# (c) Emmanuel Beffara, 2002--2006
"""
LaTeX document building system for Rubber.
This module contains all the code in Rubber that actually does the job of
building a LaTeX document from start to finish.
"""
import os, os.path, sys, imp
import re
import string... | petrhosek/rubber | rubber/converters/latex.py | Python | gpl-2.0 | 42,452 | 0.035028 |
# -*- coding: utf-8 -*-
import os
import logging
import datetime
import sys
from django.utils import timezone
from website import settings
def format_now():
return timezone.now().isoformat()
def add_file_logger(logger, script_name, suffix=None):
_, name = os.path.split(script_name)
name = name.rstrip... | caneruguz/osf.io | scripts/utils.py | Python | apache-2.0 | 1,318 | 0.000759 |
"""
Copyright (c) 2014 Marshall Farrier
license http://opensource.org/licenses/MIT
@author: Marshall Farrier
@contact: marshalldfarrier@gmail.com
@since: 2014-11-10
@summary: Neural network
Resources:
Great performance ideas:
http://stackoverflow.com/questions/21106134/numpy-pure-functions-for-performance-caching
"""
... | aisthesis/machinelearning | experiments/neural.py | Python | mit | 5,497 | 0.002001 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2010 (ita)
"""
Classes related to the build phase (build, clean, install, step, etc)
The inheritance tree is the following:
"""
import os, sys, errno, re, shutil, stat
try:
import cPickle
except ImportError:
import pickle as cPickle
from waflib import Ru... | zhumingliang1209/Ardupilot | ardupilot/modules/waf/waflib/Build.py | Python | gpl-3.0 | 37,831 | 0.031852 |
import os
import pytest
@pytest.fixture(scope='session')
def testdata():
"""
Simple fixture to return reference data
:return:
"""
class TestData():
def __init__(self):
self.datadir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
def fn(self, fn):
... | miroag/mfs | tests/conftest.py | Python | mit | 516 | 0.001938 |
"""
Copyright 2013 The Trustees of Princeton University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicab... | iychoi/syndicate-core | ms/storage/storagetypes.py | Python | apache-2.0 | 25,103 | 0.032785 |
from dateutil.relativedelta import relativedelta
from script.models import Script, ScriptProgress
from rapidsms.models import Connection
import datetime
from rapidsms.models import Contact
from rapidsms.contrib.locations.models import Location
from poll.models import Poll
from script.models import ScriptStep
from djang... | unicefuganda/edtrac | edtrac_project/rapidsms_edtrac/education/utils.py | Python | bsd-3-clause | 12,792 | 0.00641 |
#-*- coding: utf-8 -*-
'''
Created on 23 дек. 2010
@author: ivan
'''
import logging
from gi.repository import Gtk
from foobnix.fc.fc import FC
from foobnix.preferences.configs import CONFIG_OTHER
from foobnix.util.antiscreensaver import antiscreensaver
from foobnix.preferences.config_plugin import ConfigPlugin
from... | zavlab1/foobnix | foobnix/preferences/configs/other_conf.py | Python | gpl-3.0 | 9,256 | 0.002161 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from devtools_testutils import recorded_by_proxy
from azure.ai.formrecognizer._generated.v2022_01_30_preview.models import... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dac_analyze_layout.py | Python | mit | 7,732 | 0.004656 |
import sys
import re
import json
import hashlib
from ..console_write import console_write
class CachingDownloader(object):
"""
A base downloader that will use a caching backend to cache HTTP requests
and make conditional requests.
"""
def add_conditional_headers(self, url, headers):
"""
... | koery/win-sublime | Data/Packages/Package Control/package_control/downloaders/caching_downloader.py | Python | mit | 5,367 | 0.001491 |
from base64 import b64encode, b16encode, b64decode, b16decode
from math import ceil
__all__ = [
"b64max",
"b64len",
"b64from16",
"b64from256",
"b16len",
"b16max",
"b16from64",
"b16from256",
"HashString",
]
# Base 64 helpers for working in strings
# b64 encodes 6 bits per characte... | ashleywaite/django-more | django_more/hashing.py | Python | bsd-3-clause | 3,651 | 0 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | majorcs/fail2ban | fail2ban/tests/fail2banregextestcase.py | Python | gpl-2.0 | 6,546 | 0.019554 |
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Stephane Eicher <seicher@compassion.ch>
#
# The licence is in the file __manifest__.py
#
####################################################################... | CompassionCH/compassion-modules | sponsorship_compassion/models/contracts_report.py | Python | agpl-3.0 | 10,144 | 0.00138 |
# The version of Django Evolution
#
# This is in the format of:
#
# (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (0, 6, 6, 'alpha', 0, False)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2]
... | dekom/threepress-bookworm-read-only | bookworm/django_evolution/__init__.py | Python | bsd-3-clause | 1,410 | 0.001418 |
"""
This module contains functions to analyze periodic data.
"""
from __future__ import division, print_function
import numpy as np
def folded_shape(array, period_samples):
if period_samples == 0:
raise ValueError("Cannot fold unmodulated data or with period=0")
shape = list(array.shape)
shape[-1]... | ColumbiaCMB/kid_readout | kid_readout/analysis/timeseries/periodic.py | Python | bsd-2-clause | 1,094 | 0.001828 |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
import socketio.sdjango
from fabric_bolt.core import views
socketio.sdjango.autodiscover()
admin.autodiscover()
urlpatterns = [
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(... | paperreduction/fabric-bolt | fabric_bolt/core/urls.py | Python | mit | 1,071 | 0.001867 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ckeditor_uploader.fields
import django.utils.timezone
from django.conf import settings
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | liqd/a4-meinberlin | meinberlin/apps/newsletters/migrations/0001_initial.py | Python | agpl-3.0 | 1,979 | 0.005558 |
# -*- coding:utf-8 -*-
from models.base import SqlBaseModel
class Model(SqlBaseModel):
def __init__(self):
super(Model, self).__init__(db_name='blog')
Base = Model().Base
| wecatch/app-turbo | demos/models/blog/base.py | Python | apache-2.0 | 188 | 0 |
# !/usr/bin/env python
# coding=utf-8
"""
Configuration for vcr samples.
"""
import logging
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
HOST = 'http://vcr.bj.baidubce.com'
AK = 'Fill AK here'
SK = 'Fill SK here'
logger = logging.getLogg... | baidubce/bce-sdk-python | sample/vcr/vcr_sample_conf.py | Python | apache-2.0 | 675 | 0.002963 |
mapsize = 35
def test(x, y):
if <weak_warning descr="Simplify chained comparison">0 <= x < <caret>mapsize and y >= 0 and y < mapsize</weak_warning>:
return 1 | asedunov/intellij-community | python/testData/inspections/ChainedComparison5.py | Python | apache-2.0 | 164 | 0.060976 |
from xml.etree.cElementTree import parse, Element, ElementTree, dump
from os import walk
from os.path import join
from optparse import OptionParser
description = "Update the master package.config from individual project ones."
command_group = "Developer tools"
# Snippet used from the ElementTree documentation.
# Tidy... | broonie89/loadify-1 | lib/ohdevtools/commands/update-nuget.py | Python | mit | 2,276 | 0.005712 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This contains a 128x128 px thumbnail in PNG format
# Taken from http://www.zwahlendesign.ch/en/node/20
# openoffice_icons/openoffice_icons_linux/openoffice11.png
# License: Freeware
import base64
iconstr = """\
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAAG0OVFdAAAABGdBTUEAANbY1E9Y... | chirilo/mozillians | vendor-local/lib/python/tablib/packages/odf3/thumbnail.py | Python | bsd-3-clause | 31,736 | 0.000095 |
# This file is part of beets.
# Copyright 2013, 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, ... | iamdankaufman/beets | beets/autotag/__init__.py | Python | mit | 9,819 | 0 |
# Copyright 2011 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 requ... | HybridF5/jacket | jacket/api/compute/openstack/compute/deferred_delete.py | Python | apache-2.0 | 3,026 | 0.00033 |
# $Id$
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
This module contains practical examples of Docutils client code.
Importing this module from client code is not recommended; its contents are
subject to change in future Docutils releases. Instead, i... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python3/docutils/examples.py | Python | mit | 3,913 | 0.000511 |
from django.core.management.base import BaseCommand
from django_brfied.models import UnidadeFederativa, Municipio
from ...migrations import UNIDADE_FEDERATIVA_ROWS, MUNICIPIO_ROWS
class Command(BaseCommand):
help = "Importa as UFs e os Municípios para a base"
# requires_system_checks = False
# def __init... | kelsoncm/django_brfied | django_brfied/management/commands/importar_uf_municipio.py | Python | mit | 1,647 | 0.00365 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | wheeler-microfluidics/zmq-plugin | zmq_plugin/_version.py | Python | lgpl-2.1 | 18,459 | 0 |
# 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
# d... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/neutronclient/tests/functional/test_clientlib.py | Python | mit | 3,224 | 0 |
import unittest
from botlang import BotlangSystem
from botlang.extensions.storage import StorageApi
class DummyStore(StorageApi):
def __init__(self):
self.backend = {}
def put(self, key, value, expiration=None):
self.backend[key] = value
def get(self, key):
return self.backend.... | PostCenter/botlang | tests/storage/test_storage_extensions.py | Python | mit | 3,005 | 0.000333 |
#!/usr/bin/env python
from scipy import sparse
from sklearn.datasets import dump_svmlight_file
from sklearn.preprocessing import LabelEncoder
import argparse
import logging
import numpy as np
import os
import pandas as pd
from kaggler.util import encode_categorical_features, normalize_numerical_feature
logging.bas... | drivendata/countable-care-3rd-place | src/generate_feature9.py | Python | mit | 2,602 | 0.001922 |
# RUN: %python -m artiq.compiler.testbench.signature %s >%t
with interleave:
delay(1.0)
t0 = now_mu()
print(t0)
| JQIamo/artiq | artiq/test/lit/local_access/parallel.py | Python | lgpl-3.0 | 121 | 0 |
"""Plug-in module to store requirements in a Veracity repository."""
from doorstop import common
from doorstop.core.vcs.base import BaseWorkingCopy
log = common.logger(__name__)
class WorkingCopy(BaseWorkingCopy):
"""Veracity working copy."""
DIRECTORY = '.sgdrawer'
IGNORES = ('.sgignores', '.vvignore... | elewis33/doorstop | doorstop/core/vcs/veracity.py | Python | lgpl-3.0 | 959 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | resmo/ansible | lib/ansible/modules/cloud/google/gcp_spanner_instance_info.py | Python | gpl-3.0 | 5,026 | 0.004377 |
#!/usr/bin/env python3
import click
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import rc
import numpy as np
import pandas as pd
prop1range = [0.0, 1.0] # VF
prop2range = [0.0, 800.0] # ML
num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx
fsl = fs = 8
rc('font',**{'family':'sans-serif','... | WilmerLab/HTSOHM-dev | analysis/figure_ml_vs_vf.py | Python | mit | 2,118 | 0.010387 |
# Copyright 2007 Joe Wreschnig
# 2012-2016 Christoph Reiter
#
# 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, ... | Meriipu/quodlibet | gdist/__init__.py | Python | gpl-2.0 | 7,826 | 0 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
import m1
import m2
import m3
a = 5
b = 6
assert m1.m1a == 1
assert m2.m2a == 1
assert m3.m3a == 1
| blueyed/coveragepy | tests/farm/html/src/main.py | Python | apache-2.0 | 257 | 0 |
import importlib
from django.conf import settings
from django.views import View
class BaseView(View):
"""后台管理基类"""
def __init__(self):
self.context = {}
self.context["path"] = {}
def dispatch(self,request,*args,**kwargs):
_path = request.path_info.split("/")[1:]
self.contex... | wdcxc/blog | admin/views/base.py | Python | mit | 789 | 0.014157 |
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
# 2013, 2014, 2015 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 versio... | nharraud/invenio | invenio/legacy/webstyle/templates.py | Python | gpl-2.0 | 27,002 | 0.004555 |
#!/usr/bin/python
#
# Problem: Endless Knight
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
# Comments: OK for large, but may time out on small.
from itertools import *
MOD = 10007
# Precompute factorial table mod MOD
fact = [1] * MOD
for i in xrange(1, MOD):
fact[i]... | KirarinSnow/Google-Code-Jam | Round 3 2008/D1.py | Python | gpl-3.0 | 2,492 | 0.006019 |
"""
Quickly, quickly deploy and manage cloud servers
Copyright (C) 2014 Trey Tabner <trey@tabner.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your opti... | treytabner/quickly | quickly/shell.py | Python | gpl-3.0 | 2,887 | 0 |
# return_codes.py
#
# Copyright (C) 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Return codes of binaries used throughout this project.
class RC(object):
"""Return codes of binaries used throughout this project. See ``source``
for more details."""
SUCCESS = 0... | KanoComputing/kano-feedback | kano_feedback/return_codes.py | Python | gpl-2.0 | 550 | 0 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="scattermapbox", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | plotly/python-api | packages/python/plotly/plotly/validators/scattermapbox/_hoverlabel.py | Python | mit | 2,062 | 0.000485 |
# -*- coding: utf-8 -*-
from django.db import models
class Project(models.Model):
id = models.AutoField(primary_key=True)
project = models.CharField(max_length=255)
user = models.CharField(max_length=255)
password = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now=True)... | globocom/vault | identity/models.py | Python | apache-2.0 | 408 | 0 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright (c) 2016, Adfinis SyGroup AG
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
# 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
... | tszym/ansible | lib/ansible/modules/cloud/univention/udm_dns_zone.py | Python | gpl-3.0 | 7,158 | 0.00964 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Linux platform implementation."""
from __future__ import division
import base64
import errno
import os
import re
import socket
... | ztop/psutil | psutil/_pslinux.py | Python | bsd-3-clause | 40,128 | 0.0001 |
#!/usr/bin/env python
"""
Setup script for Rutgers Repository Utils.
"""
import distutils
import sys
from distutils.core import setup
setup(name = 'rutgers-repository-utils',
version = '1.3',
description = 'Python scripts for repository management',
author = ... | oss/rutgers-repository-utils | setup.py | Python | gpl-2.0 | 858 | 0.039627 |
import numpy as np
import keras as ks
import matplotlib.pyplot as plt
from keras.datasets import boston_housing
from keras import models
from keras import layers
from keras.utils.np_utils import to_categorical
(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()
mean = train_data.mean(... | FiveEye/ml-notebook | dlp/ch3_3_boston_housing.py | Python | mit | 1,900 | 0.007368 |
from . import manager
def warm_up_redis_func(app=None, db=None, user_model=None, redis_store=None):
not_available = set()
available = set()
cur = db.session.connection().connection.cursor()
cur.execute("""
SELECT taxi.id AS taxi_id, vd.status, vd.added_by FROM taxi
LEFT OUTER JOIN vehicle ON veh... | l-vincent-l/APITaxi | APITaxi/commands/warm_up_redis.py | Python | agpl-3.0 | 1,795 | 0.002786 |
# created by Angus Clark 9/2/17 updated 27/2/17
# ToDo impliment traceroute function into this
# Perhaps get rid of unnecessary itemediate temp file
import socket
import os
import json
import my_traceroute
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '130.56.253.43'
#print host
port = 5201 # Change ... | wmizzi/tn2capstone | ServerScript/recievestore.py | Python | bsd-2-clause | 1,705 | 0.017009 |
'''
@date Aug 28, 2010
@author: Matthew A. Todd
This file is part of Test Parser
by Matthew A. Todd
Test Parser is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option... | matcatc/Test_Parser | src/TestParser/View/Tkinter/__init__.py | Python | gpl-3.0 | 714 | 0.002801 |
# -*- coding: utf-8 -*-
import pytest
import validators
@pytest.mark.parametrize(('value', 'min', 'max'), [
(12, 11, 13),
(12, None, 14),
(12, 11, None),
(12, 12, 12)
])
def test_returns_true_on_valid_range(value, min, max):
assert validators.between(value, min=min, max=max)
@pytest.mark.parame... | kvesteri/validators | tests/test_between.py | Python | mit | 863 | 0 |
# (c) 2012-2013, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | dlab-berkeley/collaboratool-archive | bsd2/vagrant-ansible/ansible/lib/ansible/playbook/play.py | Python | apache-2.0 | 27,767 | 0.005258 |
"""
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... | Thielak/program-y | src/programy/parser/template/maps/predecessor.py | Python | mit | 1,445 | 0.00692 |
# -*- 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 'Group.results'
db.delete_column('scorebrd_group', 'results_id')
# Adding M2M tabl... | xlcteam/scoreBoard | scorebrd/migrations/0009_auto__del_field_group_results.py | Python | bsd-3-clause | 7,683 | 0.00807 |
import logging
import redis
from django.conf import settings
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordChangeView
from django.http import H... | hoelsner/product-database | django_project/views.py | Python | mit | 7,479 | 0.002139 |
#!/usr/bin/env python
"""@package letsacme
################ letsacme ###################
This script automates the process of getting a signed TLS/SSL certificate
from Let's Encrypt using the ACME protocol. It will need to be run on your
server and have access to your private account key.
It gets both the certificate a... | neurobin/test | test1.py | Python | mit | 876 | 0.001142 |
"""Support for EDL21 Smart Meters."""
from __future__ import annotations
from datetime import timedelta
import logging
from sml import SmlGetListResponse
from sml.asyncio import SmlProtocol
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const imp... | jawilson/home-assistant | homeassistant/components/edl21/sensor.py | Python | apache-2.0 | 11,383 | 0.000264 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('fastapp', '0010_auto_20150910_2010'),
]
operations = [
migrations.AddField(
model_name='thread',
nam... | sahlinet/fastapp | fastapp/migrations/0011_thread_updated.py | Python | mit | 451 | 0 |
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "congrefor.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
#from django.core.wsgi import get_wsgi_application
#from dj_static import Cling
#application = Cling(get_wsgi_application())
| renanalencar/congrefor | congrefor/wsgi.py | Python | mit | 296 | 0.013514 |
# coding=utf-8
# Лекция http://uneex.ru/LecturesCMC/PythonIntro2014/03_DataTypes
import decimal
import random
# print decimal.Decimal(1.1) + decimal.Decimal(1.1)
# print decimal.Decimal("1.1") + decimal.Decimal("1.1")
# print dir(random)
a = []
for j in range(0, 10):
a.append(random.randrange(100))
print a
| pasko-evg/Python-2014 | Lecture03/lecture_03.py | Python | unlicense | 321 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.