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 -*-
"""Collect driver parameters."""
import numpy as np
from . import air
class Driver(object):
"""Class to model driver units."""
def __init__(self, manufacturer, model):
"""Create a new driver.
Args:
manufacturer : manufacturer of the driver
mode... | Psirus/altay | altai/lib/driver.py | Python | bsd-3-clause | 4,306 |
import json
data = {"Name": "Miguel",
"Age": 27,
"ID": 18810993,
"info" : {"Height": 1.72,
"Weight": 80
}
}
with open("data.json", "w") as f:
f.write(json.dumps(data))
with open("example.json") as f:
j = json.loads(f.read())
print(j["isA... | miky-kr5/Presentations | Ecoanova/Introduccion a Python 3/Ejemplos/jsoning.py | Python | cc0-1.0 | 328 |
"""
===========
scipyoptdoc
===========
Proper docstrings for scipy.optimize.minimize et al.
Usage::
.. scipy-optimize:function:: scipy.optimize.minimize
:impl: scipy.optimize.optimize._minimize_nelder_mead
:method: Nelder-Mead
Produces output similar to autodoc, except
- The docstring is obtaine... | DailyActie/Surrogate-Model | 01-codes/scipy-master/doc/source/scipyoptdoc.py | Python | mit | 5,119 |
#!/usr/bin/python
import sys
import yaml
import json
j = json.load(sys.stdin)
yaml.safe_dump(j, sys.stdout, default_flow_style=False, canonical=False)
| tedder/aws-advent-2014-yml-cloudformation | json-to-yaml.py | Python | mit | 153 |
import os
import json
import numpy as np
try:
from numba.pycc import CC
cc = CC('calculate_numba')
except ImportError:
# Will use these as regular Python functions if numba is not present.
class CCSubstitute(object):
# Make a cc.export that doesn't do anything
def export(*args, **kwar... | ConservationInternational/ldmp-qgis-plugin | LDMP/calculate_numba.py | Python | gpl-2.0 | 4,469 |
# System built-in modules
import time
from datetime import datetime
import sys
import os
from multiprocessing import Pool
# Project dependency modules
import pandas as pd
pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment
import lasagne
# Project modules
sys.path.append('... | zaxliu/deepnap | experiments/kdd-exps/experiment_QNN_Feb2_0953.py | Python | bsd-3-clause | 4,589 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Samrai(AutotoolsPackage):
"""SAMRAI (Structured Adaptive Mesh Refinement Application Infra... | LLNL/spack | var/spack/repos/builtin/packages/samrai/package.py | Python | lgpl-2.1 | 4,890 |
# Copyright The OpenTelemetry 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 law or agreed to in ... | open-telemetry/opentelemetry-python | tests/opentelemetry-test-utils/src/opentelemetry/test/spantestutil.py | Python | apache-2.0 | 2,743 |
# -*- coding: UTF-8 -*-
#!/usr/bin/python
import sqlite3
import pdfkit
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash,send_file
from flask import make_response
from contextlib import closing
import requests
import urllib
import random
import os
from os.path import ... | darcyfdu/findlicense | index.py | Python | apache-2.0 | 8,913 |
import redis
from time import sleep
db0 = redis.StrictRedis(host='127.0.0.1',
port=6379,
password='niotloraredis',
db=10)
def run():
while True:
sleep(30)
for client in db0.client_list():
if client['cmd'] == 'unsu... | soybean217/lora-python | UServer/socket_io/clear_unsubscribe_client.py | Python | mit | 499 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from apps.schedules.views import Top, New, Detail, UsersNew
urlpatterns = [
url(r'^$', Top.as_view(), name='index'),
url(r'^new/$', New.as_view(), name='new'),
url(r'^(?P<id>[0-9]+)/$', Detail.as_view(), name='detail'),
url(r'^(?P<id>[0-9]+)/user... | ksk-saka/sca | apps/schedules/urls.py | Python | mit | 371 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api import client
from sentry.api.base import DocSection
from sentry.api.bases.group import GroupEndpoint
from sentry.models import Group
from sentry.utils.apidocs import scenario, attach_scenarios
@scenario('GetOldestGr... | JamesMura/sentry | src/sentry/api/endpoints/group_events_oldest.py | Python | bsd-3-clause | 1,288 |
"""Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | ssanderson/numpy | numpy/linalg/linalg.py | Python | bsd-3-clause | 78,991 |
from __future__ import absolute_import, division, print_function
from .common import Benchmark
import numpy
class Core(Benchmark):
def setup(self):
self.l100 = range(100)
self.l50 = range(50)
self.l = [numpy.arange(1000), numpy.arange(1000)]
self.l10x10 = numpy.ones((10, 10))
... | mingwpy/numpy | benchmarks/benchmarks/bench_core.py | Python | bsd-3-clause | 1,929 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-18 21:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('enquiry', '0002_newslettersignup'),
]
operations = [
... | samsath/cpcc_backend | src/website/enquiry/migrations/0003_auto_20170618_2137.py | Python | gpl-3.0 | 1,048 |
import argparse
import copy
from . import log, setup_logger
from .auth import parse_authentication
from .confluence_api import create_confluence_api
from .confluence import ConfluencePageManager, AttachmentPublisher
from .config import ConfigLoader, flatten_page_config_list, PageImageAattachmentConfig
from .constants ... | dopuskh3/confluence-publisher | conf_publisher/publish.py | Python | mit | 8,038 |
#
# 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 ... | thinker0/aurora | src/test/python/apache/aurora/common/test_transport.py | Python | apache-2.0 | 6,895 |
#!/usr/bin/python
import sqlite3
import sys
import cgi
import cgitb
# global variables
speriod=(15*60)-1
dbname='/var/www/templog.db'
# print the HTTP header
def printHTTPheader():
print "Content-type: text/html\n\n"
# print the HTML head section
# arguments are the page title and the table for the chart
d... | RoelofZA/WeatherStation | webgui.py | Python | mit | 8,740 |
# coding: utf-8
"""
@Author: Well
@Date: 2015 - 09 - 19
"""
from __future__ import unicode_literals
from __future__ import print_function
from flask_wtf import Form, RecaptchaField
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import data_required
class LoginForm(Form):
u... | neiltest/neil_learn_flask_web | app/home/forms.py | Python | mit | 527 |
#!/usr/bin/env python3
# encoding: utf-8
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | maui-packages/calamares | src/modules/grub/main.py | Python | gpl-3.0 | 1,214 |
#!/usr/bin/env python
# filename: _correct.py
###########################################################################
#
# Copyright (c) 2015 Bryan Briney. All rights reserved.
#
# @version: 1.0.0
# @author: Bryan Briney
# @license: MIT (http://opensource.org/licenses/MIT)
#
#####################################... | briney/abtools | abtools/_correct_old.py | Python | mit | 37,421 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('votes', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='vote',
name='vote_name',
... | asselapathirana/classvotes | classvotes/votes/migrations/0002_vote_vote_name.py | Python | gpl-3.0 | 421 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | rjschwei/azure-sdk-for-python | azure-mgmt-web/setup.py | Python | mit | 2,303 |
import gc
import os
import logging
from configparser import ConfigParser
from pandas import HDFStore
from openfisca_survey_manager import default_config_files_directory
log = logging.getLogger(__name__)
temporary_store_by_file_path = dict()
def temporary_store_decorator(config_files_directory = default_config... | openfisca/openfisca-survey-manager | openfisca_survey_manager/temporary.py | Python | agpl-3.0 | 3,328 |
class Solution(object):
def hammingDistance(self, x, y):
"""
:type x: int
:type y: int
:rtype: int
"""
return bin(x ^ y)[2:].count('1')
| lilsweetcaligula/Online-Judges | leetcode/easy/hamming_distance/py/solution.py | Python | mit | 188 |
#!/usr/bin/env python
import sys
import math
_symbols = { }
_cond = [ ]
_iterators = [ ]
_empties_in_a_row = 0
# Classes
class iterator:
def __init__(self):
self.str_start = ""
self.str_end = ""
self.str_iter = ""
self.symbol = ""
self.first_line = 0
self... | Steganogra/verilog-tools | vpp+/vpp+.py | Python | gpl-2.0 | 14,549 |
from gen import *
##########
# shared #
##########
flow_var[0] = """
(declare-fun tau () Real)
"""
flow_dec[0] = """
(define-ode flow_1 ((= d/dt[tau] 1)))
"""
state_dec[0] = """
(declare-fun time_{0} () Real)
(declare-fun tau_{0}_0 () Real)
(declare-fun tau_{0}_t () Real)
"""
state_val[0] = """
(assert (<= 0 ... | wolvre/dreal | benchmarks/network/battery/battery-double-p-i-sat.py | Python | gpl-2.0 | 6,058 |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class JournalConfig(AppConfig):
label = 'userspace_library'
name = 'apps.userspace.library'
| erudit/zenon | eruditorg/apps/userspace/library/apps.py | Python | gpl-3.0 | 161 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Form Customization"),
"icon": "fa fa-glass",
"items": [
{
"type": "doctype",
"name": "Customize Form",
"description": _("Change field properties (hide, readonly, permission etc.)")
... | vjFaLk/frappe | frappe/config/customization.py | Python | mit | 1,301 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0081_auto_20150314_2204'),
]
operations = [
migrations.RenameField(
model_name='taxsaveinputs',
... | talumbau/webapp-public | webapp/apps/taxbrain/migrations/0082_auto_20150314_2206.py | Python | mit | 1,408 |
from math import gcd
def units(n):
return [x for x in range(0, n) if gcd(n, x) == 1]
def generate(g, n):
acc = set()
x = 1 if n != 1 else 0
while not x in acc:
acc.add(x)
x = (x*g)%n
return acc
def is_cyclic(n):
G = units(n); setG = set(G)
return any(generate(g, n) == set... | JohnBSmith/JohnBSmith.github.io | Informatik/Rezepte/py/cyclic.py | Python | cc0-1.0 | 512 |
# Copyright 2012-2013 James McCauley
#
# 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 ... | MurphyMc/pox | pox/forwarding/l2_multi.py | Python | apache-2.0 | 15,535 |
# -*- coding: utf-8 -*-
# Copyright 2013-2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from functools import partial
from collections import namedtuple
from .exception import NoConnectorUnitError
from .connector import is_module_installed
__all__ = ['Backend']
class BackendR... | js-landoo/connector | connector/backend.py | Python | agpl-3.0 | 12,627 |
from bingmaps.apiservices import LocationByQuery
from .fixtures import parametrize, https_protocol, BING_MAPS_KEY
DATA = [
{
'q': '8672 Eagle Road Teaneck, NJ 07666',
'key': BING_MAPS_KEY
},
{
'q': '7266 Canterbury Court Oshkosh, WI 54901',
'key': BING_MAPS_KEY
},
{
... | bharadwajyarlagadda/bingmaps | tests/test_location_by_query_url.py | Python | mit | 2,496 |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... | couchbasedeps/git-repo | git_config.py | Python | apache-2.0 | 21,644 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vasicek parameter class
~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function, division
import numpy as np
from .param_generic import GenericParam
__all__ = ['VasicekParam']
class VasicekParam(GenericParam):
"""Parameter storage for Vasicek model.... | khrapovs/diffusions | diffusions/param_vasicek.py | Python | mit | 2,899 |
# -*- coding: utf-8 -*-
"""This module defines the class Argument and a number of related
classes (functions), including TestFunction and TrialFunction."""
# Copyright (C) 2008-2016 Martin Sandve Alnæs
#
# This file is part of UFL (https://www.fenicsproject.org)
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Mo... | FEniCS/ufl | ufl/argument.py | Python | lgpl-3.0 | 7,035 |
# -*- coding: utf-8 -*-
from typing import Iterable, BinaryIO
from minerva.storage.trend.datapackage import DataPackage
from minerva.storage.trend.engine import TrendEngine
class HarvestParserTrend:
@staticmethod
def store_command():
engine = TrendEngine()
return engine.store_cmd
def lo... | hendrikx-itc/python-minerva | src/minerva/harvest/plugin_api_trend.py | Python | gpl-3.0 | 1,043 |
#! /usr/bin/env python
# encoding: utf-8
# Alexander Afanasyev (UCLA), 2014
"""
Enable precompiled C++ header support (currently only clang++ and g++ are supported)
To use this tool, wscript should look like:
def options(opt):
opt.load('pch')
# This will add `--with-pch` configure option.
# Unless --with-pch ... | srene/ndnSIM-inrpp | src/ndnSIM/NFD/.waf-tools/pch.py | Python | gpl-2.0 | 4,570 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserSettings.locus_name'
db.add_column('fbapp_usersettings', 'locus_name',
... | Ecotrust/locus | locus/fbapp/migrations/0003_auto__add_field_usersettings_locus_name__add_field_usersettings_ns_pub.py | Python | bsd-3-clause | 10,120 |
#!/usr/bin/env python
import warnings
import re
import subprocess
import types
import yaml
import pandas as pd
import numpy as np
import rosbag
import rospy
from roslib.message import get_message_class
def bag_to_dataframe(bag_name, include=None, exclude=None, parse_header=False, seconds=False):
'''
Read i... | huiyi1990/RosbagPandas | rosbag_pandas.py | Python | apache-2.0 | 8,453 |
import picamera as pi
import time
import datetime
from calvin.runtime.south.plugins.async.twistedimpl import threads
from calvin.utilities.calvinlogger import get_logger
_log = get_logger(__name__)
class CalvinPiCamera(object):
def __init__(self):
self.camera = pi.PiCamera()
self._in_progress = N... | les69/calvin-base | calvin/calvinsys/media/calvinpicamera.py | Python | apache-2.0 | 1,181 |
#!/usr/bin/env python
import librmn
help(librmn)
import librmn.proto
help(librmn.proto)
| meteokid/python-rpn | __old/librmnhelp.py | Python | lgpl-2.1 | 88 |
try:
from pytesseract import image_to_string
except ImportError:
from pytesseract.pytesseract import image_to_string
| akhilari7/pa-dude | lib/python2.7/site-packages/pytesseract/__init__.py | Python | mit | 125 |
# -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2018 by XESS Corporation / Hildo Guillardi Júnior
#
# 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, includi... | xesscorp/KiCost | kicost/edas/generic_csv.py | Python | mit | 10,026 |
# Authors: David Goodger; Gunnar Schwant
# Contact: goodger@users.sourceforge.net
# Revision: $Revision$
# Date: $Date$
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.ht... | crystalspace/CS | docs/support/docutils/languages/de.py | Python | lgpl-2.1 | 1,759 |
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 12:16:16 2017
"""
from collections import namedtuple
Customer = namedtuple('Customer', 'name fidelity')
class LineItem(object): #商品
def __init__(self, product, quantity, price):
self.product = product
self.quantity = quantity
self.p... | wuqize/FluentPython | chapter6/strategy_best.py | Python | lgpl-3.0 | 2,338 |
import matplotlib
matplotlib.use('Agg')
from isochrones.dartmouth import Dartmouth_Isochrone
from isochrones.starmodel import StarModel
from isochrones.observation import ObservationTree
import pandas as pd
import matplotlib.pyplot as plt
from mpi4py import MPI
#comm = MPI.COMM_WORLD
#rank = comm.Get_rank()
for n in ... | nonsk131/USRP2016 | fitMultinest_tests.py | Python | mit | 2,033 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_d... | thequbit/ichabod | ichabod/setup.py | Python | agpl-3.0 | 1,198 |
# Based on the code.py python module
import sys
import traceback
import io
import contextlib
import functools
import argparse
from codeop import CommandCompiler, compile_command
import asyncio
__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
"compile_command"]
_exit = exit
@context... | ZhukovAlexander/rafter | rafter/raftconsole.py | Python | apache-2.0 | 12,005 |
from django.conf import settings, UserSettingsHolder
from django.contrib.auth.models import User
from django.contrib.messages.storage.fallback import FallbackStorage
from django.test.client import Client
from django.utils.functional import wraps
from django.utils.importlib import import_module
import constance.config
... | mastizada/kuma | kuma/core/tests/__init__.py | Python | mpl-2.0 | 6,376 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry import tsdb
from sentry.api.base import EnvironmentMixin, StatsMixin
from sentry.api.bases.group import GroupEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.models import Environment
class Gro... | looker/sentry | src/sentry/api/endpoints/group_stats.py | Python | bsd-3-clause | 892 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('devices', '__first__'),
('filesystem', '__first__'),
('core', '__first__'),
]
operations = [
migrations.Crea... | strongswan/strongTNC | apps/swid/migrations/0001_initial.py | Python | agpl-3.0 | 6,008 |
# Copyright 2013 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.
import unittest
from telemetry.core.platform import desktop_device
from telemetry.internal.backends.chrome import desktop_browser_finder
from telemetry.inter... | TheTypoMaster/chromium-crosswalk | tools/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder_unittest.py | Python | bsd-3-clause | 8,810 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Croc Bauges - Print Product module for Odoo
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you c... | grap/odoo-addons-crb | crb_print_product/models/product_product.py | Python | agpl-3.0 | 3,105 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
#
# Ikonos metadata parser and converter - library.
#
# Project: EO Metadata Handling
# Authors: Martin Paces <martin.paces@eox.at>
#
#-------------------------------------------------------------------------------
#... | DREAM-ODA-OS/tools | metadata/profiles/ikonos_parser.py | Python | mit | 5,915 |
# Copyright (c) 2014 RainMachine, Green Electronics LLC
# All rights reserved.
# Authors: Nicu Pavel <npavel@mini-box.com>
# Codrin Juravle <codrin.juravle@mini-box.com>
from collections import OrderedDict
from RMUtilsFramework.rmTimeUtils import rmTimestampToDateAsString
from RMDataFramework.rmForecastInfo... | sprinkler/rainmachine-developer-resources | sdk-parsers/RMDatabaseFramework/rmMixerDataTable.py | Python | gpl-3.0 | 16,346 |
class ManyToNativeMixin (object):
def many_to_native(self, value):
return [self.to_native(item) for item in value]
def field_to_native(self, obj, field_name):
"""
Override default so that the serializer can be used as a nested field
across relationships.
"""
from... | CityOfPhiladelphia/myphillyrising | website/utils/rest_framework_extensions.py | Python | gpl-3.0 | 2,136 |
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import admin, wtf
from flask.ext.admin.contrib import sqlamodel
from flask.ext.admin.contrib.sqlamodel import filters
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY']... | sfermigier/flask-admin | examples/sqla/simple.py | Python | bsd-3-clause | 3,677 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import requests
from requests import exceptions
URL = "https://api.github.com"
def build_uri(endpoint):
'''
@拼合连接
'''
return '/'.join([URL,endpoint])
def better_print(json_str):
return json.dumps(json.loads(json_str),indent... | zhangyage/Python-oldboy | my_request/main.py | Python | apache-2.0 | 1,916 |
#!/usr/bin/env python
"""
@file graph.py
@author Remi Domingues
@date 13/08/2013
This script reads an input socket connected to the remote client and process a request when received.
Requests must be sent on the port 180001, responses are sent on the port 18002.
Socket messages:
EDGES COORDINATES
(1)... | remidomingues/ASTra | astra/graph.py | Python | gpl-3.0 | 31,726 |
from django.conf.urls import url
from api.applications import views
app_name = 'osf'
urlpatterns = [
url(r'^$', views.ApplicationList.as_view(), name=views.ApplicationList.view_name),
url(r'^(?P<client_id>\w+)/$', views.ApplicationDetail.as_view(), name=views.ApplicationDetail.view_name),
url(r'^(?P<clie... | icereval/osf.io | api/applications/urls.py | Python | apache-2.0 | 417 |
# 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/.
import mozinfo
import os
import platform
import sys
from .runner import BaseRunner
class GeckoRuntimeRunner(BaseRunne... | vladikoff/fxa-mochitest | tests/venv/lib/python2.7/site-packages/mozrunner/base/browser.py | Python | mpl-2.0 | 2,915 |
from datetime import date, datetime, time, timedelta
from django.contrib import admin
from django.utils import timezone
from enrichmentmanager.models import Teacher, Student, EnrichmentOption, EnrichmentSlot, EnrichmentSignup, EmailSuppression
from simple_history.admin import SimpleHistoryAdmin
class EditableUntilLi... | rectory-school/rectory-apps | enrichmentmanager/admin.py | Python | mit | 4,641 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-11 15:33
from __future__ import unicode_literals
from django import VERSION
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('email_auth', '0003_django110'),
]
operations = []
... | khchine5/django-shop | email_auth/migrations/0004_auto_20170411_1733.py | Python | bsd-3-clause | 864 |
"""
A place for code to be called from the implementation of np.dtype
String handling is much easier to do correctly in python.
"""
import numpy as np
_kind_to_stem = {
'u': 'uint',
'i': 'int',
'c': 'complex',
'f': 'float',
'b': 'bool',
'V': 'void',
'O': 'object',
'M': 'datetime',
... | simongibbons/numpy | numpy/core/_dtype.py | Python | bsd-3-clause | 9,843 |
""" Command Result model """
from django.db import models
from django.utils import timezone
class CommandResultEntry(models.Model):
""" Command Result """
command = models.OneToOneField('commandrepo.CommandEntry')
out = models.TextField(default='')
error = models.TextField(default='')
status = mo... | imvu/bluesteel | app/logic/commandrepo/models/CommandResultModel.py | Python | mit | 1,052 |
"""
Provides an API for connecting and disconnecting Entities.
You should only use this to build your own test scenarios
"""
from core import topoOf
def link (entity1, entity2):
""" Connects the two nodes on a free port """
return topoOf(entity1).linkTo(entity2)
def unlink (entity1, entity2):
""" Disconnects t... | zhaoyan1117/RoutingProtocols | sim/topo.py | Python | bsd-3-clause | 715 |
#
# Secret Labs' Regular Expression Engine
#
# re-compatible interface for the sre matching engine
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# This version of the SRE library can be redistributed under CNRI's
# Python 1.6 license. For any other use, please contact Secret Labs
# AB (info@py... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/re.py | Python | lgpl-3.0 | 14,508 |
from SimpleCV.base import *
from SimpleCV.Features.Features import Feature, FeatureSet
from SimpleCV.Color import Color
from SimpleCV.ImageClass import Image
from SimpleCV.Features.Detection import ShapeContextDescriptor
import math
import scipy.stats as sps
class Blob(Feature):
"""
**SUMMARY**
A blob is ... | beni55/SimpleCV | SimpleCV/Features/Blob.py | Python | bsd-3-clause | 48,109 |
# coding=utf-8
# This file is part of Bika LIMS
#
# Copyright 2011-2016 by it's authors.
# Some rights reserved. See LICENSE.txt, AUTHORS.txt.
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from bika.lims.browser.bika_listing import BikaListingTable
from bika.lims.browser.worksheet.views.anal... | rockfruit/bika.lims | bika/lims/browser/worksheet/views/analyses_transposed.py | Python | agpl-3.0 | 4,358 |
# (void)walker command line interface
# Copyright (C) 2012 David Holm <dholmster@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 3 of the License, or
# (at your option... | dholm/voidwalker | voidwalker/framework/interface/__init__.py | Python | gpl-3.0 | 1,391 |
# (c) Crown Copyright 2014 Defence Science and Technology Laboratory UK
# Author: Rich Brantingham
import os
import sys
#////////////////////////////////////////////////////////////////////////////////////
#
# This settings file adds in other settings files that are based on the
# local running environme... | dstl/ideaworks | backend/ideaworks/ideaworks/settings.py | Python | agpl-3.0 | 9,091 |
"""
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Mar 10, 2013.
"""
from everest.resources.staging import create_staging_collection
from everest.testing import ResourceTestCase
from everest.tests.complete_app.entities import MyEntity
f... | helixyte/everest | everest/tests/test_staging_collection.py | Python | mit | 1,397 |
# 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.
from recipe_engine.types import freeze
from recipe_engine.recipe_api import Property
DEPS = [
'cronet',
'recipe_engine/properties',
]
BUILDERS = freeze... | eunchong/build | scripts/slave/recipe_modules/cronet/example.py | Python | bsd-3-clause | 1,298 |
from typing import NewType
from bottles.backend.logger import Logger # pyright: reportMissingImports=false
from bottles.backend.wine.wineprogram import WineProgram
logging = Logger()
# Define custom types for better understanding of the code
BottleConfig = NewType('BottleConfig', dict)
class Taskmgr(WineProgram):... | mirkobrombin/Bottles | src/backend/wine/taskmgr.py | Python | gpl-3.0 | 379 |
#-----------------------------------------------------------------------------
# Copyright (c) 2014-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-requests.py | Python | gpl-3.0 | 574 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
... | bearstech/ansible | lib/ansible/modules/network/junos/junos_command.py | Python | gpl-3.0 | 13,182 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from app.config.devices import Parser
def get_all_config_test():
path = 'examples'
assert type(Parser.get_all_config(path)) is Parser.get_all_config.__annotations__['return']
| rbagrov/xana | tests/get_all_config_test.py | Python | mit | 230 |
# Copyright 2019 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... | gunan/tensorflow | tensorflow/python/distribute/custom_training_loop_models_test.py | Python | apache-2.0 | 16,038 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | FNST-OpenStack/horizon | openstack_dashboard/test/integration_tests/pages/identity/projectspage.py | Python | apache-2.0 | 4,452 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Top-level module for librosa"""
import warnings
import re
from .version import version as __version__
from .version import show_versions
# And all the librosa sub-modules
from . import cache
from . import core
from . import beat
from . import decompose
from . import ef... | r9y9/librosa | librosa/__init__.py | Python | isc | 850 |
from __future__ import print_function, division
import decimal
import math
import re as regex
import sys
from collections import defaultdict
from .core import C
from .sympify import converter, sympify, _sympify, SympifyError
from .singleton import S, Singleton
from .expr import Expr, AtomicExpr
from .decorators impor... | kmacinnis/sympy | sympy/core/numbers.py | Python | bsd-3-clause | 81,489 |
# import scrapy
# class QuotesSpider(scrapy.Spider):
# name = "quotes"
# allowed_domains = ["toscrape.com"]
# start_urls = [
# "http://quotes.toscrape.com/"
# ]
# def parse(self, response):
# index = 0
# for sel in response.xpath('//div[@class="quote"]'):
# cont... | fishjar/gabe-study-notes | scrapy/myproject/myproject/spiders/quotes_spider.py | Python | gpl-3.0 | 5,865 |
from django.db import models
# Create your models here.
class Career(models.Model):
name = models.CharField(max_length=80)
faculty = models.CharField(max_length=80)
def __str__(self):
return self.name
class AcademicTitle(models.Model):
LEVELS = (
('3', 'Tercer Nivel'),
('4E... | miltonlab/researchman | manager/models.py | Python | agpl-3.0 | 1,045 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SMes.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Byx69/SMes | manage.py | Python | gpl-2.0 | 247 |
"""
Generate Command
"""
import argparse
from string import ascii_letters, digits, punctuation
from random import choice
def generate_pass(length, no_symbols=False):
chars = ascii_letters + digits
if not no_symbols:
chars += punctuation
return ''.join(choice(chars) for _ in range(length))
def ru... | TeensyPass/teensycli | teensy_pass/generate.py | Python | gpl-2.0 | 657 |
#!/usr/bin/env python3
import argparse
import os
import pwd
import signal
import subprocess
import sys
from typing import Any, Callable, Generator, List, Sequence
from urllib.parse import urlunparse
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
# check for the v... | andersk/zulip | tools/run-dev.py | Python | apache-2.0 | 12,598 |
from __future__ import annotations
import procrunner
import pytest
import xia2.Test.regression
@pytest.mark.parametrize("pipeline", ["dials", "3dii"])
def test_xia2(pipeline, regression_test, dials_data, tmpdir, ccp4):
master_h5 = dials_data("vmxi_thaumatin") / "image_15799_master.h5:1:20"
command_line = [
... | xia2/xia2 | tests/regression/test_vmxi_thaumatin.py | Python | bsd-3-clause | 808 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleinterns/vm-network-migration | vm_network_migration/modules/forwarding_rule_modules/internal_regional_forwarding_rule.py | Python | apache-2.0 | 3,758 |
#vim:set et sts=4 sw=4:
#
# Zanata Python Client
#
# Copyright (c) 2011 Jian Ni <jni@redhat.com>
# Copyright (c) 2011 Red Hat, Inc.
#
# This library 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; eit... | dashea/zanata-python-client | zanataclient/zanatalib/projectservice.py | Python | gpl-3.0 | 5,810 |
from django.template import RequestContext
from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib import messages
from django.core.urlresolvers import reverse
... | dannysellers/django_orders | tracker/views/workorder_views.py | Python | gpl-2.0 | 5,164 |
"""
Permission read functions.
This is a simple proxy to the permission system implemented in SQL.
See sql/functions.sql
c_can_see_cg C can view existence of CG
c_can_change_cg C can change/delete CG itself,
including add/edit/delete fields
c_can_see_members_cg C c... | nirgal/ngw | core/perms.py | Python | bsd-2-clause | 16,161 |
#!/usr/bin/env python2
#
# Copyright (C) 2015 The Android Open Source Project
#
# 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 re... | wiki2014/Learning-Summary | alps/bionic/tools/bionicbb/bionicbb.py | Python | gpl-3.0 | 4,708 |
# -*- coding: utf-8 -*-
'''
PyCampbellCR1000.pakbus
-----------------------
PakBus protocol Implementation.
Original Author: Dietrich Feist, Max Planck Institute for Biogeochemistry,
Jena Germany (PyPak)
:copyright: Copyright 2012 Salem Harrache and contributors, see AUTHORS.
... | LionelDarras/PyCampbellCR1000 | pycampbellcr1000/pakbus.py | Python | gpl-3.0 | 34,365 |
# 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/.
# Utility package for working with moz.yaml files.
#
# Requires `pyyaml` and `voluptuous`
# (both are in-tree under th... | escapewindow/signingscript | src/signingscript/vendored/mozbuild/mozbuild/moz_yaml.py | Python | mpl-2.0 | 10,022 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
from six.moves import zip as izip
# Internal modules #
from fasta import FASTA, FASTQ
from plumbing.common import isubsample, GenWithLength
from plumbing.cache import prope... | xapple/fasta | fasta/paired.py | Python | mit | 3,670 |
#made by tomMoulard 27/08/16
import random
def setres(n):
if n <= 0:
return ""
else:
return(chr(random.randint(33, 126))+setres(n - 1))
def sendemail(cnt):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
msg = MIMEMultipart()
msg['From'] = "gipsyzilla@gma... | tomMoulard/python-projetcs | passwordGen/main.py | Python | apache-2.0 | 1,042 |
"""
Copyright 2016 Mellanox Technologies. All rights reserved.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
jiri@mellanox.com (Jiri Pirko)
"""
from lnst.Controller.Task import ctl
from TestLib import TestLib
from t... | jiriprochazka/lnst | recipes/switchdev/l2-006-bridge_team.py | Python | gpl-2.0 | 2,761 |
# -*- coding: utf-8 -*-
""" Views for Logging user out """
from django.contrib.auth import logout
from django.shortcuts import redirect
def logout_page(request):
""" Log the user out and redirect to homepage """
logout(request)
return redirect('index')
| Gimpneek/exclusive-raid-gym-tracker | app/views/logout.py | Python | gpl-3.0 | 267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.