code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python2
import requests
import time
import json
import sys
if len(sys.argv) < 2:
raise Exception('no host')
host = sys.argv[1]
if len(sys.argv) > 2:
port = sys.argv[2]
else:
port = 8080
names = [line.strip().rstrip(' \xc2\xa0') for line in open('names.txt')]
coords = []
for p in [line.strip(... | navicore/oemap | www/test/simulateMap/runme.py | Python | apache-2.0 | 1,205 |
# 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/.
from django.conf.urls import patterns, url
from rest_framework import routers
from . import views
router = routers.Def... | jgmize/rna | rna/urls.py | Python | mpl-2.0 | 594 |
from unittest.mock import Mock
from aquarius.Interactor import Interactor
from aquarius.Persistence import Persistence
from aquarius.interactors.AddBookInteractor import AddBookInteractor
from aquarius.objects.Book import Book
from aquarius.objects.BookFormat import BookFormat
from tests.interactors.InteractorTestBase ... | jeroanan/Aquarius | tests/interactors/TestAddBookInteractor.py | Python | gpl-3.0 | 2,437 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2016 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | phantomii/restalchemy | restalchemy/tests/functional/restapi/sa_based/microservice/db.py | Python | apache-2.0 | 1,082 |
#!/usr/bin/env python3
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contrac... | CSD-Public/stonix | src/tests/rules/unit_tests/zzzTestRuleShowBluetoothIcon.py | Python | gpl-2.0 | 3,421 |
# Copyright 2017 Datera
# 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 applic... | j-griffith/cinder | cinder/volume/drivers/datera/datera_common.py | Python | apache-2.0 | 17,778 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import logging
from six.moves import filter # @UnresolvedImport
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from dj... | thoma5B/Django-Wiki | wiki/models/urlpath.py | Python | gpl-3.0 | 13,554 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class customized_rfq(models.Model):
_inherit=["purchase.order"]
@api.model
def _default_rfq_template(self):
company_obj = self.env['res.company']
company = self.env['res.users'].browse([self.env.user.id]).company_id
if not company.templ... | optima-ict/odoo | addons/professional_templates/models/rfq.py | Python | agpl-3.0 | 1,040 |
def example_BackgroundCall():
import urllib,time
def work():
return urllib.urlopen('http://www.python.org/').read()
bkcall=BackgroundCall(work)
print 'work() executing in background ...'
while not bkcall.is_done():
print '.',
time.sleep(0.010)
print 'done.'
print bkca... | ActiveState/code | recipes/Python/491280_BackgroundCall_Threading_like/recipe-491280.py | Python | mit | 2,587 |
from django.conf import settings
from django.views.generic.detail import DetailView
from .models import MenuLink
class PageView(DetailView):
"""
Show a page
Template: ``page.html``
Specific context variable: ``menu_link``
"""
template_name = '{0}/page.html'.format(settings.CURRENT_SKIN)
... | romanvm/romans_blog | pages/views.py | Python | gpl-3.0 | 399 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | fogelomer/cloudify-telegraf-plugin | telegraf_plugin/tasks.py | Python | apache-2.0 | 7,442 |
from sense_hat import SenseHat
###Egg Drop###
###Coded by dan_aldred###
###Based on micro:bit game###
import time
import random
sense = SenseHat()
sense.clear()
global game_over
global score
game_over = False
basket_x = 7
score = 0
'''main pitch measurement'''
def basket_move(pitch, basket_x):
sense.set_pixel(... | TeCoEd/Egg-Drop | old_version.py | Python | mit | 2,807 |
from django.test import TestCase
from .models import Parent, Child, SignedParent
from django_rest_cryptingfields.serializer_fields import CryptingCharField, Crypter
from rest_framework import serializers
from keyczar import errors
from .serializers import getParentCharFieldSerializerClass, getParentCharFieldMaxSixLengt... | russellmorley/django_rest_cryptingfields | tests/tests.py | Python | mit | 7,474 |
#
# Copyright (c) 2010 Red Hat, 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 t... | redhataccess/redhat-support-lib-python | src/redhat_support_lib/api.py | Python | apache-2.0 | 9,207 |
# -*- coding: utf-8 -*-
# Copyright 2022 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-monitoring | samples/generated_samples/monitoring_v3_generated_notification_channel_service_verify_notification_channel_async.py | Python | apache-2.0 | 1,617 |
""" Submissions Admin Views. """
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from submissions.models import Score, ScoreSummary, StudentItem, Submission, TeamSubmission
class StudentItemAdminMixin:
"""Mix this class into anything that has a student_... | edx/edx-submissions | submissions/admin.py | Python | agpl-3.0 | 5,223 |
# -*- coding: UTF-8 -*-
# Copyright 2017 Luc Saffre
#
# License: BSD (see file COPYING for details)
"""
"""
from lino.api import rt
def objects():
from lino_xl.lib.phones.mixins import ContactDetailsOwner
for m in rt.models_by_base(ContactDetailsOwner):
for p in m.objects.all():
p.propa... | khchine5/xl | lino_xl/lib/phones/fixtures/demo2.py | Python | bsd-2-clause | 363 |
from sympy import Symbol, S, oo, sqrt
from sympy.calculus.codomain import codomain, not_empty_in
from sympy.sets.sets import Interval, FiniteSet, Complement, Union
from sympy.utilities.pytest import XFAIL, raises
def test_codomain():
x = Symbol('x', real=True)
assert codomain(x, Interval(-1, 1), x) == Interva... | atreyv/sympy | sympy/calculus/tests/test_codomain.py | Python | bsd-3-clause | 4,793 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2016 Alex Forencich
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 righ... | Diti24/python-ivi | ivi/tektronix/tektronixMDO3012.py | Python | mit | 1,724 |
""" This module contains the Video and Movie class and functions. """
import webbrowser
class Video():
def __init__(self, title, duration):
self.title = title
self.duration = (duration)
class Movie(Video): # The main class for movie-trailer website
valid_ratings = ... | cooldiplomat/movie-trailer | media.py | Python | mit | 1,015 |
# -*- coding: utf-8 -*-
import re
import itertools
from scrapy import log
from scrapy.selector import Selector
from summaries.items import SummariesItem
from thread_float_bbs import (
SequenceAppend,
ThreadFloatBbsSpider
)
class OnecallSpider(ThreadFloatBbsSpider):
""" for onecall.livedoor.biz
"""
... | ikeikeikeike/scrapy-2ch-summary-spiders | onecall.py | Python | mit | 3,020 |
from django.forms import ModelForm, ValidationError
from app.models import AppOne
import re
class FormAppOne(ModelForm):
class Meta:
model = AppOne
def clean_name(self):
cleaned_name = self.cleaned_data.get('name')
if re.findall('\d+', cleaned_name):
raise ValidationError(... | valdergallo/mock_django_orm | app/forms.py | Python | mit | 374 |
import _plotly_utils.basevalidators
class GridwidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="gridwidth", parent_name="layout.ternary.caxis", **kwargs
):
super(GridwidthValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/caxis/_gridwidth.py | Python | mit | 467 |
import contextlib
import os
import sys
from itertools import takewhile
from exceptions import BundleError
__all__ = ('md5_constructor', 'pickle', 'set', 'StringIO',
'common_path_prefix', 'working_directory')
if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.md5
else:
im... | mozilla/verbatim | vendor/lib/python/webassets/utils.py | Python | gpl-2.0 | 6,430 |
# -*- coding: utf-8 -*-
try:
from PIL import Image
except ImportError:
import Image
import glob
import os
from module.plugins.internal.OCR import OCR
class LinksaveIn(OCR):
__name__ = "LinksaveIn"
__type__ = "ocr"
__version__ = "0.15"
__status__ = "testing"
__description__ = ""... | fzimmermann89/pyload | module/plugins/captcha/LinksaveIn.py | Python | gpl-3.0 | 4,613 |
import urllib2,smtplib,sys,time,datetime
from ConfigParser import SafeConfigParser
#Parsing Config File
parser = SafeConfigParser()
parser.read('config.cfg')
smtpUrl= parser.get('MMI', 'smtpUrl')
username = parser.get('MMI', 'username')
password = parser.get('MMI', 'password')
fromaddr = parser.get('MMI... | sai-prasanna/sendmyip | sendmyip/sendmyip.py | Python | mit | 1,436 |
#!/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 ***
#
... | t794104/ansible | lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py | Python | gpl-3.0 | 9,851 |
import os
import re
import copy
import math
import time
import glob
import shutil
import pickle
import pathlib
import warnings
import functools
import importlib
import itertools
from ..utils import _get_fn_name, prod, progbar
from .combo_runner import (
nan_like_result,
combo_runner_core,
combo_runner_to_d... | jcmgray/xyzpy | xyzpy/gen/cropping.py | Python | mit | 55,241 |
from classes import wunderpy_wrapper
from classes import grocerylist
from classes import grocerystore
wp = wunderpy_wrapper.wunderpy_wrapper('../data/tokens.csv')
obj = wp.get_task_positions_obj(wp.WUNDERLIST_GROCERY)
grocery_store = grocerystore.groceryStore('../data/store_order_zehrs.csv', '../data/ingredient_categ... | briancousins/RecipeBook | tests/test_grocerylist.py | Python | mit | 784 |
import logging
import threading
_lock = threading.Lock()
_logger = None
_name = 'root'
_level = logging.DEBUG
def get_logger():
"""Returns a "global" logger.
Args:
level (optional): The logging level.
name (optional): The name of the logger.
"""
global _lock
global _logger
... | robotarium/vizier | vizier/log.py | Python | mit | 790 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import time
from django.test import TestCase
from lrucache_backend import LRUObjectCache
# functions/classes for complex data type tests
def f():
return 42
class C(object):
def m(n):
return 24
class ... | kogan/django-lrucache-backend | tests/test_backend.py | Python | mit | 16,098 |
from PySide import QtGui, QtCore, QtWebKit
import pygal, os, sys
if getattr(sys, 'frozen', False):
# frozen
program_location = os.path.dirname(sys.executable)
else:
# unfrozen
program_location = os.path.dirname(os.path.realpath(__file__))
monitor_archive = os.path.join(program_location, 'monitor archi... | Symphonia/Searcher | no longer supported/MonitorGraph.py | Python | mit | 6,090 |
from django import forms
from django.contrib import messages
from django.utils import timezone
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from crispy_forms.layout import Layout, Div, HTML, Field
from crispy_forms.he... | eeriks/velo.lv | velo/payment/forms.py | Python | gpl-3.0 | 19,328 |
from django.conf.urls import patterns, include, url
from rememerme.sessions.rest import views
urlpatterns = patterns('',
url(r'^/?$', views.SessionsListView.as_view()),
url(r'^/(?P<session_id>[-\w]+)/?$', views.SessionsSingleView.as_view()),
)
| rememerme/sessions-api | rememerme/sessions/rest/urls.py | Python | apache-2.0 | 254 |
from io import StringIO
import re
import linesep
scenarios = [
(
"empty",
{
"text": "",
"sep": "\n",
"preceded": [],
"terminated": [],
"separated": [""],
"preceded_retained": [],
"terminated_retained": [],
... | jwodder/linesep | test/test_core/test_split_text.py | Python | mit | 18,169 |
# 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 ... | NeCTAR-RC/cinder | cinder/volume/drivers/xenapi/sm.py | Python | apache-2.0 | 10,307 |
import nltk
text1 = nltk.Text(nltk.word_tokenize(text.lower().replace('.', ' ')))
freq = FreqDist(text1)
keys = freq.keys()[:200]
str = ""
for k in keys:
str = str + k +'\n'
open('stopwords', 'r+').write(str) | 1wheel/whalewords | makeStopWords.py | Python | mit | 211 |
# Copyright 2019 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 agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/base/modules.py | Python | apache-2.0 | 2,700 |
def main():
print('here')
pass
if (__name__ == '__main__'):
main()
| LairdStreak/MyPyPlayGround | tujData/tujInscriptionAdvice.py | Python | mit | 90 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
#
# Xcode supports build variable substitutions and CPP; sadly, that doesn't work
# because:
#
# 1. Xcode wants to do the Info.pli... | endlessm/chromium-browser | build/mac/tweak_info_plist.py | Python | bsd-3-clause | 13,521 |
'''
Harvester for the ASU Digital Repository for the SHARE project
Example API call: http://udspace.udel.edu/dspace-oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UdelHarvester(OAIHarvester):
short_name = 'udel'
long_... | fabianvf/scrapi | scrapi/harvesters/udel.py | Python | apache-2.0 | 702 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/legacy/common/utils.py | Python | gpl-3.0 | 7,100 |
# This stores all the dialogue related stuff
import screen
class Dialogue(object):
"""Stores the dialogue tree for an individual NPC"""
def __init__(self, npc):
super(Dialogue, self).__init__()
self.npc = npc
self.game = npc.game
self.root = None
self.currentNode = None
def setRootNode(self... | mjdarby/RogueDetective | dialogue.py | Python | gpl-2.0 | 2,401 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Author: echel0n <sickrage.tv@gmail.com>
# URL: http://www.github.com/sickragetv/sickrage/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | mcus/SickRage | sickbeard/providers/cpasbien.py | Python | gpl-3.0 | 4,884 |
# Copyright 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 applicable law ... | petrutlucian94/nova_dev | nova/api/openstack/compute/contrib/user_data.py | Python | apache-2.0 | 949 |
##############################################################################
# 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... | lgarren/spack | var/spack/repos/builtin/packages/fastqvalidator/package.py | Python | lgpl-2.1 | 2,230 |
#
# main.py -- reference viewer for the Ginga toolkit.
#
# Eric Jeschke (eric@naoj.org, eric@redskiesatnight.com)
#
"""
Copyright (c) 2011-2015 Eric R. Jeschke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are... | eteq/ginga | ginga/main.py | Python | bsd-3-clause | 21,410 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-07-19 12:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | pythonkr/pyconapac-2016 | pyconkr/migrations/0011_auto_20160719_2118.py | Python | mit | 1,051 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "muebles_quetzal.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| AlexMaguey/ESCOM-C1-PP1 | muebles_quetzal/manage.py | Python | gpl-3.0 | 258 |
# -*- coding: utf-8 -*-
r"""Useful constants for neutron scattering calculations, including:
* ``magnetic_form_factors()`` : Magnetic Ion j-values
* ``periodic_table()`` : Periodic table values
* ``scattering_lengths()`` : Neutron scattering lengths
* ``symmetry()`` : Space group information
* ``JOULES_TO_MEV`` : Joul... | granrothge/neutronpy | neutronpy/constants.py | Python | mit | 2,584 |
# Copyright (c) 2010-2012 OpenStack, 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 agreed to ... | Triv90/SwiftUml | swift/proxy/controllers/obj.py | Python | apache-2.0 | 50,946 |
import recordings as recordings
import numpy as np
import operator
import math
samplerate=44100.0
from scipy.signal import argrelmax
from essentia.standard import *
def silenceGaps(frames,order=20):
from scipy.signal import argrelmax
consecutiveNumbers = [0]
for i in range(0,len(frames)-2):
... | bastustrump/genimpro | grouping.py | Python | mit | 2,122 |
from paddle.trainer_config_helpers import *
settings(batch_size=1000, learning_rate=1e-4)
probs = data_layer(name='probs', size=100)
outputs(
sampling_id_layer(input=probs), # It seems not support training
# It seems this layer is not correct, and should be rewrite.
# block_expand_layer(input=probs, cha... | helinwang/Paddle | python/paddle/trainer_config_helpers/tests/configs/unused_layers.py | Python | apache-2.0 | 353 |
#!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from pkg_resources import parse_version
def check_dependencies():
'''
setuptools causes problems for installing packages (especially
statsmodels). Use this function to abort installati... | keflavich/TurbuStat | setup.py | Python | mit | 3,706 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
# Install prereqs here and now if we can.
from setuptools import setup
kw = { 'install_requires': [
'pygit2>=0.16.1',
'json_diff>=1.2.9'
] }
except ImportError:
from distutils.core import setup
print 'No setuptools. Do\n\n ... | talos/jsongit | setup.py | Python | bsd-3-clause | 1,102 |
"""MySensors platform that offers a Climate (MySensors-HVAC) component."""
from homeassistant.components import mysensors
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, HVAC_MODE_AUTO,
HVAC_MODE... | jabesq/home-assistant | homeassistant/components/mysensors/climate.py | Python | apache-2.0 | 6,774 |
import numpy as np
from ..weight import RankingBasedSelection
class NESSelection(RankingBasedSelection):
"""
This selection scheme is Non-increasing transformation as NES weight. See also,
[Wierstra et. al., 2014]<http://jmlr.org/papers/v15/wierstra14a.html>
"""
def transform(self, rank_based_val... | satuma777/evoltier | evoltier/selection/nes_selection.py | Python | gpl-3.0 | 510 |
'''
This code is forked from https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
and modified to use as MXNet-Keras integration testing for functionality and sanity performance
benchmarking.
Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of... | likelyzhao/mxnet | tests/nightly/mxnet_keras_integration_tests/test_mnist_mlp.py | Python | apache-2.0 | 3,578 |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras.utils.test_utils import layer_test, keras_test
from keras.utils.np_utils import conv_input_length
from keras import backend as K
from keras.layers import convolutional, pooling
@keras_test
def test_convolution_1d():
nb_samples ... | nebw/keras | tests/keras/layers/test_convolutional.py | Python | mit | 20,892 |
#!/usr/bin/env python
__author__ = "Jesse Zaneveld"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Jesse Zaneveld", "Rob Knight"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Jesse Zaneveld"
__email__ = "zaneveld@gmail.com"
__status__ = "Development"
from sys import argv
from... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/parse/kegg_taxonomy.py | Python | mit | 3,470 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
import random
import re
import tempfile
import flask
import numpy as np
import werkzeug.exceptions
from .forms import ImageClassificationModelForm
from .job import ImageClassificationModelJob
import ... | AgentVi/DIGITS | digits/model/images/classification/views.py | Python | bsd-3-clause | 25,236 |
"""
Admin site bindings for splash screen
"""
from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin
from splash.models import SplashConfig
admin.site.register(SplashConfig, ConfigurationModelAdmin)
| GbalsaC/bitnamiP | django-splash/splash/admin.py | Python | agpl-3.0 | 236 |
def main() -> None:
S = [1 if s == "R" else -1 for s in input()]
N = len(S)
ans = [0] * N
for i in range(N-1):
if S[i] == 1 and S[i+1] == -1:
left, right = i, i+1
while left >= 0 and S[left] == 1:
ans_idx = i if (i - left) % 2 == 0 else i+1
... | knuu/competitive-programming | atcoder/abc/abc136_d.py | Python | mit | 595 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2017 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# 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, either version 3 of the
# Licen... | ndp-systemes/odoo-addons | odoo_online_documentation/odoo_online_documentation.py | Python | agpl-3.0 | 5,053 |
import inspect
import os
class Shim(object):
_instances = {}
def __init__(self, target, xtb):
self.target = target
self.xtb = xtb
def __repr__(self):
raise NotImplementedError()
@classmethod
def get_instance(cls, target, xtb):
oid = id(target)
if oid not... | Hypernode/xtraceback | xtraceback/shim.py | Python | mit | 1,261 |
#!/usr/bin/python3
from amazonia.classes.asg_config import AsgConfig
from amazonia.classes.amz_autoscaling import AutoscalingLeaf
from amazonia.classes.block_devices_config import BlockDevicesConfig
from amazonia.classes.elb_config import ElbConfig, ElbListenersConfig
from troposphere import Template
def main():
... | GeoscienceAustralia/Geodesy-Web-Services | aws/amazonia/test/sys_tests/test_sys_autoscaling_leaf.py | Python | bsd-3-clause | 2,660 |
print('Got this: "%s"' % input())
import sys
data = sys.stdin.readline()[:-1]
print('The meaning of life is', data, int(data) * 2)
| simontakite/sysadmin | pythonscripts/programmingpython/System/Streams/reader.py | Python | gpl-2.0 | 135 |
__version_info__ = (0, 3, 0)
__version__ = ".".join(str(x) for x in __version_info__)
| Pulgama/supriya | supriya/_version.py | Python | mit | 86 |
import os
import shutil
import logging
import json
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from colorz import order_by_hue
from django.core.files.storage import default_storage
from core.management.commands import CommunityCommand
from core.utils.configuration import DecodeConfigAct... | fako/datascope | src/future_fashion/management/commands/match_image_colors.py | Python | gpl-3.0 | 6,593 |
#!/usr/bin/env python
# encoding: utf-8
from dnslib import DNSHeader, DNSRecord, RR, A
from gevent.server import DatagramServer
import re
class DnsCache():
def __init__(self):
self.cache = dict()
def get(self, domain):
return self.cache.get(domain, None)
def set(self, dom... | ZenQ3/PyDNS | server.py | Python | mit | 1,588 |
# -*- coding: utf-8 -*-
#
# Converse.js documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 26 20:48:03 2013.
#
# 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.
#
#... | deependhulla/technomail-debian | files/html_oldx/groupoffice/modules/chat/converse.js-0.8.6/docs/source/conf.py | Python | gpl-3.0 | 9,866 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
}
}
INSTALLED_APPS = (
'memoize',
)
SECRET_KEY = "1234EFGH"
| vinu76jsr/django-memoize | test_settings.py | Python | bsd-3-clause | 148 |
import copy
import json
import re
from typing import Any, Dict, List, Mapping, Optional
import markdown
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
from zerver.openapi.openapi import check_deprecated_consistency, get_openapi_return_values
from .api_arguments_table_genera... | punchagan/zulip | zerver/lib/markdown/api_return_values_table_generator.py | Python | apache-2.0 | 9,063 |
#
# Exercises from http://learnpythonthehardway.org
#
print
# Exercise 1
print "Really? :)"
print "I'm not writing a hello world, am I?"
print 'No way!!! Where\'s the link to the next exercise?'
print 'Oh, right, "double quotes" in print; next, please'
print
# Exercise 2
print "I think my previous code shows that I... | CodeCatz/litterbox | Goranche/goranche.py | Python | mit | 1,530 |
import logging
from bearing.constants import BearingSource
from bearing.parsers.fractional import FractionalBearingParser
from bearing.parsers.rolling import RollingBearingParser
from bearing.parsers.swivel import SwivelBearingParser
logger = logging.getLogger()
class BearingParser(object):
map = {
Bea... | manti-by/POD | app/bearing/parser.py | Python | bsd-3-clause | 1,056 |
"""
Rivers of Blood
(Formely code named: Ocean World Ransom)
"""
#core
import pygame
from pygame.locals import *
import time
import sys
import owr_log as log
from owr_log import Log
import owr_image
import owr_input
import yaml
import owr_game
import owr_timer
from owr_util import YamlOpen
import owr_screenplay... | ghowland/sceneplay | owr.py | Python | mit | 3,918 |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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... | ktan2020/jpype | jpype/_jcollection.py | Python | apache-2.0 | 8,284 |
#!/usr/bin/env python
import sys, os
import subprocess
import struct
import hashlib
RRPACK_MAGIC = "PANDA_RR"
# PANDA Packed RR file format (all integers are little-endian):
# 0x00: magic "PANDA_RR"
# 0x08: uint64_t num_instructions
# 0x10: MD5 (16 bytes) of remaining data
# 0x20: archive data in .tar.xz format
if ... | KernelAnalysisPlatform/kvalgrind | scripts/rrunpack.py | Python | gpl-3.0 | 1,349 |
# Generated by Django 2.2.13 on 2020-06-22 14:01
import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sigad', '0051_auto_20200520_2037'),
]
... | cmjatai/cmj | cmj/sigad/migrations/0052_auto_20200622_1101.py | Python | gpl-3.0 | 1,351 |
#!/usr/bin/env python
"""Generates 4-in-a-row board positions, in integer format.
These are positions which are one piece away from winning.
"""
print """#ifndef FOUR_IN_A_ROW_BITSETS_H
#define FOUR_IN_A_ROW_BITSETS_H
/* Augomatically generated by gen-four-in-a-row-bitsets.py */
const long four_in_a_row_bitsets[] ... | adamhooper/code-from-adamhoopers-school-days | mcgill-se/ECSE426/ass1/helpers/gen-four-in-a-row-bitsets.py | Python | unlicense | 969 |
# -*- encoding:utf-8
from django.shortcuts import render,redirect
from django.http import HttpResponse,JsonResponse,HttpResponseBadRequest
from .models import Record
from .forms import RecordDate,CreateRecord
from datetime import datetime
from django.db.models import Sum
import json
import urllib
#from seconds to "hou... | y3kd4ad/counter | counter/views.py | Python | mit | 5,310 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
import frappe
from frappe import _, bold
from frappe.utils import cint
from frappe.model.naming import validate_name
from frappe.model.dynamic_links import get_dyn... | adityahase/frappe | frappe/model/rename_doc.py | Python | mit | 18,550 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from ..utils import check_solr
def setup():
check_solr()
| ruimashita/django-haystack | test_haystack/spatial/__init__.py | Python | bsd-3-clause | 165 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djignsdk.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| drayanaindra/django-ignsdk | djignsdk/manage.py | Python | bsd-3-clause | 251 |
"""
This module defines SwitchCtl class useful for switch controlling
Copyright 2011 Red Hat, Inc.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
jpirko@redhat.com (Jiri Pirko)
"""
import logging
import copy
import ... | jiriprochazka/lnst | obsolete/Switch/SwitchCtl.py | Python | gpl-2.0 | 1,140 |
import _plotly_utils.basevalidators
class Tick0Validator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="tick0", parent_name="layout.ternary.caxis", **kwargs
):
super(Tick0Validator, self).__init__(
plotly_name=plotly_name,
parent_name=paren... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/caxis/_tick0.py | Python | mit | 493 |
# Copyright 2014 CloudFounders NV
#
# 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... | sql-analytics/openvstorage | webapps/api/backend/views/backends.py | Python | apache-2.0 | 3,144 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Kingdread/qutebrowser | qutebrowser/browser/signalfilter.py | Python | gpl-3.0 | 3,233 |
from __future__ import print_function
import random
import tweepy
from spacenamer.generator import spacename
from words import WORDS
def generate_status(word=None):
at_reply = False
if word is None:
word = random.choice(WORDS)
if word[0] == '@':
word = word[1:]
at_reply = True... | ddbeck/SpaceNamer | spacenamer/publisher.py | Python | mit | 1,043 |
import os
import gp
import sys
import util
import tempfile
import numpy as np
import math
import numpy.random as npr
import scipy.linalg as spla
import scipy.stats as sps
import scipy.optimize as spo
import cPickle
import matplotlib.pyplot as plt
from Locker import *
def init(expt_dir, arg_string):
... | ninjin/spearmint-lite | GPEIConstrainedChooser.py | Python | gpl-3.0 | 44,400 |
import math
import mock
import time
import unittest2
from pykafka import KafkaClient
from pykafka.balancedconsumer import BalancedConsumer, OffsetType
from pykafka.test.utils import get_cluster, stop_cluster
from pykafka.utils.compat import range
def buildMockConsumer(num_partitions=10, num_participants=1, timeout=20... | jofusa/pykafka | tests/pykafka/test_balancedconsumer.py | Python | apache-2.0 | 7,018 |
#!/usr/bin/env python
import os
from kunai.log import logger
# linux only, because to problems for other os :)
# Basic USER_HZ, something like 100 (means 100 tick by seconds)
SC_CLK_TCK = os.sysconf_names['SC_CLK_TCK']
USER_HZ = os.sysconf(SC_CLK_TCK)
# For some cpu, we want the pct but the diff
# is an absolute ... | pombredanne/kunai-1 | kunai/cgroups.py | Python | mit | 5,468 |
# Copyright (c) 2013 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 ... | virlos/virl-salt | openstack/neutron/files/kilo/rpc.py | Python | gpl-2.0 | 11,220 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | natanielruiz/android-yolo | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/operator_pd_identity.py | Python | apache-2.0 | 7,686 |
# 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
# distributed under t... | stackforge/python-openstacksdk | openstack/network/v2/trunk.py | Python | apache-2.0 | 2,810 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
通道类
通过调用管理类对象的process_data函数实现信息的发送。
"""
import logging
import threading
logger = logging.getLogger('linkworld')
class BaseChannel(threading.Thread):
"""
基础设备通信类
针对每种通信模式实现各自的内容
"""
def __init__(self, network_name, channel_name, channel_protoco... | lianwutech/plugin_linkworld-discard- | libs/base_channel.py | Python | apache-2.0 | 861 |
#!/usr/bin/python -Es
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# selinux gui is a tool for the examining and modifying SELinux policy
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# ... | jpacg/su-binary | jni/selinux/python/sepolicy/sepolicy/gui.py | Python | gpl-2.0 | 133,535 |
import json
from urllib.parse import urljoin
class WebPage:
"""Models what's important to us about a web page"""
title = ""
links = []
images = []
scripts = []
def __init__(self, title="", links=None, images=None, scripts=None):
self.title = title
self.links = [] if links is N... | TransactCharlie/dembones | src/dembones/webpage.py | Python | mit | 1,103 |
__version__=''' $Id'''
__doc__='''basic tests.'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
setOutDir(__name__)
import unittest
def getrc(defns,depth=1):
from sys import getrefcount, _getframe
f = _getframe(depth)
G0 = f.f_globals
L = f.f_locals
if L is not G... | mattjmorrison/ReportLab | tests/test_rl_accel.py | Python | bsd-3-clause | 6,284 |
##
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | hpcugent/easybuild-easyblocks | easybuild/easyblocks/b/boost.py | Python | gpl-2.0 | 13,762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.