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 |
|---|---|---|---|---|---|
import os.path
import numpy.testing as npt
import pandas as pd
import pandas.util.testing as pdt
import pytest
from .. import activitysim as asim
@pytest.fixture(scope='module')
def spec_name():
return os.path.join(os.path.dirname(__file__), 'data', 'sample_spec.csv')
@pytest.fixture(scope='module')
def data_... | bhargavasana/activitysim | activitysim/tests/test_activitysim.py | Python | agpl-3.0 | 1,759 |
# Copyright 2017 Red Hat, 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... | eayunstack/neutron | neutron/tests/functional/agent/linux/openvswitch_firewall/test_iptables.py | Python | apache-2.0 | 4,420 |
# -*- coding:Utf8 -*-
from tkinter import *
from math import pi, sin, cos
class Canon(object):
"""Petit canon graphique"""
def __init__(self, boss, x, y, angle=25):
self.boss = boss # référence du canevas
self.x1, self.y1 = x, y # axe de rotation du canon
# dessiner la b... | widowild/messcripts | exercice/python3/chap15/canon02.py | Python | gpl-3.0 | 3,084 |
"""This module contains unit tests for __init__.py."""
import logging
import json
import httplib
import os
import re
import shutil
import signal
import tempfile
import unittest
import uuid
import jsonschema
from keyczar import keyczar
from keyczar import keyczart
import mock
import tornado.testing
import tornado.web
... | simonsdave/tor-async-util | tor_async_util/tests/unit_tests.py | Python | mit | 62,553 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | jerome-nexedi/dream | dream/simulation/ExcelHandler.py | Python | gpl-3.0 | 2,776 |
# -*- coding: utf-8 -*-
"""
Alter property lists through the use of the CFPreferences API.
(Just testing the possibility of using this API)
:maintainer: Mosen <mosen@github.com>
:maturity: new
:depends: objc
:platform: darwin
"""
import logging
import salt.utils
log = logging.getLogger(__name__) ... | mosen/salt-osx | _modules/cfpreferences.py | Python | mit | 2,613 |
# encoding: utf-8
"""Tests for traitlets.config.configurable"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
from unittest import TestCase
from pytest import mark
from traitlets.config.configurable import (
Configurable,
LoggingConfigura... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/traitlets/config/tests/test_configurable.py | Python | bsd-2-clause | 14,252 |
import logging
import requests
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from treeherder.etl.common import fetch_json
logger = logging.getLogger(__name__)
RUNNABLE_JOBS_URL = 'https://queue.taskcluster.net/v1/task/{task_id}/runs/0/artifacts/public/runnable-jo... | edmorley/treeherder | treeherder/etl/runnable_jobs.py | Python | mpl-2.0 | 2,510 |
#! /usr/bin/env python
"""aws methods"""
# std libs
import sys, logging
# third party
import boto
# set up logging
logger = logging.getLogger('cigarbox')
def createS3Bucket(config):
bucket_name = config['S3_BUCKET_NAME']
conn = boto.connect_s3(config['AWS_ACCESS_KEY_ID'],config['AWS_SECRET_ACCESS_KEY'])
buck... | n8foo/cigarbox | aws.py | Python | apache-2.0 | 1,670 |
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 4/26/14
###Function: mean peak-based retro zOR metric vs. CDC benchmark index, mean Thanksgiving-based early zOR metric vs. CDC benchmark index
###Import data: /home/elee/Dropbox/Elizabeth_Bansal_Lab/... | eclee25/flu-SDI-exploratory-age | scripts/create_fluseverity_figs/F3_zOR_benchmark.py | Python | mit | 5,006 |
from django.core.management.base import BaseCommand, CommandError
from clips_app.models import *
from studies_app.models import *
import json
class Command(BaseCommand):
def handle(self, *args, **options):
clip_cases = Case.objects.all()
clips_study = Study.objects.all()[0]
for case in... | NavarraBiomed/clips | studies_app/management/commands/move_studies.py | Python | gpl-2.0 | 1,099 |
import pandas as pd
import os
import subprocess as sub
import re
import sys
from Bio import SeqUtils
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
# path = os.path.join(os.path.expanduser('~'),'GENOMES_BACTER_RELEASE69/genbank')
path = "."
# ['DbxRefs','Description','FeaturesNum','assemb... | sergpolly/Thermal_adapt_scripts | ArchNew/BOOTSTRAP/Cherry_composition_analysis_Thermo_Rnd.py | Python | mit | 10,138 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Category(models.Model):
label = models.CharField(max_length=255, verbose_name=_('Label'))
order = models.IntegerField(default=0, verbose_name=_('Order'))
class Meta:
ordering = ['order']
def __unicode__... | fgaudin/aemanager | faq/models.py | Python | agpl-3.0 | 787 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import sys
import trueskill
from qllr.db import db_connect
from qllr.submission import count_multiple_players_match_perf
parser = argparse.ArgumentParser()
parser.add_argument("gametype")
args = parser.parse_args()
from qllr.db import cache
... | em92/quakelive-local-ratings | contrib/reset_rating_for_gametype.py | Python | agpl-3.0 | 3,819 |
from .pandas_vb_common import *
from numpy.random import randint
import pandas as pd
from collections import OrderedDict
from pandas.compat import BytesIO
import sqlite3
import os
from sqlalchemy import create_engine
import numpy as np
from random import randrange
class _Packers(object):
goal_time = 0.2
def _... | Ziqi-Li/bknqgis | pandas/asv_bench/benchmarks/packers.py | Python | gpl-2.0 | 9,228 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | dirkmueller/kiwi | kiwi/solver/repository/rpm_md.py | Python | gpl-3.0 | 3,939 |
import sys
from array import array
from datetime import timedelta
from tz.zoneinfo import ZoneModule
sys.modules[__name__].__class__ = ZoneModule
ut, ti = array('q', []), [(timedelta(0), 0, 'UTC')] * 0
posix_rules = None
| abalkin/tz | tz/template.py | Python | mit | 221 |
import pytest
def test_bacteria():
from examples.bacteria.simulation import BasicBacteriaSimulation
sim = BasicBacteriaSimulation()
sim._wait_on_visual_init = 0
sim.simulate(20)
def test_bacteria_qlearning():
from examples.bacteria.simulation import QLearningBacteriaTrainSimulation, QLearningBact... | SeverTopan/AdjSim | examples/bacteria/test/test_system.py | Python | gpl-3.0 | 656 |
import sidr
import pytest
import mock
from contextlib import closing
try: # https://stackoverflow.com/questions/11914472/stringio-in-python3
from StringIO import StringIO
except ImportError:
from io import StringIO | damurdock/SIDR | tests/test_runfile.py | Python | mit | 224 |
# -*- coding: utf-8 -*-
"""URL definitions."""
from tipfy.routing import Rule
rules = [
Rule('/', name='home', handler='home.HomeHandler'),
Rule('/action', handler='action.AddActionHandler'),
]
| aleaxit/pysolper | latrop/urls.py | Python | apache-2.0 | 203 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('micro_masters', '0003_programorder_discounted_price'),
]
operations = [
migrations.AlterField(
model_name='progr... | synergeticsedx/deployment-wipro | openedx/core/djangoapps/micro_masters/migrations/0004_auto_20170712_0307.py | Python | agpl-3.0 | 457 |
# 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... | tensorflow/tensorflow | tensorflow/python/framework/versions.py | Python | apache-2.0 | 3,412 |
"""The lookin integration constants."""
from __future__ import annotations
from typing import Final
from homeassistant.const import Platform
MODEL_NAMES: Final = ["LOOKin Remote", "LOOKin Remote", "LOOKin Remote2"]
DOMAIN: Final = "lookin"
PLATFORMS: Final = [Platform.CLIMATE, Platform.MEDIA_PLAYER, Platform.SENSOR... | home-assistant/home-assistant | homeassistant/components/lookin/const.py | Python | apache-2.0 | 322 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
PACKAGES = ['jira']
def get_init_val(val, packages=PACKAGES):
pkg_init = "%s/__init__.py" % PACKAGES[0]
value = '__%s__' % val
fn = open(pkg_init)
for line in fn.readlines():
if line.startswith(value):
ret... | Maplecroft/jira-rpc | setup.py | Python | mit | 1,223 |
from __future__ import division
from __future__ import absolute_import
import tensorflow as tf
class baseline(object):
def get_baseline_value(self):
pass
def update(self, target):
pass
class ReactiveBaseline(baseline):
def __init__(self, l):
self.l = l
self.b = tf.Variabl... | shehzaadzd/MINERVA | code/model/baseline.py | Python | apache-2.0 | 489 |
import optparse
import bootmachine
class CommandError(Exception):
pass
class BaseCommand(object):
"""
Stripped down version of Django's BaseCommand needed strictly for
bootmachine-admin.
"""
option_list = []
help = ""
args = ""
def version(self):
return bootmachine.__v... | rizumu/bootmachine | bootmachine/management/base.py | Python | mit | 1,098 |
import pytest
from pontoon.base.forms import LocalePermsForm, ProjectLocalePermsForm
from pontoon.base.models import PermissionChangelog
@pytest.mark.django_db
def test_locale_perms_form_log_no_changes(user_a, locale_a):
form = LocalePermsForm(
{"translators": [], "managers": []}, instance=locale_a, user... | jotes/pontoon | pontoon/base/tests/forms/test_permission_log.py | Python | bsd-3-clause | 2,763 |
from __future__ import division
import state
import time
import csv
import random
import sys
POPULATION_SIZE = 100
MAX_COLLISION = 28
VALID_ARGS = "emg"
class FitnessListener():
def __init__(self, qtd=0):
self._qtd = qtd
def log(self):
self._qtd += 1
def retrive_qtd(self):
ret... | miguelarauj1o/8-Queens | eightqueens/__main__.py | Python | mit | 6,082 |
import time
from network.cluster_managers import google_compute_cluster_manager as gccm
cm = gccm.GoogleComputeClusterManager()
cm.Initialize('bats','12345','32123')
cm.Heartbeat()
cm.ListInstanceNames()
last = ''
print 'NumInstances: %i' % cm.NumInstances()
for instance in cm.ListInstanceNames():
print ' > %s' ... | timblakely/bigbrain | bigbrain/test.py | Python | apache-2.0 | 1,684 |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2019, Arm Limited and contributors.
#
# 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
#
# ... | ARM-software/lisa | lisa/pelt.py | Python | apache-2.0 | 16,798 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
"""
Runs the GWLF-E MapShed model.
Imported from GWLF-E.frm
"""
import logging
import numpy as np
from enums import ETflag, GrowFlag
from . import ReadGwlfData... | kdeloach/gwlf-e | gwlfe/gwlfe.py | Python | apache-2.0 | 12,959 |
"""Provides functionality to interact with lights."""
import asyncio
import csv
from datetime import timedelta
import logging
import os
from typing import Dict, Optional, Tuple
import voluptuous as vol
from homeassistant.auth.permissions.const import POLICY_CONTROL
from homeassistant.components.group import ENTITY_ID... | leppa/home-assistant | homeassistant/components/light/__init__.py | Python | apache-2.0 | 14,242 |
# $Id: 969e4c5fd51bb174563d06c1357489c2742813ec $
"""
Base classes for enhanced DB drivers.
"""
from __future__ import absolute_import
__docformat__ = "restructuredtext en"
# ---------------------------------------------------------------------------
# Imports
# ------------------------------------------------------... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/grizzled/grizzled/db/base.py | Python | bsd-3-clause | 32,027 |
# =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 10433.py
# Description: UVa Online Judge - 10433
# =============================================================================
while True:... | mjenrungrot/competitive_programming | UVa Online Judge/v104/10433.py | Python | mit | 619 |
#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
"""
Common stuff.
"""
import traceback
from . import core
from .util import from_
__all__ = ['step', 'Installable', 'Interactive', 'Continuous', 'installer',
'uninstaller']
def step():
def decorator(func):
cls = core.Com... | pspacek/freeipa | ipapython/install/common.py | Python | gpl-3.0 | 2,843 |
# Generated by Django 3.2.4 on 2021-07-01 14:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0002_auto_20150527_1004'),
]
operations = [
migrations.AlterField(
model_name='baseplugin',
name='container_... | teemulehtinen/a-plus | apps/migrations/0003_auto_20210701_1730.py | Python | gpl-3.0 | 945 |
from abc import ABC, abstractmethod
from numcodecs.abc import Codec
import numpy as np
import os
from dama.utils.config import get_settings
from dama.utils.logger import log_config
from dama.utils.core import Login, Chunks, Shape
from dama.utils.files import build_path
from dama.abc.conn import AbsConn
from dama.fmtype... | elaeon/ML | src/dama/abc/driver.py | Python | apache-2.0 | 4,808 |
etas = {
'generic14_learning': {
'alpha_sys': { 'muT__hat': 1.0, 'muT__muT': 0.203084255229, 'muT__muW': -0.000905716822652, 'muT__phi': 0.0, 'muW__hat': 1.0, 'muW__muT': -0.000110063688614, 'muW__muW': 0.201823621185, 'muW__phi': 0.0 },
},
'generic20_learning': {
'alpha_sys': { 'muT__hat': 1.0, 'muT__muT__down'... | svenkreiss/decouple | plotsForPaper/twoBin/scenarioA_interpCode0_etas_table.py | Python | mit | 2,146 |
from paddle.trainer_config_helpers import *
settings(batch_size=1000, learning_rate=1e-5)
input_loc = data_layer(name='input_loc', size=16, height=16, width=1)
input_conf = data_layer(name='input_conf', size=8, height=1, width=8)
priorbox = data_layer(name='priorbox', size=32, height=4, width=8)
detout = detection... | lispc/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_detection_output_layer.py | Python | apache-2.0 | 596 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 on 2016-06-23.
# 2016, SMART Health IT.
import io
import json
import os
import unittest
from . import questionnaire
from .fhirdate import FHIRDate
class QuestionnaireTests(unittest.TestCase):
def instantiate_from(self, filename)... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_1_0_6/models/questionnaire_tests.py | Python | bsd-3-clause | 14,250 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unles... | probcomp/cgpm | src/crosscat/lovecat.py | Python | apache-2.0 | 13,758 |
# pylint: skip-file
# flake8: noqa
class PolicyUserException(Exception):
''' PolicyUser exception'''
pass
class PolicyUserConfig(OpenShiftCLIConfig):
''' PolicyUserConfig is a DTO for user related policy. '''
def __init__(self, namespace, kubeconfig, policy_options):
super(PolicyUserConfig,... | ewolinetz/openshift-ansible | roles/lib_openshift/src/class/oc_adm_policy_user.py | Python | apache-2.0 | 8,279 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 18 11:27:46 2016
@author:
Maximilian N. Guenther
Battcock Centre for Experimental Astrophysics,
Cavendish Laboratory,
JJ Thomson Avenue
Cambridge CB3 0HE
Email: mg719@cam.ac.uk
"""
import warnings
import numpy as np
import matplotlib.pyplot as plt
#from astropy.modeling ... | DJArmstrong/autovet | Features/old/Centroiding/scripts/old/stacked_images.py | Python | gpl-3.0 | 13,046 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
AUTO_REPLY_CONTENT = """
欢迎关注在行!
「在行」是一个知识服务的平台。我们为想要解决问题的人找到行家,一对一面对面答疑解惑、出谋划策;我们为愿意分享知识和经验的人找到学员,让头脑中的资源发挥更大的价值。
期待你的加入!
www.zaih.com
"""
| zongxiao/python-weixin | weixin/config.py | Python | bsd-3-clause | 395 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: character_container.py
Copyright 2017 Vai Technologies, 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:/... | vaitech/basis | basis/character_container.py | Python | apache-2.0 | 2,267 |
from django.conf.urls import url, patterns
from django.views.generic import TemplateView
from librehatti.prints import views
urlpatterns = patterns('',
url(r'^bill/', 'bill'),
url(r'^add_lab/',views.add_lab, name = 'add_lab'),
url(r'^add_material/',views.add_material, name = 'add_material'),
ur... | ChanKaur/librehattii | src/librehatti/prints/urls.py | Python | gpl-2.0 | 437 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('bootcamp.app.views',
url(r'^login/$', 'login', name='login'),
url(r'^reg/$', 'reg', name='reg'),
url(r'^get_state/$', 'get_state', name='get_state'),
url(r'^set_state/$', 'set_state', name='set_state'),
url(r'^get_feeds/$',... | Wang-Sen/nqzx-backend | bootcamp/app/urls.py | Python | gpl-3.0 | 679 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from leagueofladders import settings
urlpatterns = patterns('',
url(r'^l/', include('leagueofladders.apps.myleague.urls', namespace='myleague')),
url(r'^admin/', include(admin.site.urls)... | dylanseago/LeagueOfLadders | leagueofladders/urls.py | Python | apache-2.0 | 420 |
#!/usr/bin/env python
from setuptools import setup
from pip.req import parse_requirements
import os
def abspath(fname):
return os.path.join(os.path.dirname(__file__), fname)
def read(fname, split=False):
with open(abspath(fname)) as f:
lines = f.read()
if split:
lines = lines.splitlines(... | cangermueller/vbmfa | setup.py | Python | gpl-3.0 | 2,009 |
from rest_framework import permissions
from orchestra.models import Step
from orchestra.models import Todo
from orchestra.models import Worker
from orchestra.project_api.auth import SignedUser
from orchestra.utils.notifications import message_experts_slack_group
class IsAssociatedWorker(permissions.BasePermission):
... | b12io/orchestra | orchestra/utils/common_helpers.py | Python | apache-2.0 | 4,056 |
import sys
import sympy as sp
x, a, b, c, d = sp.symbols('x a b c d')
# Choose Q2 to be monic
Q2 = a + b*x + x**2
# scalar product
def scalar(func1, func2):
#print(sp.latex(sp.integrate(x*func1*func2, (x, 0, 1))))
return sp.integrate(x*func1*func2, (x, 0, 1))
# Need to make Q2 such that it is orthogonal to ... | nat13ejo/NUMA12 | homework_6/code/task_1.py | Python | gpl-3.0 | 1,314 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | partp/gtg-services | GTG/gtk/browser/modifytags_dialog.py | Python | gpl-3.0 | 3,778 |
import copy
from typing import List, Dict
from atcodertools.fmtprediction.models.calculator import CalcNode, CalcParseError
from atcodertools.fmtprediction.models.variable_token import VariableToken, TokenizedFormat
from atcodertools.fmtprediction.token_manager import TokenManager
def _is_ascii(s):
re... | kyuridenamida/ToolsForAtCoder | atcodertools/fmtprediction/tokenize_format.py | Python | mit | 5,939 |
# Copyright 2014 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
#
# Unless required by applicable law or agreed to in writing, ... | vmturbo/nova | nova/tests/unit/virt/test_hardware.py | Python | apache-2.0 | 140,078 |
def maior(x,y):
if x > y:
return x
else:
return y
def ehtriangulo(x,y,z):
return maior(x,maior(y,z)) < x+y+z - maior(x,maior(y,z))
def classificatriangulo(x,y,z):
if ehtriangulo(x,y,z) == False:
return 'Nop, não é triângulo'
else:
if x == y and y == z:
... | GuiASousa/Estudos | Minicursopy/Triangulos.py | Python | gpl-3.0 | 599 |
# Copyright (c) 2005-2006 The Regents of The University of Michigan
# 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 ... | tiagormk/gem5-hmp | util/stats/barchart.py | Python | bsd-3-clause | 12,472 |
# (c) 2016, Thilo Uttendorfer <tlo@sengaya.de>
#
# 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) any later vers... | Jorge-Rodriguez/ansible | test/units/cli/test_console.py | Python | gpl-3.0 | 1,787 |
import json
import os
def get():
# current directory ( example: js2ds/script )
current_dir = os.path.dirname(__file__)
# parent directory ( example: js2ds )
parent_dir = os.path.dirname(current_dir)
# config directory ( example: js2ds/schema/meta_schema )
schema_dir = os.path.join(parent_dir, ... | dabda/js2ds | js2ds/script/schema_meta.py | Python | gpl-3.0 | 477 |
from collections import namedtuple
from django.contrib.auth.models import Group, User
from rest_framework import serializers
from hs_core.hydroshare import utils
from hs_core import hydroshare
from .utils import validate_json, validate_user_name, validate_group_name
RESOURCE_TYPES = [rtype.__name__ for rtype in ut... | RENCI/xDCIShare | hs_core/views/serializers.py | Python | bsd-3-clause | 6,229 |
from django.conf import settings
from django.contrib.auth import views as auth_views
from django.urls import include, re_path
from ..views import profile_update, remove_user, terms_of_use
urlpatterns = [
# edit own profile
re_path(r'^$', profile_update, name='profile_update'),
re_path('^remove', remove_us... | rdmorganiser/rdmo | rdmo/accounts/urls/__init__.py | Python | apache-2.0 | 1,094 |
#!/usr/bin/env python3
"""Print the names of the variables present within a TF model checkpoint.
Prints out TAB separated name and shape of each model variable
"""
import argparse
import os
import re
import numpy as np
import tensorflow as tf
def main() -> None:
parser = argparse.ArgumentParser(description=__d... | varisd/school | tf_utils/print_var_values.py | Python | gpl-2.0 | 885 |
#! /usr/bin/env python
"""
#############################################################################################
#
#
# Name: RRDGraphicProducer.py
#
# @author: Nicholas Lemay
#
# @since: 2008-01-30, last updated on 2008-04-02
#
#
# @license: MetPX Copyright (C) 2004-2007 Environment Canada
# MetPX c... | khosrow/metpx | pxStats/lib/RRDGraphicProducer.py | Python | gpl-2.0 | 68,241 |
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | ctiller/grpc | src/python/grpcio_reflection/grpc_version.py | Python | apache-2.0 | 705 |
#!/usr/bin/python
def recover_message(input_string):
message = ""
lines = []
for line in input_string.split("\n"):
if line.strip() != "":
lines.append(line)
chars = zip(*lines)
for char_list in chars:
counts = {}
for char in char_list:
if char no... | mnestis/advent2016 | 06/part1.py | Python | mit | 643 |
'''
Created on Jan 9, 2017
Core utilities for the network-generator program
@author: riccardo
''' | rizac/gfzreport | gfzreport/templates/annual/core/__init__.py | Python | gpl-3.0 | 99 |
from django.http import HttpResponse, Http404
from django.db.models import get_model
from django.contrib.contenttypes.models import ContentType
from tagging.models import Tag
def autocomplete(request, app_label, model):
try:
model = ContentType.objects.get(app_label=app_label, model=model)
except:
... | alex/pinax | pinax/apps/tagging_utils/views.py | Python | mit | 736 |
#!/usr/bin/env python
#
# Copyright 2015 British Broadcasting 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | tjenkinson/dvbcss-synctiming | test_sequence_gen/src/video.py | Python | apache-2.0 | 13,746 |
import os
import django
from django.conf import settings, global_settings
from oscar import OSCAR_CORE_APPS, OSCAR_MAIN_TEMPLATE_DIR
def configure():
if not settings.configured:
from oscar.defaults import OSCAR_SETTINGS
# Helper function to extract absolute path
location = lambda x: os.p... | Giftingnation/GN-Oscar-Custom | tests/config.py | Python | bsd-3-clause | 3,270 |
# Copyright 2018 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... | annarev/tensorflow | tensorflow/python/keras/saving/saved_model_experimental.py | Python | apache-2.0 | 18,263 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Cohorte Debug REST API
:authors: Bassem Debbabi
:copyright: Copyright 2015, isandlaTech
:license: Apache Software License 2.0
"""
# iPOPO decorators
from pelix.ipopo.decorators import ComponentFactory, Provides, Property, Instantiate, \
Validate, Invalidate, ... | gattazr/cohorte-platforms | repo/debug/api.py | Python | apache-2.0 | 19,258 |
#!/usr/bin/env py.test
"""Unit tests for the DiscreteOperator class"""
# Copyright (C) 2015 Garth N. Wells
#
# This file is part of DOLFIN.
#
# DOLFIN 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, e... | FEniCS/dolfin | test/unit/python/fem/test_discrete_operators.py | Python | lgpl-3.0 | 2,198 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re, sys, json
from pymongo import MongoClient
a = None
def parseColumnNames(f):
line = f.readline()
return line.split(',')
inputFilename = sys.argv[1]
inputFilenameCron = sys.argv[2]
outputfilename = sys.argv[3]
outputfilenameIds = sys.argv[4]
outputfile... | timole/sopernovus | dev/prod2csv.py | Python | mit | 7,254 |
#!/usr/bin/env python
#
# Copyright 2011-2020 Splunk, 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... | splunk/splunk-sdk-python | tests/test_kvstore_conf.py | Python | apache-2.0 | 3,930 |
import sys
def _unknown_hash(_):
raise TypeError('Unsupported type')
def hash_str_unicode(s):
h = 0
for c in s:
h = (31 * h + ord(c)) & 0xFFFFFFFF
return ((h + 0x80000000) & 0xFFFFFFFF) - 0x80000000
def hash_int(i):
return i
if int(sys.version[0]) > 2:
_TP_MAPPING = {
bytes... | neuront/pyjhashcode | jhashcode/__init__.py | Python | mit | 594 |
# 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_10_01/models/security_rule.py | Python | mit | 7,517 |
"""
Base test classes for LMS instructor-initiated background tasks
"""
import json
# pylint: disable=attribute-defined-outside-init
import os
import shutil
from tempfile import mkdtemp
from uuid import uuid4
import six
import unicodecsv
from celery.states import FAILURE, SUCCESS
from django.contrib.auth.models imp... | cpennington/edx-platform | lms/djangoapps/instructor_task/tests/test_base.py | Python | agpl-3.0 | 17,993 |
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
features = [
# "hu",
# "tutorial",
"haralick",
# "aaronmoments",
# "lbp",
# "pftas",
# "zernike_moments",
# "image_siz... | yejingxin/kaggle-ndsb | configurations/featharalick_sharding_blend_pl_blend4_convroll4_doublescale_fs5_no_dropout_33_66.py | Python | mit | 2,560 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Redirect(models.Model):
old_path = models.CharField(
_('redirect from'), max_length=200, db_index=True, unique=True,
help_text=_("This should be an absolute path, excluding the "
"domain ... | jfterpstra/bluebottle | bluebottle/redirects/models.py | Python | bsd-3-clause | 2,158 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sphinx - Python documentation toolchain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2008 by Georg Brandl.
:license: BSD.
"""
import sys
if __name__ == '__main__':
from sphinx.quickstart import main
sys.exit(main(sys.argv))
| BackupGGCode/sphinx | sphinx-quickstart.py | Python | bsd-3-clause | 308 |
"""
Openflow tests on an l2 table
"""
import sys
import os
import logging
from oftest import config
import oftest.base_tests as base_tests
import ofp
from oftest.testutils import *
from oftest.parse import parse_mac
import openflow_base_tests
sys.path.append(os.path.join(sys.path[0], '..', '..', '..', '..',
... | p4lang/p4factory | targets/l2_switch/tests/of-tests/openflow.py | Python | apache-2.0 | 7,004 |
from Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import NumberActionMap
from Components.config import config, getConfigListEntry, ConfigNothing, NoSave, ConfigPIN
from Components.ParentalControlList import ParentalControlEntryComponent, ParentalControlList
from Com... | kakunbsc/enigma2.4 | lib/python/Screens/ParentalControlSetup.py | Python | gpl-2.0 | 10,759 |
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
from django.contrib import messages
from django.contrib.auth import authenticate
from django.contrib.messages.views import SuccessMessageMixin
from django.core.cache import cache
from django.conf import settings
from django.http import HttpResponse
from... | eli261/jumpserver | apps/users/views/user.py | Python | gpl-2.0 | 15,043 |
#pylint: disable=no-init,invalid-name
'''
@author Spencer Howells, ISIS
@date December 05, 2013
Copyright © 2007-8 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it u... | wdzhou/mantid | Framework/PythonInterface/plugins/functions/ChudleyElliot.py | Python | gpl-3.0 | 2,133 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" mytag: Python music tagger and file organiser
----------------Authors----------------
Lachlan de Waard <lachlan.00@gmail.com>
----------------Licence----------------
GNU General Public License version 3
This program is free software: you can redist... | lachlan-00/mytag | mytag/mytag.py | Python | gpl-3.0 | 45,905 |
#Copyright 2013 Paul Barton
#
#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 hope tha... | soumyasanyal/PyUserInput | tests/basic.py | Python | gpl-3.0 | 1,643 |
# FanTempInfo Converter v.0.3
# Copyright (c) 2boom 2012-14
# v.0.3-r1
# 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 ver... | MOA-2011/enigma2.pli4.0 | lib/python/Components/Converter/FanTempInfo.py | Python | gpl-2.0 | 1,944 |
"""
WSGI config for djmaterial 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/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... | fullstackpython/blog-code-examples | materialize-css-django-material-admin/step1/djmaterial/djmaterial/wsgi.py | Python | mit | 397 |
import json
import requests
from bs4 import BeautifulSoup
from .payload import Payload, Author, Affiliation
def map(url):
meta = Payload()
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'Fro... | sjennewein/MetaDataDistiller | metadata/nmd.py | Python | mit | 2,721 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# 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 ver... | taigaio/taiga-back | taiga/projects/votes/mixins/serializers.py | Python | agpl-3.0 | 1,286 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-07-25 22:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exdb', '0002_auto_20160608_1923'),
]
operations = [
migrations.AlterField(
... | mostateresnet/exdbproject | exdb/migrations/0003_auto_20160725_1701.py | Python | mit | 503 |
"""Test class for Compute Profile UI
:Requirement: Computeprofile
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: ComputeResources
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.decorators import tier... | ldjebran/robottelo | tests/foreman/ui/test_computeprofiles.py | Python | gpl-3.0 | 2,049 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | varunarya10/heat | heat/tests/test_api_cfn_v1.py | Python | apache-2.0 | 75,990 |
class JoommfError(Exception):
pass
| fangohr/oommf-python | joommf/exceptions.py | Python | bsd-2-clause | 39 |
#!/usr/bin/env python
#
# Copyright 2017 the original author or 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 require... | opencord/voltha | netconf/nc_rpc/base/delete_config.py | Python | apache-2.0 | 1,360 |
# Copyright 2013-2014 MongoDB, 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 writin... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/pymongo/auth.py | Python | mit | 9,015 |
import pilasengine
class GirarPorSiempre(pilas.habilidades.Habilidad):
def __init__(self, receptor, velocidad=1):
self.receptor = receptor
self.velocidad = velocidad
def actualizar(self):
self.receptor.rotacion += self.velocidad
pilas = pilasengine.iniciar()
a = pilas.actores.Mono()... | irvingprog/python-pilas-experimental | pilasengine/ejemplos/ejemplos_a_revisar/habilidad_personalizada_con_argumentos.py | Python | lgpl-3.0 | 409 |
'''
CIFAR-10 example from https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py
Now with weight normalization. Lines 64 and 69 contain the changes w.r.t. original.
'''
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from ... | miyamotok0105/deeplearning-sample | src/keras1.2.2/weightnorm/cifar10_cnn.py | Python | mit | 3,912 |
import academics_admission
import academics_registrar
import registrar_forms
import academics_bursar
# import report
import wizard
import housing
import transcript | danielharbor/openerp | addons/academics/__init__.py | Python | agpl-3.0 | 163 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-compute | google/cloud/compute_v1/services/public_advertised_prefixes/client.py | Python | apache-2.0 | 37,471 |
import csv
import math
class JsonCreator:
def __init__(self):
self.early_csv = 'input_data/1971-1980.csv'
self.late_csv = 'input_data/1991-2000.csv'
self.loc_count_csv = 'output_data/counts.csv'
self.json_file = '../oliverxchen.github.io/globe/twitter_vs_temp.json'
self.colo... | oliverxchen/geovis | JsonCreator.py | Python | mit | 2,960 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.