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 |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
from abjad.tools import markuptools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
def label_vertical_moments_in_expr_with_interval_class_vectors(
expr, markup_direction=Down):
r'''Labels interval-class ve... | mscuthbert/abjad | abjad/tools/labeltools/label_vertical_moments_in_expr_with_interval_class_vectors.py | Python | gpl-3.0 | 2,828 |
class Car(object):
def __init__(self, seats):
if seats == 0:
raise AttributeError("A car must have at least one seat")
self._seats = seats
def get_seats(self):
return self._seats
| addfor/cshare | cshare/model/car.py | Python | mit | 224 |
from django.shortcuts import render
def index(request):
return render(request, "pages/index.html")
def episodes(request):
return render(request, "pages/episodes.html")
| ckcollab/foolsnetwork | src/apps/pages/views.py | Python | mit | 180 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | pford68/nupic.research | sensorimotor/sensorimotor/sensorimotor_experiment_runner.py | Python | gpl-3.0 | 9,403 |
from . import communication, account_invoice, account, res_country
| OCA/l10n-italy | l10n_it_invoices_data_communication/models/__init__.py | Python | agpl-3.0 | 67 |
import unittest
from unittest import mock
from cupyx import profiler
class TestProfile(unittest.TestCase):
def test_profile(self):
start_patch = mock.patch('cupy.cuda.profiler.start')
stop_patch = mock.patch('cupy.cuda.profiler.stop')
with start_patch as start, stop_patch as stop:
... | cupy/cupy | tests/cupyx_tests/profiler_tests/test_profile.py | Python | mit | 923 |
from flask import render_template, make_response, request
from flask_restful import Resource
import re
from minblog2 import app
from minblog2.core import api
from minblog2.core import dbManager
@app.route('/')
@app.route('/create')
@app.route('/detail/<path:id>')
@app.route('/edit/<path:id>')
def route_to_main(id=No... | waisuan/minblog_af | minblog2/controllers.py | Python | mit | 3,020 |
# -*- coding: utf-8 -*-
# The actual config file should be named "config.py"
# The user part of the email address at which commands are to be received.
command_user = 'lambda'
# The region in which to create the lambda.
lambda_region = 'us-west-2'
# The name to use for the Lambda function.
lambda_name = 'LambdaMLM'... | ilg/LambdaMLM | lambda/config.example.py | Python | mit | 1,129 |
from __future__ import unicode_literals
from django.contrib.auth.models import Permission, User
from django.core.urlresolvers import reverse
from django.db import models
class Workspace(models.Model):
face_choice = (
(u'Facebook: fanpage', u'fanpage'),
(u'Facebook: tagged', u'tagged'),
)
... | beatrizChagas/scrm-solutions | extracao/models.py | Python | gpl-3.0 | 6,482 |
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from logging import getLogger
import ckanext.localimp.lib.uploader
import ckanext.localimp.logic.action as action
import os
import cgi
import pprint
import pathlib2
log = getLogger(__name__)
class LocalimpPlugin(plugins.SingletonPlugin):
plu... | ccca-dc/ckanext-filesystem | ckanext/localimp/plugin.py | Python | agpl-3.0 | 3,299 |
import sublime
import sublime_plugin
import re
# import threading
# import sys
try:
from . import scopes
except (ImportError, ValueError):
import scopes
try:
from .sublime_helper import SublimeHelper
except (ImportError, ValueError):
from sublime_helper import SublimeHelper
# sys.path.append(sublime.pac... | derickc/Fountainhead | contd.py | Python | mit | 12,420 |
#
# Copyright 2012 WebFilings, 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... | beaulyddon-wf/furious | furious/tests/context/test_auto_context.py | Python | apache-2.0 | 4,652 |
def speaker(number):
num = number
d = len(str(num))
def ten_one(n):
if d == 1:
res = FIRST_TEN[n-1]
elif d == 2:
if n // 10 == 1:
res = SECOND_TEN[n-10]
else:
if n%10 != 0:
res = OTHER_TENS[n//10-2] + ' ... | spencerpomme/coconuts-on-fire | solve_speech_20150316.py | Python | apache-2.0 | 1,472 |
# A dictionary with default values for non-existing entries
import UserDict, copy
class DictWithDefault(UserDict.UserDict):
"""Dictionary with default values
Constructor: DictWithDefault(|default|)
Instances of this class act like standard Python dictionaries,
except that they return a *copy* of |... | OS2World/DEV-PYTHON-UTIL-ScientificPython | src/Lib/site-packages/Scientific/DictWithDefault.py | Python | isc | 790 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | lucperkins/heron | heron/shell/src/python/handlers/pidhandler.py | Python | apache-2.0 | 1,214 |
# 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... | apache/incubator-superset | superset/common/query_object.py | Python | apache-2.0 | 16,461 |
class NoResultsException(Exception):
def __init__(self):
Exception("No Results.")
class RelationalOperator(object):
def __init__(self, parent):
self.parent = parent
def GenSql(self, sqlBuilder):
"""
Main external interface for SQL generation.
The client co... | alcides/rdflib | rdflib/sparql/sql/RelationalOperators.py | Python | bsd-3-clause | 4,107 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Rodolphe Quiédeville <rodolphe@quiedeville.org>
#
# 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... | rodo/pyrede | pyrede/provider/utils/main.py | Python | gpl-3.0 | 8,142 |
import bpy
class QuickSceneOptions(bpy.types.Menu):
bl_idname = "scene.quick_options"
bl_label = "Quick Scene Settings"
def draw(self, context):
layout = self.layout
layout.operator("gpencil.active_frame_delete", "Delete Grease", icon='GREASEPENCIL')
only_render = context.space_data.show_only_rend... | aditiapratama/quicktools | quick_scene.py | Python | gpl-2.0 | 667 |
import datetime
import scrapy
from scrapy import Selector
from selenium import webdriver
class DailyKos(scrapy.Spider):
count = 0
name = "daily_kos"
start_urls = [
'https://www.dailykos.com/campaigns',
]
def parse(self, response):
topic_urls = response.css('div.campaigns_title a::a... | dusterdb88/mobilize_scraper | mobilize_scraper/spiders/daily_kos.py | Python | mit | 1,753 |
class Event(object):
GETTERS = [
'GetClassName',
'GetEventType',
'GetEventObject',
'GetId',
'GetSkipped',
#'GetTimestamp',
'IsCommandEvent',
]
def dump(cls, event):
print "+ %s ================================" % event.GetClassName()[2:]
for name in cls.GETTERS:
print "%s.%s() ==> %s"% (... | onoga/toolib | toolib/wx/debug/dump.py | Python | gpl-2.0 | 1,660 |
# In production set the environment variable like this:
# DJANGO_SETTINGS_MODULE=qzard.settings.production
from .base import * # NOQA
import logging.config
# For security and performance reasons, DEBUG is turned off
DEBUG = False
# Must mention ALLOWED_HOSTS in production!
ALLOWED_HOSTS = ["qzard.com"... | triump0870/qzard | src/qzard/settings/production.py | Python | mit | 1,779 |
EXITAPP = False
wholeCounter = 1 | LinArcX/tvdoon | utility/constants.py | Python | gpl-3.0 | 33 |
# This file is part of SickRage.
#
# URL: https://www.sickrage.tv
# Git: https://github.com/SiCKRAGETV/SickRage.git
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | SerialShadow/SickRage | sickrage/show/History.py | Python | gpl-3.0 | 3,519 |
import sys
from prettytable import PrettyTable
from mistcommand.helpers.login import authenticate
def template_action(args):
client = authenticate()
if args.action == 'list-templates':
list_templates(client, args.pretty)
elif args.action == 'show-template':
show_template(client, args.temp... | mistio/mist.client | src/mistcommand/helpers/templates.py | Python | gpl-3.0 | 2,680 |
#!/usr/bin/env python
# vim: tabstop=4: shiftwidth=4: expandtab: softtabstop=4: autoindent:
# $Id: test_libsvn.py 48712 2011-03-02 21:13:54Z iwontbecreative $
"""
Copyright (C) 2007 by Mark de Wever <koraq@xs4all.nl>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software;... | RushilPatel/BattleForWesnoth | utils/test_libsvn.py | Python | gpl-2.0 | 5,082 |
# LOFAR IMAGING PIPELINE
#
# Demixing: node script
# Marcel Loose, 2011
# loose@astr... | kernsuite-debian/lofar | CEP/Pipeline/recipes/sip/nodes/deprecated/demixing.py | Python | gpl-3.0 | 12,289 |
import sys
import pygame
import os
import inspect
from pygame.locals import *
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from scripts import player
class GameSpace:
''' Game Space Controller '''
def... | placher/pokeproject2 | devfiles/testplayer.py | Python | gpl-3.0 | 2,013 |
from txircd.modbase import Module
class QuitServerNotice(Module):
def sendQuitNotice(self, user, reason):
if "sendservernotice" in self.ircd.module_data_cache:
message = "Client quit: {} ({}) [{}]".format(user.prefix(), user.ip, reason)
self.ircd.module_data_cache["sendservernotice"... | DesertBus/txircd | txircd/modules/servnoticequit.py | Python | bsd-3-clause | 656 |
import unittest
from test import support
import os
import io
import socket
import urllib.request
from urllib.request import Request, OpenerDirector
# XXX
# Request
# CacheFTPHandler (hard to write)
# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler
class TrivialTests(unittest.TestCase):
def test_trivial(... | mancoast/CPythonPyc_test | fail/313_test_urllib2.py | Python | gpl-3.0 | 51,087 |
# 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... | tensorflow/fairness-indicators | tensorboard_plugin/tensorboard_plugin_fairness_indicators/demo.py | Python | apache-2.0 | 1,508 |
from bsPlugins import *
from bein import execution
from bbcflib.common import fasta_length
from bbcflib.motif import meme
from bbcflib import genrep
from bbcflib.track import track, FeatureStream
import os, tarfile
input_types = [(0, 'Fasta upload'), (1, 'Select regions from genome')]
input_map = {0: ['fastafile'], 1:... | bbcf/bsPlugins | bsPlugins/MotifSearch.py | Python | gpl-3.0 | 5,265 |
import unittest
from unittest import mock
from tinydb import TinyDB, Query
from motey.repositories import nodes_repository
class TestNodeRepository(unittest.TestCase):
@classmethod
def setUp(self):
self.test_ip = '127.0.0.42'
nodes_repository.config = {'DATABASE': {'path': '/tmp/testpath'}}
... | Neoklosch/Motey | tests/repositories/test_nodes_repository.py | Python | apache-2.0 | 2,057 |
from conans import ConanFile
import os
class VenturaConan(ConanFile):
name = "ventura"
version = "0.8"
generators = "cmake"
requires = "silicium/0.12@TyRoXx/stable"
url="http://github.com/TyRoXx/ventura"
license="MIT"
exports="ventura/*"
def package(self):
self.copy(pattern="*.... | TyRoXx/ventura | conanfile.py | Python | mit | 505 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | zhaohuaw/connector-magento | magentoerpconnect/connector.py | Python | agpl-3.0 | 3,241 |
# GUI Application automation and testing library
# Copyright (C) 2015 Intel Corporation
# Copyright (C) 2006 Mark Mc Mahon
#
# 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; either v... | moden-py/pywinauto | examples/MiscExamples.py | Python | lgpl-2.1 | 3,097 |
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-04-20 23:24:08
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-04-20 23:47:41
if __name__ == "__main__":
a, t_a = map(int, raw_input().split())
b, t_b = map(int, raw_input().split())
hour, minute = map(int, raw_input().spl... | zeyuanxy/code-forces | contest/665/A.py | Python | mit | 508 |
from django.urls import path
from .views import MapView
urlpatterns = [path("", MapView.as_view(), name="map")]
| sinnwerkstatt/landmatrix | apps/map/urls.py | Python | agpl-3.0 | 114 |
from Avatar import PlayerAvatar
from xfw.events import registerEvent
from xfw_actionscript.python import as_event
from gui.shared.utils.TimeInterval import TimeInterval
from gui.Scaleform.daapi.view.battle.shared.damage_panel import DamagePanel
ENGINE = 'engine'
GUN = 'gun'
TURRET = 'turretRotator'
SUR... | KnechtRootrechtCH/Mimir | content/Mods/XVM/XVM_Base/res_mods_content/configs/xvm/py_macro/repairTime.py | Python | mit | 6,064 |
# Copyright 2014 Google 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/LICENSE-2.0
#
# Unless required by applicable law or ... | ido-ran/ran-smart-frame2 | web/server/lib/googleapiclient/errors.py | Python | mit | 4,382 |
#!/usr/bin/env python
# Copyright 2016 Sam Yaple
#
# 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 a... | brk3/ekko | tools/generate_manifest.py | Python | apache-2.0 | 2,544 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "python_poc.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| trwalker/python_poc | manage.py | Python | mit | 253 |
import unit
import universe
import VS
import faction_ships
import vsrandom
import launch
import Briefing
import launch_recycle
def moveUnitTo(un,place,radius):
where=place.LocalPosition()
print("moving "+un.getName() +" to "+place.getName())
prsize=place.rSize();
prp = VS.getPlanetRadiusPercent()
pp... | vegastrike/Assets-Production | modules/go_somewhere_significant.py | Python | gpl-2.0 | 6,813 |
# 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 (t... | apache/allura | Allura/allura/lib/project_create_helpers.py | Python | apache-2.0 | 12,458 |
##########################################
# pt_pass.py
#
# Models PassTools Pass
#
# Copyright 2013, Urban Airship, Inc.
##########################################
"""
Define and provide methods for manipulating PassTools Pass objects.
"""
try:
import simplejson as json
except ImportError:
import json
impo... | tello/passtools-python | passtools/pt_pass.py | Python | mit | 7,435 |
# This script compares an on-going release notes file with published release notes files.
# If the ongoing release notes file has a duplicate note with the published one, the script reports the note and replaces it with the published one.
import re, os
from tempfile import mkstemp
from shutil import move
from os impor... | pingcap/docs | scripts/get-duplicated-notes.py | Python | apache-2.0 | 4,228 |
from meep_mpi import * # make it 'meep_mpi' for MPI-meep and 'meep' for non-MPI meep
grid_size_x = 16.0
grid_size_y = 32.0
grid_size_z = 0.5+0.38
class epsilon(PolygonCallback3D):
def __init__(self):
PolygonCallback3D.__init__(self)
master_printf("Callback function for epsilon contructed.\n")
... | sirgogo/docker-meep | siex.py | Python | mit | 2,529 |
# Creates wordPatterns.py based on dictionary.txt
import pprint
def getWordPattern(word):
word = word.upper()
nextNum = 0
letterNums = {}
wordPattern = []
for letter in word:
if letter not in letterNums:
letterNums[letter] = str(nextNum)
nextNum += 1
wordPa... | Tookmund/hackingCiphers | makeWordPatterns.py | Python | bsd-2-clause | 882 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google-research/smore | smore/models/complex.py | Python | apache-2.0 | 12,028 |
# :Id: $Id$
# :Author: Guenter Milde.
# :License: Released under the terms of the `2-Clause BSD license`_, in short:
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
# This fi... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/__init__.py | Python | mit | 1,637 |
import unittest
from os.path import join, exists
import tempfile
from bricks import Settings
from bricks import Bricks
from bricks.static_manager import StaticManager
from bricks.static_builder import establish_static_assets
from common_components.test.test_components.testcomponents import (
testscss,
testlib
)... | Zer0-/common_components | common_components/test/test.py | Python | mpl-2.0 | 1,448 |
# -*- coding:utf8 -*-
"""
Handels everthing related to the main Window
"""
from __future__ import unicode_literals
import sys
from urllib.parse import urlparse, urlunparse
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QMessageBox, QMessageBox
from PyQt5.QtCore import (QAbstractListModel, Qt, QModelIndex, QTh... | Arvedui/picup | picup/main_window.py | Python | gpl-2.0 | 12,014 |
# -*- coding: utf8 -*-
import os
from multiprocessing import Process, Queue, Value
from pycraft.service import logger
from .base import MobAI
from .scratch import ScratchAgentManager
class MobAIProcess:
def __init__(self):
self._received_motion = {}
self._terminate = Value('b', False)
... | nosix/PyCraft | src/pycraft/service/ai/process.py | Python | lgpl-3.0 | 2,044 |
# -*- coding: utf-8 -*-
import numpy
from sklearn.base import BaseEstimator
from sklearn.base import RegressorMixin
from sklearn.metrics import mean_squared_error
class NegativeCorrelationEnsemble(BaseEstimator, RegressorMixin):
"""Classe que implementa um ensemble por correlação negativa."""
def __init__(sel... | fberanizo/sin5016 | ensemble/negative_correlation.py | Python | bsd-2-clause | 3,440 |
# -*- coding: UTF-8 -*-
logger.info("Loading 44 objects to table sheets_partnerentry...")
# fields: id, report, old_d, old_c, during_d, during_c, partner, trade_type
loader.save(create_sheets_partnerentry(45,1,'0.00','0.00','450.00','450.00',101,'S'))
loader.save(create_sheets_partnerentry(46,1,'0.00','0.00','880.00','... | lino-framework/book | lino_book/projects/lydia/tests/dumps/18.12.0/sheets_partnerentry.py | Python | bsd-2-clause | 4,001 |
# -*- coding: utf-8 -*-
import math
import os
in_file = '{base}/infinite_house_pancakes_small.in'.format(base=os.getcwd())
out_file = '{base}/infinite_house_pancakes_small.out'.format(base=os.getcwd())
#in_file = '{base}/infinite_house_pancakes_large.in'.format(base=os.getcwd())
#out_file = '{base}/infinite_house_pa... | topliceanu/learn | codejam/previous_editions/infinite_house_pancakes.py | Python | mit | 1,318 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0008_merge'),
]
operations = [
migrations.AddField(
model_name='profile',
name='twitter_... | bahattincinic/arguman.org | web/profiles/migrations/0009_profile_twitter_username.py | Python | mit | 458 |
import subprocess
import sys
if len(sys.argv) < 2:
sys.exit("usage: dist-news.py <appstream_util>")
appstream_util = sys.argv[1]
print('Generating NEWS file…')
subprocess.call([appstream_util, 'appdata-to-news', 'data/org.gnome.buoh.appdata.xml.in'])
| GNOME/buoh | build-aux/dist-news.py | Python | gpl-2.0 | 258 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.txt.
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.db import transaction
from lizard_measure.models import Unit
from lizard_measure.models import KRWStatus
from lizard_measure.models import KRWWatertype
from lizard_measure.... | lizardsystem/lizard-measure | lizard_measure/management/commands/sync_aquo.py | Python | gpl-3.0 | 688 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from flask import current_app
from app import create_app, db
class BasicTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
d... | 8cbx/OnlineJudge_Web | tests/test_basics.py | Python | agpl-3.0 | 613 |
import unittest
import firebase_admin
import os
os.environ["FIRESTORE_EMULATOR_HOST"] = "localhost:8080"
os.environ["GCLOUD_PROJECT"] = "localtest"
from fam.exceptions import *
from fam.tests.models.test01 import GenericObject, Dog, Cat, Person, NAMESPACE
from fam.tests.models.test04 import House, Fence
from fam.extr... | paulharter/fam | src/fam/tests/test_firestore/test_firestore_fields.py | Python | mit | 1,595 |
# -*- coding: utf-8 -*-
class ServiceNotFound(Exception):
pass
class ObjectDoesNotExist(Exception):
pass
class ObjectsDoNotExist(Exception):
pass
class MultipleObjectReturned(Exception):
pass
class ValidationError(Exception):
pass
class FieldException(Exception):
pass
class Invalid... | ctxis/lather | lather/exceptions.py | Python | bsd-2-clause | 403 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | souravbadami/oppia | core/domain/rating_services_test.py | Python | apache-2.0 | 7,949 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""PID fetchers for grants and funders."""
from __future__ import absolute_import, p... | inveniosoftware/invenio-openaire | invenio_openaire/fetchers.py | Python | mit | 780 |
#!/usr/bin/env python
# Author: L. Tattrie
# Purpose: svgwrite examples
# Created: 2012/5/31
# Copyright (C) 2012, L. Tattrie
# License: LGPL
# Python version 2.7
import sys
import svgwrite
# http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#propdef-font-family
# 'serif', 'sans-serif', 'cursive', 'f... | hirobert/svgwrite | examples/ltattrie/text_font_generic_family.py | Python | gpl-3.0 | 1,709 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from indico.util.signals import named_objects_from_sig... | pferreir/indico | indico/util/signals_test.py | Python | mit | 3,566 |
###############################################################################
##
## hardcode_haml - Haml for hardcore coders
## Copyright (C) 2010 Thammi
##
## 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
## ... | Innovailable/Hardcode-Haml | src/hardcode_haml/primitives.py | Python | agpl-3.0 | 1,518 |
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
from packaging.version import Version
folium = pytest.importorskip("folium")
branca = pytest.importorskip("branca")
matplotlib = pytest.importorskip("matplotlib")
mapclassify = pytest.importorskip("mapclassify")
import matplotlib.cm as cm #... | geopandas/geopandas | geopandas/tests/test_explore.py | Python | bsd-3-clause | 29,992 |
import unittest
import numpy as np
from sklearn.datasets import load_boston, load_breast_cancer
from sklearn.linear_model import LinearRegression, LogisticRegression
from tests.generic import GenericModelMixin
from tests.generic import SchemaValidationMixin
class LinearRegressionTestCase(GenericModelMixin, SchemaVa... | vaclavcadek/sklearn2pmml | tests/test_regression.py | Python | mit | 725 |
"""
Containers for the type and configuration data of information resources.
Exports
-------
ResourceConfiguration
The type and configuration data of an information resource.
"""
from doxhooks.functions import importattr
__all__ = [
"ResourceConfiguration",
]
class ResourceConfiguration(dict):
"""
... | nre/Doxhooks | doxhooks/resource_configs.py | Python | mit | 2,510 |
#!/usr/bin/python
# Created 2016-08-09, Jordi Huguet, Dept. Radiology AMC Amsterdam
####################################
__author__ = 'Jordi Huguet' ##
__dateCreated__ = '20160809' ##
__version__ = '0.3.8' ##
__versionDate__ = '20171205' ##
####################################
# get_mri_d... | jhuguetn/xnat-pipelines | qMRI/resource/get_mri_data.py | Python | gpl-3.0 | 12,442 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import csv
import os.path
import glob
import getpass
username = getpass.getuser()
if __name__ == '__main__':
#要擷取資訊的desktop資料夾
desktop_dirs = [
"/usr/share/applications/",
"/usr/share/applications/kde4/",
#"/home/" + username + "/.local/share/applications/",
]
... | ezgo-dev/ezgomenu | desktop_info_getter.py | Python | gpl-3.0 | 2,032 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
'''Read in a file of object, correction fields and patch each object'''
import basicStart
import argparse
import requests
import json
import sys
import os.path
from base64 import b64encode
from copy import deepcopy
HEADERS = {'content-type': 'application/json'}
DEBUG_... | ENCODE-DCC/WranglerScripts | removeField.py | Python | mit | 8,403 |
from distutils.util import execute
import os
from pathlib import PurePath
from edc_device.constants import CENTRAL_SERVER
from edc_fabric.fabfile.environment import bootstrap_env, update_fabric_env
from edc_fabric.fabfile.files import mount_dmg_locally, dismount_dmg_locally, mount_dmg
from edc_fabric.fabfile.mysql imp... | botswana-harvard/bcpp | fabfile/utils.py | Python | gpl-3.0 | 17,778 |
# pylint: disable=g-bad-file-header
# encoding: utf-8
# 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.o... | TakayukiSakai/tensorflow | tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_vocabulary_test.py | Python | apache-2.0 | 2,210 |
from django.test import TestCase
from hashids import Hashids
from hashid_field import Hashid
from hashid_field.descriptor import HashidDescriptor
salt = "abcd"
min_length = 1
alphabet = "0123456789abcdef"
hashids = Hashids(salt=salt, min_length=min_length, alphabet=alphabet)
class TestClass(object):
a = HashidD... | nshafer/django-hashid-field | tests/test_descriptor.py | Python | mit | 3,042 |
"""Translate generators test."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tarfile
import tensorflow as tf
from data_generators import text_problems
from data_generators import translate
class TranslateTest(tf.test.Te... | mlperf/training_results_v0.6 | Google/benchmarks/transformer/implementations/tpu-v3-512-transformer/transformer/data_generators/translate_test.py | Python | apache-2.0 | 2,128 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | PaulinaLach/invenio-accounts-rest | tests/test_views.py | Python | gpl-2.0 | 47,788 |
# 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... | snnn/tensorflow | tensorflow/python/eager/imperative_grad.py | Python | apache-2.0 | 2,348 |
#!/usr/bin/python
import os
import re
import shutil
import sys
import tempfile
import time
import unittest
from clienttests import ClientConfigTests
from sitetests import SiteConfigTests
from arbtests import ArbitratorConfigTests
if __name__ == '__main__':
if os.geteuid() == 0:
sys.stderr.write("Mus... | krig/booth | test/runtests.py | Python | gpl-2.0 | 1,540 |
import _plotly_utils.basevalidators
class YpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="ypad", parent_name="scatter3d.marker.colorbar", **kwargs
):
super(YpadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/_ypad.py | Python | mit | 457 |
#-------------------------------------------------------------------------------
#
# Test the DockWindow.
#
# Written by: David C. Morrill
#
# Date: 10/20/2005
#
# (c) Copyright 2005 by Enthought, Inc.
#
#-------------------------------------------------------------------------------
#-----------------------------... | enthought/traitsgui | examples/dock/drag_test.py | Python | bsd-3-clause | 8,053 |
#! /usr/bin/env python
"""Four-Russian's Method for Bit-Matrix Multiplication"""
import sys
from PyQt4 import QtGui
from fourussians.gui import MainWindow
def main():
"""Launch Four-Russians Application"""
application = QtGui.QApplication(sys.argv)
windows = MainWindow()
windows.show()
sys.exit... | c-square/homework | Licență/Anul III/CN/fourussians/scripts/frcli.py | Python | mit | 381 |
# Copyright 2015 Google 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/LICENSE-2.0
#
# Unless required by applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/surface/source/repos/clone.py | Python | mit | 8,206 |
##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | code-google-com/cortex-vfx | python/IECore/registerObject.py | Python | bsd-3-clause | 2,108 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/ceph_path52.py | Python | apache-2.0 | 1,668 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Kongsea/tensorflow | tensorflow/python/keras/_impl/keras/losses.py | Python | apache-2.0 | 3,948 |
from ingenico.connect.sdk.log.log_message import \
LogMessage
class ResponseLogMessage(LogMessage):
"""
A utility class to build request log messages.
"""
def __init__(self, request_id, status_code, duration=-1):
super(ResponseLogMessage, self).__init__(request_id)
self.__status_c... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/log/response_log_message.py | Python | mit | 1,615 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016-2017, Yanis Guenane <yanis+ansible@guenane.org>
# Copyright: (c) 2017, Markus Teufelberger <mteufelberger+ansible@mgit.at>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import... | h3biomed/ansible | lib/ansible/modules/crypto/openssl_certificate.py | Python | gpl-3.0 | 79,027 |
"""
`jsonvalidator` is a simple validator for testing the format of json string
"""
import json
def jsonvalidator(jsonString):
"""
Return the status of json validator
"""
try:
datas = json.loads(jsonString)
except Exception as ex:
print '| JSON | ERROR | ' + str(ex)
return Fa... | WenYuChen/OuO | jsonvalidator/jsonvalidator.py | Python | mit | 341 |
from __future__ import absolute_import, division, print_function
import os
from ply.lex import TOKEN, lex
__all__ = ['create_lexer', 'tokens']
keyworks = {'BEGIN', 'END', 'INPUT', 'OUTPUT'}
tokens = [
# with value.
'BOOLEAN',
'ID',
'SHORT_STRING',
'LONG_STRING',
'FLOAT_NUMBER',
'DECIMA... | huntzhan/tcg | tcg/ast/lexer.py | Python | mit | 2,722 |
#-*-coding:utf-8-*-
from flask import Flask, render_template, request, jsonify
from qiniu import Auth
from config import BUCKET_NAME, CALLBACK_URL, Q_DOMAIN, EXPIRE_TIME, ACCESS_KEY, SECRET_KEY
q = Auth(ACCESS_KEY, SECRET_KEY)
app = Flask(__name__)
@app.route('/')
def index():
policy = {
'callbackUrl': ... | wong2/doora | app.py | Python | mit | 775 |
#
# Licensed under the GNU General Public License Version 3
#
# 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 p... | xkollar/spacewalk | spacecmd/src/lib/optionparser.py | Python | gpl-2.0 | 1,342 |
from frappe import _
def get_data():
return {
'fieldname': 'purchase_invoice',
'non_standard_fieldnames': {
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Landed Cost Voucher': 'receipt_document',
'Purchase Invoice': 'return_against'
},... | hassanibi/erpnext | erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py | Python | gpl-3.0 | 779 |
from astropy.io import fits
import numpy as np
###simple addition of UV component to spectrum. Modeled as a f propto lambda**-2.3. This value is acceptable within 0.3 of 2.0
#for star forming galaxies. You should compare resulting u band spectroscopic magnitudes to photometric magnitudes to get a sense of what value ... | tiffanyhsyu/XMPs | xmps/color_selection/uvcontinuum.py | Python | bsd-3-clause | 732 |
import binascii
def read_pbm(fname):
bytez = open("test_1.pbm", "rb").read()
img = []
newlines_seen = 0
for b in bytez:
if newlines_seen < 4:
if b == 10:
newlines_seen += 1
else:
img.append(b)
grayscale = []
for i in range(784):
grayscale.append( (img[3*i] + img[3*i + 1]... | alexcoplan/p2proj | tf_mnist/read_test.py | Python | mit | 372 |
"""
Toggles for Course API.
"""
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
COURSE_BLOCKS_API_NAMESPACE = LegacyWaffleFlagNamespace(name=u'course_blocks_api')
# .. toggle_name: course_blocks_api.hide_access_denials
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .... | stvstnfrd/edx-platform | lms/djangoapps/course_api/blocks/toggles.py | Python | agpl-3.0 | 802 |
"""
WSGI config for kartographer project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kartographer.settings.production"... | dougwt/kartographer | kartographer/kartographer/wsgi.py | Python | gpl-2.0 | 410 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
#
# 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 vers... | bioinformatics-ua/montra | emif/emif/models.py | Python | gpl-3.0 | 5,071 |
from job_types import JobTypes
from move import MoveJob
from recover_dc import RecoverDcJob
from couple_defrag import CoupleDefragJob
from restore_group import RestoreGroupJob
class JobFactory(object):
@staticmethod
def make_job(data):
job_type = data.get('type', None)
if job_type == JobTypes... | nobodyisme/mastermind_toshik | src/cocaine-app/jobs/job_factory.py | Python | gpl-2.0 | 766 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.