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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -
#
# This file is part of socketpool.
# See the NOTICE for more information.
import contextlib
import sys
import time
from socketpool.util import load_backend
class MaxTriesError(Exception):
pass
class MaxConnectionsError(Exception):
pass
class ConnectionPool(object):
"""Pool of co... | interactiveinstitute/watthappened | python_modules/socketpool/pool.py | Python | mit | 6,292 |
class DataSelectorError(Exception):
"""
Raised when failing to execute a step when calling DataSelector.transform
"""
pass
| edublancas/sklearn-evaluation | src/sklearn_evaluation/exceptions.py | Python | mit | 139 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# Copyright (c) 2008 ACYSOS S.L. (htt... | vauxoo-dev/l10n-spain | l10n_es_fiscal_year_closing/__openerp__.py | Python | agpl-3.0 | 3,570 |
#coding:utf-8
from cmd import Cmd
class Mycmd(Cmd):
def __init__(self):
Cmd.__init__(self)
self.prompt = '&>>'
def default(self, line):
print 'no found-->default', line
def do_help(self, arg):
print arg
def do_test(self, arg):
if not arg:
self.he... | Jayin/practice_on_py | CmdTest/myCmd.py | Python | mit | 687 |
from re import sub
from jinja2 import contextfunction
from flask import g, request, url_for, flash
from wtforms.validators import DataRequired, InputRequired
from flask_admin._compat import urljoin, urlparse, iteritems
from ._compat import string_types
def set_current_view(view):
g._admin_view = view
def get_... | Widiot/simpleblog | venv/lib/python3.5/site-packages/flask_admin/helpers.py | Python | mit | 3,409 |
# Copyright 2015 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/layers/python/layers/initializers.py | Python | bsd-2-clause | 6,169 |
#
# 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... | ganeshmurthy/qpid-dispatch | python/qpid_dispatch_internal/management/schema_doc.py | Python | apache-2.0 | 6,093 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.core.notifications import email_sender, make_email
from indico.modules.rb.notifications.reserv... | pferreir/indico | indico/modules/rb/notifications/reservation_occurrences.py | Python | mit | 2,485 |
#!/usr/bin/python
import os
import sys
import glob
import subprocess
import tempfile
SAMPLE = False
def find_grass():
"""Find GRASS installation.
"""
ins = subprocess.Popen(['grass', '--config', 'path'],
stdout=subprocess.PIPE)
out, err = ins.communicate()
os.environ['... | ctu-geoforall-lab/subdayprecip-design | grass/chmi_ufa/process_grass.py | Python | gpl-2.0 | 6,375 |
from __future__ import division
# The Hazard Library
# Copyright (C) 2012-2016 GEM Foundation
#
# 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
# License, or (at y... | rcgee/oq-hazardlib | openquake/hazardlib/tests/source/rupture_test.py | Python | agpl-3.0 | 10,789 |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2008 EVO Sistemas Libres <central@evosistemas.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 F... | olivergs/evogtk | evogtk/gui/accessclasslib/textview.py | Python | mit | 2,070 |
import string
template = string.Template("""
description "redis server memory database"
author contrail
# run when the local FS becomes available
start on local-filesystems
stop on shutdown
# The default redis conf has `daemonize = yes` and will naiively fork itself.
expect fork
# Respawn unless redis dies 10 times... | Juniper/contrail-provisioning | contrail_provisioning/collector/templates/redis_server_conf_template.py | Python | apache-2.0 | 534 |
"""
A library of functions (for now just one function) to create a thermal
(blackbody) spectrum.
"""
def planck_spec_lambda(T, lammin, lammax, showfig=True, returnspec=False):
"""
Generates a Planck spectrum in terms of wavelength, i.e., B_lambda(T).
Inputs:
T - temperature in K
lammin ... | cdfassnacht/CodeCDF | python/planck_spec.py | Python | mit | 511 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Johann Prieur <johann.prieur@gmail.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 2 of the License, or
# (at your option) an... | emesene/papyon | papyon/service/OfflineIM/scenario/sync_headers.py | Python | gpl-2.0 | 1,386 |
__all__ = (
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
)
def __get_version():
from os import path
here = path.abspath(path.dirname(__file__))
return(open(path.join(here, 'version.py')).read())
exec(__get_version())
__title__ = ... | kdheepak89/fono | fono/__init__.py | Python | bsd-3-clause | 605 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | mindriot101/bokeh | bokeh/sampledata/tests/test_sea_surface_temperature.py | Python | bsd-3-clause | 2,086 |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class LibcxxVectorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydi... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py | Python | bsd-3-clause | 7,165 |
import os, sys, imp
import tempfile
def _get_c_extension_suffix():
for ext, mod, typ in imp.get_suffixes():
if typ == imp.C_EXTENSION:
return ext
def compile_shared(csource, modulename):
"""Compile '_testcapi.c' or '_ctypes_test.c' into an extension module,
and import it.
"""
... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib_pypy/_pypy_testcapi.py | Python | mit | 2,147 |
#!/usr/bin/env python
#
# Example of one object under gravity with one contactor and a ground
# using the Siconos proposed mechanics API
#
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics
# Creation of the hdf5 file for input/output
... | bremond/siconos | examples/Mechanics/GeometricPrimitives/mesh.py | Python | apache-2.0 | 2,469 |
from django.db import models
from django.conf import settings
import logging
from logging.handlers import SysLogHandler
import threading
_LOCAL = threading.local()
def getlogger():
logger = getattr(_LOCAL, 'logger', None)
if logger is not None:
return logger
logger = logging.getLogger()
... | incuna/authentic | authentic2/admin_log_view/models.py | Python | agpl-3.0 | 1,450 |
#!/usr/bin/python
import subprocess
import unittest
import re
import os
from unittest import TestCase
regex_for_vagrantfile = re.compile(
"components/centos/centos-openshift-setup/Vagrantfile"
)
def is_openshift_custom_vagrantfile_modified():
"""Check if any custom vagrantfile is modified."""
modified_f... | dharmit/adb-tests | adb-vagrantfile-tests/openshift-tests/test-openshift.py | Python | gpl-2.0 | 2,669 |
#
# This program is distributed without any warranty and it
# can be freely redistributed for research, classes or private studies,
# since the copyright notices are not removed.
#
# Calculate the convolution between 2 arrays in python
#
# Jadson Santos - jadsonjs@gmail.com
#
#
# to run this exemple install pyhton modu... | jadsonjs/DataScience | image-processing/my_convolution.py | Python | apache-2.0 | 1,227 |
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.bcrypt import Bcrypt
from flask.ext.login import LoginManager
from flask.ext.bower import Bower
app = Flask(__name__)
bcrypt = Bcrypt(app)
login_manager = LoginManager()
login_manager.init_app(app)
app.config.from_object(os.en... | omarayad1/cantkeepup | app/__init__.py | Python | mit | 931 |
import shelve
class Library:
def __init__(self, fn):
self.fn = fn
self.shelf = shelve.open(fn)
def add(self, book):
self.shelf[book.isbn] = book
def get_by_title(self, title):
for book in self.shelf.values():
if book.title == title:
retu... | ceeblet/OST_PythonCertificationTrack | Python2/PersistentStorage/src/library.py | Python | mit | 1,417 |
import logging
import libsolace
from libsolace.Decorators import only_if_not_exists, only_if_exists, primary, backup
from libsolace.SolaceReply import SolaceReplyHandler
from libsolace.plugin import Plugin, PluginResponse
from libsolace.SolaceCommandQueue import SolaceCommandQueue
from libsolace.SolaceXMLBuilder import... | unixunion/python-libsolace | libsolace/items/SolaceVPN.py | Python | mit | 14,694 |
# wind barbs over time (x axis) for several elevations (y axis)
import svgdatashapes as s
import svgdatashapes_dt as sdt # for date/time support
import examples.sampledata4 as sampledata4
def example11():
winddata = sampledata4.winddata() # get some data
... | grubbcode/minplot | examples/e11.py | Python | mit | 2,033 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | connorimes/servo | python/servo/command_base.py | Python | mpl-2.0 | 14,626 |
# Generated by Django 3.1.13 on 2021-08-26 19:30
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("evaluation", "0011_auto_20210819_1832"),
]
operations = [
migrations.RenameField(
model_name="pha... | comic/comic-django | app/grandchallenge/evaluation/migrations/0012_auto_20210826_1930.py | Python | apache-2.0 | 1,141 |
#-------------------------------------------------------------------------------
# Name: export_dpp_and_metadata
# Purpose: Export Data Driven Pages with Metadata
#
# Author: Andrew K, Mapaction
#
# Created: 16/06/2016
#-------------------------------------------------------------------------------... | mapaction/mapaction-toolbox | arcgis10_mapping_tools/MapAction/MapAction/mapbook_export_tool/export_mapbook.py | Python | gpl-3.0 | 4,042 |
import os
import sys
from django.forms.fields import ImageField
from ..utils import resize_image, BytesIO, Image
from ..conf import settings
class ResizedImageField(ImageField):
def __init__(self, *args, **kwargs):
self.required_size = kwargs.pop('required_size', settings.DEFAULT_IMAGE_SIZE)
sel... | MichalMaM/django-image-fields | image_fields/forms/fields.py | Python | bsd-2-clause | 1,697 |
###############################################################################
# #
# 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 #
... | dparks1134/GenomeTreeTk | genometreetk/reroot_tree.py | Python | gpl-3.0 | 6,790 |
# pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world, step
from lettuce.django import django_url
@step('I register for the course "([^"]*)"$')
def i_register_for_the_course(_step, course):
url = django_url('courses/%s/about' % world.scenario_dict['COURSE'].id.to_deprecated_string())
worl... | nanolearning/edx-platform | lms/djangoapps/courseware/features/registration.py | Python | agpl-3.0 | 1,354 |
from django.conf.urls import url
from rest_framework import routers
import views
app_name = 'shortener'
urlpatterns = [
#url(r'$', views.IndexView.as_view(), name='index'),
url(r'^$', views.shorten, name='new')
]
| pattu777/URL-Shortener | app/shortener/urls.py | Python | mit | 218 |
from __future__ import print_function
import unittest
import os
from numpy import array, array_equal, sin, cos, radians
import pyNastran
from pyNastran.bdf.bdf import BDF, BDFCard, read_bdf
from pyNastran.bdf.bdf import DMI, DMIG
root_path = pyNastran.__path__[0]
test_path = os.path.join(root_path, 'bdf', 'cards', ... | saullocastro/pyNastran | pyNastran/bdf/cards/test/test_dmig.py | Python | lgpl-3.0 | 18,845 |
# -*- coding: utf-8 -*-
from datetime import date
from dateutil.relativedelta import relativedelta
from decimal import Decimal
from sql.aggregate import Sum
from sql.conditionals import Coalesce
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from trytond.model import fields, ModelV... | sharoonthomas/trytond-report-html-accounts | report_html_accounts.py | Python | bsd-3-clause | 9,451 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __f... | klahnakoski/MySQL-to-S3 | vendor/jx_elasticsearch/es14/expressions.py | Python | mpl-2.0 | 40,320 |
"""
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
from __future__ import division, absolute_import, print_function
import datetime
import sys
import operator
import warnings
import pytest
import numpy as np
from numpy.testing ... | gfyoung/numpy | numpy/core/tests/test_deprecations.py | Python | bsd-3-clause | 21,004 |
# -*- coding: UTF-8 -*-
# pylint: disable=wrong-import-position, wrong-import-order
"""
Invoke build script.
Show all tasks with::
invoke -l
.. seealso::
* http://pyinvoke.org
* https://github.com/pyinvoke/invoke
"""
from __future__ import absolute_import
# ---------------------------------------------... | cucumber/tag-expressions-python | tasks/__init__.py | Python | mit | 2,176 |
import re
import glob, os
import get_tables
def get_csv_filename(infile):
base = re.sub(".*--([0-9]{4}).xml", "\\1", infile)
return 'csvs/tax-table-' + base + '.csv'
# Scripts only work for 2014, 2015, as used an ugly hack to filter by
# fontsize. Would need another method for years further back.
# xml_fil... | bradyt/tax-tables-etc | make-csvs.py | Python | gpl-3.0 | 710 |
class Solution(object):
def findDisappearedNumbers(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
output = []
N = len(nums)
nums_sorted = sorted(nums)
if N > 1:
if nums_sorted[0] > 1:
for i in... | SeisSparrow/Leetcode | python/448.py | Python | mit | 900 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2018 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 | stock_mandatory_orderpoints/__init__.py | Python | agpl-3.0 | 833 |
import sys
import DefaultTable
import array
from fontTools import ttLib
from fontTools.misc.textTools import safeEval
class table__c_v_t(DefaultTable.DefaultTable):
def decompile(self, data, ttFont):
values = array.array("h")
values.fromstring(data)
if sys.byteorder <> "big":
values.byteswap()
self.value... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/FontTools/fontTools/ttLib/tables/_c_v_t.py | Python | lgpl-3.0 | 1,185 |
# -*- coding: utf-8 -*-
import os, sys
sys.path.insert(0, os.path.abspath(".."))
from pysignfe.nf_e import nf_e
if __name__ == '__main__':
nova_nfe = nf_e()
##Gerar danfe a partir de uma NFe ja processada
f = open("procNFe_exemplo.xml", encoding='utf8')
proc_nfe = f.read()
f.close()
... | thiagopena/PySIGNFe | exemplos_nfe/04_gerar_danfe.py | Python | lgpl-2.1 | 532 |
# Copyright 2017 Max Planck Society
# Distributed under the BSD-3 Software license,
# (See accompanying file ./LICENSE.txt or copy at
# https://opensource.org/licenses/BSD-3-Clause)
"""This class implements POT training.
"""
import collections
import logging
import os
import time
import tensorflow as tf
import utils
f... | tolstikhin/adagan | pot.py | Python | bsd-3-clause | 92,925 |
from __future__ import absolute_import, unicode_literals
import traceback
from django.db import transaction
from django.utils import timezone, translation
from temba.orgs.models import Org
from temba.contacts.models import Contact
from temba.settings import BRANDING, DEFAULT_BRAND, HOSTNAME
class ExceptionMiddlewar... | praekelt/rapidpro | temba/middleware.py | Python | agpl-3.0 | 5,397 |
# Paparazzi center utilities
#
# Copyright (C) 2016 ENAC, Florian BITARD (intern student)
#
# This file is part of paparazzi.
#
# paparazzi 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, or ... | baspijhor/paparazzi | sw/supervision/python/hmi.py | Python | gpl-2.0 | 76,585 |
class Solution:
def solveSudoku(self, board):
"""
Do not return anything, modify board in-place instead.
"""
digits = { str(i) for i in range(1, 10) }
rows = [ digits.copy() for _ in range(9) ]
cols = [ digits.copy() for _ in range(9) ]
boxs = [ [ digits.copy... | BigEgg/LeetCode | Python/LeetCode/_001_050/_037_SudokuSolver.py | Python | mit | 1,803 |
# Copyright 2014 Intel Corp.
#
# 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, soft... | Hybrid-Cloud/conveyor | conveyor/conveyorheat/objects/stack.py | Python | apache-2.0 | 8,010 |
#!/usr/bin/python
#-*-coding:utf-8-*-
'''
思路:
1.先获取到首页内容,
2.用正则来找到css,js和img的位置,
3.用当前时间来命名文件并在其下面新建css,js和image文件夹
4.将找到的css等文件写入该路径下,注:图片要以二进制的方式存取。
'''
import urllib2
import os
import re
from datetime import datetime
import time
import requests
import sys, getopt
class Spider():
#获取页面,返回这个页面的字符串
#url 是获取页面的... | No7777/sohu | main.py | Python | gpl-3.0 | 4,011 |
import urlparse
import json
import httplib2
from keystoneclient.v2_0 import endpoints
from tests import utils
class EndpointTests(utils.TestCase):
def setUp(self):
super(EndpointTests, self).setUp()
self.TEST_REQUEST_HEADERS = {
'X-Auth-Token': 'aToken',
'User-Agent': 'py... | dolph/python-keystoneclient | tests/v2_0/test_endpoints.py | Python | apache-2.0 | 4,046 |
"""
Really could have implemented this all in javascript on the client side...
"""
from __future__ import print_function
import requests
from flask import Flask, redirect, url_for, request, session, abort, jsonify
import os
import sys
import logging
import json
STRAVA_CLIENT_ID = 1367
Flask.get = lambda self, path: s... | krujos/strava-private-to-public | private-to-public.py | Python | apache-2.0 | 3,601 |
# -*- coding: utf-8 -*-
"""
All known information on metadata is exposed in ``gmusicapi.protocol.metadata.md_expectations``.
This holds a mapping of *name* to *Expectation*, where *Expectation* has
the following fields:
*name*
key name in the song dictionary (equal to the *name* keying ``md_expectations``).
*type... | nvbn/Unofficial-Google-Music-API | gmusicapi/protocol/metadata.py | Python | bsd-3-clause | 8,707 |
import numpy as np
import time
import cv2
def check_object_status(tracking_data_list):
debug = True
# debug = False
detect_image_count = 7
if len(tracking_data_list) > detect_image_count:
# angle_list = [abs(tracking_data_list[i].get('angle')-45) for i in xrange(detect_image_count)]
# angle_list.remove... | lexuszhi1990/jetsontk1 | detection.py | Python | gpl-2.0 | 2,365 |
import pytest
import responses
from django.contrib.auth.models import User
from mc2.controllers.base.tests.base import ControllerBaseTestCase
from mc2.controllers.base.models import Controller
from mc2.controllers.base import exceptions
from mc2.organizations.models import Organization, OrganizationUserRelation
# t... | praekelt/mc2 | mc2/controllers/base/tests/test_models.py | Python | bsd-2-clause | 5,604 |
from django.core.management.base import BaseCommand
from conference.invoicing import (
Invoice,
VAT_NOT_AVAILABLE_PLACEHOLDER,
upgrade_invoice_placeholder_to_real_invoice
)
def generate_invoices_from_placeholders_for_year(year):
print("====== making real invoices from polaceholders =======")
invo... | EuroPython/epcon | conference/management/commands/upgrade_placeholder_invoices_for_2018.py | Python | bsd-2-clause | 1,188 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | mohamedhagag/community-addons | openeducat_erp/op_roll_number/__init__.py | Python | agpl-3.0 | 1,094 |
from django.contrib.auth import forms as admin_forms
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
User = get_user_model()
class UserChangeForm(admin_forms.UserChangeForm):
class Meta(admin_forms.UserChange... | luzfcb/cookiecutter-django | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/forms.py | Python | bsd-3-clause | 914 |
# coding: utf-8
from lessons.models import Lesson
from django.contrib import admin
class LessonAdmin(admin.ModelAdmin):
list_display = ('title', 'course', 'group', 'date_starttime', 'date_endtime')
list_filter = ('group', 'course', 'course__year__start_year')
search_fields = ('title', 'course__name', 'de... | znick/anytask | anytask/lessons/admin.py | Python | mit | 375 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
# Comment the next two lines to disable the admin:
from django.contrib import ad... | lodaviz/recerca | config/urls.py | Python | bsd-3-clause | 928 |
import setup_util
import subprocess
import os
def start(args, logfile, errfile):
kill_running_process() # Kill the running process and delete the
# RUNNING_PID file (if any). With any luck no
# new process has picked up the same PID.
play_cmd = "play"
if args.... | morrisonlevi/FrameworkBenchmarks | play-scala/setup.py | Python | bsd-3-clause | 927 |
# -*- coding: utf-8 -*-
import logging
from google.appengine.api import memcache
# When using runtime:python27 you can just use `import json`
from django.utils import simplejson as json # http://stackoverflow.com/questions/1171584/how-can-i-parse-json-in-google-app-engine
from google.appengine.api import urlfetch
i... | trevornelson/squeeklights | mc/cache.py | Python | mit | 3,176 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from nose.tools import assert_equals
from ..apps.base import AppBase
# since AppBase introspects its name based upon the django app which it
# is located in, if the module name changes, the tests fail. this would
# be misleading, since it's the renamed tests at fau... | dimagi/rapidsms-core-dev | lib/rapidsms/tests/test_app_base.py | Python | bsd-3-clause | 1,427 |
import re
wires = {}
for i in open('day7.txt'):
set = re.match(r'([a-z0-9]+) -> ([a-z]+)',i)
if set:
wires[set.group(2)] = set.group(1)
op1 = re.match(r'(NOT) ([a-z0-9]+) -> ([a-z]+)',i)
if op1:
wires[op1.group(3)] = [op1.group(1), op1.group(2)]
op2 = re.match(r'([a-z0-9]+) (AND|OR|LSHIFT|RSHIFT) ([a-z0-9]+) ... | jsvennevid/adventofcode | 2015/07/puzzle2.py | Python | mit | 1,071 |
# 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 or agreed to in... | jamielennox/keystone | keystone/tests/unit/test_v2_keystoneclient.py | Python | apache-2.0 | 58,102 |
#!/usr/bin/env python
import json, os, re, csv, sys, socket
import argparse, unicodedata, random
from pprint import pprint
from datetime import datetime, timedelta
import parse_raw_JSON
options = {
'verbose': True,
'minimum_date': '20160226_0300',
'maximum_date': '20160227_0300',
'directory': True,
... | emCOMP/visualization | src/python/jsonsample.py | Python | mit | 4,340 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MoneyBook.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| dyyi/moneybook | MoneyBook/manage.py | Python | apache-2.0 | 252 |
"""
WSGI config for {{ project_name }} project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | django-quickstart/1.5-webfaction | project_name/wsgi.py | Python | mit | 1,451 |
import re
from django.core.validators import MinValueValidator
from django.utils.translation import ugettext_lazy as _
from rest_framework import exceptions as rf_exceptions
from rest_framework import serializers as rf_serializers
from waldur_core.core import serializers as core_serializers
from waldur_core.structure... | opennode/waldur-mastermind | src/waldur_slurm/serializers.py | Python | mit | 5,905 |
LITRES_PER_GALLON = 3.785411784
KMS_PER_MILE = 1.609344
def mpg2lp100km(mpg):
""" mpg_to_litres_per_100km == PEP8 """
return round(LITRES_PER_GALLON / ((mpg * KMS_PER_MILE) / 100), 2)
def lp100km2mpg(lp100km):
""" litres_per_100_km_to_mpg == PEP8 """
return round((100 / KMS_PER_MILE) / (lp100km / LI... | the-zebulan/CodeWars | katas/kyu_7/fuel_economy_converter.py | Python | mit | 341 |
#!/usr/bin/python
# Copyright 2014 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.
"""
cr_cronet.py - cr - like helper tool for cronet developers
"""
import argparse
import os
import sys
def run(command, extra_options=''... | danakj/chromium | components/cronet/tools/cr_cronet.py | Python | bsd-3-clause | 5,409 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import nowdate, add_months
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_... | adityaduggal/erpnext | erpnext/shopping_cart/test_shopping_cart.py | Python | gpl-3.0 | 6,758 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/ui.py | Python | lgpl-3.0 | 11,198 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 11 01:22:54 2017
@author: Shabaka
"""
# Import pickle package
import pickle
# Open pickle file and load data: d
with open('data.pkl', 'rb') as file:
d = pickle.load(file)
# Print d
print(d)
# Print datatype of d
print(type(d)) | qalhata/Python-Scripts-Repo-on-Data-Science | Import_Pickled-Data.py | Python | gpl-3.0 | 300 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Product import Product
from Variables import Variables
from Client import Client
from random import randint
import numpy as np
from operator import itemgetter
const_vars = Variables()
class Store(object):
def __init__(self, n_products, m_clients):
self.... | ferreiro/Jaccard-Similarity | jaccard-similarity/app/Store.py | Python | mit | 12,493 |
"""View for block details specialized for a GAS"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from flexi_auth.models import PrincipalParamRoleRelation, ObjectWithContext
from ajax_select.fields import autosel... | befair/gasistafelice | gasistafelice/rest/views/blocks/gas_details.py | Python | agpl-3.0 | 2,158 |
#!/usr/bin/python
#
# Copyright (c) 2010-2019 Belledonne Communications SARL.
#
# This file is part of Liblinphone.
#
# 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 Lic... | BelledonneCommunications/linphone | wrappers/csharp/genwrapper.py | Python | gpl-3.0 | 23,531 |
from django.db import models
from image_cropping.fields import ImageCropField, ImageRatioField
class Profile(models.Model):
avatar = ImageCropField()
cropping = ImageRatioField('avatar', '200x200') | danithaca/berrypicking | django/advanced/crop/models.py | Python | gpl-2.0 | 207 |
#title :image_class.py
#description :This code will batch classify multiple images using a .csv file containing tags using a Convolustional Neural Network.
#author :Harry F Bullough
#date :10/05/2017
#version :3.1
#usage :python image_class.py /my/image/directory... | harryfb/DST5 | FinalFinalFinalCode/ImageProcessingFinalCode/img_class.py | Python | apache-2.0 | 14,122 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | mesheven/pyOCD | pyocd/probe/pydapaccess/__init__.py | Python | apache-2.0 | 779 |
# The MIT License (MIT)
# Escalate Copyright (c) [2014] [Chris Smith]
# 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, c... | KirillShaman/escalate_gspread | app/channels/views.py | Python | mit | 5,392 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import operator
import re
from itertools import product
def bool_matrix(template, mask=None, expect=None... | pferreir/indico | indico/testing/util.py | Python | mit | 7,239 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | vthorsteinsson/tensor2tensor | tensor2tensor/models/research/attention_lm_moe.py | Python | apache-2.0 | 28,301 |
class Router:
PROTOCOL_IPV4 = 4;
PROTOCOL_IPV6 = 6;
TYPE_ROUTE_SERVER = 1;
TYPE_ROUTE_COLLECTOR = 2;
TYPE_AS112 = 3;
TYPE_OTHER = 99;
SOFTWARE_BIRD = 1;
SOFTWARE_BIRD2 = 6;... | 20c/django-ixpmgr | src/django_ixpmgr/v5/const.py | Python | apache-2.0 | 754 |
#!/usr/bin/env python
'''
Generate the main window for the pi-gui program. The interface show the last played
item with cover, title and supllemental informations that is interactive
and two buttons for show up the library screen and exit the porgram itself.
'''
#@author: Philipp Sehnert
#@contact: philipp.sehnert[a... | psikon/pitft-scripts | src/mainscreen.py | Python | mit | 2,347 |
from decimal import Decimal
from django.test import TestCase
from django.contrib.auth.models import User
from pinax.ratings.models import Rating
from .models import Car
class Tests(TestCase):
def setUp(self):
self.paltman = User.objects.create(username="paltman")
self.jtauber = User.objects.c... | rizumu/pinax-ratings | pinax/ratings/tests/tests.py | Python | mit | 809 |
"""Module to handle markdown operations."""
import re
from vsc.utils import fancylogger
from vsc.utils.run import run_asyncloop
from panhandler import markdown_from_pan
logger = fancylogger.getLogger()
MAILREGEX = re.compile(("([a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`"
... | jouvin/release | src/documentation_builder/lib/quattordocbuild/markdownhandler.py | Python | apache-2.0 | 3,564 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j. F Y.'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y. H:i'
YEAR_MONTH_FORMAT = 'F Y.'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'j.m.Y.'
SHORT_DATETIME_FORMAT = 'j.m.Y. H:i'
FIRST_DAY_... | hunch/hunch-gift-app | django/conf/locale/hr/formats.py | Python | mit | 1,522 |
def itemNames():
return ['chassis_blueprints','clothing_repair_device','medical_device','motor','software_module','unpowered_survey_pad']
def itemChances():
return [21,8,21,21,21,8] | agry/NGECore2 | scripts/loot/lootPools/endor/re_junk_masterfull_jinda_warrior.py | Python | lgpl-3.0 | 188 |
from .admin import AdminExcludeFieldsMixin
| botswana-harvard/edc-admin-exclude | edc_admin_exclude/__init__.py | Python | gpl-2.0 | 43 |
import bones.event
from bones.bot import Module
class NickServ(Module):
def __init__(self, *args, **kwargs):
Module.__init__(self, *args, **kwargs)
self._disabled = False
if not self.settings.get("services", "nickserv.password"):
self.log.error(
"Configuration d... | 404d/Bones-IRCBot | bones/modules/services.py | Python | gpl-3.0 | 3,923 |
#
# 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 us... | shaneknapp/spark | python/pyspark/streaming/tests/test_dstream.py | Python | apache-2.0 | 24,259 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | tests/python/twitter/pants/base/test-generator.py | Python | apache-2.0 | 1,738 |
import os
import textwrap
import warnings
import glob
import numpy as np
from astropy.table import Table, join
from astropy.io import fits
import astropy.units as u
from spectral_cube import SpectralCube
from . import catalogs
from scipy.ndimage import binary_opening
import aplpy
import matplotlib as mpl
mpl.rcParams[... | rfriesen/GAS | GAS/plot_regions.py | Python | mit | 17,215 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_ips_custom.py | Python | gpl-3.0 | 12,736 |
# จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย)
for i in range(11):
if (i % 2 == 0):
print(i) | supasate/word_prediction | Chapter4/4-7-even-solution.py | Python | gpl-2.0 | 193 |
# -*- encoding: utf-8 -*-
"""Test class for Global parameters CLI
:Requirement: Globalparam
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: Parameters
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string
from robottelo.cli.globalparam import GlobalPa... | ldjebran/robottelo | tests/foreman/cli/test_globalparam.py | Python | gpl-3.0 | 2,309 |
from __future__ import print_function
import os.path as op
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_allclose, assert_array_equal)
from scipy import sparse
from nose.tools import assert_true, assert_raises
import copy
import warnings
from m... | dimkal/mne-python | mne/minimum_norm/tests/test_inverse.py | Python | bsd-3-clause | 25,560 |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError
from LanguageStatistic.models import Video
from LanguageStatistic.models import Subtitle
from LanguageStatistic.models import Language
from datetime import datetime
from time import time
import sys
import j... | alani1/KALanguageReport | LanguageStatistic/management/commands/updateVideos.py | Python | mit | 6,911 |
# encoding: utf8
import re
from random import *
from collections import Counter
from pprint import pprint
from heapq import nlargest
from time import time
# http://blog.echen.me/2011/08/22/introduction-to-latent-dirichlet-allocation/
# https://tedunderwood.com/2012/04/07/topic-modeling-made-just-simple-enough/
# -> h... | mobarski/sandbox | topic/lda/lda4v2.py | Python | mit | 3,180 |
"""Provides functionality to interact with lights."""
from __future__ import annotations
from collections.abc import Iterable
import csv
import dataclasses
from datetime import timedelta
import logging
import os
from typing import cast, final
import voluptuous as vol
from homeassistant.config_entries import ConfigEn... | sander76/home-assistant | homeassistant/components/light/__init__.py | Python | apache-2.0 | 36,404 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.