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 |
|---|---|---|---|---|---|
"""
edraak_i18n app url
"""
from django.conf.urls import patterns, url
from edunext_openedx_extensions.edraak_i18n.views import set_language
urlpatterns = patterns(
'',
url(r'^changelang/$', set_language, name='edraak_setlang'),
)
| eduNEXT/edunext-openedx-extensions | edunext_openedx_extensions/edraak_i18n/urls.py | Python | agpl-3.0 | 243 |
#! /usr/bin/env python
# coding: utf-8
# Python Script Collection for GEOS-Chem Chemistry Transport Model (gchem)
# Copyright (C) 2012 Gerrit Kuhlmann
#
# 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 Foun... | gkuhl/gchem | gchem/misc.py | Python | gpl-3.0 | 2,831 |
#!/usr/bin/env python
# coding : utf-8
"""
CUI interface for VOI analyzer.
"""
import pandas as pd
import argparse
from base import voi_analysis
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Extract VOI statistics")
parser.add_argument('images', help="Images to extract Statistics"... | spikefairway/VOIAnalyzer | VOIAnalyzerCUI.py | Python | mit | 1,113 |
"""2
3
: :
=+.+.
:T:Z
.+.+.
E:J:
1
O
T Stuff({"сокровище": 1})
E Exit(LEFT)
J Stuff({"дубина": 1})
Z EffectorSquare(lambda: Sleep(3, Position(1,0,0)))
"""
| nzinov/maze | test/1.py | Python | gpl-3.0 | 174 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the... | karrtikr/ete | ete3/tools/phylobuild_lib/task/clustalo.py | Python | gpl-3.0 | 3,233 |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
dummy = p = ListNode(-1)
p.next = head
while p.next and p.next.next:
if p.next.va... | jiadaizhao/LeetCode | 0001-0100/0082-Remove Duplicates from Sorted List II/0082-Remove Duplicates from Sorted List II.py | Python | mit | 539 |
import asyncio
import io
import re
import sys
# The display classes deal with output from subprocesses. The FancyDisplay
# gives a multi-line, real-time view of each running process that looks nice in
# the terminal. The VerboseDisplay collects output from each job and prints it
# all when the job is finished, in a wa... | oconnor663/peru | peru/display.py | Python | mit | 9,334 |
# Copyright 2010-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 required by ap... | onecloud/neutron | neutron/tests/base.py | Python | apache-2.0 | 7,506 |
#!/bin/python
import sys
n = int(raw_input().strip())
A = map(int,raw_input().strip().split(' '))
res = sys.maxint
dic = {}
for i in xrange(n):
if A[i] not in dic:
dic[A[i]] = i
else:
res = min(res, i - dic[A[i]])
dic[A[i]] = i
print res if res < sys.maxint else -1
| shree-shubham/Unitype | Minimum Distances.py | Python | gpl-3.0 | 301 |
from functools import wraps
import json
import decimal
from django.core.serializers import serialize
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models.query import QuerySet
from django.http import HttpResponse, HttpResponseBadRequest
class EDXJSONEncoder(DjangoJSONEncoder):
"""
... | solashirai/edx-platform | common/djangoapps/util/json_request.py | Python | agpl-3.0 | 3,842 |
"""
Cohorts API serializers.
"""
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from rest_framework import serializers
class CohortUsersAPISerializer(serializers.ModelSerializer):
"""
Serializer for cohort users.
"""
name = serializers.SerializerMetho... | eduNEXT/edx-platform | openedx/core/djangoapps/course_groups/serializers.py | Python | agpl-3.0 | 569 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-14 16:41
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... | inmagik/pollicino | pollicino/core/migrations/0007_app_owner.py | Python | mit | 657 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from nerve import files
from nerve.logs import log
from nerve import types
from nerve.objects import public, is_public, join_path, ObjectNode
from nerve import modules
from nerve.core import QueryHandler, Request, Controller, View, Server, Model, Device, PyCodeQuery, Symbolic... | transistorfet/nerve | nerve/__init__.py | Python | gpl-3.0 | 737 |
#!/usr/bin/python
# Copyright (C) 2010-2014 by the Free Software Foundation, Inc.
#
# This file is part of mailman.client.
#
# mailman.client 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, version 3 o... | rajeevs1992/mailmancli | src/mailmanclient/cli/lib/mailman_utils.py | Python | lgpl-3.0 | 4,303 |
from pycp2k.inputsection import InputSection
class _job1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Directory = None
self.Input_file_name = None
self.Output_file_name = None
self.Job_id = None
self.Dependencies = None
self._name = "J... | SINGROUP/pycp2k | pycp2k/classes/_job1.py | Python | lgpl-3.0 | 507 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'lucy'
def error(obj, msg):
print('[%s][error] %s' % (obj.__class__.__name__, msg))
def info(obj, msg):
print('[%s][info] %s' % (obj.__class__.__name__, msg))
def warn(obj, msg):
print('[%s][warn] %s' % (obj.__class__.__name__, msg)) | derlin/pyton3-websocket-server-template | src/python/utils/log.py | Python | gpl-2.0 | 308 |
#
# 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... | wileeam/airflow | airflow/operators/dummy_operator.py | Python | apache-2.0 | 1,203 |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = ('Loops through all of the photos to create a cached version.')
def handle(self, *args, **options):
from tendenci.apps.photos.models import Image
from tendenci.apps.photos.utils.caching import cache_photo_s... | alirizakeles/tendenci | tendenci/apps/photos/management/commands/cache_photos.py | Python | gpl-3.0 | 821 |
import sys
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
"tests",
]
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': 'db.sqlite3',
}
}
STATIC_URL = '/static/'
if sys.platform == 'darwin':
SPATIALITE_LIBRARY_PATH = '/usr/local/lib/mod_spatialit... | Mixser/django-location-field | tests/test_settings.py | Python | mit | 329 |
class RecursionError(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class FailedIntegrationError(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
__all__ = ["RecursionError", "FailedIntegrationError"]... | Microno95/DESolver | desolver/exception_types/exception_types.py | Python | mit | 321 |
from pyramid.response import Response
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
from .models import (
DBSession,
MyModel,
)
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
try:
one = DBSession.query(MyModel).filter(My... | jmercouris/PyramidStarter | source/source/views.py | Python | bsd-3-clause | 1,084 |
# Authors: Rob Crittenden <rcritten@redhat.com>
# John Dennis <jdennis@redhat.com>
#
# Copyright (C) 2009 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | msimacek/freeipa | ipapython/nsslib.py | Python | gpl-3.0 | 14,219 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def btc2satoshis(btc):
if isinstance(btc, str):
if '.' in btc:
parts = btc.split('.')
if len(parts) == 2:
whole_btc = int(parts[0])
satoshis = int(parts[1].ljust(8, '0')) # add zeros up to 8 decimals
... | ValyrianTech/BitcoinSpellbook-v0.3 | helpers/conversionhelpers.py | Python | gpl-3.0 | 675 |
import os
import sys
from setuptools import setup, find_packages
os.chdir(os.path.dirname(sys.argv[0]) or ".")
import libsongtext
version = '%s.%s.%s' % libsongtext.__version__
try:
long_description = open('README.rst', 'U').read()
except IOError:
long_description = 'See https://github.com/ysim/songtext'
s... | ysim/songtext | setup.py | Python | bsd-2-clause | 1,179 |
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.ap... | sileht/deb-openstack-quantum | quantum/extensions/credential.py | Python | apache-2.0 | 6,330 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description:
Given a triangle, find the minimum path sum from top to bottom.
Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
... | Jan-zou/LeetCode | python/Array/120_triangle.py | Python | mit | 1,281 |
'''
____ _ _ _ _ _ ____ ___
| _ \ ___ __| | \ | | ___| |_ / \ | _ \_ _|
| |_) / _ \ / _` | \| |/ _ \ __| / _ \ | |_) | |
| __/ (_) | (_| | |\ | __/ |_ / ___ \| __/| |
|_| \___/ \__,_|_| \_|\___|\__| /_/ \_\_| |___|
File: PodNet.py
Author: Zach Podbieln... | zachpodbielniak/PodNet | Linux/Python/__init__.py | Python | gpl-3.0 | 1,448 |
#!/usr/bin/env python2.6
import sys
import setuptools
if sys.version_info >= (3,):
protobuf = 'protobuf-py3>=2.5.1,<3.0.0'
else:
protobuf = 'protobuf>=2.3.0,<3.0.0'
setuptools.setup(
name='riemann-client',
version='6.1.2',
author="Sam Clements",
author_email="sam.clements@datasift.com",
... | jrmccarthy/python-riemann-client | setup.py | Python | mit | 1,554 |
import os
mmsis = [370580000,
209108000,
209587000,
210228000,
210582000,
212338000,
226022000,
226270000,
228030800,
228036800,
228045600,
228045800,
228050600,
233694000,
235113838,
235338000,
236111851,
236111902,
236403000,
236483000,
... | GlobalFishingWatch/vessel-maps | utilities/convert_many.py | Python | apache-2.0 | 2,796 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.PaymentList.as_view(), name='payments'),
url(r'^(?P<pk>[0-9]+)/$', views.payment_details, name='payment-details')
)
| hongquan/saleor | saleor/dashboard/payments/urls.py | Python | bsd-3-clause | 239 |
# Natural Language Toolkit: WordNet stemmer interface
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.wordnet import NOUN
from... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/nltk/stem/wordnet.py | Python | mit | 1,263 |
from stanczyk.proxy import connectProxy
from stanczyk.test.util import ConnectedCommandTestMixin
from twisted.trial.unittest import SynchronousTestCase
from twisted.test.proto_helpers import MemoryReactor
class ConnectProxyTests(ConnectedCommandTestMixin, SynchronousTestCase):
command = staticmethod(connectProxy)... | crypto101/stanczyk | stanczyk/test/test_proxy.py | Python | isc | 1,051 |
"""
Script to visualize the "Noise vs. Exposure" data from DevWare
According to section 2.2.4.7 of the DevWareX help (http://is.gd/mt7FyF) we get
signal levels and different kinds of noise measurements by using the "Sensor
Control" > "Diagnostics" > "Noise vs. Exposure" tool.
The analyis report gives
- Signal
- RMS D... | habi/GlobalDiagnostiX | aptina/NoiseVsExposure.py | Python | unlicense | 6,444 |
import kombu.connection
import kombu.entity
import kombu.messaging
import uuid
params = {
'hostname': 'localhost',
'port': 5672,
'virtual_host': '/',
}
connection = kombu.connection.BrokerConnection(**params)
connection.connect()
channel = connection.channel()
exchange = kombu.entity.Exchange(name='di... | Skablam/Python-RabbitMQ | kombu-examples/direct_exchange/addmessage-direct.py | Python | mit | 1,245 |
#!/usr/bin/env python
import os, sys
from setuptools import setup, find_packages
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit(0)
with open('README.rst') as f:
long_description = f.read()
VERSION = __import__('delivery').__version__
setup(
name='django-delivery',
... | dakrauth/django-delivery | setup.py | Python | mit | 864 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nyc_inspections import app
from database import db_session
from extensions import cache
from flask import abort
from flask import jsonify
from flask import request
from models import Cuisine
from models import Inspection
from models import Restaurant
def _make_cache... | ryankanno/nyc-inspections | nyc_inspections/api.py | Python | bsd-3-clause | 1,943 |
# coding: utf-8
import os
import timeit
import tempfile
import argparse
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('seaborn')
def get_performance_multiplication():
data = {'shape': []}
for i in range(1, FLAGS.max_degree):
sshape =... | dsysoev/fun-with-algorithms | matrix/performance.py | Python | mit | 2,703 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.website.website_generator import WebsiteGenerator
from frappe import _
from frappe.utils.file_manager import save_file, remov... | geo-poland/frappe | frappe/website/doctype/web_form/web_form.py | Python | mit | 3,187 |
import gc, os
from tempfile import mkstemp
import warnings
import numpy as np
import nose.tools
from nipy.modalities.fmri.api import fmri_generator, FmriImageList
from nipy.core.api import parcels, fromarray, Image
from nipy.io.api import load_image, save_image
from nipy.testing import funcfile
def setup():
#... | yarikoptic/NiPy-OLD | nipy/modalities/fmri/tests/test_fmri.py | Python | bsd-3-clause | 2,192 |
# This snakemake file performs the following actions on one biosample.
# This biosample may contain multiple subsamples and be sequenced multiple times.
# Further, each sequencing run can be missing some subsamples.
# This snakemake file does not perform optimization of thresholding perameters.
#
# 1. quality trimming
... | brianyu2010/Mini-Metagenomic_Analyses | Snakefile_toplevel2.py | Python | gpl-3.0 | 5,289 |
#
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | lhellebr/spacewalk | backend/server/importlib/backendOracle.py | Python | gpl-2.0 | 24,786 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
'''
This software has been developed by:
GI Genética, Fisiología e Historia Forestal
Dpto. Sistemas y Recursos Naturales
ETSI Montes, Forestal y del Medio Natural
Universida... | GGFHF/NGScloud | Package/xgmap.py | Python | gpl-3.0 | 50,068 |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from __future__ import unicode_literals
from collections import OrderedDict
import warnings
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, FieldError
from django.forms.fields import Field, ChoiceF... | beckastar/django | django/forms/models.py | Python | bsd-3-clause | 53,499 |
# ubuntu-drivers-common custom detect plugin for x86 CPU microcodes
#
# Author: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
#
# This plugin detects CPU microcode packages based on pattern matching
# against the "vendor_id" line in /proc/cpuinfo.
#
# To add a new microcode family, simply insert a line into the db
#... | linuxmint/ubuntu-drivers-common | detect-plugins/cpu-microcode.py | Python | gpl-2.0 | 920 |
# -*- coding: utf-8 -*-
# Copyright: (C) 2013 Canonical
#
# Authors:
# Didier Roche
#
# 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; version 3.
#
# This program is distributed in the hope that... | didrocks/cupstream2distro | tests/unit/__init__.py | Python | gpl-3.0 | 1,751 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py | Python | mit | 10,108 |
"""PermMissingElem (https://codility.com/c/run/demoXVU8HJ-5VU)
Analysis:
- Space O(1) requires that there is only 1 variable for temporary storage.
- Time O(n) requires that we only iterate array A in linear time.
"""
__author__ = 'au9ustine'
def solution(A):
"""We might use sum for temporary storage"""
... | au9ustine/org.au9ustine.puzzles.codility | lessons/lesson01_time_complexity/PermMissingElem.py | Python | mit | 650 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-google.cloud.pubsub_v1.py | Python | gpl-3.0 | 524 |
import flask
import flask.ext.login
import flask.ext.bcrypt
import rod
import rod.model.staff
import rod.model.schemas
auth_handler = flask.Blueprint('auth', __name__)
@auth_handler.route('/auth', methods=['GET'])
def verify():
staff = flask.ext.login.current_user
if not staff.is_authenticated:
ra... | sssilver/angler | rod/rod/handler/auth.py | Python | bsd-3-clause | 1,576 |
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^users/$', views.searchUsers),
]
| bitsnbytes7c8/django-site | search/urls.py | Python | mit | 155 |
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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... | mahak/neutron | neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py | Python | apache-2.0 | 21,892 |
#!/usr/bin/env python3
import subprocess
import sys
from os.path import abspath, dirname, join
from time import sleep, perf_counter
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditi... | apeschar/webwinkelkeur-virtuemart | test/test.py | Python | gpl-3.0 | 3,695 |
"""
This file defines the types for type annotations.
These names aren't part of the module namespace, but they are used in the
annotations in the function signatures. The functions in the module are only
valid for inputs that match the given type annotations.
"""
__all__ = [
"Array",
"Device",
"Dtype",
... | simongibbons/numpy | numpy/array_api/_typing.py | Python | bsd-3-clause | 949 |
try:
import os
import json
import traceback
import IPython.lib
import pgcontents
c = get_config()
### Password protection ###
# http://jupyter-notebook.readthedocs.io/en/latest/security.html
if os.environ.get('JUPYTER_NOTEBOOK_PASSWORD_DISABLED') != 'DangerZone!':
passwd = ... | chrisbarnettster/cfg-analysis-on-heroku-jupyter | .jupyter/jupyter_notebook_config.py | Python | mit | 2,062 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='Flask-QiniuStorage',
version='0.9.5',
url='https://github.com/csuzhangxc/Flask-QiniuStorage',
license='MIT',
author='Zhang Xuecheng',
author_email='csuzhangxc@gmail.com',
description='Qiniu Storage for Flask',
... | csuzhangxc/Flask-QiniuStorage | setup.py | Python | mit | 1,139 |
# -*- coding: utf-8 -*-
"""
Sycamore - revert action
This action allows you to revert a page. Note that the standard
config lists this action as excluded!
@copyright: 2006-2007 Philip Neustrom <philipn@gmail.com>,
2004 by Jürgen Hermann <jh@web.de>
@license: GNU GPL, see COPYING fo... | rtucker/sycamore | Sycamore/action/revert.py | Python | gpl-2.0 | 13,563 |
# Copyright 2017 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... | francoisluus/tensorboard-supervise | tensorboard/backend/application_test.py | Python | apache-2.0 | 18,600 |
"""
.. _tut_io_export_pandas:
=================================
Export epochs to Pandas DataFrame
=================================
In this example the pandas exporter will be used to produce a DataFrame
object. After exploring some basic features a split-apply-combine
work flow will be conducted to examine the laten... | wronk/mne-python | tutorials/plot_epochs_to_data_frame.py | Python | bsd-3-clause | 8,814 |
#!/usr/bin/env python
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for Boto have already been s... | phyominhtun1990/ansible-for-devops | lamp-infrastructure/inventories/aws/ec2.py | Python | mit | 26,437 |
import subprocess
import sys
import csv
import re
import os, os.path
from fnmatch import fnmatch
CONFIG = "DATA_FILE={}\nALLOW_GREEDY=true\n"
DATE_CHECK = re.compile("[0-9]{1,2}([/\\-\\.])[0-9]{1,2}\\1[0-9]{4}")
def print_command_err(command, ret_code):
make_arg = lambda x: x.replace(" ", "\\ ")
command = [make_a... | Unit4TechProjects/ChoiceOptimization | run.py | Python | gpl-2.0 | 3,621 |
import pygame
import random
import item
import mob
import tile
class Mapgen(object):
def __init__(self, level):
self.xsiz = 10
self.ysiz = 10
self.biome = "random"
self.procedure = 0
self.zone = []
self.level = level
self.sizefactor = 2
#self.items = ... | Lincoln-Cybernetics/Explore- | mapgen.py | Python | unlicense | 7,161 |
import pytest
from killranswers.connections import cassandra
@pytest.fixture(scope="module", autouse=True)
def connect():
cassandra()
| rustyrazorblade/killranswers | tests/conftest.py | Python | bsd-3-clause | 139 |
"""Provide functionality to interact with the vlc telnet interface."""
from __future__ import annotations
from datetime import datetime
from functools import wraps
from typing import Any, Callable, TypeVar, cast
from aiovlc.client import Client
from aiovlc.exceptions import AuthError, CommandError, ConnectError
from... | home-assistant/home-assistant | homeassistant/components/vlc_telnet/media_player.py | Python | apache-2.0 | 10,179 |
# -*- coding: utf-8 -*-
from antispoofing.spectralcubes.datasets.replayattack import ReplayAttack
from antispoofing.spectralcubes.datasets.casia import Casia
from antispoofing.spectralcubes.datasets.maskattack import MaskAttack
from antispoofing.spectralcubes.datasets.uvad import UVAD
registered_datasets = {0: Replay... | allansp84/spectralcubes | antispoofing/spectralcubes/datasets/registered_datasets.py | Python | agpl-3.0 | 456 |
#! /usr/bin/env python
from pySecDec.loop_integral import loop_package
import pySecDec as psd
li = psd.loop_integral.LoopIntegralFromPropagators(
propagators = ['k1^2', '(k1-k2)^2', '(k1-k2+p1)^2-mZ^2', '(k2)^2', '(k2+p2)^2', '(k1+p1+p2)^2', '(k2+p1)^2'],
loop_momenta = ['k1','k2'],
external_momenta = ['p1','p2','p3... | mppmu/secdec | nodist_examples/Zbb_vertex_correction_finite/F1_45_2_alt.py | Python | gpl-3.0 | 1,810 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
from opus_core.misc import safe_array_divide
class average_land_value_per_acre_from_buil... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/gridcell/average_land_value_per_acre_from_buildings.py | Python | gpl-2.0 | 1,881 |
# Copyright (C) 2008 University of Maryland
# All rights reserved.
# See LICENSE.txt for details.
# Author: Christopher Metting
#Starting Date:6/12/2009
from pylab import *
from numpy import *
import numpy as np
from time import time
from ..model.sample_prep import Q_space
from .approximations import wavefunction_fo... | reflectometry/osrefl | osrefl/theory/DWBAGISANS.py | Python | bsd-3-clause | 16,197 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 Fco. Javier Lucena Lucena (https://forja.rediris.es/users/franlu/)
Copyright (C) 2012 Serafín Vélez Barrera (https://forja.rediris.es/users/seravb/)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Affero General Public Li... | pupils/pupils | pupils/actividad/__init__.py | Python | agpl-3.0 | 894 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import utilities
from base import Base, Error, loadable
import media
class MalformedMangaPageError(media.MalformedMediaPageError):
"""Indicates that a manga-related page on MAL has irreparably broken markup in some way.
"""
pass
class InvalidMangaError(media.InvalidMedi... | XueAlfred/MALAnalysis | scraper-code/myanimelist/manga.py | Python | mit | 6,438 |
#!/usr/bin/env python
#
# Copyright 2014-2020 Matthew Wall
# Copyright 2014 Nate Bargmann <n0nb@n0nb.us>
# See the file LICENSE.txt for your rights.
#
# Credit to and contributions from:
# Jay Nugent (WB8TKL) and KRK6 for weather-2.kr6k-V2.1
# http://server1.nuge.com/~weather/
# Steve (sesykes71) for testing th... | hes19073/hesweewx | bin/weewx/drivers/ultimeter.py | Python | gpl-3.0 | 15,014 |
import numpy as np
import os
import speakerInfo as sinfo
import infoSingleFile
from unpackMFC import run as unmfc
from pyAudioAnalysis import audioBasicIO, audioFeatureExtraction
from datetime import datetime
import sklearn
from threading import Thread, BoundedSemaphore
import modelStorage as mds
from enum import Enum... | dare0021/ClusteringBasedID | run.py | Python | mit | 16,148 |
#decode.py
#Driver program for translating Morse code strings.
#By Timothy Cohen
from morsetree import MorseCodeTree
def main(filename):
file = open(filename, 'r')
for line in file:
line = line.rstrip("\n")
tree = MorseCodeTree()
words = tree.translate(line)
words = ''.join(wor... | Tacohen/Morse-Code | decode.py | Python | bsd-2-clause | 510 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import sys
import unittest
from fedora.rest.api import Fedora
from fedora.rest.ds import DatastreamProfile, FileItemMetadata, RelsExt, AdministrativeMetadata, ObjectDatastreams, \
EasyMetadata
test_file = "easy-file:1950715"
test_dataset = "... | DANS-repo/fedora-api | fedora/rest/test/test_ds.py | Python | apache-2.0 | 5,008 |
import json
import datetime
import os
import urlparse
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Group, Permission
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone
import mock
from nose.tools im... | m8ttyB/socorro | webapp-django/crashstats/manage/tests/test_views.py | Python | mpl-2.0 | 48,676 |
'''
Template tags for WorldPay offsite payments
'''
from django import template
from django.template.loader import render_to_string
register = template.Library()
class WorldPayNode(template.Node):
def __init__(self, integration):
self.integration = template.Variable(integration)
def render(self, con... | yceruto/merchant | billing/templatetags/world_pay_tags.py | Python | bsd-3-clause | 872 |
"""
Common utilities for the course experience, including course outline.
"""
from django.utils import timezone
from opaque_keys.edx.keys import CourseKey
from lms.djangoapps.course_api.blocks.api import get_blocks
from lms.djangoapps.course_blocks.api import get_course_blocks
from openedx.core.djangoapps.content.co... | EDUlib/edx-platform | openedx/features/course_experience/utils.py | Python | agpl-3.0 | 9,472 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Gallery', fields ['title']
db.delete_unique('photologue_gallery', ['title... | iberben/django-photologue | photologue/migrations/0003_auto__del_unique_gallery_title.py | Python | bsd-3-clause | 7,918 |
# Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
#
# Answer: 5537376230
def run():
numbers = [
37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538,
74324986199524741059474233309513058123726617309629,... | tgetzoya/project-euler-python | problems/pe13.py | Python | bsd-2-clause | 6,182 |
# saved_state.py
# Ronald L. Rivest
# August 1, 2017
# Routines to save and restore some stage between audit stages.
import json
import os
import multi
import utils
def write_initial_saved_state(e):
"""
Write the first saved-state, after the election-spec has been read."
"""
initial_stage_time = "0... | ron-rivest/2017-bayes-audit | 2017-code/saved_state.py | Python | mit | 3,044 |
from __future__ import unicode_literals
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
from boto.exception import DynamoDBResponseError
def create_table(conn):
mes... | pior/moto | tests/test_dynamodb/test_dynamodb_table_without_range_key.py | Python | apache-2.0 | 10,450 |
# Copyright (C) 2012 Free Software Foundation, 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 License, or
# (at your option) any later version.
#
# This program is... | ASlave2Audio/Restaurant-App | mingw/share/gdb/python/gdb/function/__init__.py | Python | mit | 687 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registro', '0015_auto_20151220_1216'),
]
operations = [
migrations.AlterField(
model_name='certificacion',
... | infoINGenieria/Zweb | z_web/registro/migrations/0016_auto_20151230_0957.py | Python | gpl-2.0 | 1,002 |
#!/usr/bin/python
import logging
import os
from optparse import OptionParser
import random
import time
from cinderclient import client as cinderclient
from novaclient.v2 import client as novaclient
USER = os.getenv('OS_USERNAME')
TENANT = os.getenv('OS_TENANT_NAME')
PASSWORD = os.getenv('OS_PASSWORD')
AUTH_URL = os.... | solidfire/solidfire-ai | sfai-openstack/verification_scripts/boot_volumes.py | Python | apache-2.0 | 4,798 |
__author__ = 'mslabicki'
import pygmo as pg
#
from pyltes.powerOptimizationProblemsDef import maximalThroughputProblemRR
from pyltes.powerOptimizationProblemsDef import local_maximalThroughputProblemRR
from pyltes.powerOptimizationProblemsDef import maximalMedianThrProblemRR
from pyltes.powerOptimizationProblem... | iitis/PyLTEs | pyltes/powerConfigurator.py | Python | mit | 5,818 |
from locust import HttpLocust, TaskSet, task
class WebsiteTasks(TaskSet):
@task
def page1(self):
self.client.get("/sugestoes-para/6a-feira-da-quarta-semana-da-pascoa/")
@task
def page2(self):
self.client.get("/sugestoes-para/5a-feira-da-quarta-semana-da-pascoa/")
@task
def pa... | gustavofoa/pympm | scripts/locustfile.py | Python | apache-2.0 | 988 |
from corehq.apps.users.models import CommCareUser
from corehq.apps.hqcase.management.commands.ptop_fast_reindexer import PtopReindexer
from corehq.pillows.user import UserPillow
CHUNK_SIZE = 500
POOL_SIZE = 15
class Command(PtopReindexer):
help = "Fast reindex of user elastic index by using the domain view and r... | gmimano/commcaretest | corehq/apps/users/management/commands/ptop_fast_reindex_users.py | Python | bsd-3-clause | 433 |
# Copyright (c) 2016-present, Facebook, 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... | davinwang/caffe2 | caffe2/python/operator_test/rebatching_queue_test.py | Python | apache-2.0 | 9,823 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=80:
__version__ = '1.2'
import os, sys
import csv
from lxml import etree
from types import *
def main(config):
import string
translationTable = string.maketrans(' ','_')
# Read each line of the csv file, ... | Mutos/StarsOfCall-NAEV | utils/csv2xml/main.py | Python | gpl-3.0 | 2,441 |
from coilsnake.modules.eb.EbModule import EbModule
from coilsnake.util.common.yml import yml_load, yml_dump
from coilsnake.util.eb.pointer import to_snes_address
from coilsnake.util.eb.text import standard_text_to_byte_list
class SkipNamingModule(EbModule):
NAME = "Skip Names"
def write_to_project(self, reso... | mrtenda/CoilSnake | coilsnake/modules/eb/SkipNamingModule.py | Python | gpl-3.0 | 2,396 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
#-*- coding: utf-8 -*-
from __future__ import absolute_import, with_statement
__all__ = ['EventHandler', ]
from treeio.events.models import Event
from treeio.events.forms import EventForm
from treeio.core... | havard024/prego | events/api/handlers.py | Python | mit | 797 |
import json
import os
import sys
import gettext as gettext_module
from django import http
from django.conf import settings
from django.template import Context, Template
from django.utils import importlib
from django.utils.translation import to_locale
from django.utils.encoding import smart_text
from django.utils.forma... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/statici18n/compat.py | Python | agpl-3.0 | 8,409 |
# 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... | hehongliang/tensorflow | tensorflow/python/kernel_tests/morphological_ops_test.py | Python | apache-2.0 | 18,659 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICE... | jimbobhickville/taskflow | taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py | Python | apache-2.0 | 1,778 |
#!/usr/bin/env python
import socket, ssl
# This is a copy of _RESTRICTED_SERVER_CIPHERS from the current tip of ssl.py
# <https://hg.python.org/cpython/file/af793c7580f1/Lib/ssl.py#l174> except that
# RC4 has been added back in, since it was removed in Python 2.7.10,
# but SSLStreamConnection only supports RC4 cipher... | marco-c/pluotsorbet | tests/sslEchoServer.py | Python | gpl-2.0 | 2,382 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listtransactions API
from test_framework.test_framework import InfinitumTestFramework
fro... | fcecin/infinitum | qa/rpc-tests/listtransactions.py | Python | mit | 10,223 |
# -*- coding: utf-8 -*-
############################################################################
# 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... | Rusk85/pyload | module/plugins/hooks/DebridItaliaCom.py | Python | gpl-3.0 | 2,462 |
"""
This module implements a set of functions that are commonly used by plugins.
"""
from traceback import print_exc as debug
from os.path import exists, dirname, join
from vyapp.app import root
from vyapp.areavi import AreaVi
from os.path import abspath
import sys
def set_line(area, line, col=0):
"""
Th... | iogf/vy | vyapp/tools.py | Python | mit | 3,130 |
"""Contains the implementation of the command entry widget."""
from mudpyl.gui.commandhistory import CommandHistory
from mudpyl.gui.tabcomplete import Trie
from mudpyl.gui.keychords import from_gtk_event
import gtk
import pango
class CommandView(gtk.Entry):
"""The area where the user enters commands to be sent to... | Nik0las1984/mudpyl | mudpyl/gui/gtkcommandline.py | Python | gpl-2.0 | 2,673 |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | Dexhub/MTX | src/arch/x86/X86TLB.py | Python | bsd-3-clause | 2,737 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# 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 Apach... | twitter/heron | heronpy/connectors/pulsar/pulsarstreamlet.py | Python | apache-2.0 | 3,080 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.