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 |
|---|---|---|---|---|---|
"""This namespace aggregates modules related to wavelength calibration.
"""
from .wavelength_calibration import WavelengthCalibrator
| rcbrgs/tuna | tuna/tools/wavelength/__init__.py | Python | gpl-3.0 | 134 |
#!/usr/bin/env python3
from setuptools import setup
setup(
name="svgplease",
version="0.2",
url="https://github.com/sapal/svgplease",
download_url="https://launchpad.net/~sapalskimichal/+archive/svgplease",
license="GPLv3",
author="Michał Sapalski",
author_email="sapalskimichal@gmail.com",
... | sapal/svgplease | code/setup.py | Python | gpl-3.0 | 1,246 |
def feed():
import feedparser
d = feedparser.parse('http://www.reddit.com/r/python/.rss')
entries = d.entries
return dict(message=sif, source=source, title1=title1, entries=entries)
| seefor/mycode | feed.py | Python | apache-2.0 | 198 |
import os
import sys
import sqlite3
import logging
from tqdm import tqdm
from pathlib import Path
from whoosh.index import create_in, open_dir
from whoosh.fields import Schema, TEXT, NUMERIC
from whoosh.qparser import QueryParser
from whoosh.spelling import ListCorrector
from whoosh.highlight import UppercaseFormatter
... | DeastinY/srpdfcrawler | pdf_search.py | Python | gpl-3.0 | 2,775 |
import re
import requests
from collections import deque
from bs4 import BeautifulSoup
from . import db
from .models import Instructor, Department, Course, Term, Rating
def run():
"""A breadth-first search on the graph of Ninja Courses data.
We view each department, course, and instructor as a node,
to be p... | rskwan/ncindex | ncindex/scraper.py | Python | mit | 7,488 |
"""Tests for account creation"""
from datetime import datetime
import json
import unittest
import ddt
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User, AnonymousUser
from django.core.urlresolvers import reverse
from django.test import TestCase, TransactionTestCase
fro... | romain-li/edx-platform | common/djangoapps/student/tests/test_create_account.py | Python | agpl-3.0 | 30,398 |
# fbdata.models
# PYTHON
from datetime import timedelta
# DJANGO
from django.conf import settings
from django.core.paginator import Paginator
from django.db import models
# DJANGO FACEBOOK
from django_facebook.models import FacebookProfile
# FBDATA
from .fields import IntegerListField
from .utils import (
date_... | valuesandvalue/valuesandvalue | vavs_project/fbdata/models.py | Python | mit | 29,633 |
# 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)
import platform
from spack import *
class IntelOneapiDpl(IntelOneApiLibraryPackage):
"""Intel oneAPI DPL."""
... | LLNL/spack | var/spack/repos/builtin/packages/intel-oneapi-dpl/package.py | Python | lgpl-2.1 | 1,726 |
from nose.tools import * # noqa
from tests.base import (
OsfTestCase,
fake
)
from tests.factories import (
UserFactory,
ProjectFactory
)
from tests import utils
from website.files import models
from tests.test_addons import TestFile
from website.models import MetaSchema
from website.prereg.utils impo... | chrisseto/osf.io | scripts/tests/test_migrate_registration_extra.py | Python | apache-2.0 | 5,204 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 4 15:13:53 2015
@author: remi
"""
import psycopg2
def connect_to_base():
conn = psycopg2.connect(
database='vosges'
,user='postgres'
,password='postgres'
,host='172.16.3.50'
,port='5432' ) ;
cur = conn.cursor()
r... | Remi-C/LOD_ordering_for_patches_of_points | script/octree_ordering_out_of_server.py | Python | lgpl-3.0 | 7,993 |
from datetime import datetime
from django.db import models
from LabtrackerCore.models import Item,InventoryType,Group
from django.contrib.auth.models import User
from django.test import TestCase
from django import dispatch
class ResolveState(models.Model):
"""
Issues are resolved into a resolve state such as t... | abztrakt/labtracker | IssueTracker/models.py | Python | apache-2.0 | 4,368 |
import os
import urllib2
from . import *
from .helpers.mail import *
RESET_PW = '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
SG = sendgrid.SendGridAPIClient(apikey=os.environ['SENDGRID_API_KEY'])
def _send_email(template_id, subject, dst_email, dst_name, src_email, src_name, sub_dict):
mail = Mail()
mail.set_sub... | sbuss/voteswap | lib/sendgrid/temp.py | Python | mit | 1,286 |
from django.core.cache.backends import filebased
from django_prometheus.cache.metrics import (
django_cache_get_total,
django_cache_hits_total,
django_cache_misses_total,
)
class FileBasedCache(filebased.FileBasedCache):
"""Inherit filebased cache to add metrics about hit/miss ratio"""
def get(s... | korfuri/django-prometheus | django_prometheus/cache/backends/filebased.py | Python | apache-2.0 | 709 |
#!/usr/bin/env python
import os, os.path
from .math import *
from .strings import *
from .rendering import *
from .daemon import Daemon
from .rest_query_parser import *
def mkdir(path):
"""
Makes the specified folder, including required folders "below"
"""
if not path:
return
bpath = os.... | wolverton-research-group/qmpy | qmpy/utils/__init__.py | Python | mit | 2,029 |
#!/usr/bin/env python
import jinja2
import mimetypes
import numpy as np
import csv
import os
import smtplib
import sys
import getpass
import email
import email.utils
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
def is_poster(entry):
if e... | cgodshall/scipy-conference | manual/mailings/program_committee/send-req-reminder.py | Python | bsd-3-clause | 3,730 |
"""
tests.test_generator
~~~~~~~~~~~~~~~~~~~~
Lua table generator (encoder)
"""
import unittest
from luatable.generator import Generator
from luatable.parser import Parser
class GeneratorTestCase(unittest.TestCase):
def test_generate(self):
# examples from Programming in Lua, 3e
inp... | zauonlok/luatable | tests/test_generator.py | Python | mit | 697 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | pkimber/blog | blog/migrations/0001_initial.py | Python | apache-2.0 | 976 |
"""Integrate with DuckDNS."""
from asyncio import iscoroutinefunction
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_DOMAIN
from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.helpers.aiohttp_client import async_get_... | sdague/home-assistant | homeassistant/components/duckdns/__init__.py | Python | apache-2.0 | 3,699 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | tiancj/emesene | emesene/gui/gtkui/RichWidget.py | Python | gpl-3.0 | 4,161 |
from __future__ import division, print_function
from functools import (
wraps,
)
from jim import function
from jim.os_ import mkdirp
def memoized(directory='data'):
mkdirp(directory)
def _memoized(f):
import os
function_directory = os.path.join(
directory,
funct... | Jim-Holmstroem/jim | jim/memoize.py | Python | gpl-2.0 | 885 |
'''
Tornado-MySQL: A pure-Python MySQL client library for Tornado.
Copyright (c) 2010, 2013-2014 PyMySQL contributors
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, includin... | manyunkai/tweixin | weixin/tmysql/__init__.py | Python | gpl-2.0 | 4,381 |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 msto <mstone5@mgh.harvard.edu>
#
# Distributed under terms of the MIT license.
"""
Simple venn diagrams.
"""
import matplotlib.pyplot as plt
import matplotlib.patches as patches
def venn4(subsets,
set_labels=('A', 'B', 'C', 'D'),
# s... | msto/svplot | svplot/venn.py | Python | mit | 8,650 |
# coding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_b64decode,
compat_urllib_parse_unquote,
compat_urlparse,
)
from ..utils import (
determine_ext,
update_url_query,
)
from .bokecc import BokeCCBaseIE
class InfoQIE(BokeCCBaseIE):
_VALID_URL = r'https?://(?:w... | rg3/youtube-dl | youtube_dl/extractor/infoq.py | Python | unlicense | 5,072 |
from Operation import Operation
import HeeksCNC
class Profile(Operation):
def __init__(self):
Operation.__init__(self)
def TypeName(self):
return "Profile"
def op_icon(self):
# the name of the PNG file in the HeeksCNC icons folder
return "profile"
... | AlanZheng/heekscnc | pycnc/Profile.py | Python | bsd-3-clause | 934 |
# Copyright 2013 Mario Graff Guerrero
# 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 wri... | mgraffg/RGP | EvoDAG/utils.py | Python | apache-2.0 | 9,348 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-21 02:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("planner", "0014_school_audit_notes")]
operations = [
migrations.AlterField(
... | mblayman/lcp | conductor/planner/migrations/0015_auto_20170221_0229.py | Python | bsd-2-clause | 398 |
"""Functions to plot M/EEG data on topo (one axes per channel)."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: Simplified BSD
from c... | olafhauk/mne-python | mne/viz/topo.py | Python | bsd-3-clause | 39,094 |
from django.conf.urls import url
from home import views
urlpatterns = [
url(r'^$', views.front, name='front'),
url(r'^register/', views.register, name='register'),
url(r'^login/', views.userLogin, name='login'),
]
| Vritrahan/Chitragupt-Abhilekh | home/urls.py | Python | gpl-3.0 | 228 |
"""
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | seckcoder/lang-learn | python/sklearn/examples/applications/svm_gui.py | Python | unlicense | 11,157 |
# -*- coding: utf-8 -*-
from rest_framework import status as http_status
from framework.exceptions import HTTPError
from website.citations.providers import CitationsProvider
from addons.zotero.serializer import ZoteroSerializer
class ZoteroCitationsProvider(CitationsProvider):
serializer = ZoteroSerializer
pr... | mfraezz/osf.io | addons/zotero/provider.py | Python | apache-2.0 | 5,211 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
from functools import reduce
"""
This module implements representations of slabs and surfaces, as well as
algorithms for generating them.
"""
__author__ = "Ri... | migueldiascosta/pymatgen | pymatgen/core/surface.py | Python | mit | 35,314 |
import os
from collections import defaultdict
from django.db import migrations
def migrate_post_extra_to_postextraelection(apps, schema_editor):
SuggestedPostLock = apps.get_model("moderation_queue", "SuggestedPostLock")
for spl in SuggestedPostLock.objects.all():
# If there's more than one postextra... | DemocracyClub/yournextrepresentative | ynr/apps/moderation_queue/migrations/0019_migrate_post_extra_to_postextraelection.py | Python | agpl-3.0 | 3,476 |
"""empty message
Revision ID: 502662155e36
Revises: 838b8a109034
Create Date: 2016-06-30 01:26:07.563294
"""
# revision identifiers, used by Alembic.
revision = '502662155e36'
down_revision = '838b8a109034'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | agileronin/skills-api | migrations/versions/502662155e36_.py | Python | mit | 868 |
# -*- coding: utf-8 -*-
#
# test_upload.py — UploadController test cases
#
# This file is part of debexpo - https://alioth.debian.org/projects/debexpo/
#
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2010 Jan Dittberner <jandd@debian.org>
#
# Permission is hereby granted, free of charge, to a... | swvist/Debexpo | debexpo/tests/functional/test_upload.py | Python | mit | 5,784 |
from pycp2k.inputsection import InputSection
class _ci_neb1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Nsteps_it = None
self._name = "CI_NEB"
self._keywords = {'Nsteps_it': 'NSTEPS_IT'}
| SINGROUP/pycp2k | pycp2k/classes/_ci_neb1.py | Python | lgpl-3.0 | 250 |
# THREE GOLD STARS
# Sudoku [http://en.wikipedia.org/wiki/Sudoku]
# is a logic puzzle where a game
# is defined by a partially filled
# 9 x 9 square of digits where each square
# contains one of the digits 1,2,3,4,5,6,7,8,9.
# For this question we will generalize
# and simplify the game.
# Define a procedure, check_s... | annaxli/UdacityCS101 | Lesson3/L3Q8.py | Python | mit | 3,769 |
# ***************************************************************************
# * Copyright (c) 2013 Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | Fat-Zer/FreeCAD_sf_master | src/Mod/Fem/femtaskpanels/task_material_common.py | Python | lgpl-2.1 | 33,586 |
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.urls import path
from confla import views
app_name = "confla"
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^$', views.IndexView... | rh-lab-q/conflab | wsgi/openshift/confla/urls.py | Python | gpl-3.0 | 6,136 |
#!/usr/bin/env python
import unittest
import sys
sys.path.insert(0, '..')
from bitstring import ByteStore, ConstByteStore, equal, offsetcopy
class OffsetCopy(unittest.TestCase):
def testStraightCopy(self):
s = ByteStore(bytearray([10, 5, 1]), 24, 0)
t = offsetcopy(s, 0)
self.assertEqual(t... | kostaspl/SpiderMonkey38 | python/bitstring/test/test_bitstore.py | Python | mpl-2.0 | 1,132 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/falken | sdk/build/nasm_installer.py | Python | apache-2.0 | 4,457 |
import os
from cement.core.log import get_logger
from subprocess import Popen, PIPE
from iustools.core import exc
log = get_logger(__name__)
def get_input(msg, suppress=False):
res = ''
if suppress:
try:
os.system('stty -echo')
res = raw_input(msg).strip('\n')
except ... | iuscommunity/ius-tools | src/iustools.core/iustools/helpers/misc.py | Python | gpl-2.0 | 1,308 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jmesteve/saas3 | openerp/addons/share/res_users.py | Python | agpl-3.0 | 1,891 |
#
# Readout.py -- Readout for displaying image cursor information
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga.qtw.QtHelp import QtGui, QtCore
from ginga... | Rbeaty88/ginga | ginga/qtw/Readout.py | Python | bsd-3-clause | 1,006 |
# 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 u... | GabrielBrascher/cloudstack | test/integration/component/test_vpc_network_internal_lbrules.py | Python | apache-2.0 | 66,892 |
# Copyright (c) 2010-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 agree... | kalrey/swift | test/unit/container/test_server.py | Python | apache-2.0 | 117,657 |
#
#testapi.py
from ..lib.pyGuifiAPI import *
from ..lib.pyGuifiAPI.error import GuifiApiError
import urllib
import re
r = re.compile('http:\/\/([^\/]*).*')
from ..guifiwrapper.cnmlUtils import *
# https://guifi.net/api?command=guifi.service.get&service_id=37668
# https://github.com/guifi/drupal-guifi/commit/c155cb31... | emmdim/guifiAnalyzer | traffic/tests/testApi.py | Python | gpl-3.0 | 804 |
class Display():
def __init__(self, width, height):
self.width = width
self.height = height
def getSize(self):
return (self.width, self.height)
| thebruce87/Photobooth | src/display.py | Python | mit | 155 |
from tastypie.throttle import CacheDBThrottle
import time
from django.core.cache import cache
from django.contrib.auth.models import User, SiteProfileNotAvailable
import logging
log = logging.getLogger(__name__)
class UserAccessThrottle(CacheDBThrottle):
"""
A throttling mechanism that uses the cache for actu... | pombredanne/discern | freeform_data/throttle.py | Python | agpl-3.0 | 4,356 |
## 2. Looking at the data ##
# We can use the pandas library in python to read in the csv file.
# This creates a pandas dataframe and assigns it to the titanic variable.
titanic = pandas.read_csv("titanic_train.csv")
# Print the first 5 rows of the dataframe.
print(titanic.head(5))
print(titanic.describe())
## 3. Mi... | vipmunot/Data-Analysis-using-Python | Kaggle Competitions/Getting started with Kaggle-73.py | Python | mit | 4,368 |
#!/usr/bin/env python3
from lsltools import sim,vis
# STEP 1: Initialize a generator for simulated EEG and start it up.
eeg_data = sim.EEGData(nch=3,stream_name="example")
eeg_data.start()
# STEP 2: Find the stream started in step 1 and pass it to the vis.Grapher
streams = vis.pylsl.resolve_byprop("name","example")... | bwrc/lsltools | examples/visualizer_example.py | Python | mit | 395 |
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from .. import jwt_utils
from ..utils import str_to_class, get_redirect_url
logger = logging.getLogger(__name__)
# TODO: Remove this duplicated code from Loginview
auth_backends... | qdqmedia/wiggum | wiggum/authorization/actions/login_pre_check.py | Python | bsd-3-clause | 3,600 |
import sys
import os
from setuptools import setup, Command
NAME = "gnu_health_fhir"
with open("README.md") as readme:
README = readme.read()
README_TYPE = "text/markdown"
with open(os.path.join(NAME, "VERSION")) as version:
VERSION = version.readlines()[0].strip()
with open("requirements.txt") as requir... | teffalump/health_fhir | setup.py | Python | gpl-3.0 | 1,173 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack, LLC
# 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/... | SUSE-Cloud/glance | glance/tests/functional/test_cache_middleware.py | Python | apache-2.0 | 32,711 |
# -*- coding: utf-8 -*-
"""Abstract base classes to define readers and writers."""
from __future__ import unicode_literals, print_function
from abc import ABCMeta, abstractmethod
class LinkReader:
"""Abstract reader of links."""
__metaclass__ = ABCMeta
def __init__(self, stream, header=True):
se... | gbv/wdmapper | wdmapper/format/base.py | Python | mit | 1,684 |
# Copyright 2016 Autodesk 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 to in writing... | tkzeng/molecular-design-toolkit | moldesign/viewer/common.py | Python | apache-2.0 | 3,411 |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | OpenUniversity/ovirt-engine | packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-common/apache/ssl.py | Python | apache-2.0 | 7,366 |
from django.views import generic
class HomeView(generic.TemplateView):
template_name = 'home.html'
| yourlabs/django-permissions-widget | test_project/test_project/views.py | Python | mit | 105 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SeilaplanPluginDialog
A QGIS plugin
Seilkran-Layoutplaner
-------------------
begin : 2013
copyright : (C) 20... | piMoll/SEILAPLAN | gui/seilaplanPluginDialog.py | Python | gpl-2.0 | 44,262 |
from setuptools import setup, find_packages
setup(name='MODEL7434234848',
version=20140916,
description='MODEL7434234848 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL7434234848',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL7434234848 | setup.py | Python | cc0-1.0 | 377 |
#!/usr/bin/env python3
import kfp
import json
import copy
from kfp import components
from kfp import dsl
from kfp.aws import use_aws_secret
sagemaker_hpo_op = components.load_component_from_file('../../../../components/aws/sagemaker/hyperparameter_tuning/component.yaml')
sagemaker_train_op = components.load_component... | kubeflow/kfp-tekton-backend | samples/contrib/aws-samples/mnist-kmeans-sagemaker/mnist-classification-pipeline.py | Python | apache-2.0 | 6,993 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | SamStudio8/scikit-bio | skbio/sequence/_sequence.py | Python | bsd-3-clause | 78,197 |
from future.utils import PY2, iteritems
from mockthink.test.common import assertEqual
if PY2:
import mock
else:
from unittest import mock
import unittest
from pprint import pprint
from ... import util
class TestUtil(unittest.TestCase):
def test_curry2(self):
fun = lambda x, y: x + y
curri... | scivey/mockthink | mockthink/test/unit/test_util.py | Python | mit | 10,940 |
from django.views.generic import ListView
from models import Project
# Create your views here.
class ListProjectView(ListView):
model = Project
template_name = 'cmsplugin_vfoss_project/project_list.html'
| thuydang/djagazin | wsgi/djagazin/cmsplugin_vfoss_project/views.py | Python | bsd-2-clause | 207 |
from django.contrib import admin
from bongo.apps.archive.models import *
class MultiDBModelAdmin(admin.ModelAdmin):
# A handy constant for the name of the alternate database.
using = 'archive'
def save_model(self, request, obj, form, change):
# Tell Django to save objects to the 'other' database.... | BowdoinOrient/bongo | bongo/apps/archive/admin.py | Python | mit | 2,240 |
import arrayfire as af
import numpy as np
from petsc4py import PETSc
from bolt.lib.physical_system import physical_system
from bolt.lib.nonlinear_solver.nonlinear_solver \
import nonlinear_solver
import domain
import boundary_conditions
import params
import initialize
import bolt.src.nonrelativistic_boltzmann.ad... | ShyamSS-95/Bolt | example_problems/nonrelativistic_boltzmann/instabilities/KH/hydrodynamic/lecoanet_paper_setup/main.py | Python | gpl-3.0 | 1,319 |
# Standard Python packages
import math
import numbers
# Special dependencies
import numpy
class InfiniteType:
def __init__(self, multiplier=1.):
if multiplier == 0.: raise ZeroDivisionError, "Cannot multiply infinity and zero."
self._multiplier = multiplier
def __repr__(self):
if self... | opendatagroup/cassius | tags/cassius-0_1_0_0/cassius/mathtools.py | Python | apache-2.0 | 17,665 |
#---------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
#
# Adham Lucas da Silva Oliveira 1715310059
# Alexandre Marques Uchôa 1715310028
# André Luís Labo... | jucimarjr/IPC_2017-1 | lista05/lista05_lista01_questao41.py | Python | apache-2.0 | 2,362 |
# 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 use ... | cloudkick/libcloud | libcloud/compute/drivers/rackspace.py | Python | apache-2.0 | 18,878 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
import brainstorm as bs
import numpy as np
from PIL import Image
network = bs.Network.from_hdf5('mnist_pi_best.hdf5')
image = Image.open("test_4.jpg")
data = np.array(image).reshape(
image.size[0], ima... | pinae/MNIST-Brainstorm | classify.py | Python | gpl-3.0 | 681 |
import random
import collections
import functools
from hearthbreaker.game_objects import Hero
class memoized(object):
'''Decorator. Caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned
(not reevaluated).
'''
def __init__(sel... | anuragpapineni/Hearthbreaker-evolved-agent | hearthbreaker/agents/trade/util.py | Python | mit | 1,929 |
"""
This file contains the generic, assorted views that don't fall under one of
the other applications. Views are django's way of processing e.g. html
templates on the fly.
"""
from django.contrib.admin.sites import site
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_r... | MarsZone/DreamLand | muddery/web/website/views.py | Python | bsd-3-clause | 3,673 |
cases = [
('pmt.py -s 1 -n 20 populations, first without state filter',
'pmt.py -s 1 -n 20 populations'),
('pmt.py -s 2 -n 20 populations filter3, state filter limits population to 3',
'pmt.py -s 2 -n 20 populations filter3')
]
| nfredrik/pyModelStuff | samples/populations/test/test_filter.py | Python | bsd-3-clause | 247 |
__author__ = 'oglebrandon'
| CarterBain/AlephNull | alephnull/live/__init__.py | Python | apache-2.0 | 27 |
# Copyright 2013-2020 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 Cronie(AutotoolsPackage):
"""Cronie contains the standard UNIX daemon crond that runs spec... | iulian787/spack | var/spack/repos/builtin/packages/cronie/package.py | Python | lgpl-2.1 | 811 |
from cached_property import cached_property
import sympy
from devito.ir.equations.algorithms import dimension_sort, lower_exprs
from devito.finite_differences.differentiable import diff2sympy
from devito.ir.support import (IterationSpace, DataSpace, Interval, IntervalGroup,
Stencil, dete... | opesci/devito | devito/ir/equations/equation.py | Python | mit | 9,325 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
#在python脚本中第一行必须是#!/usr/bin/env python,这样才可以向下以python的环境来解释下面的语句
#=============================================================================
# Copyright (c) 2015
# ShanghaiKunyan. All rights reserved
#
# Filename : /home/wukun/work/enum_to_switch.py
# Aut... | smartdata-x/strade | src/pub/net/enum_to_switch.py | Python | apache-2.0 | 4,275 |
from DoneDone import IssueTracker
import json,sys
# for flask decorator
from datetime import timedelta
from flask import Flask, make_response, request, current_app
from functools import update_wrapper
def get_people_in_a_project(projectId):
peopleObj = issueTracker.getAllPeopleInProject(projectId)
people = []... | darksmo/gmailToDoneDone | doneDoneServer.py | Python | mit | 4,872 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | maljac/odoo-addons | sale_contract_editable/__openerp__.py | Python | agpl-3.0 | 1,519 |
from os.path import join, normcase, abspath, sep
from django.utils.encoding import force_unicode
def safe_join(base, *paths):
"""
Joins one or more path components to the base path component intelligently.
Returns a normalized, absolute version of the final path.
The final path must be located inside ... | jamslevy/gsoc | app/django/utils/_os.py | Python | apache-2.0 | 1,166 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys... | landism/pants | testprojects/src/python/print_env/main.py | Python | apache-2.0 | 447 |
"""Aiohttp test utils."""
import asyncio
from contextlib import contextmanager
import json as _json
import re
from unittest import mock
from urllib.parse import parse_qs
from aiohttp import ClientSession
from aiohttp.streams import StreamReader
from yarl import URL
from aiohttp.client_exceptions import ClientResponse... | jamespcole/home-assistant | tests/test_util/aiohttp.py | Python | apache-2.0 | 7,132 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class HypemIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hypem\.com/track/(?P<id>[0-9a-z]{5})'
_TEST = {
'url': 'http://hypem.com/track/1v6ga/BODYWORK+-+TAME',
'md5': 'b9cc91b5af89... | vinegret/youtube-dl | youtube_dl/extractor/hypem.py | Python | unlicense | 1,551 |
"""op/TwoBodyInteraction.py
Definition of namedtuple representation of a two-body matrix element
<a b|V|c b>
"""
from __future__ import print_function, division, unicode_literals
from collections import namedtuple
# noinspection PyClassHasNoInit
class TwoBodyInteraction(namedtuple('TwoBodyInteraction',
... | dilynfullerton/tr-A_dependence_plots | src/deprecated/op/TwoBodyInteraction.py | Python | cc0-1.0 | 795 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_controllers/controller/skin/skin_search_id_first/skin_search_id_first.py | Python | mit | 3,982 |
import time
from optparse import make_option
from django.core.management.base import BaseCommand
from treeherder.model.derived import JobsModel
from treeherder.model.models import (Datasource,
Job,
Repository)
class Command(BaseCommand):
... | akhileshpillai/treeherder | treeherder/model/management/commands/migrate_to_intermediate_jobs.py | Python | mpl-2.0 | 2,402 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__author__ = 'Trung Dong Huynh'
__email__ = 'trungdong@donggiang.com'
__all__ = [
'get'
]
from prov import Error
class Serializer(object):
def __init__(self, document=None):
self.document = ... | KNMI/VERCE | verce-hpc-pe/src/prov/serializers/__init__.py | Python | mit | 1,472 |
#!/usr/bin/python
#
# Copyright (c) 2015 CenturyLink
# 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.1',
'status': ['previ... | hryamzik/ansible | lib/ansible/modules/cloud/centurylink/clc_alert_policy.py | Python | gpl-3.0 | 17,447 |
# -*- coding: utf-8 -*-
from builtins import map
#from builtins import str
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
from threading import Timer
import xbmc
import xbmcaddon
import xbmcgui
from channelselector import get_thumb
from platformcode import conf... | alfa-addon/addon | plugin.video.alfa/platformcode/keymaptools.py | Python | gpl-3.0 | 7,319 |
"""
utility.py
Provides a number of simple commands for working with strings.
Created By:
- Luke Rogers <https://github.com/lukeroge>
- Dabo Ross <https://github.com/daboross>
Special Thanks:
- Fletcher Boyd <https://github.com/thenoodle68>
License: GPL v3
"""
import base64
import hashlib
import collec... | CrushAndRun/Cloudbot-Fluke | plugins/utility.py | Python | gpl-3.0 | 7,527 |
import os, sys
import mercadopago
import json
def index(req, **kwargs):
preference = {
"items": [
{
"title": "Item title",
"description": "Description",
"quantity": 1,
"unit_price": 50,
"currency_id": "CURRENCY_ID",
"picture_url": "https://www.mercadopago.com/org-img/MP3/home/logomp3.gif"... | matikbird/matikbird.github.io | portfolio/quay/back_end/payments2/mercadopago/api-mercadopago-master/templates/code-examples-master/mp-checkout/marketplace/python/payment_button.py | Python | mit | 711 |
from agms.exception.agms_exception import AgmsException
class AuthenticationException(AgmsException):
"""
Raised when the client library cannot authenticate with the gateway.
This generally means the username/password key are incorrect, or the merchant is not active.
"""
pass
| agmscode/agms_python | agms/exception/authentication_exception.py | Python | mit | 301 |
from django.db.models import ProtectedError
from django.views.generic import ListView
from django.core import serializers
from django.contrib.auth.decorators import login_required
from ..models import Catalog, CatalogIssue
from ..mixins import TacoMixin
from ..utils import __preprocess_get_request, __taco_render, json... | the0forge/sp | frontend/views/catalog.py | Python | gpl-3.0 | 4,180 |
from sys import stdin
def readLine():
return stdin.readline().strip()
def readInt():
return int(readLine())
def readInts():
return list(map(int, readLine().split()))
FACES = 6
T, N, K = 0, 0, 0
S = dict()
def backtrack(idx, totalSum):
global FACES, N
if idx == N:
if totalSum in S:
S[totalSum] += 1
els... | mikebsg01/Contests-Online | SPOJ/AE2A-BF-1.py | Python | mit | 945 |
# -*- encoding: utf-8 -*-
import pytest
from thefuck.rules import switch_lang
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command(stderr='command not found: фзе-пуе', script=u'фзе-пуе'),
Command(stderr='command not found: λσ', script=u'λσ')])
def test_match(command):
assert swit... | nwinkler/thefuck | tests/rules/test_switch_lang.py | Python | mit | 958 |
"""
Domain middleware: enables multi-tenancy in a single process
"""
from anaf.core.domains import setup_domain, setup_domain_database
from anaf.core.db import DatabaseNotFound
from anaf.core.conf import settings
from django.http import HttpResponseRedirect
from django.db.utils import DatabaseError
from django.core.url... | tovmeod/anaf | anaf/core/middleware/domain.py | Python | bsd-3-clause | 1,463 |
# Rounder - Poker for the GNOME Desktop
#
# Copyright (C) 2006-2008 Devan Goodwin <dgoodwin@dangerouslyinc.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 th... | dgoodwin/rounder | src/rounder/ui/gtk/util.py | Python | gpl-2.0 | 1,387 |
import argparse
import torch
import torch.nn as nn
import os
import numpy as np
import torchvision
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
import ray
from ray import tune
from ray.tune.schedulers import create_scheduler
from ray.tune.integration.horovod import (DistributedT... | richardliaw/ray | release/horovod_tests/workloads/horovod_test.py | Python | apache-2.0 | 4,533 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | ddd/logic/learning_unit/domain/model/learning_unit.py | Python | agpl-3.0 | 5,867 |
from ase.atoms import Atoms
from ase.quaternions import Quaternions
from ase.calculators.singlepoint import SinglePointCalculator
from ase.parallel import paropen
def read_lammps_dump(fileobj, index=-1, order=True):
"""Method which reads a LAMMPS dump file.
order: Order the particles according to their id. M... | grhawk/ASE | tools/ase/io/lammpsrun.py | Python | gpl-2.0 | 5,820 |
farmer = {
'kb': '''
Farmer(Mac)
Rabbit(Pete)
Mother(MrsMac, Mac)
Mother(MrsRabbit, Pete)
(Rabbit(r) & Farmer(f)) ==> Hates(f, r)
(Mother(m, c)) ==> Loves(m, c)
(Mother(m, r) & Rabbit(r)) ==> Rabbit(m)
(Farmer(f)) ==> Human(f)
(Mother(m, h) & Human(h)) ==> Human(m)
''',
# Note that this order of conjuncts
# would r... | armadill-odyssey/aima-python | submissions/Ottenlips/myLogic.py | Python | mit | 1,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.