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 .optimizer import Optimizer
from .cmaes import CMAES
__all__ = [
'Optimizer',
'CMAES',
'optimizer_from_config'
]
_objs = {
CMAES.__name__: CMAES
}
def optimizer_from_config(config: dict) -> [Optimizer]:
if len(config) == 0:
return None
cls_name = config.get("class_name", None)
... | rafaeltg/Deep-Learning-Algorithms | pydl/hyperopt/optimizers/__init__.py | Python | mit | 595 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2014 Bitergia
#
# 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 ... | jalonsob/Informes | vizgrimoire/metrics/__init__.py | Python | gpl-3.0 | 766 |
#! /usr/bin/env python
"""Checks that all words in a prompt file occur in the corresponding lexicon.
"""
import codecs
import io
import sys
STDOUT = io.open(1, 'wb')
STDERR = io.open(2, 'wb')
def Print(*objects, **kwargs):
sep = kwargs.get('sep', u' ')
end = kwargs.get('end', u'\n')
buf = kwargs.get('file',... | googlei18n/language-resources | si/prompt_words_in_lexicon.py | Python | apache-2.0 | 1,524 |
class GameObject:
def LoadContent(self):
pass
def Update(self,event):
pass
def Draw(self,screen):
pass
| vtungn/HackaPanzer | GameObject.py | Python | mit | 142 |
# Copyright 2010 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 agreed to ... | SkyLined/headsup | decode/PNG_hIST.py | Python | apache-2.0 | 1,394 |
import numpy as np
from sklearn.linear_model import ElasticNet
from ..base import BaseModel, use_sklearn
from ..utils import arghandler
# Suppress an annoying error from scikit-learn
import warnings
warnings.filterwarnings(action="ignore", module="scipy",
message="^internal gelsd")
@use_sklea... | harmslab/epistasis | epistasis/models/linear/elastic_net.py | Python | unlicense | 3,836 |
'''Capture network traffic and generate event-reports about it's content.
Events are reported to Cube (http://square.github.io/cube/), which stores them
in it's database for later analysis.
This example requires a running Cube daemon on localhost; note that naively
executing it will flood your mongodb instance with u... | lukaslueg/wirepy | examples/create_cube_events.py | Python | gpl-3.0 | 5,858 |
import numpy as np
from model import GAN, discriminator_pixel, discriminator_image, discriminator_patch1, discriminator_patch2, generator, discriminator_dummy
import utils
import os
from PIL import Image
import argparse
from keras import backend as K
# arrange arguments
parser=argparse.ArgumentParser()
parser.add_arg... | jaeminSon/V-GAN | codes/train.py | Python | mit | 6,553 |
# -*- coding: utf-8
"""
Tests related to the Cuttle class.
"""
import os
import unittest
import warnings
import time
from cuttle.reef import Cuttle, Column
from cuttlepool import CuttlePool
from cuttlepool.cuttlepool import PoolConnection
DB = '_cuttle_test_db'
DB2 = '_cuttle_test_db2'
HOST = 'localhost'
class Bas... | smitchell556/cuttle | tests/test_cuttle_class.py | Python | mit | 6,111 |
#!/usr/bin/env python2.7
# 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 l... | firebase/grpc | tools/distrib/check_include_guards.py | Python | apache-2.0 | 7,286 |
from xml.etree import ElementTree
class XMLResult:
def __init__(self, xmlfile):
'''Grab lat and long from XML and return it'''
self.tree = ElementTree.parse(xmlfile)
self.root = self.tree.getroot()
self.lat = ''
self.lng = ''
for child in self.root:
if child.tag == "result":
self.child = child
... | HackerParachuteBattalion/scream | xmlHandler.py | Python | gpl-3.0 | 674 |
#!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
from os import path
import sys
__all__ = ['libsvm', 'svm_problem', 'svm_parameter',
'toPyModel', 'gen_svm_nodearray', 'print_null', 'svm_node', 'C_SVC',
'EPSILON_SVR', 'LINEAR', 'NU_SVC', 'NU_SVR', 'ONE_CLASS',
... | tiffanyle/facedetection | utils/libsvm/python/svm.py | Python | mit | 9,605 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | Six_zebra_models/Six_zebra_models_final_output_0.1_-0.1_13000/mtx1_models/Six_zebra_models5319.py | Python | gpl-3.0 | 13,940 |
import glob
import os
import numpy as np
from chainer.dataset import download
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.datasets.cityscapes.cityscapes_utils import cityscapes_labels
from chainercv.utils import read_image
from chainercv.utils import read_label
class ... | chainer/chainercv | chainercv/datasets/cityscapes/cityscapes_semantic_segmentation_dataset.py | Python | mit | 4,520 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bamdst(MakefilePackage):
"""Bamdst is a a lightweight bam file depth statistical tool."""
... | LLNL/spack | var/spack/repos/builtin/packages/bamdst/package.py | Python | lgpl-2.1 | 765 |
from freezegun import freeze_time
from werkzeug.test import Client
from backend.web.handlers.tests import helpers
def test_get_bad_team_num(web_client: Client) -> None:
resp = web_client.get("/team/0/2020")
assert resp.status_code == 404
def test_get_bad_year(web_client: Client, ndb_stub) -> None:
help... | the-blue-alliance/the-blue-alliance | src/backend/web/handlers/tests/team_detail_test.py | Python | mit | 4,519 |
import morepath
class app(morepath.App):
pass
@app.path(path='/')
class Root(object):
pass
@app.path(path='/', model=Root)
def get_root():
return Root()
| taschini/morepath | morepath/tests/fixtures/conflict.py | Python | bsd-3-clause | 171 |
import yaml
import os
import hashlib
import json
import lcmconf
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def task_checksum(local_dir,mode):
tasks_yaml = []
for ro... | dherasimenko/fuel-lcm-plugin | lib/checksum.py | Python | apache-2.0 | 1,433 |
import ast
import sys
from data.logic import _grammar_transformer
from puzzle.problems import problem
# These are specific enough to rarely appear.
_CONCLUSIVE_TOP_LEVEL_NODES = (
ast.For, # for x in y:.
ast.FunctionDef, # def foo():.
ast.If, # If statements.
)
# These are less conclusive.
_INTERESTING_TOP_L... | PhilHarnish/forge | src/puzzle/problems/logic_problem.py | Python | mit | 2,464 |
"""Provide the Multireddit class."""
from json import dumps
import re
from ...const import API_PATH
from ..listing.mixins import SubredditListingMixin
from .base import RedditBase
from .redditor import Redditor
from .subreddit import Subreddit, SubredditStream
class Multireddit(RedditBase, SubredditListingMixin):
... | 13steinj/praw | praw/models/reddit/multi.py | Python | bsd-2-clause | 6,290 |
#-*- coding:utf-8 -*-
import os
import tempfile
from subprocess import Popen, PIPE
from miasm2.jitter import Jittcc
from miasm2.jitter.jitcore_cc_base import JitCore_Cc_Base, gen_core
class JitCore_Tcc(JitCore_Cc_Base):
"JiT management, using LibTCC as backend"
def __init__(self, ir_arch, bs=None):
... | chubbymaggie/miasm | miasm2/jitter/jitcore_tcc.py | Python | gpl-2.0 | 3,349 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, rounded, date_diff, money_in_words
from frappe.model.naming import ... | shreyasp/erpnext | erpnext/hr/doctype/salary_slip/salary_slip.py | Python | gpl-3.0 | 14,795 |
properties = {
'jira_live_server' : 'http://live.jira.server.com/rpc/soap/jirasoapservice-v2?wsdl',
'jira_live_username' : 'admin',
'jira_live_password' : 'Pa5w0rd',
'jira_test_server' : 'http://test.jira.server.com/rpc/soap/jirasoapservice-v2?wsdl',
'jira_test_username' : 'admin',
'jira_test_pa... | ThePavolC/CleanJira | src/properties.py | Python | mit | 408 |
import json
import os
import pexpect
import re
import time
from behave import step
import nmci
@step(u'Autocomplete "{cmd}" in bash and execute')
def autocomplete_command(context, cmd):
bash = context.pexpect_spawn("bash")
bash.send(cmd)
bash.send('\t')
time.sleep(1)
bash.send('\r\n')
time.sl... | NetworkManager/NetworkManager-ci | features/steps/commands.py | Python | gpl-3.0 | 19,422 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_set_column06.py | Python | bsd-2-clause | 1,649 |
import datetime
import json
import re
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp import hdrs, signals
from aiohttp.protocol import (HttpVersion, HttpVersion10, HttpVersion11,
RawRequestMessage)
from aiohttp.web import (ContentCoding, Request, R... | mind1master/aiohttp | tests/test_web_response.py | Python | apache-2.0 | 26,418 |
<<<<<<< HEAD
'''
=======
'''
>>>>>>> 40ed99339556e93f918d8fce74e2ad70ffe63213
1.主页信息显示:欢迎来到Python for China
我们的宗旨就是让你免费学习Python语言,这是新时代所具备的一种技能语言。
如果你想学习,我们会帮助你一点一滴的来进入到Python语言世界。
入学测试是我们的第一步,这将有助于你如何起步。
2.功能定位:考试系统,选择题形式,显示成绩,评估功能,推荐起步阶段
根据答题情况来判断答题者适合进入哪个学习阶段
3.考题类型:初、中、高各个范围的题型,
什么样子的考题能够判断出答题者的语言水平?
根据对概念的理解,判断对错... | GeorgeChii/Python4CN | design_idea.py | Python | gpl-2.0 | 1,185 |
#!/usr/bin/env python3
from functools import wraps
import scheduler
class Component:
"""Component for flows"""
in_ports = {}
out_ports = {}
def __init__(self):
"""Initializes the component"""
self._call = {}
for port_name, port in self.in_ports.items():
port.node ... | jonathanmcelroy/pyflo | pyflo/component.py | Python | mit | 1,341 |
#!/usr/bin/env python
# -- coding: utf-8 --
#
# Copyright © 2011 Collabora Ltd.
# By Seif Lotfy <seif@lotfy.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 ... | purpleidea/gedit-plugins | plugins/dashboard/dashboard/utils.py | Python | gpl-2.0 | 5,156 |
# Copyright (c) 2012 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 ... | dawnpower/nova | nova/tests/unit/api/openstack/compute/contrib/test_hypervisors.py | Python | apache-2.0 | 15,857 |
#
# 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, software
# ... | pshchelo/heat | heat/engine/clients/os/nova.py | Python | apache-2.0 | 22,068 |
'''
This script runs a Rock Properties Catalog lookup, prestack modeling,
and stacking operation for a set of prototype vecors and saves them in ../pvs
'''
import mod_func
import rpc as rock
rpc = rock.RPC()
mod = mod_func.modeler()
# init
rknum = 10 # number of rocks per lithology
rkprop = [] # list 4 rock properti... | gganssle/organize-yaself | modeler/build_PVs.py | Python | mit | 1,952 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/synapse/manual/operations/accesscontrol.py | Python | mit | 11,030 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
指定数据目录,生成对应的合约行业数据
分为两种
1. 全市场数据,将部分标记上权重
2. 只对历史上成为成份股的,进行处理,由于前面已经转换了数据,这里只要跳选数据并处理即可
以前的做法是先生成数据,然后再生成合约
"""
import os
from kquant_data.config import __CONFIG_H5_STK_DIR__
from kquant_data.processing.merge import merge_weight_internal
from kquant_data.api import ... | wukan1986/kquant_data | demo_stock/B_5min_000016/E04_merge_000016_indexconstituent.py | Python | bsd-2-clause | 1,168 |
"""
Classes that represent database functions.
"""
from django.db.models import (
DateTimeField, Func, IntegerField, Transform, Value,
)
class Coalesce(Func):
"""
Chooses, from left to right, the first non-null expression and returns it.
"""
function = 'COALESCE'
def __init__(self, *expressio... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/db/models/functions.py | Python | artistic-2.0 | 7,053 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-06 00:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sagelist', '0003_booksale_amazon_price'),
]
operations = [
migrations.Remove... | aspc/mainsite | aspc/sagelist/migrations/0004_auto_20160906_0057.py | Python | mit | 594 |
# Copyright (c) 2010 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.
# TODO(slightlyoff): move to using shared version of this script.
'''This script makes it easy to combine libs and object files to a new lib,
optionally... | meego-tablet-ux/meego-app-browser | chrome_frame/combine_libs.py | Python | bsd-3-clause | 3,229 |
from pylama.main import shell
from pympler.tracker import SummaryTracker
def pylama_test():
shell('-l pylint ../perf_test/requests-2.12.1/'.split(), error=False)
tracker = SummaryTracker()
pylama_test()
tracker.print_diff()
| IPMITMO/statan-research | analyze/perfomance_test/pylama_pympler_test.py | Python | mit | 231 |
""" Payload implemenation for coroutines as data provider.
As a simple case, you can upload data from file::
@aiohttp.streamer
def file_sender(writer, file_name=None):
with open(file_name, 'rb') as f:
chunk = f.read(2**16)
while chunk:
yield from writer.write(chunk)
... | alex-eri/aiohttp-1 | aiohttp/payload_streamer.py | Python | apache-2.0 | 1,594 |
from rpython.rlib import jit, rstackovf
from rpython.rlib.debug import check_nonneg
from rpython.rlib.objectmodel import we_are_translated, specialize
from topaz import consts
from topaz.error import RubyError
from topaz.objects.arrayobject import W_ArrayObject
from topaz.objects.classobject import W_ClassObject
from ... | kachick/topaz | topaz/interpreter.py | Python | bsd-3-clause | 33,269 |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# 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... | uber/tchannel-python | tchannel/rw.py | Python | mit | 19,427 |
from spacy import parts_of_speech as pos
def is_adposition(node):
return node.pos == pos.ADP
def is_noun(node):
return node.pos in [pos.NOUN, pos.PROPN]
def is_adjective(node):
return node.pos == pos.ADJ
def is_verb(node):
return node.pos == pos.VERB
def is_number(node):
return node.pos ==... | alvaromorales/whoami | whoami/spacypos.py | Python | mit | 329 |
# The MIT License (MIT)
# Copyright (c) 2017 Microsoft Corporation
# 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... | Azure/azure-documentdb-python | azure/cosmos/execution_context/aggregators.py | Python | mit | 3,298 |
def pe0001(upto):
total = 0
for i in range(upto):
if i % 3 == 0 or i % 5 == 0:
total += i
return total
print(pe0001(1000)) | guandalf/projecteuler | pe0001.py | Python | mit | 155 |
from django.contrib import admin
from .models import IngestQueue
class IngestQAdmin(admin.ModelAdmin):
list_display = ("uuid", "ingestion_queue_length", "created_at", "created_by")
readonly_fields = (
"created_by",
"target",
)
admin.site.register(IngestQueue, IngestQAdmin)
| whav/hav | src/hav/apps/ingest/admin.py | Python | gpl-3.0 | 306 |
import uuid
from django.core.exceptions import ImproperlyConfigured
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.urls import Resolver404, path, resolve, reverse
from .converters import DynamicConverter
from .views import empty_view
included_kwargs = {'base': b'he... | nesdis/djongo | tests/django_tests/tests/v21/tests/urlpatterns/tests.py | Python | agpl-3.0 | 7,893 |
from __future__ import unicode_literals
import tox
from .common import base_discover
from .via_path import check_with_path
@tox.hookimpl
def tox_get_python_executable(envconfig):
spec, path = base_discover(envconfig)
if path is not None:
return path
# 3. check if the literal base python
cand... | tox-dev/tox | src/tox/interpreters/unix.py | Python | mit | 550 |
from datetime import datetime
from aiohttp import web
from pair.model import get_pair_list, get_pair, set_pair_label
class IndexView(web.View):
async def get(self):
body = """
<head>
<meta charset="UTF-8">
<title>Seimur</title>
<link rel="stylesheet" href="/static/s... | siauPatrick/seimur | pair/views.py | Python | mit | 1,851 |
from tuneme.settings import * # noqa
SITE_LAYOUT = 'new'
TEMPLATES[0]['DIRS'] = [
join(PROJECT_ROOT, 'tuneme', 'templates', SITE_LAYOUT), ]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'ndohyep_test.db',
}
}
WAGTAILSEARCH_BACKENDS = {
'default': {
... | praekelt/molo-tuneme | test_settings.py | Python | bsd-2-clause | 417 |
""" The aomi "seed" loop """
from __future__ import print_function
import os
import difflib
import logging
from shutil import rmtree
import tempfile
from termcolor import colored
import yaml
from future.utils import iteritems # pylint: disable=E0401
from aomi.helpers import dict_unicodeize
from aomi.filez import thaw
... | otakup0pe/aomi | aomi/seed_action.py | Python | mit | 7,172 |
from __future__ import unicode_literals, print_function
from subprocess import PIPE, Popen
def test_game(turn, reset_beacon):
proc1 = Popen(['player_one', turn.p1_mv], stdout=PIPE)
proc2 = Popen(['player_two', turn.p2_mv], stdout=PIPE)
for proc in (proc1, proc2):
output = str(proc.communicate()[... | tomviner/network-rock-paper-scissors | tests/test_game_subprocess.py | Python | bsd-2-clause | 408 |
#title :test.py
#description :This will create a header for a python script.
#author :Guillaume Lemaitre
#date :2015/06/06
#version :0.1
#notes :
#python_version :2.7.6
#==============================================================================
import matplotl... | glemaitre/protoclass | protoclass/tool/tests/.dummy.py | Python | gpl-2.0 | 608 |
import re
from termcolor import colored
def escape (string):
def _inner (s):
if s == "\n":
return "\\n"
elif s == "\t":
return "\\t"
else:
return s
return "".join (map (_inner, string))
class Keyword ():
def __init__ (self, name):
self.na... | darithorn/iliad-py | main.py | Python | mit | 7,183 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from config import config
bootstrap = Bootstrap()
db = SQLAlchemy()
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view... | ts25504/test_paper_generator | app/__init__.py | Python | gpl-2.0 | 905 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db.migrations.operations import AddField, RemoveField
from django.utils import timezone
def forwards_func(apps, schema_editor):
PatientVisit = apps.get_model("tracking", "PatientVisit")
db... | Heteroskedastic/Dr-referral-tracker | tracking/migrations/0009_migrating_data_patient_visit_record_date.py | Python | mit | 989 |
from __future__ import absolute_import
from .cnn import extract_cnn_feature
from .database import FeatureDatabase
__all__ = [
'extract_cnn_feature',
'FeatureDatabase',
]
| Cysu/open-reid | reid/feature_extraction/__init__.py | Python | mit | 180 |
#!/bin/sh
#
AIRINV_HOSTNAME="localhost"
AIRINV_PORT=":8000"
API_URL_PREFIX="sim/airinv/api"
AIRINV_API_ACTION="display/inv"
AIRINV_BASE_URL="http://${AIRINV_HOSTNAME}${AIRINV_PORT}/${API_URL_PREFIX}/${AIRINV_API_ACTION}"
AIRINV_ACTION="callback%3Dlist"
TMP_FILE="found.tmp"
# Check whether curl is installed
`type curl... | airsim/airinv | appserver/django/airinvDjangoClient.py | Python | lgpl-2.1 | 1,021 |
#!/usr/bin/python3
"""All different types of hit objects"""
import sys
TEXT_OBJECT_LEVELS = {"doc": 1, "div1": 2, "div2": 3, "div3": 4, "para": 5, "sent": 6, "word": 7}
SHARED_CACHE = {}
def _safe_lookup(row, field):
metadata = ""
try:
metadata = row[field]
except:
pass
if metadata i... | ARTFL-Project/PhiloLogic4 | python/philologic/runtime/HitWrapper.py | Python | gpl-3.0 | 6,680 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ssd.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| VentureCranial/system-status-dashboard | manage.py | Python | apache-2.0 | 246 |
###############################################################################
# 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 | tests/testSlotCallbacks.py | Python | lgpl-3.0 | 8,515 |
from django.test import override_settings
from corehq import privileges
from corehq.apps.accounting.models import SoftwarePlanEdition
from corehq.apps.accounting.tests.base_tests import BaseAccountingTest
from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
from corehq.apps.accounting.utils import (
... | dimagi/commcare-hq | corehq/apps/accounting/tests/test_enterprise_mode.py | Python | bsd-3-clause | 1,444 |
# Volatility
# Copyright (C) 2008-2013 Volatility Foundation
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# This file is part of Volatility.
#
# Volatility 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... | Cisco-Talos/pyrebox | volatility/volatility/plugins/registry/printkey.py | Python | gpl-2.0 | 10,172 |
import model
#setup
model.metadata.create_all(model.engine)
| santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/jq-0.1-py2.5.egg/jq/queue/setup.py | Python | bsd-3-clause | 63 |
#! /usr/bin/env python2
#-*- coding:utf-8 -*-
from builtins import range
import unittest
import logging
from miasm.analysis.machine import Machine
import miasm.os_dep.win_api_x86_32 as winapi
from miasm.os_dep.win_api_x86_32 import get_win_str_a, get_win_str_w
from miasm.core.utils import pck32
from miasm.jitter.csts ... | serpilliere/miasm | test/os_dep/win_api_x86_32.py | Python | gpl-2.0 | 9,960 |
#!/usr/bin/env python
import sys
import texpy
import latexstubs
def loadConcepts(conceptsfile):
""" Loads concepts from the files
and arranges them in a dictionary """
concepts = {}
for line in conceptsfile:
line = line.strip(' \n\r')
line1 = line.lower() \
.re... | graphite/texpp | hrefkeywords/hrefkeywords.py | Python | lgpl-2.1 | 5,377 |
import sklearn | rishuatgithub/MLPy | sklearn_helloworld.py | Python | apache-2.0 | 14 |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import fcntl
import struct
import socket
import log
import errno
from json_helper import _PACKAGE_MIN_LEN_,_PACKAGE_MAGIC_NUM_,get_pkg_len
#最大包长度5M
_MAX_PKG_LEN_ = 5242880
#fd_info 是一个dictionary,所以传的是引用,可以修改内容
def sock_recv_remain_data(fd_info):
fd = f... | georgexuedz/access_proxy | access/socket_helper.py | Python | apache-2.0 | 3,852 |
from __future__ import print_function
from __future__ import division
from past.utils import old_div
import unittest
import numpy as np
import statsmodels.api as sm
from statsmodels.genmod.tests.results.results_glm import InvGauss
from IOHMM import GLM
class PoissonTests(unittest.TestCase):
@classmethod
... | Mogeng/IO-HMM | tests/test_GLM.py | Python | mit | 67,433 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
import os
import config
import re
import ast
#calibre sort stuff
title_pat = re.compile(config.TITLE_REGEX, re.IGNORECASE)
def title_sort(title):
match = titl... | cervinko/calibre-web | cps/db.py | Python | gpl-3.0 | 7,410 |
#!/usr/bin/env python
########################################################################
# File : dirac-sys-sendmail
# Author : Matvey Sapunov
########################################################################
"""
Utility to send an e-mail using DIRAC notification service.
Arguments:
Formated text m... | ic-hep/DIRAC | src/DIRAC/FrameworkSystem/scripts/dirac_sys_sendmail.py | Python | gpl-3.0 | 2,650 |
#!/usr/bin/env python
# Copyright 2016 Jim Pivarski
#
# 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 la... | diana-hep/rootconverter | root2avro/tests/arrayArrayUChar2.py | Python | apache-2.0 | 1,635 |
import os
from PyQt5.QtCore import QDir
from tests.QtTestCase import QtTestCase
from urh.models.FileFilterProxyModel import FileFilterProxyModel
from urh.models.FileSystemModel import FileSystemModel
from urh.ui.views.DirectoryTreeView import DirectoryTreeView
class TestDirectoryTreeView(QtTestCase):
def test_r... | splotz90/urh | tests/test_directory_tree_view.py | Python | gpl-3.0 | 1,267 |
#encoding: UTF8
import os
import time
import urllib
import urllib2
import re
import StarchScanner
import StarchScanner.Model
import random
import threading
scanner = StarchScanner.scanner
mutex = threading.Lock()
scanner.start()
def asdf(response, content):
ConTp = response.info().getheader('Content-Typ... | fffe5390/StarchScanner | src/test/__init__.py | Python | apache-2.0 | 1,054 |
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.sites.models import Site
from django.core.cache import caches
from django.db import models
from django.utils.translation import ugettext_lazy as _
from rdmo.conditions.models import Condition
from rdmo.core.constants impo... | DMPwerkzeug/DMPwerkzeug | rdmo/questions/models.py | Python | apache-2.0 | 27,506 |
import os
import time
import module.loading as ld
import module.command as cmd
import data_manager as dm
from module.setup import speaker as s
from module.typing_text import textType as tt
def chat_line(name, chat):
time.sleep(.2)
s(name)
ld.deGa()
tt(chat)
ld.deGa()
def story_telling(text, delay=... | Indmind/Jomblo-Story | module/story_env.py | Python | mit | 431 |
import sys
try:
import uerrno
try:
import uos_vfs as uos
except ImportError:
import uos
except ImportError:
print("SKIP")
sys.exit()
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __init__(self, blocks):
... | cwyark/micropython | tests/extmod/vfs_fat_ramdisk.py | Python | mit | 2,174 |
import logging
from pymongo.son_manipulator import SONManipulator
class Product(object):
def __init__(self, cpe=None):
self.vendor = None
self.product = None
self.version = None
if cpe:
try:
self.vendor = cpe.split(':')[2]
self.product = ... | espenfjo/nvdparser | lib/Product.py | Python | gpl-2.0 | 2,504 |
#-*- coding: utf-8 -*-
from threading import Thread;
import pygame;
from pygame.locals import *;
from classes.render import Render;
from classes.game import Game;
from classes.obstacle import Obstacle;
from classes.menu import *;
import ConfigParser;
from classes.score import *;
import os;
import random
from random imp... | BastienDufaud/pewpew | main.py | Python | gpl-3.0 | 19,277 |
# -*- coding: utf-8 -*-
"""
dicom2nifti
@author: abrys
"""
import logging
import pydicom.config as pydicom_config
import dicom2nifti.common as common
import dicom2nifti.convert_generic as convert_generic
from dicom2nifti.exceptions import ConversionValidationError
pydicom_config.enforce_valid_values = False
logger ... | icometrix/dicom2nifti | dicom2nifti/convert_hitachi.py | Python | mit | 1,557 |
"""
Telegram bot polling implementation.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/telegram_bot.polling/
"""
import logging
from homeassistant.components.telegram_bot import (
initialize_bot,
CONF_ALLOWED_CHAT_IDS, BaseTelegramBotEntity,
... | PetePriority/home-assistant | homeassistant/components/telegram_bot/polling.py | Python | apache-2.0 | 3,168 |
# -*- coding: utf-8 -*-
################################################################################
# Copyright (C) 2013 Travis Shirk <travis@pobox.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 So... | daltonsena/eyed3 | src/eyed3/utils/console.py | Python | gpl-2.0 | 18,251 |
import pygame
import config
## Container for a single frame in an animation.
class AnimationFrame(object):
## Constructor.
# @param image Image data.
# @param delay Delay before proceeding to next frame, in seconds.
# @param nextFrame Reference to next AnimationFrame.
# @param number Frame number.
def __in... | markbreynolds/ARPGEngine | graphics/animation.py | Python | gpl-3.0 | 5,864 |
# -*- coding: utf-8 -*-
"""
This file is part of memoria
Copyright (C) 2014 Qing Ye
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 vers... | qingye3/memoria | uiedit.py | Python | gpl-3.0 | 1,867 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2011, Daniele Esposti <expo@expobrain.net>
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
... | CharlesZhong/Mobile-Celluar-Measure | http_parser/webm/tests/handlers_tests.py | Python | mit | 4,592 |
"""
Management utility to create superusers.
"""
import getpass
import os
import sys
from django.contrib.auth import get_user_model
from django.contrib.auth.management import get_default_username
from django.contrib.auth.password_validation import validate_password
from django.core import exceptions
from django.core.m... | ar4s/django | django/contrib/auth/management/commands/createsuperuser.py | Python | bsd-3-clause | 11,849 |
# Copyright 2016-2018 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | jpakkane/meson | mesonbuild/msetup.py | Python | apache-2.0 | 14,456 |
# Part of info-beamer hosted
#
# Copyright (c) 2014, Florian Wesch <fw@dividuum.de>
# 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 c... | info-beamer/package-conference-room | hosted.py | Python | mit | 6,388 |
from psycopg2 import connect, extras
import requests
import json
import datetime
from config import *
#
# Setup for DB
#
def dict_cursor(conn, cursor_factory=extras.RealDictCursor):
return conn.cursor(cursor_factory=cursor_factory)
#
# Setup for all Github queries
#
if 'GITHUB_TOKEN' in os.environ:
github_... | codeforamerica/gotissues | gotissues/github_bot.py | Python | mit | 7,168 |
# ----------------------------------------------------------------------------
# Imports:
# ----------------------------------------------------------------------------
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcu... | Clemson-DPA/dpa-pipe-backend | dpa/products/rest_api.py | Python | mit | 9,858 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v10/services/services/ad_group_asset_service/transports/grpc.py | Python | apache-2.0 | 12,169 |
'''
run with: python ten2eleven.py -f selectatoms test_dummy_old_MDA_code.py
Author: Tyler Reddy
'''
from __future__ import absolute_import
from lib2to3.fixer_base import BaseFix
from lib2to3.pgen2 import token
class FixSelectatoms(BaseFix):
_accept_type = token.NAME
def match(self, node):
if node... | kain88-de/mdanalysis | package/MDAnalysis/migration/fixes/fix_selectatoms.py | Python | gpl-2.0 | 491 |
"""Definitions of common enumerations to be used together with ``Enum`` property. """
from __future__ import absolute_import
from six import string_types
from . import colors, icons, palettes
class Enumeration(object):
pass
def enumeration(*values):
if not (values and all(isinstance(value, string_types) an... | roxyboy/bokeh | bokeh/enums.py | Python | bsd-3-clause | 2,898 |
"""
Parse flavonoid molecule object read from Indigo toolkit. The molecular
identifiers accepted are canonical SMILES, InchI or file like format
..mol (file stored in ChemSpider database), and ..sdf (in PubChem database).
"""
import collections
from re import findall, sub
from indigo import Indigo, IndigoException
fro... | DongElkan/flavonoid | flavonoid_parser.py | Python | gpl-3.0 | 15,159 |
"""
Test the index view is being accessed properly.
"""
from django.test import TestCase, Client
from django.urls import reverse
class TestIndexView(TestCase):
client = None
def setUp(self):
self.client = Client()
def test_view_init(self):
"""Test the view can be accessed from the url."... | jakeharding/repo-health | repo_health/index/tests.py | Python | mit | 592 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This is the person who owns a huge place to make sweet treats."""
CHARLIE = "Brown"
VIOLET = "Gray"
PATRICIA = "Reichardt"
LINUS = "van Pelt"
| saulatmajid/is210-week-02-synthesizing | task_03.py | Python | mpl-2.0 | 193 |
import os
__author__ = 'bromix'
def debug_here(host='localhost'):
import sys
for comp in sys.path:
if comp.find('addons') != -1:
pydevd_path = os.path.normpath(os.path.join(comp, os.pardir, 'script.module.pydevd', 'lib'))
sys.path.append(pydevd_path)
break
... | azumimuo/family-xbmc-addon | zips/plugin.video.youtube/resources/lib/kodion/debug.py | Python | gpl-2.0 | 422 |
# Not tested:
# socket.fromfd()
# sktobj.getsockopt()
# sktobj.recvfrom()
# sktobj.sendto()
# sktobj.setblocking()
# sktobj.setsockopt()
# sktobj.shutdown()
from test_support import verbose, TestFailed
import socket
import os
import time
def missing_ok(str):
try:
... | mancoast/CPythonPyc_test | cpython/213_test_socket.py | Python | gpl-3.0 | 4,309 |
"""
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one
sorted array.
Note:
You may assume that nums1 has enough space (size that is greater or equal to
m + n) to hold additional elements from nums2. The number of elements
initialized in nums1 and nums2 are m and n respectively.
... | ufjfeng/leetcode-jf-soln | python/088_merge_sorted_array.py | Python | mit | 1,180 |
def hello_again():
print("hello again")
| pdorrell/emacs-site-lisp | test/test-project/src/subdir_with_files/spaced dir name/hello.py | Python | gpl-2.0 | 45 |
"""
Unit tests for the API module
"""
import datetime
from unittest import mock
from urllib import parse
import pytest
import pytz
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.ccxcon import api as ccxconapi
from common.djangoapps.student.tests.factories import AdminFactory
from xmodule.modu... | eduNEXT/edunext-platform | openedx/core/djangoapps/ccxcon/tests/test_api.py | Python | agpl-3.0 | 8,008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.