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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
from numpy import *
parameter_list = [[10,3,15,0.9,1,2000,1],[20,4,15,0.9,1,5000,2]]
def classifier_larank_modular (num_vec,num_class,distance,C=0.9,num_threads=1,num_iter=5,seed=1):
from modshogun import RealFeatures, MulticlassLabels
from modshogun import GaussianKernel
from modshogun import... | AzamYahya/shogun | examples/undocumented/python_modular/classifier_larank_modular.py | Python | gpl-3.0 | 1,452 |
from mjhmc.search.objective import obj_func
from mjhmc.samplers.markov_jump_hmc import MarkovJumpHMC
from mjhmc.misc.distributions import ProductOfT
from mjhmc.misc.autocor import autocorrelation
from mjhmc.misc.autocor import sample_to_df
from mjhmc.fast import hmc
from scipy.sparse import rand
import numpy as np
impo... | mudigonda/hmc_scripts | tests/test_fast_pot.py | Python | mit | 1,300 |
"""
# Stack Overflow CLI
# Created by
# Gautam Krishna R : www.github.com/gautamkrishnar
# And open source contributors at GitHub: https://github.com/gautamkrishnar/socli#contributors
"""
import os
import re
import sys
import logging
import requests
from bs4 import BeautifulSoup
import urwid
import urllib3
try:
i... | gautamkrishnar/socli | socli/socli.py | Python | bsd-3-clause | 18,764 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A script to re-enable colour in .html files produced from IPython notebooks.
Based on a script in a GitHub gist with this copyright notice:
#----------------------------------------------------------------------------
# Copyright (c) 2013 - Damián Avila
#
# Distribu... | hughperkins/kgsgo-dataset-preprocessor | thirdparty/future/docs/other/fix_notebook_html_colour.py | Python | mpl-2.0 | 1,053 |
# -*- coding: utf-8 -*-
#
# This file is a part of Pluggable Output Processor
#
# Copyright (c) 2013-2017 Alex Turbov <i.zaufi@gmail.com>
#
# Pluggable Output Processor 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 Foun... | zaufi/pluggable-output-processor | test/context.py | Python | gpl-3.0 | 2,132 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2012-2019 British Crown (Met Office) & Contributors.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under t... | benfitzpatrick/rose | metomi/rose/checksum.py | Python | gpl-3.0 | 5,825 |
# -*- coding: utf-8 -*-
# $Id$
# -------------------------------------------------------------------
# Copyright 2010 Achim Köhler
#
# This file is part of openADAMS.
#
# openADAMS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# b... | VCTLabs/openadams | _naf_simplesection.py | Python | gpl-2.0 | 3,859 |
"""This file exists solely to make sure Python understands this is a package."""
| TheLastProject/PyPass | pext/ui/__init__.py | Python | gpl-3.0 | 81 |
import _plotly_utils.basevalidators
class ArrayValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="array", parent_name="scatter.error_y", **kwargs):
super(ArrayValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/error_y/_array.py | Python | mit | 446 |
# -*- coding: utf-8 -*-
import os.path
import time
import urllib
import json
import requests
from tencentyun import conf
from .auth import Auth
class ImageProcess(object):
def __init__(self, appid, secret_id, secret_key, bucket):
self.IMAGE_FILE_NOT_EXISTS = -1
self._secret_id,self._secret_key = ... | tencentyun/python-sdk | python2/tencentyun/imageprocess.py | Python | mit | 3,116 |
"""
Created on 15.03.2016
:author: Andrej Nussdorfer
Tuleap REST API Client for Python
Copyright (c) Djuro Drljaca, All rights reserved.
This Python module 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;... | moreauxh/tuleap-rest-api-client | Tuleap/RestClient/Commons.py | Python | lgpl-3.0 | 1,340 |
import os
import unittest
import json
import time
from copy import deepcopy
from w2p.classes.processor import WebPageProcessor
from .configs import echoconf
from .configs import testconf
class ConfigsTestCase(unittest.TestCase):
''' Test new implemented configs '''
@classmethod
def setUpClass(self):
... | rails-to-cosmos/force | w2p/tests/test_configs.py | Python | gpl-2.0 | 2,876 |
#!/usr/bin/env python
import os
import logging
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import pickle
def setLogger(fname,loglevel):
""" Function to handle error logging """
logging.basicConfig(filename=fname, filemode='w', level=loglevel, format='%(asctime)s - %(levelname)s - ... | McIntyre-Lab/papers | fear_sem_sd_2015/scripts/rank_ggm_graph_network_neighborhoods.py | Python | lgpl-3.0 | 7,422 |
"""Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... | meduz/scikit-learn | sklearn/datasets/lfw.py | Python | bsd-3-clause | 18,687 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2017 CERN.
#
# CERN Document Server 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
# Licens... | omelkonian/cds | tests/unit/test_webhook_tasks.py | Python | gpl-2.0 | 12,578 |
#!/usr/bin/python
# (c) 2018 Piotr Olczak <piotr.olczak@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'st... | onitake/ansible | lib/ansible/modules/storage/netapp/na_ontap_gather_facts.py | Python | gpl-3.0 | 9,256 |
# 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 that it will be useful,
# bu... | fracpete/wekamooc | dataminingwithweka/class-4.2.py | Python | gpl-3.0 | 2,018 |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library
from django.conf import settings
from django.template.loader import get_template
from django.template.loader_tags import IncludeNode
from django.utils.translation import ugettext_lazy as _
register = Lib... | alirizakeles/tendenci | tendenci/apps/search/templatetags/search_tags.py | Python | gpl-3.0 | 3,420 |
"""ThreeUpShow is a variant of ShowBase that defines three cameras covering
different parts of the window."""
__all__ = ['ThreeUpShow']
from . import ShowBase
class ThreeUpShow(ShowBase.ShowBase):
def __init__(self):
ShowBase.ShowBase.__init__(self)
def makeCamera(self, win, sort = 0, scene = None,... | chandler14362/panda3d | direct/src/showbase/ThreeUpShow.py | Python | bsd-3-clause | 977 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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
#
#... | metacloud/oslo.config | tests/test_cfg.py | Python | apache-2.0 | 113,201 |
import configparser
from flask import render_template, request
from app import app
from .analyze import Politician
@app.route('/')
@app.route('/index')
def index():
politicians = configparser.ConfigParser()
politicians.read('app/static/config/twitter_handles.ini')
return render_template('index.html',
... | adarj/president_watson | president-watson/app/views.py | Python | mit | 4,244 |
from django.conf.urls import patterns, url
from youtubeadl.apps.downloader import views
urlpatterns = patterns('',
url(
regex=r'^convert/$',
view=views.ConvertAjaxView.as_view(),
name='convert_ajax_view',
),
url(
regex=r'^download/(?P<youtube_id>.*)/(?P<filename>.*)$',
... | Codecors/ytdmpy | youtubeadl/apps/downloader/urls.py | Python | mit | 384 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the GPL3 software license, see the accompanying
# file COPYING or http://www.gnu.org/licenses/gpl.html.
#
# Test -alertnotify
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy... | v4l3r10/emercoin | qa/rpc-tests/forknotify.py | Python | gpl-3.0 | 2,166 |
"""sffhmm_hill_batch
This is the script that computes the results for the article:
J.-L. Durrieu and J.-Ph. Thiran,
'Source/Filter Factorial Hidden Markov Model,
with Application to Pitch and Formant Tracking,'
submitted, 2012.
Script to run a batch processing on all the files from the
Hillenbrand dat... | wslihgt/sffhmm | va-sffhmm/sffhmm_hill_batch_awgn.py | Python | gpl-2.0 | 14,939 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | antoan2/incubator-mxnet | python/mxnet/ndarray/sparse.py | Python | apache-2.0 | 37,445 |
#!/usr/bin/python
"""
A Flask app to post visitor information to reddit.
Requirements:
* Envoy account (https://signwithenvoy.com/)
* reddit account (http://www.reddit.com/)
* PRAW library (https://github.com/praw-dev/praw/)
"""
from ConfigParser import RawConfigParser
from datetime import datetime
import... | rram/moneypenny | moneypenny.py | Python | mit | 5,035 |
from ase import Atom
from gpaw import GPAW
from gpaw.cluster import Cluster
from gpaw.test import equal
h=0.40
txt = None
txt = 'mgga_sc.txt'
s = Cluster([Atom('H')])
s.minimal_box(4., h=h)
s.set_initial_magnetic_moments([1])
# see https://trac.fysik.dtu.dk/projects/gpaw/ticket/244
s.set_cell((8.400000,8.400000,8.400... | robwarm/gpaw-symm | gpaw/test/mgga_sc.py | Python | gpl-3.0 | 834 |
import inspect
import sys
#Bpdb - breakpoint debugging system (kanpatel - 04/2010)
class BpMan:
def __init__(self):
self.bpInfos = {}
def partsToPath(self, parts):
cfg = parts.get('cfg')
grp = parts.get('grp')
id = parts.get('id','*')
path = ''
if cfg:
... | silly-wacky-3-town-toon/SOURCE-COD | toontown/pandautils/BpDb.py | Python | apache-2.0 | 20,462 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | TheWardoctor/Wardoctors-repo | plugin.video.salts/scrapers/scenedown_scraper.py | Python | apache-2.0 | 7,216 |
from flask_admin.contrib.sqla.typefmt import DEFAULT_FORMATTERS as BASE_FORMATTERS
import json
from jinja2 import Markup
from wtforms.widgets import html_params
from geoalchemy2.shape import to_shape
from geoalchemy2.elements import WKBElement
from sqlalchemy import func
from flask import current_app
def geom_formatt... | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/contrib/geoa/typefmt.py | Python | apache-2.0 | 988 |
#**************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to y... | hanya/pyuno3ext | pyuno/source/loader/pythonloader.py | Python | apache-2.0 | 5,519 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth1.rfc5849.endpoints.access_token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the access token provider logic of
OAuth 1.0 RFC 5849. It validates the correctness of access token req... | dakiri/splunk-app-twitter | twitter2/bin/oauthlib/oauth1/rfc5849/endpoints/access_token.py | Python | apache-2.0 | 8,797 |
"""
A scenario discovery oriented implementation of PRIM.
The implementation of prim provided here is data type aware, so
categorical variables will be handled appropriately. It also uses a
non-standard objective function in the peeling and pasting phase of the
algorithm. This algorithm looks at the increase in the m... | quaquel/EMAworkbench | ema_workbench/analysis/prim.py | Python | bsd-3-clause | 53,701 |
#!/usr/bin/env python
#
# Copyright Omega Noc (C) 2014 Omega Cube and contributors
# Xavier Roger-Machart, xrm@omegacube.fr
# Nicolas Lantoing, nicolas@omegacube.fr
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... | Omega-Cube/omeganoc | lib/on_reader/on_reader/livestatus.py | Python | agpl-3.0 | 19,107 |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# Modified for Datadog
# stdlib
import logging
import os
import os.path as osp
import platform
# To manage the agent on OSX
from subprocess import (
CalledProcessError,
check_call,
check_... | huhongbo/dd-agent | win32/gui.py | Python | bsd-3-clause | 28,567 |
"""Slack request signature verifier"""
import hashlib
import hmac
from time import time
from typing import Dict, Optional, Union
class Clock:
def now(self) -> float: # skipcq: PYL-R0201
return time()
class SignatureVerifier:
def __init__(self, signing_secret: str, clock: Clock = Clock()):
"... | slackhq/python-slackclient | slack_sdk/signature/__init__.py | Python | mit | 2,419 |
# Copyright (C) 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 in writ... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/google-api-python-client/apiclient/ext/django_orm.py | Python | bsd-3-clause | 1,509 |
# The Admin4 Project
# (c) 2013-2019 Andreas Pflug
#
# Licensed under the Apache License,
# see LICENSE.TXT for conditions of usage
filePatterns=['.png', '.ico', '.xrc', '.py', '.html']
ignoredirs=['xrced', 'build', 'dist', '_update', 'release']
ignoredfiles=['createBundle.py', 'Dockerfile', 'admin4-docker.sh']
more... | andreas-p/admin4 | createBundle.py | Python | apache-2.0 | 11,389 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | cloudera/hue | desktop/libs/hadoop/src/hadoop/core_site_tests.py | Python | apache-2.0 | 3,408 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2017 Alex Forencich
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... | python-ivi/python-ivi | ivi/chroma/chroma62012p8060.py | Python | mit | 1,825 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from itertools import chain
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_i... | jacobmetrick/Flexget | flexget/plugins/input/myepisodes_list.py | Python | mit | 3,362 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
def homepage(request):
return render(request, 'homepage.html')
| ljarufe/django-adminfilter | example/core/views.py | Python | isc | 129 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_CEN_CBOD_CICIECIF').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
s... | cysuncn/python | spark/crm/PROC_O_CEN_CBOD_CICIECIF.py | Python | gpl-3.0 | 10,194 |
# -*- coding:utf8 -*-
# Author: shizhenyu96@gamil.com
# github: https://github.com/imndszy
from flask import Blueprint
admin = Blueprint('admin', __name__)
from . import views
| imndszy/voluntary | app/admin/__init__.py | Python | mit | 178 |
#!/usr/bin/env python
import time
import json
import re
import praw
import OAuth2Util
import urllib2
import xmltodict
import acrodb
from collections import deque
USER_AGENT = "PRAW:Acronym Explainer:v0.1 by /u/AlexDGr8r"
CACHE_FILE_NAME = 'cache.dat'
r = praw.Reddit(user_agent=USER_AGENT)
o = OAuth2Util.OAuth2Util(r... | AlexDGr8r/AcronymExplainerBot | main.py | Python | mit | 5,422 |
## $Id: theme.py,v 1.4 2003/09/09 18:02:13 riq Exp $
##
## Tenes Empanadas Graciela
##
## Copyright (C) 2000 Ricardo Quesada
##
## Author: Ricardo Calixto Quesada <riq@coresecurity.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as... | JeroenDeDauw/teg | python/client/theme.py | Python | gpl-3.0 | 6,090 |
# Copyright 2014 Cisco Systems, 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 requir... | CingHu/neutron-ustack | neutron/plugins/cisco/db/l3/l3_models.py | Python | apache-2.0 | 4,553 |
import json
import os
directives_by_section = {}
with open(os.path.join(os.path.dirname(__file__), "directives.json")) as f:
directives_by_section = json.loads(f.read())
| wglass/lighthouse | lighthouse/haproxy/directives.py | Python | apache-2.0 | 177 |
#!/usr/bin/env python3
"""
该模块提供一些简单的字符串操作方法
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/10
:version 1.0
"""
import string
def simplify(text, whitespace=string.whitespace, delete=""):
"""
将字符串中多余的空格给去掉
:param text: 原
字符串
:param ... | weiwei02/Technical--Documentation | python/src/base/TextUtil/TextUtil.py | Python | apache-2.0 | 1,667 |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.lines import lineStyles
Light_cnames={'mistyrose':'#FFE4E1','navajowhite':'#FFDEAD','seashell':'#FFF5EE','papayawhip':'#FFEFD5','blanchedalmond':'#FFEBCD','white':'#FFFFFF','mintcream':'#F5FFFA','antiquewhite':'#FAEBD7','moccasin':'#FFE4B5','ivory':'#F... | newera912/WeatherTransportationProject | target/classes/edu/albany/cs/transWeatherPy/plotMesonetOrgData.py | Python | gpl-2.0 | 43,328 |
import logging
import os
import math
from collections import defaultdict
from gensim import corpora
# 引入斷詞與停用詞的配置
from .Matcher.matcher import Matcher
class Evaluator(Matcher):
"""
讀入一串推文串列,計算出當中可靠度最高的推文
"""
def __init__(self,segLib="Taiba"):
#FIXME 若「線上版本」受記憶體容量限制,需考慮更換為 jieba!
sup... | zake7749/Chatbot | Chatbot/QuestionAnswering/responsesEvaluate.py | Python | gpl-3.0 | 5,244 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# ffi-python-main.py
import ctypes
ffi = ctypes.CDLL('./ffi-c.so')
ffi.sinc.argtypes = [ctypes.c_char_p]
ffi.hello('world')
ffi.sinc.argtypes = [ctypes.c_double]
ffi.sinc.restype = ctypes.c_double
print 'sin(1.0) = ', ffi.sinc(1.0) | utmi-2014/utmi-soft3 | doc20141119/ffi-c-main.py | Python | mit | 279 |
name = 'foster'
version = '0.1.0'
packages = ['foster']
files = ['foster/samples', 'LICENSE']
requirements = ['twine >= 1, < 2']
scripts = ['foster=foster.main:run']
author = 'Hugo Leonardo Leão Mota'
author_email = 'hugo.txt@gmail.com'
license = 'MIT'
url = 'https://github.com/hugollm/foster'
keywords = 'foster pyt... | hugollm/foster | package.py | Python | mit | 530 |
"""HTTP server base class.
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
(including CGI scripts).
Contents:
- BaseHTTPRequestHandler: HTTP request handler base class
- test: test function
XXX To do:
- send server version
- l... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/BaseHTTPServer.py | Python | mit | 16,434 |
# Copyright (C) 2000-2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | linkcheck/linkchecker | linkcheck/checker/ftpurl.py | Python | gpl-2.0 | 7,889 |
from __future__ import unicode_literals
import sys
from datetime import date, datetime
from decimal import Decimal, ROUND_UP, ROUND_DOWN
from unittest import TestCase
from wtforms import validators, widgets, meta
from wtforms.fields import *
from wtforms.fields import Label, Field, SelectFieldBase, html5
from wtform... | subyraman/wtforms | tests/fields.py | Python | bsd-3-clause | 33,494 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | rahulunair/nova | nova/cmd/policy.py | Python | apache-2.0 | 5,946 |
"""
/***************************************************************************
Name : Manage Users Accounts and System Roles Dialog
Description : Helps to manage user accounts and corresponding roles
Date : 18/June/2013
copyright : (C) 2013 by John Gitau
email... | gltn/stdm | stdm/ui/manage_accounts_dlg.py | Python | gpl-2.0 | 14,470 |
__all__ = [
'main',
]
from g1 import scripts
from g1.bases import argparses
from g1.bases import oses
from g1.bases.assertions import ASSERT
from . import alerts
from . import bases
from . import envs
from . import pod_ops_dirs
from . import tokens
from . import xar_ops_dirs
@argparses.begin_parser(
'init',... | clchiou/garage | py/g1/operations/cores/g1/operations/cores/repo_cmds.py | Python | mit | 1,944 |
# test concurrent interning of strings
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# function to check the interned string
def check(s, val):
assert type(s) == str
assert int(s) == val
# main thread function
def th(base, n):
for i in range(n):
# this... | mhoffma/micropython | tests/thread/thread_qstr1.py | Python | mit | 825 |
"""Code for building tables that are displayed in the terminal"""
import re
from pathlib import Path
from typing import List
from rich.table import Table
def get_tags_table(rows: List[dict]) -> Table:
"""Return a tag table"""
table = Table(show_header=True, header_style="bold magenta")
table.title = "[no... | Clinical-Genomics/housekeeper | housekeeper/cli/tables.py | Python | mit | 6,615 |
import os.path
from oxdpython.configurer import Configurer
this_dir = os.path.dirname(os.path.realpath(__file__))
location = os.path.join(this_dir, 'data', 'initial.cfg')
def test_oxdconfig_looks_for_config_file_while_initialization():
config = Configurer(location)
assert os.path.isfile(config.config_file)
... | GluuFederation/oxd-python | tests/test_configurer.py | Python | mit | 1,111 |
#!/usr/bin/env python
import sys
import os
import shutil
from datetime import datetime
import gzip
from argparse import ArgumentParser
import random
from distutils.spawn import find_executable
from ..illumina.run_info import parse_samplesheet
# TODO: Finish this RunInfo.xml generation function
# Need to popula... | mytardis/mytardis_ngs_ingestor | mytardis_ngs_ingestor/utils/generate_test_run.py | Python | bsd-3-clause | 16,011 |
# Copyright 2019 Google
#
# 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, soft... | firebase/firebase-ios-sdk | scripts/lib/terminal.py | Python | apache-2.0 | 1,032 |
#
# KVM HA in OpenStack (Demo Version)
#
# Copyright HP, Corp. 2014
#
# Authors:
# Lei Li <li.lei2@hp.com>
#
# 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
#
# ht... | leilihh/novaha | nova/tests/kvmha/test_kvmha_manager.py | Python | apache-2.0 | 3,161 |
#!/usr/bin/env python
#
# SilverBot is a Python application to interact with IB's TWS API.
# Copyright (C) 2013 Christopher Jastram <cjastram@gmail.com>
#
# 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 ... | cjastram/silverbot | archives/tws-oo-trader.py | Python | agpl-3.0 | 9,613 |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='iar'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = '... | poranmeloge/test-github | stm32_rtt_wifi/bsp/mb9bf506r/rtconfig.py | Python | gpl-2.0 | 3,310 |
#!/usr/bin/python
"""
Copyright 2013 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
"""
# System-level imports
import argparse
import fnmatch
import json
import logging
import... | trevorlinton/skia | gm/rebaseline_server/results.py | Python | bsd-3-clause | 22,208 |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'António Anacleto'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "António Anacleto"
__status__ = "Development"
__model_name__='email_account.EmailAccount'
import auth, base_models
from orm import *
from form import *
class EmailAccount... | IdeaSolutionsOnline/ERP4R | core/objs/email_account.py | Python | mit | 1,935 |
# coding=utf-8
from itertools import chain
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext, Context, loader
from django import forms
try:
from django.utils.module_loading import import_module
except ImportEr... | eliasfernandez/django-simplecms | cms/utils/content.py | Python | bsd-2-clause | 5,083 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
from cobra.core import Metabolite, Model, Reaction
from cobra.manipulation import *
from .conftest import model, salmonella
class TestManipulation:
"""Test functions in cobra.manipulation"""
def test_canonical_form(self, model):
... | zakandrewking/cobrapy | cobra/test/test_manipulation.py | Python | lgpl-2.1 | 11,912 |
# Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.
# For example:
# Given n = 5 and edges = [[0, 1], [0, 2], [0, 3], [1, 4]], return true.
# Given n = 5 and edges = [[0, 1], [1, 2], [2, 3], [1, 3],... | youhusky/Facebook_Prepare | 261. Graph Valid Tree.py | Python | mit | 1,265 |
from __future__ import unicode_literals
from ..pandajob.columns_config import COLUMNS, ORDER_COLUMNS, COL_TITLES, FILTERS
import json
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db import connections
from django.utils import timezone
from django.contrib.auth.mode... | PanDAWMS/panda-bigmon-core | core/compare/modelsCompare.py | Python | apache-2.0 | 1,086 |
try:
import pyuff
except ImportError:
raise RuntimeError(
"In order to perform this validation you need the 'pyuff' package."
)
try:
import matplotlib.pyplot as plt
except ImportError:
raise RuntimeError(
"In order to perform this validation you need the 'matplotlib' package."
... | Eomys/MoSQITo | validations/noct_spectrum/valid_noct_spectrum.py | Python | apache-2.0 | 2,478 |
from salty_tickets.models import Event
from salty_tickets import products
for order in Event.query.filter_by(id=2).one().orders:
print(order.registration.name, order.registration.email, order.registration.registered_datetime, order.status, order.total_price)
for order_product in order.order_products:
p... | vinokurov/salty_tickets | service/crowdfunding_stats.py | Python | mit | 380 |
#!/usr/bin/env python3
# -*- python -*-
"""
%prog SUBMODULE...
Hack to pipe submodules of Numpy through 2to3 and build them in-place
one-by-one.
Example usage:
python3 tools/py3tool.py testing distutils core
This will copy files to _py3k/numpy, add a dummy __init__.py and
version.py on the top level, and copy a... | teoliphant/scipy | tools/py3tool.py | Python | bsd-3-clause | 12,352 |
# -*- coding: utf-8 -*-
# import python libs
import os
from array import array
# import pure_pynacl libs
from saltchannel.saltlib.pure_pynacl import lt_py3, lt_py33
from saltchannel.saltlib.pure_pynacl import TypeEnum, integer, Int, IntArray
class u8(Int):
'''unsigned char'''
bits = array('B').itemsize*8
... | assaabloy-ppi/salt-channel-python | saltchannel/saltlib/pure_pynacl/tweetnacl.py | Python | mit | 25,273 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
# Copyright 2013 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 Li... | OpenAcademy-OpenStack/nova-scheduler | nova/tests/api/openstack/compute/test_servers.py | Python | apache-2.0 | 193,364 |
# -*- coding: utf-8 -*-
#
# This file is a plugin for EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost 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 v... | topic2k/EventGhost | plugins/Barco/__init__.py | Python | gpl-2.0 | 20,158 |
from __future__ import unicode_literals
import boto.rds
import boto.vpc
from boto.exception import BotoServerError
import sure # noqa
from moto import mock_ec2_deprecated, mock_rds_deprecated
from tests.helpers import disable_on_py3
@disable_on_py3()
@mock_rds_deprecated
def test_create_database():
conn = boto... | heddle317/moto | tests/test_rds/test_rds.py | Python | apache-2.0 | 10,968 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferArnoldUITest/ArnoldShaderUITest.py | Python | bsd-3-clause | 7,673 |
# -*- coding: utf-8 -*
#此脚本计算collabstream预测结果的topN命中率
#第一个参数指定collabstream训练出的user矩阵的文件,第二参数指定item矩阵的文件,第三个参数指定topN的测试集,第四个参数指定K的维数
#第五个参数topN的N
import mmap,sys,contextlib
with open(sys.argv[1],'r') as f_user:
with open(sys.argv[2],'r') as f_item:
with open(sys.argv[3],'r') as f_test:
with cont... | YinYanfei/CadalWorkspace | CollabStreamTwo/topNtest.py | Python | gpl-3.0 | 3,625 |
# Copyright (c) 2013 MetaMetrics, 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, publish, d... | gilt/nova | nova/core/cfn_pyplates/options.py | Python | mit | 1,386 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
# -*- coding:utf-8 -*-
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.db.models.query import QuerySet
from grading_standard.dao.canvas import *
from grading_standard.models import Gra... | uw-it-aca/grading-standard-lti | grading_standard/tests.py | Python | apache-2.0 | 4,587 |
#-------------------------------------------------------------------------------
# Author: Enric Tejedor <enric.tejedor.saavedra@cern.ch> CERN
#-------------------------------------------------------------------------------
################################################################################
# Copyright (... | root-mirror/root | documentation/doxygen/extract_docstrings.py | Python | lgpl-2.1 | 1,726 |
#!/usr/bin/env python
import sys
import os
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ctxis/cvsslib | tests/django_app/manage.py | Python | lgpl-3.0 | 243 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import os
import subprocess
import sys
from platform import system
from tempfile import NamedTemporaryFile
CURINTERPRETER_PATH = os.path.normpath(sys.executable)
IS_WINDOWS = system() == "Windows"
def fix_winpython_pathenv():
"""
Add... | TimJay/platformio | scripts/get-platformio.py | Python | mit | 4,095 |
#
#
# =================================================================
# =================================================================
import os
import sys
import zipfile
import shutil
#PMC_DIR = "/devstate/WS_SSP/PMC.REST.SDK.BASE_7.7.8.0_20130731T1253"
#PMC_DIR = "/devstate/INSTALL-PMC/PMC.REST.SDK.BASE_7.7.8.... | windskyer/k_cinder | paxes_cinder/k2aclient/k2asample/tool_extract_pmc_schema.py | Python | apache-2.0 | 10,663 |
#!python
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an option (PNG, JPEG)
# 0.5 98-12-30 fl Fixed... | jojoriveraa/titulacion-NFCOW | venv/bin/pilconvert.py | Python | apache-2.0 | 2,348 |
# -*- coding: utf-8 -*-
class ErrorDesctiptorEvent(object):
""" Error descriptor event.
'params' attribute can be extended with extra records by event handler.
"""
def __init__(self, errors, params):
self.errors = errors
self.params = params
self.request = errors.request
| openprocurement/openprocurement.api | src/openprocurement/api/events.py | Python | apache-2.0 | 319 |
#!/usr/bin/env python
"""Darwin (OS X) support.
Appropriated from pygame.macosx
"""
from __future__ import division, print_function, unicode_literals
import six
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import os
import sys
# SDL-ctypes on OS X requires PyObjC
from Foundation import *
from AppKit ... | twenty0ne/CocosBuilder-wxPython | cocos/cocos/audio/SDL/darwin.py | Python | mit | 5,100 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | etcmodel/models/tokenization.py | Python | apache-2.0 | 14,944 |
"""This platform enables the possibility to control a MQTT alarm."""
import functools
import logging
import re
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_CUSTOM... | partofthething/home-assistant | homeassistant/components/mqtt/alarm_control_panel.py | Python | apache-2.0 | 10,392 |
#!/usr/bin/python
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],... | kvar/ansible | lib/ansible/modules/cloud/misc/xenserver_facts.py | Python | gpl-3.0 | 5,155 |
#pin maker
#need to implement this
class pinMaker():
def __init__(self, senderInfo,recepientInfo,timestamp):
self.senderInfo = senderInfo
self.recepientInfo = recepientInfo
self.timestamp = timestamp
def genKey(self):
return (int) (self.senderInfo * self.recepientInfo * self.tim... | dexkcd/ushare | process/encyption.py | Python | gpl-3.0 | 453 |
from collections import namedtuple
import pytest
from .main import (contains_match, MATCH_ALPHANUMERIC, MATCH_LENGTH_10, is_valid,
MATCH_REPEAT_CHARACTERS, MATCH_UPPER, MATCH_DIGIT)
validate_2_upper = contains_match(MATCH_UPPER, count=2, op='>=')
validate_3_digits = contains_match(MATCH_DIGIT, coun... | bionikspoon/HackerRank-Challenges | python/regex_and_parsing/validating_uid/test_main.py | Python | mit | 2,940 |
# Authors:
# Pedro Jose Pereira Vieito <pvieito@gmail.com> (Twitter: @pvieito)
#
# URL: https://github.com/mr-orange/Sick-Beard
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | drglove/SickRage | sickbeard/clients/download_station.py | Python | gpl-3.0 | 2,700 |
# -*- coding:utf-8 -*-
import logging
from userprofile.forms import StuProfileForm, UserProfileBySiteForm
from django.utils.translation import ugettext_lazy as _
from userprofileops import UserProfileOPS
from userprofile.models import UserProfile, Accommodation, UserAccomodationPref, UserProfileBySite
log = logging.... | akademikbilisim/ab-kurs-kayit | abkayit/userprofile/uutils.py | Python | gpl-3.0 | 2,250 |
#coding:utf8
import math
# total 是rom容量
def avgMen(men, total):
if len(men):
_men = [math.ceil(((men[i]) / total) * 1024) for i in range(len(men))]
return str(math.ceil(sum(_men) / len(_men))) + "%"
return "0%"
def avgCpu(cpu):
if len(cpu):
return str(math.ceil(sum(cpu) / len(cpu... | mocne/PycharmProjects | HanderCode/handerCode/Base/BaseAnalysis.py | Python | mit | 1,970 |
"""
Deletes Cosmos database from Azure
"""
import azure.mgmt.cosmosdb as cosmosdb
from azure.common.credentials import ServicePrincipalCredentials
from common.methods import set_progress
from resourcehandlers.azure_arm.models import AzureARMHandler
def _get_client(handler):
"""
Get the client using newer met... | CloudBoltSoftware/cloudbolt-forge | blueprints/azure_cosmos/delete.py | Python | apache-2.0 | 2,090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.