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 |
|---|---|---|---|---|---|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/catalog/models/catalog_item.py | Python | mit | 1,143 |
# -*- coding: utf-8 -*-
from pymiles import u_db_meta as u_meta
if __name__ == '__main__':
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
db = 'tst1.sql3'
tmeta = u_meta.Metadb(db)
print(tmeta.trpr('lmo'))
print(tmeta.db)
print(tmeta.zf_exists)
print(tmeta.pars('programmer'... | tedlaz/pyted | pymiles/miles_tst/tst_meta.py | Python | gpl-3.0 | 386 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import re
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from unidecode import unidecode
import... | max-arnold/django-cities-light | cities_light/abstract_models.py | Python | mit | 4,811 |
# -*- coding: utf-8 -*-
from openerp.addons.website_blog.tests.common import TestWebsiteBlogCommon
class TestWebsiteBlogFlow(TestWebsiteBlogCommon):
def test_website_blog_followers(self):
""" Test the flow of followers and notifications for blogs. Intended
flow :
- people subscribe to ... | aimas/TuniErp-8.0 | addons/website_blog/tests/test_website_blog_flow.py | Python | agpl-3.0 | 2,863 |
# coding=utf-8
import logging
from realtime.app_settings import LOGGER_NAME
from realtime.tasks.realtime.celery_app import app
__author__ = 'Rizky Maulana Nugraha <lana.pcfre@gmail.com>'
__date__ = '7/20/16'
LOGGER = logging.getLogger(LOGGER_NAME)
@app.task(
name='realtime.tasks.ash.process_ash',
queue='i... | timlinux/inasafe-django | django_project/realtime/tasks/realtime/ash.py | Python | bsd-2-clause | 581 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | traceml/traceml/processors/importance_processors.py | Python | apache-2.0 | 3,422 |
"""Operations on trees."""
from functools import partial
from itertools import chain
import networkx as nx
from itertools import accumulate
__all__ = ["join"]
def join(rooted_trees, label_attribute=None):
"""Returns a new rooted tree with a root node joined with the roots
of each of the given rooted trees.
... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/algorithms/tree/operations.py | Python | gpl-3.0 | 3,520 |
# -*- coding: utf-8 -*-
# Copyright 2018 上海开阖软件 ((http://www.osbzr.com).)
{
'name': 'GOODERP 招聘问卷',
'version': '11.11',
'author': '上海开阖软件',
'website': 'http://www.osbzr.com',
'category': 'gooderp',
'summary': '招聘问卷',
'description': """在招聘流程中使用问卷表格""",
'depends': [
'staff_hire', ... | floraXiao/gooderp_addons | staff_survey/__manifest__.py | Python | agpl-3.0 | 591 |
from sympy import Symbol, simplify, Derivative, Function, diff, Equality, Matrix, gcd, cancel, integrate, Integral
def syst2matrix(system, variables=None):
"""
Returns A, B matrices of the system A·X = B.
Examples
========
>>> from sympy import *
>>> x, y, z = symbols('x y z')
>>> syst = [... | Curiosidad-Racional/Python | physics/lagrangian.py | Python | gpl-3.0 | 7,562 |
# ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | BRAINSia/ITK | Modules/Core/Common/wrapping/test/itkVariableLengthVectorTest.py | Python | apache-2.0 | 1,870 |
import pytest
from django.contrib import admin
from django.db import models
from siteprefs.models import Preference
from siteprefs.toolbox import autodiscover_siteprefs, get_app_prefs, get_prefs_models
from siteprefs.utils import Frame, PatchedLocal, PrefProxy, get_field_for_proxy, get_pref_model_class, \
get_pref... | idlesign/django-siteprefs | siteprefs/tests/test_basic.py | Python | bsd-3-clause | 4,691 |
import re
from openerp import models, SUPERUSER_ID
from openerp.http import request
from openerp.osv import orm
from openerp.addons.website.models import website as website_file
from openerp.addons.website.models.website import slug as slug_super
from openerp.addons.website.models.ir_http import ModelConverter
def s... | bmya/website-addons | website_seo_url/ir_http.py | Python | lgpl-3.0 | 2,603 |
def interpret(slackMessage):
import random
import tools.settings
if ("@mal" in slackMessage.message.lower()):
return ".1.2.1."
elif (slackMessage.message.lower() == '{}, what is the meaning of life?'.format(tools.settings.getName()).lower()):
from tools.file_handling import rando... | chaosking121/mal | plaintext.py | Python | mit | 1,309 |
import os
from c2corg_ui.tests.views import BaseTestUi, handle_mock_request
from c2corg_ui.views.health import Health
from httmock import all_requests, HTTMock
base_path = os.path.dirname(os.path.abspath(__file__))
class TestHealthUi(BaseTestUi):
def setUp(self): # noqa
self.set_prefix('health')
... | olaurendeau/v6_ui | c2corg_ui/tests/views/test_health.py | Python | agpl-3.0 | 848 |
# 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, ... | google/ftc-object-detection | training/object_detector.py | Python | apache-2.0 | 4,142 |
# Copyright 2011 OpenStack Foundation
#
# 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... | citrix-openstack-build/trove | trove/tests/api/mgmt/storage.py | Python | apache-2.0 | 4,557 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 IBM
#
# 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... | usc-isi/nova | nova/virt/powervm/operator.py | Python | apache-2.0 | 25,712 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('rss_gen.views',
url(r'^(?P<owner>[\w,\-,\_]+)/(?P<repo>[\w,\-,\_]+)/.*$', 'feed_xml'),
url(r'^$', 'index'),
) | billryan/github-rss | rss_gen/urls.py | Python | mit | 249 |
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from ... | fnp/redakcja | src/documents/models/image.py | Python | agpl-3.0 | 5,094 |
from __future__ import unicode_literals
from appconf import AppConf
from django.conf import settings # noqa
from django.utils.translation import ugettext_lazy as _
class TimelineLoggerConf(AppConf):
DEFAULT_TEMPLATE = 'timeline_logger/default.txt'
PAGINATE_BY = 25
USER_EMAIL_FIELD = 'email'
DIGE... | maykinmedia/django-timeline-logger | timeline_logger/conf.py | Python | mit | 740 |
import re
from typing import (
Optional,
Union,
)
_INTEGER_RE = re.compile(r"^[+-]?[0-9]+$")
def is_integer(
value: Union[str, int, float],
at_least: Optional[int] = None,
at_most: Optional[int] = None,
) -> bool:
"""
Check if the specified value is an integer, optionally check a range
... | feist/pcs | pcs/common/validate.py | Python | gpl-2.0 | 1,057 |
from pecan import conf, abort
from draughtcraft.tests import TestApp
from draughtcraft import model
import fudge
class TestSignup(TestApp):
def test_signup_form(self):
assert model.User.query.count() == 0
self.get('/signup')
assert model.User.query.count() == 0
def test_schema_valid... | ryanpetrello/draughtcraft | draughtcraft/tests/controllers/test_signup.py | Python | bsd-3-clause | 8,418 |
from unittest import skipUnless
import django
from django.http import QueryDict
from django.test import TestCase
from lbutils import (QuickSearchForm, create_instance, do_filter, fmt_month,
fmt_num, format_filesize, forms_is_valid, get_max,
get_or_none, get_pk_or_none, get_sum... | vicalloy/lbutils | lbutils/tests/tests.py | Python | mit | 10,518 |
reprophyloversion="99c16963"
############################################################################################
if False:
"""
ReproPhylo version 1
General purpose phylogenetics package for reproducible and experimental analysis
Amir Szitenebrg
A.Szitenberg@Hull.ac.uk
Szitenb... | gawbul/ReproPhyloVagrant | reprophylo/reprophylo.py | Python | mit | 281,160 |
# imports
import shlex
import math
def ohigginsRaw2g2o(infoOdomPos, infoOdomAng, infoPointSen, dataDir, dataSkip, dataSize):
# filenames
inDeadReckon = dataDir + "deadReckoning.dat"
inMeasurement = dataDir + "measurement.dat"
outG2O = dataDir + "ohiggins.g2o"
fg2o = open(outG2O, 'w')
... | francocurotto/GraphSLAM | src/python-helpers/v3-real-data/data/Parque OHiggins/OHigginsRaw2g2o.py | Python | gpl-3.0 | 3,023 |
#!/usr/bin/env python
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# ... | stdlib-js/stdlib | lib/node_modules/@stdlib/stats/base/dists/arcsine/ctor/benchmark/python/benchmark.scipy.py | Python | apache-2.0 | 5,040 |
import copy
from itertools import product
from django.db.models.sql.datastructures import EmptyResultSet
from djangae.db.backends.appengine.query import WhereNode
from django.db import NotSupportedError
def preprocess_node(node, negated):
to_remove = []
# Go through the children of this node and if any of t... | wangjun/djangae | djangae/db/backends/appengine/dnf.py | Python | bsd-3-clause | 9,132 |
"""
Barrister runtime for Python. Includes all classes used when writing a client or server.
Hacked up for StackHut by StackHut :) Thx
:copyright: 2012 by James Cooper.
:license: MIT, see LICENSE for more details.
"""
import urllib.request
import urllib.error
import urllib.parse
import uuid
import iter... | StackHut/stackhut | stackhut_toolkit/common/barrister/runtime.py | Python | apache-2.0 | 39,585 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-13 10:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('web', '0011_history'),
]
operations = [
migrations.AlterModelOptions(
n... | fladi/django-campus02 | campus02/web/migrations/0012_auto_20161013_1013.py | Python | mit | 574 |
from fabric.api import task
from fabfile.centos.lib import rpm
from fabfile.common.lib import template
@task(default=True)
def ensure_setup():
ensure_package_installed()
ensure_config_file()
def ensure_package_installed():
rpm.ensure_installed('sysstat')
def ensure_config_file():
template.ensure_temp... | hnakamur/my-fabfiles | fabfile/centos/sysstat.py | Python | mit | 505 |
"""
Commenting App
This module provides generic django URL routing.
"""
from django.conf.urls import patterns, url
from honeypot.decorators import check_honeypot
from tunobase.commenting import views, forms
urlpatterns = patterns('',
url(r'^post-comment/$',
check_honeypot(views.PostComment.as_view(
... | unomena/tunobase | tunobase/commenting/urls.py | Python | bsd-3-clause | 786 |
# Input Module
import dm3_lib as dm3_lib
import numpy as np
import data as data
def load_files(file_path_smh, file_path_ic, datastruct):
"""Load the files by asking the controller the filepaths smh and ic provided by the user and store the appropriate
data in the data structure object (dictionary). Before s... | slimpotatoes/STEM_Moire_GPA | src/userinput.py | Python | bsd-3-clause | 2,672 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_log_alerts_operations.py | Python | mit | 20,502 |
import os.path
import time
import re
import hashlib
import shutil
import magic
from io import SEEK_END
from flask import request, jsonify, abort
from .. import app
from ..helpers import verify_token, gen_hash
from ..models import UploadedFile, ChunkedUpload
HEX_RE = re.compile(r'^[0-9a-f]+$')
@app.route('/api/1/up... | ngld/fsnebula | app/controllers/upload.py | Python | apache-2.0 | 6,974 |
from __future__ import print_function, division, absolute_import
from llvmlite.llvmpy.core import Type, Builder, Constant
import llvmlite.llvmpy.core as lc
from numba import types, cgutils, config
class _ArgManager(object):
"""
A utility class to handle argument unboxing and cleanup
"""
def __init__... | pombredanne/numba | numba/callwrapper.py | Python | bsd-2-clause | 7,092 |
# coding=utf-8
#-------------------------------------------------------------------------------
#LICENSE: BSD 3-Clause
#Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
#Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#Universidad del Pais Vasco UPV/EHU
#
#2014, Alexandre Manhaes Savio
#Use this at your... | Neurita/boyle | boyle/files/configuration.py | Python | bsd-3-clause | 762 |
# coding: utf8
import sys
import os
import string
from PIL import Image
#自动创建指定的各种尺寸的logo
#python crop.py 1024.png ./ -o 90 100 192
#python crop.py 1024.png ./
def crop():
#只允许创建的尺寸
includes = ''
sizes = []
name = sys.argv[1]
folder = sys.argv[2]
if len(sys.argv) > 4:
if sys.argv[3] ... | bili/logoscale | logoscale.py | Python | mit | 1,398 |
#!/usr/bin/python
import os
import string
import shutil
''' Basic module which defines the workspace class
'''
class Workspace:
workspace_paths = []
numOfws = 0
robocomp_dir = ''
''' constructor'''
def __init__(self):
self.update_pathlist()
def update_pathlist(self):
... | rajathkumarmp/robocomp | tools/buildTools/workspace.py | Python | gpl-3.0 | 7,354 |
time = 0
color = dict()
start = dict()
finish = dict()
parent = dict()
order = list()
def dfs(graph):
global time
time = 0
for vertex in graph:
color[vertex] = 'W'
parent[vertex] = None
for vertex in graph:
if color[vertex] == 'W':
dfs_visit(graph, vertex)
def dfs_v... | saqibns/standard-algorithms | Python/topological-sort.py | Python | mit | 977 |
from setuptools import setup, find_packages
setup(name='sparchive',
version="0.1.1",
description="simple personal archive",
classifiers=[
"Operating System :: OS Independent",
"Programming Language :: Python",
],
author='Erik Hetzner',
author_email='egh@e6h.org',... | egh/sparchive | setup.py | Python | gpl-3.0 | 611 |
"""Implementation of a base class for all IHC devices."""
import logging
from ihcsdk.ihccontroller import IHCController
from homeassistant.helpers.entity import Entity
from .const import CONF_INFO, DOMAIN
_LOGGER = logging.getLogger(__name__)
class IHCDevice(Entity):
"""Base class for all IHC devices.
Al... | rohitranjan1991/home-assistant | homeassistant/components/ihc/ihcdevice.py | Python | mit | 3,161 |
# Copyright (c) 2019-2021, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING, Iterable
from ezdxf.math import Vec2
from ezdxf.math.line import ConstructionRay, ParallelRaysError
if TYPE_CHECKING:
from ezdxf.eztypes import Vertex
__all__ = ["offset_vertices_2d"]
def offset_vertices_2d(
v... | mozman/ezdxf | src/ezdxf/math/offset2d.py | Python | mit | 3,013 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
#DISCLAIMER: THIS FILE IS OUT OF DATE AND NEEDS SIGNIFICANT MODIFICATIONS
# TO MAKE IT WORK
print "Create MySQL connection"
from urbansim.store.scenario_database import ScenarioDatab... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/waterdemand/join_with_gridcells.py | Python | gpl-2.0 | 2,510 |
import win32debug, sys, os
class A(object):
def __init__(self, a):
self.a = a
def f_cellvar(self, param1, param2):
local1 = 5
# c is cell variable because it is used in f_cellfreevar
cell1 = {1: 2, 3: 4}
def f_cellfreevar(param):
# cell1 is free variable b... | SeanCline/PyExt | test/scripts/localsplus_test.py | Python | mit | 1,091 |
from django.utils.translation import ugettext_lazy as _
from unipath import Path
import os
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to b... | RuralIndia/pari | pari/settings/base.py | Python | bsd-3-clause | 15,429 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | tpaszkowski/quantum | quantum/openstack/common/log.py | Python | apache-2.0 | 19,310 |
#!/usr/bin/env python
import rospy
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxySubscriberCached
from sensor_msgs.msg import PointCloud2
class StorePointcloudState(EventState):
'''
Stores the latest pointcloud of the given topic.
-- topic string The topic on which to listen... | pschillinger/lamor15 | lamor_flexbe_states/src/lamor_flexbe_states/store_pointcloud_state.py | Python | mit | 847 |
import configparser
import logging.handlers
from datetime import datetime
from time import time
import telebot
from rastreio import db
config = configparser.ConfigParser()
config.read('bot.conf')
TOKEN = config['RASTREIOBOT']['TOKEN']
int_del = int(config['RASTREIOBOT']['int_del'])
LOG_DEL_FILE = config['RASTREIOBOT... | GabrielRF/RastreioBot | del_routine.py | Python | gpl-3.0 | 1,603 |
from abc import ABCMeta, abstractmethod
class AbstractResultHandler(object):
__meta__ = ABCMeta
@abstractmethod
def send(self, data):
pass
| kartvep/Combaine | combaine/plugins/ResultHandler/_abstractresulthandler.py | Python | lgpl-3.0 | 162 |
#!/usr/bin/python3
## Copyright (C) 2015 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (... | endlessm/system-config-printer | test_PhysicalDevice.py | Python | gpl-2.0 | 1,597 |
from yum_metadata_diff.package import Package
from yum_metadata_diff.metadata import Metadata
class PrimaryPackage(Package):
DIFF_ATTR = None
def __init__(self):
Package.__init__(self)
self.pkgkey = ""
#self.checksum = ""
#self.name = ""
#self.epoch = ""
#self... | Tojaj/yum-metadata-diff | yum_metadata_diff/primary.py | Python | lgpl-2.1 | 1,801 |
"""
==================================================
Automatic Relevance Determination Regression (ARD)
==================================================
Fit regression model with Bayesian Ridge Regression.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary l... | RPGOne/Skynet | scikit-learn-0.18.1/examples/linear_model/plot_ard.py | Python | bsd-3-clause | 2,828 |
"""ANTLR3 exception hierarchy"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2006 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source c... | sshrdp/mclab | lib/antlr-3.0.1/runtime/Python/antlr3/exceptions.py | Python | apache-2.0 | 11,289 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script that updates the language lists in Wikimedia family files."""
#
# (C) xqt, 2009-2017
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import codecs
import re
import pywikib... | npdoty/pywikibot | scripts/maintenance/wikimedia_sites.py | Python | mit | 2,975 |
"""
Parses Phenotype Data from SNPMAX and places the data in a format for use
in plink/seq.
Format looks something like the one shown below.
PATIENT<TAB>PHENO1<TAB>PHENO2<TAB>
1<TAB>1<TAB>RED
2<TAB>0<TAB>BLUE
"""
from phenotype import Phenotype
import argparse
import tempfile
sample_list... | theboocock/plinkseq_utilities | pseq_util/phenotypes_snpmax.py | Python | mit | 4,546 |
# -*- coding: utf-8 -*-
from project import helpers
import resource
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
def create(request):
data = request.DATA
if getattr(request, 'ignore_csrf_checks', False):
return {'code': 'no_access'}, 404, False... | EndyKaufman/django-postgres-angularjs-blog | app/account/validator.py | Python | mit | 4,776 |
"""
New Technology File System (NTFS) file system parser.
Sources:
- The NTFS documentation
http://www.linux-ntfs.org/
- NTFS-3G driver
http://www.ntfs-3g.org/
Creation date: 3rd january 2007
Author: Victor Stinner
"""
SECTOR_SIZE = 512
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (F... | Branlala/docker-sickbeardfr | sickbeard/lib/hachoir_parser/file_system/ntfs.py | Python | mit | 11,618 |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name = 'Adafruit_Video_Looper',
version = '1.0.0',
author = 'Tony DiCola',
author_email = 'tdicola@adafruit.com',
description = 'Application to tur... | backsteen/beun_video | setup.py | Python | gpl-2.0 | 669 |
#!/usr/bin/env python3
# Copyright (C) 2020 Locha Inc
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
# VLIM
child.sendline("b... | brummer-simon/RIOT | tests/driver_bq2429x/tests-with-config/01-run.py | Python | lgpl-2.1 | 1,032 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | bank-netforce/netforce | netforce_general/netforce_general/models/province.py | Python | mit | 1,776 |
# Copyright (C) 2003-2011, Stefan Schwarzer <sschwarzer@sschwarzer.net>
# See the file LICENSE for licensing terms.
"""
ftp_path.py - simulate `os.path` for FTP servers
"""
import posixpath
import stat
from ftputil import ftp_error
# The `_Path` class shouldn't be used directly by clients of the
# ftputil library.... | rathodmartin/oc | tools/tst/ftputil-2.8/ftputil/ftp_path.py | Python | epl-1.0 | 6,929 |
# -*- coding: utf-8 -*-
"""
Problem Statement
You are given an integer N. Is there a permutation of digits of integer that's divisible by 8? A permutation of digits
of integer N is defined as an integer formed by rearranging the digits of N. For example, if the number N = 123, then
{123, 132, 213, 231, 312, 321}... | ee08b397/HackerRankAlgorithms | Manasa loves Maths.py | Python | apache-2.0 | 1,817 |
from mahjong.constants import NORTH
from mahjong.hand_calculating.yaku import Yaku
from mahjong.utils import is_pon_or_kan
class YakuhaiNorth(Yaku):
"""
Pon of north winds
"""
def __init__(self, yaku_id=None):
super(YakuhaiNorth, self).__init__(yaku_id)
def set_attributes(self):
... | MahjongRepository/mahjong | mahjong/hand_calculating/yaku_list/north.py | Python | mit | 825 |
"""Provides a dictionary that is indexed by insertion order."""
__author__ = "Niklas Fiekas"
__email__ = "niklas.fiekas@backscattering.de"
__version__ = "1.2.1"
__license__ = "PSFL"
import collections
import collections.abc
import operator
import reprlib
class IndexedOrderedDict(dict):
"""A dictionary that is i... | niklasf/indexed.py | indexed/__init__.py | Python | gpl-3.0 | 5,332 |
#!/usr/bin/env python3
import os
import sys
import click
import re
@click.command()
@click.argument('cosmic_file', type=click.File('r'), required=True)
@click.argument('output_file', type=click.File('w'), required=False, default=sys.stdout)
def cli(cosmic_file, output_file):
"""replaces SYMBOL_JUNK with SYMBOL in co... | kotoroshinoto/TCGA_MAF_Analysis | gooch_maf_tools/commands/names/cosmic_name_clipper.py | Python | unlicense | 1,922 |
__version__ = '3.0-dev'
from .facets import Facet, GlobalTermsFacet, RangeFilter, TermsFacet, YearHistogram
from .mapping import (
DEFAULT_ANALYZER, Indexable, ModelIndex, RawMultiString, RawString, build_mapping, deep_field_factory,
document_field, document_from_model)
from .registry import app_documents, doc... | imsweb/django-seeker | seeker/__init__.py | Python | bsd-2-clause | 483 |
"""Functions for FEHM thermodynamic variables calculations."""
"""
Copyright 2013.
Los Alamos National Security, LLC.
This material was produced under U.S. Government contract DE-AC52-06NA25396 for
Los Alamos National Laboratory (LANL), which is operated by Los Alamos National
Security, LLC for the U.S. Department ... | losalamos/PyFEHM | fvars.py | Python | lgpl-2.1 | 27,149 |
# Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
... | JiangKlijna/leetcode-learning | py/035 Search Insert Position/SearchInsertPosition.py | Python | mit | 639 |
from graph import Graph
from node import Node
class helper:
def __init__(self):
pass
#loops through the circular list of buckets and returns the first non-empty
@staticmethod
def find_min_dist(lst, k):
for i in range(0,len(lst)):
if(len(lst[(k+i)% len(lst)])) >0:
... | emmanuj/dials_shortest_path | util.py | Python | mit | 4,752 |
import numpy
from numpy.testing import assert_array_almost_equal
import pytest
from sklearn.pipeline import make_pipeline
from sksurv.datasets import load_breast_cancer
from sksurv.ensemble import ExtraSurvivalTrees, RandomSurvivalForest
from sksurv.preprocessing import OneHotEncoder
from sksurv.testing import assert_... | sebp/scikit-survival | tests/test_forest.py | Python | gpl-3.0 | 9,388 |
import warnings
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as IUS
from astropy import units
from astropy import constants
from astropy.cosmology import z_at_value
from astropy.table import Table
from frb.halos.models import ModifiedNFW, ICM
from frb.defs import frb_cosmo as cosmo
... | FRBs/FRB | frb/halos/hmf.py | Python | bsd-3-clause | 12,923 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#from __future__ import unicode_literals
#
#
# SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | StevenCHowell/zazmol | src/python/old_subset.py | Python | gpl-3.0 | 39,442 |
# class A1(object):
# pass
#
#
# class A2(object):
# pass
#
#
# class A3(object):
# pass
#
#
# class B(A1, A2):
# pass
#
#
# class C(A1, A2, A3):
# pass
#
#
# class D(B, C):
# pass
#
#
# print(D.__mro__)
class A(object):
pass
class B(A):
pass
class C(object):
pass
class D(A, ... | lilbond/bitis | day4/mro.py | Python | mit | 398 |
from __future__ import unicode_literals
from django.shortcuts import render
from markitup import settings
from markitup.markup import filter_func
def apply_filter(request):
markup = filter_func(request.POST.get('data', ''))
return render(request, 'markitup/preview.html', {'preview': markup})
| carljm/django-markitup | markitup/views.py | Python | bsd-3-clause | 305 |
###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
###########################################
import os
import time
import random
import importlib
i... | armandosrz/UdacityNanoMachine | smartcab/smartcab/simulator.py | Python | apache-2.0 | 24,939 |
# -*- coding: utf-8 -*-
# Author: Leonardo Pistone
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or... | hurrinico/stock-logistics-workflow | stock_ownership_by_move/__openerp__.py | Python | agpl-3.0 | 1,196 |
'''
@Author Sean McLaughiln
This is my copy of the logistic_sgd module. I'm adding some features so I can use DNN for regression rather than just classification.
'''
import cPickle
import gzip
import os
import sys
import time
import numpy
from layers.logistic_sgd import LogisticRegression
import theano
import thean... | mclaughlin6464/pdnn | layers/regressions_sgd.py | Python | apache-2.0 | 1,899 |
# Django settings for scrum_pm project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'N... | propdata/scrum-pm | scrum_pm/scrum_pm/settings.py | Python | mit | 5,458 |
# coding:utf-8
"""Objects for Phamarsim
"""
from __future__ import division
import numpy as np
import warnings
import logging
log = logging.getLogger(__name__)
def cartesian_to_spherical(x, y, z):
"""Convert a set of cartesian coordinates to spherical ones.
Parameters
----------
x : float
... | ast0815/phamarsim | phamarsim/objects.py | Python | mit | 9,910 |
### Copyright (C) 2002-2009 Stephen Kennedy <stevek@gnome.org>
### Copyright (C) 2010-2011 Kai Willadsen <kai.willadsen@gmail.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 v... | pedrox/meld | meld/preferences.py | Python | gpl-2.0 | 17,788 |
# TODO: complete dockerfile parser for easy checks and validation against any part of it
#
# def parse_dockerfile(dockerfile_content, is_guessed=False):
# """
# Given a single string as a dockerfile, parse it into a keyed dict.
#
# :param dockerfile_content:
# :param is_guessed:
# :return:
# """... | anchore/anchore-engine | anchore_engine/util/dockerfile.py | Python | apache-2.0 | 2,231 |
# Linear Regression: Inverse Matrix Method
#----------------------------------
#
# This function shows how to use Tensorflow to
# solve linear regression via the matrix inverse.
#
# Given Ax=b, solving for x:
# x = (t(A) * A)^(-1) * t(A) * b
# where t(A) is the transpose of A
import matplotlib.pyplot as plt
import n... | benjaminoh1/tensorflowcookbook | Chapter 03/lin_reg_inverse.py | Python | mit | 1,528 |
"""Import all models so they can be found by `makemigrations`"""
from .activity import *
from .place import *
from .place_image import *
from .place_info import *
from .secondary_type import *
| jricardo27/holiday_planner | holiday_planner/holiday_place/models/__init__.py | Python | bsd-3-clause | 194 |
# Generated by Django 2.2.6 on 2019-10-10 08:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('community', '0004_auto_20191010_0837'),
]
operations = [
migrations.CreateModel(
name='Cooperat... | jeromecc/doctoctocbot | src/community/migrations/0005_auto_20191010_0838.py | Python | mpl-2.0 | 1,298 |
from asposeslides import Settings
from com.aspose.slides import Presentation
from com.aspose.slides import ChartType
from com.aspose.slides import SaveFormat
class ChartProperties:
def __init__(self):
# Setting the RotationX, RotationY and DepthPercents properties of 3D Chart.
... | ali-salman/Aspose.Slides-for-Java | Plugins/Aspose-Slides-Java-for-Jython/asposeslides/WorkingWithCharts/ChartProperties.py | Python | mit | 5,196 |
from PyQt4 import QtCore, QtGui, QtNetwork
import functools
import logging
from config import Settings
FAF_PROXY_HOST = Settings.get('HOST', 'PROXY')
FAF_PROXY_PORT = Settings.get('PORT', 'PROXY')
UNIT16 = 8
class proxies(QtCore.QObject):
__logger = logging.getLogger(__name__)
def __init__(self, pare... | Sheeo/client | src/fa/proxies.py | Python | gpl-3.0 | 9,490 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class GraphProviderConfig(AppConfig):
name = 'graph_provider'
| GuitarmonYz/AutoKnowledge | django_back_end/auto_smart_graph/smart_backend/graph_provider/apps.py | Python | mit | 167 |
# Copyright (c) 2020 The ARA Records Ansible authors
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import logging
import os
import sys
from cliff.command import Command
from cliff.lister import Lister
from cliff.show import ShowOne
import ara.cli.utils as cli_utils
from... | dmsimard/ara | ara/cli/result.py | Python | gpl-3.0 | 10,301 |
"""
IDAPython script to annotate IDB files with information extracted from the
MSDN documentation including functions, arguments and constants.
Authors: Moritz Raabe, William Ballenthin
Copyright 2014 Mandiant, A FireEye Company
Mandiant licenses this file to you under the Apache License, Version
2.0 (the "License");... | nihilus/flare-ida | python/flare/IDB_MSDN_Annotator/__init__.py | Python | apache-2.0 | 22,021 |
__author__ = 'rakesh.varma'
from fabric.api import *
class nginx_install:
def __init__(self, host_ip, host_user, host_key_file):
env.host_string = host_ip
env.user = host_user
env.key_filename = host_key_file
def install(self):
sudo('apt-get update')
sudo('apt-get inst... | varmarakesh/devops-toolbox | devops-toolbox/nginx/install.py | Python | isc | 369 |
"""
This Molotov script demonstrates how to hook events.
"""
import molotov
@molotov.events()
async def print_request(event, **info):
if event == "sending_request":
print("=>")
@molotov.events()
async def print_response(event, **info):
if event == "response_received":
print("<=")
@molot... | loads/molotov | molotov/tests/example5.py | Python | apache-2.0 | 534 |
# Copyright 1998-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.dbapi import dbapi
from portage import cpv_getkey
class fakedbapi(dbapi):
"""A fake dbapi that allows consumers to inject/remove packages to/from it
portage.settings is required to maintain the d... | Neuvoo/legacy-portage | pym/portage/dbapi/virtual.py | Python | gpl-2.0 | 3,914 |
"""
Settings to run Studio in devstack using optimized static assets.
This configuration changes Studio to use the optimized static assets generated for testing,
rather than picking up the files directly from the source tree.
The following Paver command can be used to run Studio in optimized mode:
paver devstack s... | atsolakid/edx-platform | cms/envs/devstack_optimized.py | Python | agpl-3.0 | 1,550 |
import xml.etree.ElementTree as ET
from enum import Enum
from urh.simulator.SimulatorItem import SimulatorItem
class SimulatorRule(SimulatorItem):
def __init__(self):
super().__init__()
def set_parent(self, value):
if value is not None:
assert value.parent() is None
supe... | jopohl/urh | src/urh/simulator/SimulatorRule.py | Python | gpl-3.0 | 2,389 |
# domain management
#
# Copyright Matthias Dieter Wallnoefer 2009
# Copyright Andrew Kroeger 2009
# Copyright Jelmer Vernooij 2007-2012
# Copyright Giampaolo Lauria 2011
# Copyright Matthieu Patou <mat@matws.net> 2011
# Copyright Andrew Bartlett 2008-2015
# Copyright Stefan Metzmacher 2012
#
# This program is free soft... | jelmer/samba | python/samba/netcmd/domain.py | Python | gpl-3.0 | 176,123 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | sbrichards/rockstor-core | src/rockstor/smart_manager/data_collector.py | Python | gpl-3.0 | 15,176 |
'''
This is less of a helper function file and more of a pile of things
where I wasn't sure of where to put.
A lot of things could probably be consolidated or removed. There are many
non-independent functions which are part of HotSpotter. They should be removed
and put into their own module. The standalone functions sh... | SU-ECE-17-7/hotspotter | hscom/helpers.py | Python | apache-2.0 | 58,687 |
# -*- coding: utf-8 -*-
{
'!langcode!': 'uk',
'!langname!': 'Українська',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"Оновити" це додатковий вираз, такий, як "field1=\'нове_значення\'". Ви не можете змінювати або вилучати дані об\'єднаних таблиць... | DaytonGarcia/quizmodule | languages/uk.py | Python | gpl-3.0 | 15,123 |
# -*- coding: utf-8 -*-
"""
Project name: OMSTD
Project URL: https://github.com/cr0hn/open_shortener
Copyright (c) 2014, cr0hn<-AT->cr0hn.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistr... | cr0hn/OMSTD | examples/develop/lp/005/lp-005-s1.py | Python | bsd-2-clause | 1,958 |
#!/usr/bin/env python
from base_test import DakTestCase
import unittest
from daklib.lintian import parse_lintian_output, generate_reject_messages
class ParseLintianTestCase(DakTestCase):
def assertParse(self, output, expected):
self.assertEqual(
list(parse_lintian_output(output)),
... | tanglu-org/tdak | tests/test_lintian.py | Python | gpl-2.0 | 4,104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.