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.core.management.base import BaseCommand, CommandError
import silk.models
class Command(BaseCommand):
help = "Clears silk's log of requests."
@staticmethod
def delete_model(model):
count = model.objects.count()
print("deleting %s %s objects" % (model.__name__, count))
... | Alkalit/silk | silk/management/commands/silk_clear_request_log.py | Python | mit | 715 |
"Shows images"
import cv2
class FrameDisplay:
"Handles the logic of displaying webcam images"
def __init__(self, name):
self.frame_name = name
cv2.namedWindow(name)
def close(self):
cv2.destroyAllWindows()
print("Closing window")
def showFrame(self, frame):
... | netsecIITK/moVi | movi/image/frame.py | Python | apache-2.0 | 502 |
from .vnsoptmd import MdApi
from .vnsopttd import TdApi
from .sopt_constant import *
| bigdig/vnpy | vnpy/api/sopt/__init__.py | Python | mit | 85 |
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.test import TestCase
from core.mixins import ChartsUtilityMixin
from core.views import AngularView
class CoreTestCase(TestCase):
fixtures = ['test.json']
... | jkosir/insightful | core/test.py | Python | mit | 898 |
"""
Support for Enviro pHAT sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor.envirophat
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassis... | HydrelioxGitHub/home-assistant | homeassistant/components/sensor/envirophat.py | Python | apache-2.0 | 6,887 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('doctypemigrations', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DocTypeMigrationCheckpoint',... | qedsoftware/commcare-hq | corehq/doctypemigrations/migrations/0002_auto_20150924_1930.py | Python | bsd-3-clause | 1,066 |
#!/usr/bin/python
#
# 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 b... | richardfergie/googleads-python-lib | examples/dfp/v201411/user_team_association_service/delete_user_team_associations.py | Python | apache-2.0 | 2,762 |
'''
Ant wrapper
Copyright (c) 2015 Rob "N3X15" Nelson <nexisentertainment@gmail.com>
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
t... | N3X15/python-build-tools | buildtools/wrapper/ant.py | Python | mit | 1,881 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 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 flask import flash, render_template, session
from indico.core import signals
from indico.core.db imp... | indico/indico | indico/modules/events/registration/__init__.py | Python | mit | 10,142 |
# -*- encoding: utf-8 -*-
from abjad import *
from abjad.tools.lilypondparsertools import LilyPondParser
def test_lilypondparsertools_LilyPondParser__indicators__StemTremolo_01():
target = Staff([Note(0, 1)])
stem_tremolo = indicatortools.StemTremolo(4)
attach(stem_tremolo, target[0])
assert systemt... | mscuthbert/abjad | abjad/tools/lilypondparsertools/test/test_lilypondparsertools_LilyPondParser__indicators__StemTremolo.py | Python | gpl-3.0 | 700 |
# -*- coding: utf-8 -*-
#
# project-template documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 18 14:44:12 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... | wikilinks/neleval | doc/conf.py | Python | apache-2.0 | 8,305 |
"""
======================================================================
Compressive sensing: tomography reconstruction with L1 prior (Lasso)
======================================================================
This example shows the reconstruction of an image from a set of parallel
projections, acquired along dif... | chenyyx/scikit-learn-doc-zh | examples/zh/applications/plot_tomography_l1_reconstruction.py | Python | gpl-3.0 | 5,478 |
# -*- coding: utf-8 -*-
#
# Manticore documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 10 18:04:51 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | montyly/manticore | docs/conf.py | Python | apache-2.0 | 5,587 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import cStringIO
from telemetry.core import util
util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'png')
import png # pylint: d... | mogoweb/chromium-crosswalk | tools/telemetry/telemetry/core/backends/png_bitmap.py | Python | bsd-3-clause | 4,066 |
import sys
import os
import ConfigParser
import string
from collections import OrderedDict
x = os.path.dirname(sys.argv[1])
sys.path.append(x)
import spec_lib
from spec_lib.bin_ascii import ascii_bin
from spec_lib.generic_feedhandler import generic_feedhandler
files = [y.split('.', 1)[0] for y in os.listdir(x) if os... | hexforge/pulp_db | utils/decoder/rosetta/utils/old_spec_to_ini.py | Python | apache-2.0 | 1,802 |
#!/usr/bin/env python
"""
These functions search the environment for software dependencies and configuration.
"""
from __future__ import unicode_literals
import os
import subprocess
import logging
import pkg_resources
import ciftify.utilities as util
def find_workbench():
"""
Returns path of the workbench bi... | BrainIntensive/OnlineBrainIntensive | resources/HCP/ciftify/ciftify/config.py | Python | mit | 8,757 |
from itertools import product
import numpy as np
from nose.tools import assert_true
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
eigen_solvers = ['dense', 'arpack']
def assert_... | cdegroc/scikit-learn | sklearn/manifold/tests/test_locally_linear.py | Python | bsd-3-clause | 4,181 |
#!/usr/bin/env python3
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("filename")
args = parser.parse_args()
try:
input_file = open(args.filename, encoding="UTF-8")
except IOError as e:
print("Unable to open input file", file=sys.stderr)
sys.exit()
attribute_name = None
... | sgithens/dicom-anon | parse_annex_e.py | Python | bsd-2-clause | 789 |
from django.shortcuts import render
def login(request):
return render(request, 'login.html')
| tjghs/ghstracker | ghswebsite/apps/user/views.py | Python | mit | 99 |
import argparse
# Create an instance
parser = argparse.ArgumentParser(description='A simple program that prints a greeting to the name specified')
# Add a name argument
parser.add_argument('--name', type=str, required=True, help='Name of the person being greeted')
parser.add_argument('--greeting', '-g', type=str, de... | Unidata/unidata-python-workshop | notebooks/Command_Line_Tools/greetme.py | Python | mit | 474 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/graph-attribution | tests/test_graphs.py | Python | apache-2.0 | 13,483 |
from flask import Flask, request, jsonify
app = Flask(__name__)
request_store = []
@app.route("/api/action/task_status_update_many", methods=['GET', 'POST'])
def task_status_update_many():
request_store.append({
"data": request.json,
"headers": dict(request.headers)
})
return 'ok'
@app.ro... | DanePubliczneGovPl/ckanext-archiver | tests/fake_ckan.py | Python | mit | 1,284 |
#
# Copyright 2014 David Novakovic
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | fiorix/cyclone | cyclone/tests/test_mail.py | Python | apache-2.0 | 2,169 |
#!/usr/bin/env python
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/li... | rabimba/p2pScrapper | BitTorrent-5.2.2/launchmany-console.py | Python | mit | 6,239 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Red Hat, inc
# Written by Seth Vidal
# based on the mount modules from salt and puppet
#
# 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 ... | yannh/ansible-modules-core | system/mount.py | Python | gpl-3.0 | 12,182 |
'''
Created on Jul 28, 2015
.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
'''
from __future__ import (print_function, absolute_import, unicode_literals,
division)
import unittest
import unittest.mock as mock
from ema_workbench.em_framework.model import Model, FileModel
fro... | quaquel/EMAworkbench | test/test_em_framework/test_model.py | Python | bsd-3-clause | 4,824 |
from utils import CanadianJurisdiction
class ManitobaMunicipalities(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/province:mb'
division_name = 'Manitoba'
name = 'Manitoba Municipalities'
url = 'http://web5.gov.mb.ca/Public/municipalities.aspx'
| opencivicdata/scrapers-ca | disabled/ca_mb_municipalities/__init__.py | Python | mit | 313 |
from typing import Optional
from prompt_toolkit.application.current import get_app
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.enums import SYSTEM_BUFFER
from prompt_toolkit.filters import (
Condition,
FilterOrBool,
emacs_mode,
has_arg,
has_completions,
has_focus,
has_valid... | jonathanslenders/python-prompt-toolkit | prompt_toolkit/widgets/toolbars.py | Python | bsd-3-clause | 12,256 |
import os
import numpy as np
import tensorflow as tf
from .utils import weight_variable, bias_variable, conv2d, conv2d_VALID, max_pool
def remove_duplicate_spikes_by_energy(energy_train_tf, T, c_idx, temporal_window):
temporal_max_energy = max_pool(
tf.expand_dims(tf.expand_dims(energy_train_tf,0),-1... | jinhyunglee/yass | src/yass/neuralnetwork/remove.py | Python | apache-2.0 | 706 |
import struct
import socket
import time
def p(a):
return struct.pack("<Q", a)
def u(a):
return struct.unpack("<Q", a)[0]
def recv_until(sock, s="\n"):
res = ""
while 1:
res += sock.recv(1)
if res.endswith(s):
break
return res
s = socket.create_connection(('lab30.wargame.whitehat.vn', 7002))
#s = socket.... | anarcheuz/CTF | whitehat.vn/pwn/pwn002/exploit.py | Python | mit | 4,049 |
import pytest
from django.urls import reverse
from rest_framework.status import HTTP_302_FOUND, HTTP_200_OK
from organizations.tests.factories import OrganizationFactory
from projects.views.projects.tests import setup, login, user_permissions_test_manage
@pytest.mark.django_db
def test_user_permissions_for_document_... | bgroff/kala-app | django_kala/projects/views/projects/settings/tests/test_transfer_ownership.py | Python | mit | 3,003 |
from sklearn.datasets import load_digits
from sklearn.neighbors import KNeighborsClassifier
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, random_state=0)
param_grid = {'n_neighbors': [1, 3, 5, 10, 50]}
gs = GridSearchCV(KNeighborsClassifier(), param_grid=param_... | RTHMaK/RPGOne | scipy-2017-sklearn-master/notebooks/solutions/14_grid_search.py | Python | apache-2.0 | 473 |
import sys
import time
import subprocess
from urllib.parse import urlencode
import scrapy
from scrapy.commands import ScrapyCommand
from scrapy.linkextractors import LinkExtractor
class Command(ScrapyCommand):
default_settings = {
'LOG_LEVEL': 'INFO',
'LOGSTATS_INTERVAL': 1,
'CLOSESPIDER... | eLRuLL/scrapy | scrapy/commands/bench.py | Python | bsd-3-clause | 1,629 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Crypter import Crypter
class MegaCoNzFolder(Crypter):
__name__ = "MegaCoNzFolder"
__type__ = "crypter"
__version__ = "0.03"
__pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w+^_])!(?P<KEY>[\w,\\-]+)... | EvolutionClip/pyload | module/plugins/crypter/MegaCoNzFolder.py | Python | gpl-3.0 | 1,119 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-2019
# (c) The University of Strathclude 2019-2020
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute of Pharmaceutical and Biomedical Sciences
# The University o... | widdowquinn/pyani | tests/test_subcmd_01_download.py | Python | mit | 4,394 |
""" This is a test of the chain
DataStoreClient -> DataStoreHandler -> AccountingDB
It supposes that the DB is present, and that the service is running
this is pytest!
"""
# pylint: disable=invalid-name,wrong-import-position
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DI... | fstagni/DIRAC | tests/Integration/AccountingSystem/Test_DataStoreClient.py | Python | gpl-3.0 | 1,561 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | dhermes/google-cloud-python | storage/setup.py | Python | apache-2.0 | 2,755 |
#!/usr/bin/env python
# Copyright 2017, 2018 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 re... | tombstone/models | research/lexnet_nc/sorted_paths_to_examples.py | Python | apache-2.0 | 7,655 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Common codegen classes.
from collections import defaultdict
from itertools import groupby
import operator
import os
... | srivassumit/servo | components/script/dom/bindings/codegen/CodegenRust.py | Python | mpl-2.0 | 284,993 |
../../../../../share/pyshared/mx/DateTime/DateTime.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/mx/DateTime/DateTime.py | Python | gpl-3.0 | 53 |
"""
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once.
For example, 2143 is a 4-digit pandigital and is also prime.
What is the largest n-digit pandigital prime that exists?
"""
from sys import exit
from math import sqrt
from itertools import permutations
primes ... | hickeroar/project-euler | 040/solution041.py | Python | mit | 944 |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
def GetTheGraph1022(y_init):
X_TIMES = 30
Y_TIMES = 0.1
Y_LOW = 1.70
fig = plt.figure(figsize=(10,10))
for i in np.arange(0,100,1):
x = [i,i]
y = [0,100]
plt.plot... | buaase/Phylab-Web | PythonExperimentDataHandle/1022Matplot.py | Python | gpl-2.0 | 2,280 |
# coding=utf8
from datetime import datetime
from messageboard import app
from messageboard.models import Message
from flask import flash, render_template, request, redirect, url_for
@app.route('/', methods=['GET'])
def index():
query = Message.orderby(
Message.create_at, desc=True).select() # sort by ... | hit9/skylark | examples/messageboard/messageboard/views.py | Python | bsd-2-clause | 1,358 |
# -*- coding: utf-8 -*-
from cobradb.models import *
from cobradb import settings
import re
import os
import logging
from time import time
from sys import stdout
def check_none(v):
"""Return None if v is the empty string or the string 'None'."""
return None if (v == 'None' or v == '') else v
def get_or_cr... | SBRG/ome | cobradb/util.py | Python | mit | 6,371 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
import datetime
from decimal import Decimal
# Django imports
from django.conf import settings
from django.core.management.base import BaseCommand
from allauth.socialaccount.providers import registry
from allauth.socialac... | Semillas/semillas_platform | semillas_backend/users/management/commands/create_social_apps.py | Python | mit | 1,682 |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | camptocamp/mapproxy | mapproxy/test/unit/test_client_arcgis.py | Python | apache-2.0 | 3,056 |
#!/usr/bin/python
#
# Copyright 2017 Google 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 a... | brain-research/hyperbolictext | nli/baseline_encoders_test.py | Python | apache-2.0 | 1,205 |
#!/usr/bin/env python
from __future__ import print_function
from configobj import ConfigObj
import sys
import os
from subprocess import call
def lower_to_sep(string, separator='='):
line=string.partition(separator)
string=str(line[0]).lower()+str(line[1])+str(line[2])
return string
if (len(sys.argv) < 2):
print(... | aasensio/hazel | runMPI/run.py | Python | mit | 15,443 |
"""Forward modeling code."""
from .forward import (Forward, read_forward_solution, write_forward_solution,
is_fixed_orient, _read_forward_meas_info,
_select_orient_forward,
compute_orient_prior, compute_depth_prior,
apply_forward, ... | wmvanvliet/mne-python | mne/forward/__init__.py | Python | bsd-3-clause | 1,347 |
from .pyutils.version import get_version
try:
# This variable is injected in the __builtins__ by the build
# process. It used to enable importing subpackages when
# the required packages are not installed
__SETUP__
except NameError:
__SETUP__ = False
VERSION = (1, 1, 0, 'final', 0)
__version__ ... | Globegitter/graphene | graphene/__init__.py | Python | mit | 1,497 |
# -*- 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.
class ModuleTestModule(object):
identifier = "mtm1"
greet... | suutari/shoop | shuup_tests/core/module_test_module.py | Python | agpl-3.0 | 421 |
from pandac.PandaModules import Texture, TextureStage, Shader, PNMImage
from pandac.PandaModules import Vec2,Vec3,Vec4,BitMask32
from pandac.PandaModules import NodePath,PandaNode,ShaderAttrib, OmniBoundingVolume, Filename
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import EggData
fro... | zed-ee/grader-simulator | LevelCalc.py | Python | mit | 7,391 |
"""
up2date Logs - Files ``/var/log/up2date``
==========================================
Modules for parsing the content of log file ``/var/log/up2date`` in sosreport archives of RHEL.
"""
from .. import LogFileOutput, parser
from insights.specs import Specs
@parser(Specs.up2date_log)
class Up2dateLog(LogFileOutpu... | RedHatInsights/insights-core | insights/parsers/up2date_log.py | Python | apache-2.0 | 1,557 |
import configparser
import os
import sys
import gamepedia_client
class GamepediaPagesRW:
gc = None
'''
Create new instance of GamepediaClient (required for name attribution)
'''
def create_gamepedia_client(self, username=None, password=None):
global cfg_file
if username is None:
... | networkjanitor/faeriawikibot | gamepedia_rw_pages.py | Python | mit | 13,081 |
from allauth.socialaccount.providers.battlenet.provider import BattleNetProvider
class BattleNetSC2ScopeProvider(BattleNetProvider):
id = 'battlenet_sc2scope'
def get_default_scope(self):
return "sc2.profile"
| biddellns/litsl | players/provider.py | Python | gpl-3.0 | 227 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# jason@glen... | openmicroscopy/omero-marshal | omero_marshal/encode/encoders/timestamp_annotation.py | Python | gpl-2.0 | 1,209 |
"""Place of record for the package version"""
__version__ = "1.0.12"
__git_hash__ = "GIT_HASH"
| amplify-education/data_kennel | data_kennel/version.py | Python | mit | 96 |
from benchmark.test_types.framework_test_type import FrameworkTestType
from benchmark.test_types.db_type import DBTestType
import json
class QueryTestType(DBTestType):
def __init__(self):
args = ['query_url']
FrameworkTestType.__init__(self, name='query', requires_db=True,
accept_header=self.accept_j... | waiteb3/FrameworkBenchmarks | toolset/benchmark/test_types/query_type.py | Python | bsd-3-clause | 3,816 |
from decimal import Decimal
from twisted.internet import defer
from twisted.internet import reactor
class SoftwareModule:
module = ''
def __init__(self, module):
self._module = module
if not self.module:
raise ValueError("Must set a module name")
def log(sel... | offmessage/blackpearl | blackpearl/things/software/base.py | Python | mit | 2,890 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import paramiko
from sys import stdout, stderr
hostname = "116.196.69.47"
username = "root"
password = "Zhangyage"
paramiko.util.log_to_file('syslogin') #发送paramiko日志到syslogin中
ssh = paramiko.SSHClient() #创建ssh链接对象
##ssh.load_system_host_keys() ... | zhangyage/Python-oldboy | python-auto/p_ssh2/ssh_passwd.py | Python | apache-2.0 | 659 |
import rethinkdb as r
def setup():
"""
Sets up the connection to RethinkDB which we'll use in the rest of the
tests, and puts it into .repl() mode so we don't have to pass the model
object a connection. After that, we create a new database called `model`
and within that a table called `stargate` a... | JoshAshby/pyRethinkORM | rethinkORM/tests/__init__.py | Python | gpl-3.0 | 719 |
import mock
from mock import patch
from pytest import raises
from kiwi.package_manager.base import PackageManagerBase
class TestPackageManagerBase:
def setup(self):
repository = mock.Mock()
repository.root_dir = 'root-dir'
self.manager = PackageManagerBase(repository)
def test_reques... | SUSE/kiwi | test/unit/package_manager/base_test.py | Python | gpl-3.0 | 2,998 |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. All rights reserved.
# Copyright (c) 2015 Goutham Pacha Ravi. All rights reserved.
# Copyright (c) 2016 Mike Rooney. All rights reserved.
#
# Licensed under the Apache L... | bswartz/cinder | cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_7mode.py | Python | apache-2.0 | 28,046 |
import os
import sys
from django.conf import settings
from smart_server.smart.models.apps import OAuthApp
from smart_server.smart.triplestore.triplestore import TripleStore
def check_environment():
check_database()
check_triplestore()
def check_database():
# ensure database is online + accessible
try:... | smart-classic/smart_server | smart/utils/startup.py | Python | apache-2.0 | 738 |
#!/usr/bin/env python
import MySQLdb as mdb
import _mysql_exceptions
class MySQLSetup(object):
def __init__(self, connection_info, scoring_dbUser, scoring_dbPass, scoring_dbName):
self.con = mdb.connect(connection_info, scoring_dbUser, scoring_dbPass, scoring_dbName)
def build_all_new_databases(self):
self.b... | stustustu123/tennis | mysql_tennis.py | Python | gpl-3.0 | 3,967 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 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... | hachreak/invenio-pidstore | invenio_pidstore/version.py | Python | gpl-2.0 | 1,205 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | tanglei528/nova | nova/api/openstack/compute/contrib/server_diagnostics.py | Python | apache-2.0 | 2,779 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import sjutils
class TestFlattenDict(unittest.TestCase):
def setUp(self):
self.simple_dictionary = {'first': 'value',
'second': {'nested': 'hello'}}
self.nested_dictionary = {'first': {'1': {'2': '3'},
... | SmartJog/python-sjutils | tests/test_flatten.py | Python | lgpl-2.1 | 2,920 |
from urllib import unquote
from tornado.web import authenticated
from amgut.handlers.base_handlers import BaseHandler
from amgut.connections import ag_data
from amgut.lib.mail import send_email
from amgut import text_locale
class ChangePasswordHandler(BaseHandler):
@authenticated
def get(self):
user_... | adamrp/american-gut-web | amgut/handlers/change_password.py | Python | bsd-3-clause | 1,799 |
import copy
from fs.errors import ResourceNotFoundError
import logging
import os
import sys
from lxml import etree
from path import path
from pkg_resources import resource_string
from xblock.fields import Scope, String, Boolean
from xmodule.editing_module import EditingDescriptor
from xmodule.html_checker import check... | pelikanchik/edx-platform | common/lib/xmodule/xmodule/html_module.py | Python | agpl-3.0 | 11,507 |
"""
Created on 21 March 2019
@author: galdam
"""
from Utils.RunSingularity import Singularity
class RnaseqcCounts(Singularity):
"""
Runs the Rnaseqc Counts task in the broadinstitute/gtex_rnaseq singularity image.
"""
PIPELINE = 'rnaseqccounts'
CMD_KWARGS = ['gatk_flags']
CMD_ARGS = ['md_bam... | igsr/igsr_analysis | PyHive/TOPMed/RnaseqcCounts.py | Python | apache-2.0 | 892 |
version_number = '2.0.1'
| johnmcdonnell/psiTurk | psiturk/version.py | Python | mit | 25 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'a rather very hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECKILL_ADMIN = os.environ.get('SECKILL_ADMIN')
SECKILL_KILLHOU... | Gloomymoon/SecKill | config.py | Python | gpl-3.0 | 1,133 |
# 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 ... | rjschwei/azure-sdk-for-python | unreleased/azure-mgmt-intune/azure/mgmt/intune/models/device.py | Python | mit | 2,557 |
from __future__ import unicode_literals
from django.db.utils import DatabaseError
from django.utils.encoding import python_2_unicode_compatible
class AmbiguityError(Exception):
"""
Raised when more than one migration matches a name prefix.
"""
pass
class BadMigrationError(Exception):
"""
Ra... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/db/migrations/exceptions.py | Python | gpl-3.0 | 1,490 |
# 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.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cg31/tensorflow | tensorflow/contrib/grid_rnn/python/kernel_tests/grid_rnn_test.py | Python | apache-2.0 | 20,682 |
##
# Copyright (C) 2014 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen 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
#... | Inboxen/Inboxen | inboxen/tickets/tests.py | Python | agpl-3.0 | 17,573 |
# -*- coding: utf-8 -*-
from .decorators.universal_view_decorator import universal_view_decorator, universal_view_decorator_with_args
from .decorators.view_decorator_base import ViewDecoratorBase
__all__ = ['universal_view_decorator', 'universal_view_decorator_with_args', 'ViewDecoratorBase']
# version_info[0]: In... | pasztorpisti/django-universal-view-decorator | src/django_universal_view_decorator/__init__.py | Python | mit | 1,150 |
from __future__ import absolute_import, print_function
import unittest
import numpy as np
from weighted_levenshtein import dam_lev, lev, osa
class TestClev(unittest.TestCase):
def setUp(self):
self.iw = np.ones(128, dtype=np.float64)
self.dw = np.ones(128, dtype=np.float64)
self.sw = n... | infoscout/weighted-levenshtein | test/test.py | Python | mit | 7,418 |
N, K = map(int, input().split())
R = sorted(map(int, input().split()))
ans = 0
for r in R[len(R)-K:]:
ans = (ans + r) / 2
print(ans)
| knuu/competitive-programming | atcoder/abc/abc003_c.py | Python | mit | 137 |
import json
import logging
from rdr_service.lib_fhir.fhirclient_1_0_6.models import observation as fhir_observation
from rdr_service.lib_fhir.fhirclient_1_0_6.models.fhirabstractbase import FHIRValidationError
from sqlalchemy.orm import subqueryload
from sqlalchemy.orm.attributes import flag_modified
from werkzeug.exc... | all-of-us/raw-data-repository | rdr_service/dao/physical_measurements_dao.py | Python | bsd-3-clause | 40,814 |
__version__ = '0.2.6-dev'
| tarioch/bapi | bapi/__init__.py | Python | gpl-2.0 | 26 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from stacker.lookups.handlers.envvar import EnvvarLookup
import os
class TestEnvVarHandler(unittest.TestCase):
def setUp(self):
self.testkey = 'STACKER_ENVVAR_TESTCASE'
sel... | remind101/stacker | stacker/tests/lookups/handlers/test_envvar.py | Python | bsd-2-clause | 717 |
import unittest
from node.openbazaar_daemon import OpenBazaarContext
import mock
from node import transport
def get_mock_open_bazaar_context():
return OpenBazaarContext.create_default_instance()
class TestTransportLayerCallbacks(unittest.TestCase):
"""Test the callback features of the TransportLayer class.... | atsuyim/OpenBazaar | tests/test_transport.py | Python | mit | 2,556 |
#!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from core.common import retrieve_content
__url__ = "https://www.talosintelligence.com/documents/ip-blacklist"
__check__ = ".1"
__info__ = "bad reputation"
__... | stamparm/maltrail | trails/feeds/talosintelligence.py | Python | mit | 696 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
basic usage::
>>> # Here is a quick simhash example
>>> from changanya.simhash import Simhash
>>>
>>> hash1 = Simhash('This is a test string one.')
>>> hash2 = Simhash('This is a test string TWO.')
>>> hash1 # doctest: +ELLIPSIS
<chang... | reubano/changanya | examples/usage.py | Python | mit | 4,956 |
"""Support functions for working with wheel files.
"""
from __future__ import absolute_import
import logging
from email.parser import Parser
from zipfile import ZipFile
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import DistInfoDistribution
from pip._vendor.six import PY2... | xavfernandez/pip | src/pip/_internal/utils/wheel.py | Python | mit | 7,302 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from collections import defaultdict, OrderedDict
import re
import numpy as np
from monty.io import zopen
from monty.json import MSONable
from pymatgen import Orbital, Spin, Element
from pymatgen.electronic_... | tschaume/pymatgen | pymatgen/io/feff/outputs.py | Python | mit | 14,880 |
#!/usr/bin/env python
"""
Provide Line function (y= Ax + B). Until July 10, 2016 this function provided
(y= A + Bx). This however was contrary to all the other code using it which
assumed (y= mx+b) or in this nomenclature (y=Ax + B). This lead to some
contortions in the code and worse incorrect calculations until now... | SasView/sasview | src/sas/qtgui/Plotting/LineModel.py | Python | bsd-3-clause | 3,191 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
import sys, pickle
try:
import threading
except ImportError:
threading = None
from twisted.trial import unittest
from twisted.python import threadable
from twisted.internet import defer, reactor
class TestObject:
synchroni... | sorenh/cc | vendor/Twisted-10.0.0/twisted/test/test_threadable.py | Python | apache-2.0 | 3,233 |
"""empty message
Revision ID: 88ecbc02d652
Revises: 8cafbc31d7b8
Create Date: 2017-04-02 22:01:27.339747
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '88ecbc02d652'
down_revision = '8cafbc31d7b8'
branch_labels = None... | MegaTransparency/MegaTransparency | migrations/versions/88ecbc02d652_.py | Python | apache-2.0 | 896 |
# Tabulon
# Copyright (c) 2015-2017 BeaconHill <theageofnewstars@gmail.com>
# See `LICENSE.txt` for license terms.
import re
import urllib.parse
from sys import stdout
from termutil import *
import difflib
#########################
## Miscellaneous Utils ##
#########################
def uniq(a):
return list(set(a)... | Evarcha/tabulon | util.py | Python | isc | 2,942 |
class Intervallo:
def __init__(self, intDistanzaGradi, intDistanzaSemitoni,intOttave=0):
self.dg = intDistanzaGradi
self.ds = intDistanzaSemitoni
self.do = intOttave
def __str__(self):
return "Intervallo "+ str(self.dg)+" gradi e "+str(self.ds)+" semitoni"
def __repr__(self):... | pbrenna/notacce | Intervallo.py | Python | gpl-2.0 | 1,456 |
import numpy as np
import os
import pandas as pa
import scipy.stats as stats
import unittest
from pbsea import PandasBasedEnrichmentAnalysis, EnrichmentAnalysisExperimental, preprocessing_files
from unittest.mock import patch
test_data_directory = 'test_data/'
test_data_directory_cdf = test_data_directory + 'test_cdf... | ArnaudBelcour/liasis | test/test_pbsea.py | Python | gpl-3.0 | 9,677 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Workflow:
# 1. Check if the folder has been analysed before
# 1.1 Status: checked, converted, reported, compiled, emailed, running, error, completed
# 2. If the sequencer is NextSeq:
# 2.1 Run bcl2fastq to create the FASTQ files
# 2.1.1 Execution:
# nohup /us... | CEFAP-USP/fastqc-report | RunFastQC.py | Python | gpl-3.0 | 18,788 |
#!/usr/bin/env python
"""
Permutation Poetry
Copyright 2013 Mayank Lahiri
Released under the terms of the MIT License.
mlahiri@gmail.com
PERMUTATION POETRY
==================
Requires:
(1) NLTK library
(install via "pip install nltk")
(2) Gutenberg and CMUDict NLTK corpora
(install via "import nltk... | mayanklahiri/permutation-poetry | poet.py | Python | mit | 5,140 |
class LRUCache:
'''
>>> l = LRUCache(maxsize=3)
>>> l.add('a')
>>> l.add('b')
>>> l.add('c')
>>> l.add('d')
>>> l.to_list()
['b', 'c', 'd']
>>> l.add('b')
>>> l.to_list()
['c', 'b', 'd']
>>> l.add('b')
>>> l.to_list()
['c', 'd', 'b']
>>> l.add('b')
>>> l... | majek/ziutek | ziutek/lrucache.py | Python | bsd-3-clause | 1,553 |
import hashlib
import hmac
CAMO_HOST = 'https://img.example.com'
def camo_url(hmac_key, image_url):
if image_url.startswith("https:"):
return image_url
hexdigest = hmac.new(hmac_key, image_url, hashlib.sha1).hexdigest()
hexurl = image_url.encode('hex')
requrl = '%s/%s/%s' % (CAMO_HOST, hexdi... | arachnys/go-camo | examples/python-hex.py | Python | mit | 577 |
#
# mjmud - The neverending MUD project
#
# Copyright (c) 2014, Matt Jordan
#
# See https://github.com/matt-jordan/mjmud for more information about the
# project. Please do not contact the maintainers of the project for information
# or assistance. The project uses Github for these purposes.
#
# This program is free so... | matt-jordan/mjmud | game/commands/account/createaccount_command.py | Python | mit | 7,533 |
# -*- coding: utf-8 -*-
"""
smartformat.local
~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by What! Studio
:license: BSD, see LICENSE for more details.
"""
import math
import re
import string
from babel import Locale
from babel.numbers import get_group_symbol, LC_NUMERIC, NumberPattern
__all__ = ['LocalForma... | what-studio/smartformat | smartformat/local.py | Python | bsd-3-clause | 4,523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.