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 |
|---|---|---|---|---|---|
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.translation import gettext as _
from django.views.generic import TemplateView
from .components import DashboardBaseMixin, DashboardAppMixin
from .dashboard_widgets import DashboardWidgets
from .shortcuts import check_permissions
... | d120/pyophase | dashboard/views.py | Python | agpl-3.0 | 3,245 |
import unittest
from juju.utils import juju_config_dir, juju_ssh_key_paths
class TestDirResolve(unittest.TestCase):
def test_config_dir(self):
config_dir = juju_config_dir()
assert 'local/share/juju' in config_dir
def test_juju_ssh_key_paths(self):
public, private = juju_ssh_key_path... | juju/python-libjuju | tests/unit/test_utils.py | Python | apache-2.0 | 429 |
##############################################################################
#
# 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 | base/models/education_group.py | Python | agpl-3.0 | 4,326 |
#!/usr/bin/python3
# -*- coding:Utf-8 -*-
# EPUB-Nox: read EPUB files in CLI.
# Copyright (C) 2015 Etienne Nadji <etnadji@eml.cc>
# 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, ei... | etnadji/epub-nox | epub-nox.py | Python | gpl-3.0 | 11,939 |
'''
Copyright (C) 2013 Rasmus Eneman <rasmus@eneman.eu>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is... | Pajn/RAXA-Django | backend/widgets/__init__.py | Python | agpl-3.0 | 1,099 |
from pysb import ComponentSet
import pysb.core
import inspect
import numpy
import cStringIO
__all__ = ['alias_model_components', 'rules_using_parameter']
def alias_model_components(model=None):
"""Make all model components visible as symbols in the caller's global namespace"""
if model is None:
model ... | neurord/pysb | pysb/util.py | Python | bsd-2-clause | 3,112 |
import parser
import logging
def test(code):
log = logging.getLogger()
parser.parser.parse(code, tracking=True)
print "Programa con 1 var y 1 asignacion bien: "
s = "program id; var beto: int; { id = 1234; }"
test(s)
print "Original: \n{0}".format(s)
print "\n"
print "Programa con 1 var mal: "
s = "program ;... | betoesquivel/PLYpractice | testingParser.py | Python | mit | 1,412 |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... | stuarteberg/lazyflow | lazyflow/operators/ioOperators/opRESTfulBlockwiseFilesetReader.py | Python | lgpl-3.0 | 3,408 |
#!/usr/bin/env python3
import subprocess
import requests
def location() -> (float, float):
try:
process = subprocess.run(
['CoreLocationCLI', '-once', 'YES',
'-format', '%latitude\n%longitude'],
stdout=subprocess.PIPE,
encoding='utf8',
timeout=... | JohnStarich/dotfiles | python/johnstarich/weather/parse.py | Python | apache-2.0 | 2,543 |
import operator
import distance
# distance_func = distance.hamming_distance
distance_func = distance.euclidean_distance
# all arguments must be int-elemented
def kNN(inputData, dataPool, labelPool, k):
distance = list()
for data in dataPool:
distance.append(distance_func(inputData, data))
sor... | longtengz/pyml | kNearestNeighbors/kNN.py | Python | mit | 948 |
import json
import pickle
import numpy as np
import pandas as pd
import numpy as np
import datatables.traveltime
def write_model(baserate, model_file):
"""
Write model to file
baserate -- average travel time
output_file -- file
"""
model_params = {
'baserate': baserate
}
model_s... | anjsimmo/simple-ml-pipeline | learners/traveltime_baserate.py | Python | mit | 1,292 |
import re
def fileNameTextToFloat(valStr, unitStr):
# if there's a 'p' character, then we have to deal with decimal vals
if 'p' in valStr:
regex = re.compile(r"([0-9]+)p([0-9]+)")
wholeVal = regex.findall(valStr)[0][0]
decimalVal = regex.findall(valStr)[0][1]
baseVal = 1.0*int(w... | paulgclark/waveconverter | src/iqFileArgParse.py | Python | mit | 3,934 |
# MacroIP_DHCP is part of MacroIP Core. Provides Access to DHCP services through simple
# textual macros.
# Copyright (C) 2014 Nicola Cimmino
#
# 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 Fou... | nicolacimmino/LoP-RAN | LoPAccessPoint/MacroIP_DHCP.py | Python | gpl-3.0 | 3,535 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2014-2018 Contributor
#
# 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 co... | quattor/aquilon | tests/broker/test_refresh_user.py | Python | apache-2.0 | 12,148 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/grad/test/test_rks.py | Python | apache-2.0 | 16,013 |
import atexit
from collections import defaultdict
from multiprocessing.pool import ThreadPool
import threading
import ray
from dask.core import istask, ishashable, _execute_task
from dask.local import get_async, apply_sync
from dask.system import CPU_COUNT
from dask.threaded import pack_exception, _thread_get_id
fro... | richardliaw/ray | python/ray/util/dask/scheduler.py | Python | apache-2.0 | 16,044 |
# MIT License
# Copyright (c) 2015, 2017 Marie Lemoine-Busserolle
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | mrlb05/Nifty | nifty/pipeline/objectoriented/GetConfig.py | Python | mit | 6,414 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('runners', '0005_auto_20151106_0404'),
]
operations = [
migrations.RemoveField(
model_name='runtime',
... | Turupawn/website | runners/migrations/0006_auto_20151111_0837.py | Python | agpl-3.0 | 561 |
import os
from callbacks.fsns_bbox_plotter import FSNSBBOXPlotter
# os.environ["MXNET_ENGINE_TYPE"] = "NaiveEngine"
# os.environ["MXNET_CUDNN_AUTOTUNE_DEFAULT"] = "0"
import datetime
import train_utils as utils
from callbacks.save_bboxes import BBOXPlotter
from data_io.file_iter import FileBasedIter, _load_image
fro... | Bartzi/stn-ocr | mxnet/train_fsns.py | Python | gpl-3.0 | 5,709 |
'''
Given an input GFF3 file, the database name and a file with the relationship
between the gff3 IDs and the database accessions for each feature the script
adds the dbxref to the GFF3 file
'''
from optparse import OptionParser
from franklin.gff import modify_gff3, create_go_annot_mapper
def parse_options():
'It... | JoseBlanca/franklin | scripts/gmod/add_go_term_to_gff3.py | Python | agpl-3.0 | 1,572 |
import os
from frb.cfx import CFX
from frb.utils import find_file
from frb.raw_data import M5, dspec_cat
from frb.search_candidates import Searcher
from frb.dedispersion import de_disperse_cumsum
from frb.search import search_candidates, create_ellipses
from frb.queries import query_frb, connect_to_db
# Setup
exp_cod... | ipashchenko/frb | examples/process_one_experiment.py | Python | apache-2.0 | 3,337 |
#!/usr/bin/env python
import sys
import os
from lib.util import safe_mkdir, extract_zip, tempdir, download
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases' \
'/download/v0.0.2'
def main():
os.chdi... | rwaldron/atom-shell | script/update-frameworks.py | Python | mit | 1,042 |
#!/usr/bin/env python3
from sympy import *
from mpmath import *
from matplotlib.pyplot import *
import matplotlib.ticker as plticker
import numpy as np
#init_printing() # make things prettier when we print stuff for debugging.
# ************************************************************************** #
# B-Fie... | alpenwasser/laborjournal | versuche/skineffect/python/vollzylinder_lowfreq.py | Python | mit | 9,786 |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | suqi/gym-sandbox | test_algos/GA3C_TF/ThreadPredictor.py | Python | mit | 2,679 |
#-*- coding: utf-8 -*-
# Implements Colobot model formats
# Copyright (c) 2014 Tomasz Kapuściński
import modelformat
import geometry
import struct
class ColobotNewTextFormat(modelformat.ModelFormat):
def __init__(self):
self.description = 'Colobot New Text format'
def get_extension(self):
... | tomaszkax86/Colobot-Model-Converter | colobotformat.py | Python | bsd-2-clause | 11,044 |
#!/usr/bin/env python
#
# Beautiful Capi generates beautiful C API wrappers for your C++ classes
# Copyright (C) 2015 Petr Petrovich Petrov
#
# This file is part of Beautiful Capi.
#
# Beautiful Capi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | PetrPPetrov/beautiful-capi | source/Xsd2Python3.py | Python | gpl-3.0 | 14,443 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 version 3 of the ... | tylercal/dragonfly | dragonfly/engines/backend_sphinx/engine.py | Python | lgpl-3.0 | 45,112 |
import itertools
from ieml.usl import USL, PolyMorpheme, check_polymorpheme
def check_lexeme(lexeme, sfun=None):
for pm in [lexeme.pm_flexion, lexeme.pm_content]:
if not isinstance(pm, PolyMorpheme):
raise ValueError("Invalid arguments to create a Lexeme, expects a Polymorpheme, not a {}."
.format(pm.__... | IEMLdev/propositions-restful-server | ieml/usl/lexeme.py | Python | gpl-3.0 | 2,853 |
import sys
import gc
import numarray as _na
import time
# gc.set_threshold(1)
packages = [
"numarray.numtest",
"numarray.ieeespecial",
"numarray.records",
"numarray.strings",
"numarray.memmap",
"numarray.objects",
"numarray.memorytest",
"numarray.examples.convolve",
"numarray.convo... | fxia22/ASM_xf | PythonD/site_python/numarray/testall.py | Python | gpl-2.0 | 1,079 |
"""Adds TRACE level logging, which is below DEBUG."""
import logging
import types
TRACE_LEVEL = 5
logging.addLevelName(TRACE_LEVEL, 'TRACE')
def _trace(self, msg, *args, **kwargs):
self.log(TRACE_LEVEL, msg, *args, **kwargs)
def getLogger(name):
logger = logging.getLogger(name)
if not hasattr(logger, ... | gamechanger/kafka-rest | kafka_rest/custom_logging.py | Python | mit | 405 |
__author__ = 'bruno'
def mark_component(graph, node, marked):
marked[node] = True
total_marked = 1
for neighbor in graph[node]:
if neighbor not in marked:
total_marked += mark_component(graph, neighbor, marked)
return total_marked
def list_component_number_of_vertices(graph):
... | bnsantos/python-junk-code | algorithms/graphs/connectedComponents.py | Python | gpl-2.0 | 502 |
L: List[int] = list()
b: bool = bool(L)
# FINAL: L -> _@⊥; b -> [0, 0]; len(L) -> [0, 0]
| caterinaurban/Lyra | src/lyra/unittests/numerical/interval/forward/indexing3/empty.py | Python | mpl-2.0 | 92 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.osv import expression
class FleetVehicle(models.Model):
_inherit = ['mail.thread', 'mail.activity.mixin']
_nam... | ygol/odoo | addons/fleet/models/fleet_vehicle.py | Python | agpl-3.0 | 19,734 |
# Generated by Django 3.2.10 on 2021-12-25 19:08
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('content... | jensadne/brixdb | brixdb/migrations/0001_initial.py | Python | mit | 12,872 |
import os
import unittest
class UnitTests(unittest.TestCase):
def setUp(self):
print('SetUp Complete.')
def test_assert_string(self): #testString):
db_path = '../data/db.txt'
self.assertTrue(os.path.isfile(db_path))
data_file = open(db_path,'r')
data_list = data_file.readlines()
ro... | MAhlers/python | HelloWorld/tests/test_hello_world.py | Python | mit | 737 |
# -*- coding: utf-8 -*-
# Copyright © 2014 Puneeth Chaganti and others.
# See the LICENSE file for license rights and limitations (MIT).
import os
from os.path import abspath, dirname, exists, join
def read_heroku_env_file(name='.env'):
env_path = join(dirname(abspath(__file__)), name)
env = {}
if exis... | punchagan/statiki | settings.py | Python | mit | 969 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.sites.shortcuts import get_current_site
from django.http import HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.views.generic.base import TemplateView
from django.views.generi... | pennersr/django-allauth | allauth/socialaccount/views.py | Python | mit | 4,170 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/application_gateway_http_listener_py3.py | Python | mit | 3,718 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | xpac1985/ansible | lib/ansible/plugins/action/__init__.py | Python | gpl-3.0 | 29,391 |
import httplib
import itertools
from flask import (
Flask,
abort,
make_response,
render_template,
request,
send_from_directory,
url_for,
)
from werkzeug import secure_filename
import os
from tempfile import mkdtemp
from urlobject import URLObject
from builder import build_docs, unzip_doc... | vmalloc/devdocs | webapp/flask_app.py | Python | bsd-3-clause | 3,785 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-10 17:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | nikkomidoy/project_soa | soamgr/migrations/0001_initial.py | Python | mit | 1,335 |
from gui.resources import *
class Button(ttk.Button):
"""
Extends ttk.Button so arrow keys can be used to traverse
between buttons
"""
def __init__(self, *args, **kwargs):
ttk.Button.__init__(self, *args, **kwargs)
self.bind("<Return>", self.on_press)
self.bind("<Left>", s... | LincolnPuzey/ZirconsRock | zircons_rock/gui/widgets/button.py | Python | gpl-3.0 | 1,227 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... | ASMlover/study | python/proto/google/protobuf/internal/cpp_message.py | Python | bsd-2-clause | 24,063 |
# -*- 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):
# Changing field 'Feed.title'
db.alter_column('feedmanager_feed', 'title', self.gf('django.db.models.fields.... | jacobjbollinger/sorbet | sorbet/feedmanager/migrations/0006_chg_field_feed_title.py | Python | bsd-2-clause | 5,274 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/storage_migration_response.py | Python | mit | 1,990 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
TauDEMUtils.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... | wonder-sk/QGIS | python/plugins/processing/algs/taudem/TauDEMUtils.py | Python | gpl-2.0 | 3,960 |
import foohid
import struct
import random
import time
joypad = (
0x05, 0x01,
0x09, 0x05,
0xa1, 0x01,
0xa1, 0x00,
0x05, 0x09,
0x19, 0x01,
0x29, 0x10,
0x15, 0x00,
0x25, 0x01,
0x95, 0x10,
0x75, 0x01,
0x81, 0x02,
0x05, 0x01,
0x09, 0x30,
0x09, 0x31,
0x09, 0x32... | unbit/foohid-py | test_joypad.py | Python | mit | 945 |
"""
Test compiling and executing using the dmd tool.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to... | timj/scons | test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py | Python | mit | 1,396 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | tsvi/py-libhdate | docs/source/conf.py | Python | gpl-3.0 | 1,977 |
# 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... | ghchinoy/tensorflow | tensorflow/contrib/timeseries/examples/lstm_test.py | Python | apache-2.0 | 1,760 |
from django.db import models
from django.db import connection, transaction
from .PUC import PUC
from .common_info import CommonInfo
from .product import Product
from django.utils.translation import ugettext_lazy as _
DEFAULT_CLASSIFICATION_METHOD_CODE = "MA"
class ProductToPUC(CommonInfo):
"""
Each product ... | HumanExposure/factotum | dashboard/models/product_to_puc.py | Python | gpl-3.0 | 4,278 |
from django.conf import settings as config
def settings(request):
""" Give access to some of the application settings"""
return {
'DOMAIN': config.DOMAIN,
'APPLICATION_TITLE': config.APPLICATION_TITLE,
'COMPANY_NAME': config.COMPANY_NAME,
}
def next(request):
"""Make {{ NEXT }} available"""
if 'next' in re... | MitMaro/The-Blame-Game | context_processors.py | Python | mit | 485 |
'''
https://leetcode.com/problems/number-of-submatrices-that-sum-to-target/
Algorithm:
1. Make cumulative summed rows - N * N steps
2. Use 1 to go over all rows fixing right and left columns of the matrix - N steps
'''
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
... | jan25/code_sorted | leetcode/target_sum_submatrices.py | Python | unlicense | 1,006 |
# -*- coding: utf-8 -*-
##############################################################################################
# This file is deprecated because Python 2.x is deprecated #
# A Python 3.x version of this file can be found at: #
# ... | Guymer/PyGuymer | MPLS/load_PlayListMark.py | Python | apache-2.0 | 2,438 |
from dtest import Tester
import os, sys, time
from ccmlib.cluster import Cluster
from tools import require, since
from jmxutils import make_mbean, JolokiaAgent
class TestDeletion(Tester):
def gc_test(self):
""" Test that tombstone are fully purge after gc_grace """
cluster = self.cluster
... | tjake/cassandra-dtest | deletion_test.py | Python | apache-2.0 | 2,588 |
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------#
# This file is part of Py-notify. #
# #
# Copyright (C) 2006, 2007, 2008 Paul Pogonyshev. #
# ... | berinhard/py-notify | notify/utils.py | Python | lgpl-2.1 | 11,952 |
# ******************************************************************************
# Copyright 2017-2020 Intel Corporation
#
# 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.apa... | NervanaSystems/ngraph | python/test/ngraph/test_basic.py | Python | apache-2.0 | 9,480 |
import hashlib
import os
import shutil
import stat
import time
from django.conf import settings
from django.core.cache import cache
import commonware.log
import cronjobs
from files.models import FileValidation
log = commonware.log.getLogger('z.cron')
@cronjobs.register
def cleanup_extracted_file():
log.info(... | jinankjain/zamboni | apps/files/cron.py | Python | bsd-3-clause | 1,539 |
#ImportModules
import ShareYourSystem as SYS
#Define and set a dict
MySetter=SYS.SetterClass(
).set(
'set',
{
'#liarg':('MyRedirectStr','MyStr')
}
).set(
'set',
{
'#liarg':'MyFirstStr',
'#kwarg':{'SettingValueVariable':'SettingValueVariable'}
}
).set(
'set',
{
'#liarg:#map@get':['MyRedi... | Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Itemizers/Setter/15_ExampleDoc.py | Python | mit | 862 |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
# internal
import stix
import stix.bindings.stix_common as common_binding
# relative
from .vocabs import VocabString
class Names(stix.EntityList):
_namespace = "http://stix.mitre.org/common-1"
_binding = ... | chriskiehl/python-stix | stix/common/names.py | Python | bsd-3-clause | 486 |
import unittest
import lxml
import lxml.etree
from pywps.app import Process, Service
from pywps import WPS, OWS
from tests.common import assert_pywps_version, client_for
class BadRequestTest(unittest.TestCase):
def test_bad_http_verb(self):
client = client_for(Service())
resp = client.put('')
... | jachym/PyWPS | tests/test_capabilities.py | Python | mit | 3,680 |
# # -*- coding: utf-8 -*-
# from django.contrib.auth import get_user_model
# from django.test import TransactionTestCase
# from net_promoter_score.forms import UserScoreForm
# from net_promoter_score.models import UserScore, score_group
# class UserScoreFormTests(TransactionTestCase):
# """Test suite for promot... | hugorodgerbrown/django-hipchat | hipchat/tests/test_forms.py | Python | mit | 1,525 |
from __future__ import unicode_literals
def execute():
"""Make standard print formats readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
... | gangadhar-kadam/mtn-erpnext | patches/may_2012/std_pf_readonly.py | Python | agpl-3.0 | 718 |
"""Tests for the `eofs.tools` package."""
# (c) Copyright 2013-2014 Andrew Dawson. All Rights Reserved.
#
# This file is part of eofs.
#
# eofs 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 ... | nicolasfauchereau/eofs | lib/eofs/tests/test_tools.py | Python | gpl-3.0 | 6,440 |
import collections
import json
import ApiHttpURLFetcher
class ApiRequestMaker:
def __init__(self, aso, url, apiKey):
self.aso = aso
self.url = url
self.apiKey = apiKey
self.default_user_agent = "Python Wrapper v1"
self.default_timeout = 5000
self.contentType = "application/json"
def fetchRecomme... | PerceptLink/perceptlink-python-api-wrapper | src/ApiRequestMaker.py | Python | mit | 2,015 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# 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_... | shsingh/ansible | lib/ansible/modules/network/aci/aci_interface_policy_leaf_profile.py | Python | gpl-3.0 | 7,180 |
'''
Created on Dec 17, 2013
@author: ajdeveloped@gmail.com
This file is part of XOZE.
XOZE 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... | JRepoInd/Repo_Indi | plugin.video.tvondesizonexl/tvshows/dtb_actions.py | Python | gpl-2.0 | 46,447 |
# python3
# coding=utf-8
# Copyright 2020 The Google Research 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 b... | google/localized-narratives | transcription_example.py | Python | apache-2.0 | 2,874 |
from __future__ import print_function
from django.core.management.base import BaseCommand
from django.db import transaction
import pandas as pd
import math
from sa_api_v2.models import (
Tag,
PlaceTag,
Place,
DataSet
)
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
... | smartercleanup/api | src/sa_api_v2/management/commands/ingestPrevetTags.py | Python | gpl-3.0 | 4,460 |
#-------------------------------------------------------------------------------
# Copyright (c) 2014 Proxima Centauri srl <info@proxima-centauri.it>.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribut... | myna-project/modbus | ownet/__init__.py | Python | gpl-3.0 | 14,612 |
import module1
import module2 | github/codeql | python/ql/test/query-tests/Metrics/imports/entry.py | Python | mit | 29 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
from findfine_crawler.crawlerForExRate import CrawlerForExRate
"""
測試 爬取 Yahoo 外幣投資頁面匯率資料
"""
clas... | muchu1983/104_findfine | test/unit/test_crawlerForExRate.py | Python | bsd-3-clause | 911 |
from .serializers import ProgramSerializer, ProgramProductSerializer
from partners.models import Program, ProgramProduct
from core.api.views import BaseModelViewSet
class ProgramViewSet(BaseModelViewSet):
queryset = Program.objects.all()
serializer_class = ProgramSerializer
class ProgramProductViewSet(BaseM... | eHealthAfrica/LMIS | LMIS/partners/api/views.py | Python | gpl-2.0 | 426 |
dict = { 1: 'a', 2: 'b', 3: 'c' } | romankagan/DDBWorkbench | python/testData/formatter/spaceWithinBraces_after.py | Python | apache-2.0 | 33 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | Quikling/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions_03.py | Python | apache-2.0 | 8,502 |
#https://pypi.python.org/pypi/enum34
#from enum import Enum
#class ResponseCode(Enum):
# OK = 1
# WARNING = 2
# ERROR = 3
class ResponseMessage:
def __init__(self, errorCode, errorMessage):
self.errorCode = errorCode
self.errorMessage = errorMessage
def getErrorCode(self):
... | andriyboychenko/books-online | catalogue/entities/ResponseMessage.py | Python | apache-2.0 | 346 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Mts20140618AddMediaRequest(RestApi):
def __init__(self,domain='mts.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.Description = None
self.InputFileUrl = None
self.Tags = None
self.Title = None
... | wanghe4096/website | aliyun/api/rest/Mts20140618AddMediaRequest.py | Python | bsd-2-clause | 392 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Runs the server for backend application `prepojenia`."""
import argparse
import json
import os
import sys
from paste import httpserver
import webapp2
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../data/db')))
from db import DatabaseConnecti... | verejnedigital/verejne.digital | prepojenia/server.py | Python | apache-2.0 | 8,389 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | sidzan/netforce | netforce_general/netforce_general/models/role.py | Python | mit | 1,560 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/db/versions/v0_9_0/__init__.py | Python | bsd-3-clause | 1,861 |
from datetime import datetime
from django.db import models
from django.utils import timezone
from applications.validators import validate_phone_number
YEAR_CHOICES = (
(1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 5),
)
class ApplicationPeriod(models.Model):
name = models.CharField(max_length=50, ver... | hackerspace-ntnu/website | applications/models.py | Python | mit | 2,686 |
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | apache/libcloud | libcloud/common/cloudsigma.py | Python | apache-2.0 | 7,813 |
#!/usr/bin/env python3
# author: grey@christoforo.net
import visa # https://github.com/hgrecco/pyvisa
import numpy
import sys
import time
import k2450 # functions to talk to a keithley 2450 sourcemeter
import rs # grey's sheet resistance library
# for plotting
import matplotlib.pyplot as plt
plt.switch_backend("Qt5Ag... | AFMD/rs-tool | rs-tool-gui.py | Python | apache-2.0 | 12,191 |
# coding=utf-8
from collections import namedtuple
__all__ = ['Struct', 'PayAppInternalResult', 'PayType', 'PayState', ]
class Struct(object):
def __init__(self, **entries):
self.__dict__.update(entries)
def __repr__(self):
return str(self.__dict__)
def __contains__(self, item):
... | ssut/payapp | payapp/classes.py | Python | mit | 1,877 |
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import unittest
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.engine.internals.parser import BuildFilePreludeSymbols, SymbolTable
from pants.engine.legacy.p... | tdyas/pants | src/python/pants/engine/legacy/parser_test.py | Python | apache-2.0 | 1,296 |
"""
basics.py
Contains the definitions of basic functions used for various purposes
in the game.
Written by: Mohsin Rizvi
Last edited: 07/12/17
"""
import sys
import os
# Purpose: Prints the keys followed by the values of a given dictionary,
# where the values are CommVal objects.
# Parameters: A di... | mohsr/print-adventure | src/basics.py | Python | mit | 2,836 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import json
HONEYPOT_CHANGES_PERCENTAGE = 11
def files_check():
try:
file1 = open(sys.argv[1], "rb").read()
except Exception as _:
sys.exit(print("cannot open the file, {0}".format(sys.argv[1])))
t... | Nettacker/Nettacker | lib/payload/scanner/ics_honeypot/changes_percentage.py | Python | gpl-3.0 | 1,608 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2007 Lukáš Lalinský
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License... | dufferzafar/picard | picard/formats/wav.py | Python | gpl-2.0 | 1,649 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import inspect
import json... | suutari/shoop | shuup/admin/utils/urls.py | Python | agpl-3.0 | 9,892 |
#!/usr/bin/env python
#******************************************************************************
# $Id: gdalchksum.py 18952 2010-02-28 11:59:53Z rouault $
#
# Project: GDAL
# Purpose: Application to checksum a GDAL image file.
# Author: Frank Warmerdam, warmerdam@pobox.com
#
#****************************... | kctan0805/vdpm | share/gdal/gdal-2.0.0/swig/python/scripts/gdalchksum.py | Python | lgpl-2.1 | 3,011 |
__version__ = (0, 4, 0, 'dev', 0)
def get_version():
version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version
| jszakmeister/trac-backlog | backlog/__init__.py | Python | bsd-3-clause | 271 |
"""
:synopsis: Unit Tests for Windows iis Module 'state.win_iis'
:platform: Windows
.. versionadded:: 2019.2.2
"""
import pytest
import salt.states.win_iis as win_iis
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {win_iis: {}}
def __base_webc... | saltstack/salt | tests/pytests/unit/states/test_win_iis.py | Python | apache-2.0 | 8,811 |
# yaranullin/tests/event_system.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE... | ciappi/Yaranullin | yaranullin/tests/event_system.py | Python | isc | 2,539 |
# Developer and idea: Lasse Steenbock Vestergaard (lasse.vestergaard@alexandra.dk)
#
# The software is distributed under the MIT license
#
# Copyright (C) 2014 The Alexandra Institute A/S www.alexandra.dk/uk
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associat... | alexandrainst/arip | server/genericplatform.py | Python | mit | 8,159 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Lice... | DreamSourceLab/DSView | libsigrokdecode4DSL/decoders/edid/__init__.py | Python | gpl-3.0 | 1,316 |
import urllib.request as urllib
from bs4 import BeautifulSoup
def get_html(adress):
""" Gets HTML from the adress provided
and returns it as a soup """
response = urllib.urlopen(adress) # add exception handeling to this
html = response.read()
soup = BeautifulSoup(html, 'html.parser')
return(s... | Stinners/Web-Scrapper | Scrapper/utilities.py | Python | gpl-3.0 | 2,491 |
#!/usr/bin/env python2
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the ... | parpg/parpg | run_tests.py | Python | gpl-3.0 | 1,286 |
# -*- coding: utf-8 -*-
# vim: noai:ts=4:sw=4:expandtab
import subprocess
from mockbuild.trace_decorator import getLog, traceLog
from mockbuild import util
class Podman:
""" interacts with podman to create build chroot """
@traceLog()
def __init__(self, buildroot, image):
self.buildroot = buildro... | rpm-software-management/mock | mock/py/mockbuild/podman.py | Python | gpl-2.0 | 3,096 |
# Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
import bdot
import numpy as np
class TimeSuite:
"""
An example benchmark that times the performance of various kinds
of iterating over dictionaries in Python.
Production
1. Nearest Neighbor S... | tailwind/bdot | benchmarks/asv/benchmarks.py | Python | mit | 1,523 |
# -*- coding: utf-8 -*-
# Roastero, released under GPLv3
import json
import openroast
from multiprocessing import sharedctypes, Array
import ctypes
import freshroastsr700
class Recipe(object):
def __init__(self, roaster, app, max_recipe_size_bytes=64*1024):
# this object is accessed by multiple processes... | Roastero/Openroast | openroast/controllers/recipe.py | Python | gpl-3.0 | 5,733 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.