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 cmio import Joint | esetomo/mio | script/pymio/rigging/joint.py | Python | gpl-3.0 | 22 |
#!/usr/bin/env python3
# This file is part of SunlightDPD - a home for open source software
# related to the dissipative particle dynamics (DPD) simulation
# method.
# Based on an original code copyright (c) 2007 Lucian Anton.
# Modifications copyright (c) 2008, 2009 Andrey Vlasov. Additional
# modifications copyrig... | patrickbwarren/SunlightHNC | x_dmu_compare.py | Python | gpl-2.0 | 3,085 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at y... | yannrouillard/weboob | modules/bp/pages/accountlist.py | Python | agpl-3.0 | 3,140 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Red Hat, Inc.
#
# This library 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; either
# version 2.1 of the License, or (at your option) ... | lubomir/productmd | tests/test_common.py | Python | lgpl-2.1 | 3,318 |
#!/usr/bin/env python
###
# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP
#
# 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 limita... | miqui/python-hpOneView | examples/scripts/get-san-manager.py | Python | mit | 3,746 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2006 Donald N. Allingham
#
# 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 t... | pmghalvorsen/gramps_branch | gramps/gen/datehandler/_date_sv.py | Python | gpl-2.0 | 6,514 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# beta.1 Regex de Dinozap
# Version 0.1 (17.10.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.mimediacent... | iptvgratis/TUPLAY | resources/regex/dinozap.py | Python | gpl-3.0 | 4,482 |
import logging
from passlib.context import CryptContext
import openerp
from openerp.osv import fields, osv
from openerp.addons.base.res import res_users
res_users.USER_PRIVATE_FIELDS.append('password_crypt')
_logger = logging.getLogger(__name__)
default_crypt_context = CryptContext(
# kdf which can be verified... | vileopratama/vitech | src/addons/auth_crypt/auth_crypt.py | Python | mit | 3,959 |
import json
import re
import scrapy
from locations.items import GeojsonPointItem
class McDonaldsPLSpider(scrapy.Spider):
name = "mcdonalds_pl"
allowed_domains = ["mcdonalds.pl"]
start_urls = (
'https://mcdonalds.pl/restauracje/getMarkers',
)
def store_hours(self, data):
day_groups... | iandees/all-the-places | locations/spiders/mcdonalds_pl.py | Python | mit | 2,591 |
# encoding: utf-8
# module samba.dcerpc.lsa
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/lsa.so
# by generator 1.135
""" lsa DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class ForestTrustBinaryData(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real sig... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/lsa/ForestTrustBinaryData.py | Python | gpl-2.0 | 754 |
# encoding:utf-8
"""
Objetos para saldo variante
"""
class VariantBalance():
def __init__(self,initial_balance,anual_interest):
self.balance = initial_balance
self.interest = (anual_interest+1)**(1/12)-1
self.months = 0
def pass_month(self):
self.balance += self.balan... | dslima90/SimuladorFinanciamento | VariantBalance.py | Python | apache-2.0 | 1,563 |
import discord
from discord.ext import commands
from cogs.utils.dataIO import dataIO, fileIO
from collections import namedtuple, defaultdict
from datetime import datetime
from random import randint
from copy import deepcopy
from .utils import checks
from __main__ import send_cmd_help
import os
import time
im... | GitAcrown/Kreybot | Krey/cogs/economy.py | Python | mit | 27,235 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | airflow/contrib/hooks/ftp_hook.py | Python | apache-2.0 | 10,430 |
#
## https://leetcode.com/problems/add-two-numbers/
#
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: List... | leonard-sxy/practice-and-accumulation | algorithm/leetcode/Python_2.7.10/00002.py | Python | mit | 1,829 |
"""URL configuration
"""
from django.urls import path
from . import views
app_name = 'fmrweb'
urlpatterns = [
path(r'', views.index, name='index'),
path(r'index.html', views.index, name='index-legacy'),
path(r'faq', views.faq, name='faq'),
path(r'faq.html', views.faq, name='faq-legacy'),
path(r'n... | fmrchallenge/fmrbenchmark-website | fmrweb/urls.py | Python | mit | 1,246 |
"""
====================================================
Shuffle channels' data in the time domain and plot.
====================================================
"""
# Author: Eberhard Eich
# Praveen Sripad
#
# License: BSD (3-clause)
import numpy as np
import os.path as op
import mne
from jumeg.j... | fboers/jumeg | examples/connectivity/plot_shuffle_time_slices.py | Python | bsd-3-clause | 2,449 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.template
"""
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
import template
from template import render
class TestTemplate(unittest.TestCase):
def testRun(self):
self.assertEqual(render(content='{{for ... | seadsystem/website | web2py/gluon/tests/test_template.py | Python | mit | 6,382 |
import _plotly_utils.basevalidators
class FamilysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="familysrc", parent_name="barpolar.hoverlabel.font", **kwargs
):
super(FamilysrcValidator, self).__init__(
plotly_name=plotly_name,
p... | plotly/python-api | packages/python/plotly/plotly/validators/barpolar/hoverlabel/font/_familysrc.py | Python | mit | 475 |
# coding: utf-8
from __future__ import unicode_literals
from django.contrib import admin
from core.admin import SubcategoryAdmin, DetailAdmin
from .models import CutDetail, CutSubcategory
class CutSubcategoryAdmin(SubcategoryAdmin):
def get_form(self, request, obj=None, **kwargs):
from . import DETAIL_... | michaupl/materialsapp | cuts/admin.py | Python | apache-2.0 | 1,080 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__all__ = ['FilterAPI', 'FilterExtension', "FilterRegex", 'FilterPattern', ]
from filter_api import *
from extension_filter import *
from regex_filter import *
from pattern_filter import *
| RonenNess/Fileter | fileter/filters/__init__.py | Python | mit | 232 |
import logging as log
from SimpleXMLRPCServer import SimpleXMLRPCServer
class Aggregator(object):
"""
XML-RPC endpoints for aggregator functionality.
Why xmlrpc? Easy integration with any kind of external service and UI.
"""
def __init__(self, client):
self.client = client
def get_... | andreisavu/feedaggregator | aggregator/rpc.py | Python | bsd-2-clause | 803 |
#!/usr/bin/env python
"""
This script uploads raw data to figshare. It should be run on Windows with
a `.figsharerc` file in the user's home directory.
"""
from __future__ import division, print_function
import requests
from requests_oauthlib import OAuth1
import os
import json
article = "XXXXXXX" # TODO
def load_cr... | petebachant/TurbineDAQ-project-template | Scripts/upload.py | Python | mit | 4,124 |
from seth import versioning
from seth.tests import IntegrationTestBase
from seth.classy.rest import generics
class DefaultVersioningResource(generics.GenericApiView):
def get(self, **kwargs):
return {}
class NotShowVersionResource(generics.GenericApiView):
display_version = False
def get(self,... | jnosal/seth | seth/tests/test_versioning.py | Python | mit | 6,814 |
# coding: utf-8
import inspect
import logging
import sys
from contesto import config
LOG_FORMAT = "[%(asctime)s] %(levelname)s %(session_id)s: %(message)s"
class SessionStreamHandler(logging.StreamHandler):
def emit(self, record):
self.stream = sys.stderr
super(SessionStreamHandler, self).emit(... | 2gis/contesto | contesto/utils/log.py | Python | mit | 1,291 |
import mock
import os
from django.test import TestCase
from jinja2 import Environment, FileSystemLoader
from jinja2.environment import Template
from opbeat.contrib.django.models import opbeat, get_client
class InstrumentJinja2Test(TestCase):
def setUp(self):
self.client = get_client()
filedir = ... | daikeren/opbeat_python | tests/instrumentation/jinja2_tests/jinja2_tests.py | Python | bsd-3-clause | 2,300 |
# Copyright 2013 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | devsim/devsim | python_packages/model_create.py | Python | apache-2.0 | 6,933 |
import os
import csv
import numpy as np
# Read in the data from a template CSV
tableData = []
csv_filepath = os.path.join(
os.path.dirname(__file__), 'template_table_temp.csv')
with open(csv_filepath, 'r') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
tableData.append(row)
# Set... | vitale232/ves | ves/templates/tempData.py | Python | lgpl-3.0 | 3,462 |
# -*- coding: utf-8 -*-
import bot
import socket
def is_valid_ipv4_address(address):
try:
socket.inet_pton(socket.AF_INET, address)
except AttributeError: # no inet_pton here, sorry
try:
socket.inet_aton(address)
except socket.error:
return False
return... | shacknetisp/vepybot | plugins/internet/ip.py | Python | mit | 3,473 |
#
# Copyright (c) 2008--2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | hustodemon/spacewalk | client/tools/rhnpush/rhnpush.py | Python | gpl-2.0 | 26,255 |
from examples.all_examples import showcase_all_examples
if __name__ == '__main__':
showcase_all_examples()
| frrmack/googlesearch | run_examples.py | Python | mit | 118 |
# coding: utf-8
# Django db
from django.db import models
# Fields (Requirements)
from djangocms_text_ckeditor.fields import HTMLField
#Filer (Requirements)
from filer.fields.image import FilerImageField
from filer.fields.folder import FilerFolderField
# Taggit (Requirements)
from taggit.managers import TaggableMana... | Pyc0kw4k/djangocms-portfolio | djangocms_portfolio/models.py | Python | apache-2.0 | 2,018 |
# coding=utf-8
import unittest
import json
from docker import container_config
class ContainerConfigTest(unittest.TestCase):
def test_build_config(self):
new_container = container_config.ContainerConfig()
new_container.set_image('ubuntu:14.04')
new_container.set_hostname('te... | PinaeCloud/docker-api | docker_test/container_config_test.py | Python | apache-2.0 | 1,674 |
# pylint: disable=missing-docstring, no-name-in-module, invalid-name
from behave import given, then
from os.path import isdir, isfile
from nose.tools import assert_true, assert_false, assert_not_in, assert_multi_line_equal
from bddbot.config import CONFIG_FILENAME
@given("the file \"{filename:Path}\" doesn't exist")
... | nivbend/bdd_bot | features/steps/filesystem.py | Python | mit | 2,885 |
"""
This is intended ot be imported by other scripts to handle a lot of the
default command line options
(c) 2015 Massachusetts Institute of Technology
"""
# Native
import logging
import sys
import os
logger = logging.getLogger(__name__)
# LO-PHI
import lophi.globals as G
def parser(opts, callback, arg... | mit-ll/LO-PHI | python-lophi/lophi/command_line.py | Python | bsd-3-clause | 1,675 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_preferences_operations.py | Python | mit | 22,341 |
from scapy.all import *
packets = sniff(iface='tap0', count='1000')
with open('packets.cap','w') as f:
f.write(packets)
| bcoffey218/offsec | sniffer.py | Python | mit | 126 |
#!/usr/bin/env python
# Copyright (c) 2010-2015 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS"... | matrix207/RAMCloud | scripts/recovery.py | Python | isc | 14,227 |
#!/usr/bin/env python
import os, pickle, random, time
try:
os.remove('my_gp_module.pyc')
except OSError:
pass
import scipy as sp
from scipy.linalg import eigh
from my_gp_module import GaussianProcess
import matplotlib.pyplot as plt
# --------------------------------------------
# WHAT IT DOES:
# Given Ntest ... | marcocaccin/MarcoGP | alpha_trends.py | Python | apache-2.0 | 4,979 |
# *- coding: utf-8 -*-
# pylint: disable=wildcard-import, missing-docstring, no-self-use, bad-continuation
# pylint: disable=invalid-name, unused-wildcard-import, unused-import, import-outside-toplevel
""" Test «some_module».
"""
# Copyright © 2015 - 2019 Jürgen Hermann <jh@web.de>
#
# Licensed under the Apache Licens... | jhermann/rudiments | src/tests/test_security.py | Python | apache-2.0 | 4,691 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 13 14:00:12 2017
@author: hxc
"""
import numpy as np
from matplotlib import pyplot as plt
#指数平滑公式
def exponential_smoothing(alpha, s):
s2 = np.zeros(s.shape)
s2[0] = s[0]
for i in range(1, len(s2)):
s2[i] = alpha*s[i]+(1-alpha)*s2[i-1]... | Data-Analysis-Team/Data-Analysis-Platform_V0.1 | alarm.py | Python | apache-2.0 | 4,142 |
# -*- coding: utf-8 -*-
"""This file imports Python modules that register CLI helpers."""
from plaso.cli.helpers import analysis_plugins
from plaso.cli.helpers import artifact_definitions
from plaso.cli.helpers import artifact_filters
from plaso.cli.helpers import data_location
from plaso.cli.helpers import date_filte... | Onager/plaso | plaso/cli/helpers/__init__.py | Python | apache-2.0 | 1,723 |
import collections
import struct
from supriya import CalculationRate, ParameterRate, utils
from supriya.system.SupriyaObject import SupriyaObject
class SynthDefDecompiler(SupriyaObject):
"""
SynthDef decompiler.
::
>>> import supriya.synthdefs
>>> import supriya.ugens
>>> with s... | Pulgama/supriya | supriya/synthdefs/SynthDefDecompiler.py | Python | mit | 11,933 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Smile (<http://www.smile.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... | tiexinliu/odoo_addons | smile_log/tools/db_logger.py | Python | agpl-3.0 | 2,985 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/profile/ui.py | Python | lgpl-3.0 | 3,246 |
# -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests.common import TransactionCase
class TestMedicalPrescriptionOrderLine(TransactionCase):
def setUp(self):
super(TestMedicalPrescriptionOrderLine, self).setUp()
self.pat... | laslabs/vertical-medical | medical_prescription_disease_state/tests/test_medical_prescription_order_line.py | Python | agpl-3.0 | 2,956 |
import os
from parso._compatibility import FileNotFoundError
class FileIO(object):
def __init__(self, path):
self.path = path
def read(self): # Returns bytes/str
# We would like to read unicode here, but we cannot, because we are not
# sure if it is a valid unicode file. Therefore ju... | sserrot/champion_relationships | venv/Lib/site-packages/parso/file_io.py | Python | mit | 1,333 |
#!/usr/bin/env python
import sys
import logging
import logging.handlers
#The terminal has 8 colors with codes from 0 to 7
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#These are the sequences need to get colored ouput
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
#The backg... | ashkankzme/IAISCustomsLoadTest | web/log/config.py | Python | apache-2.0 | 3,429 |
from .systems import *
from .bases import *
from .operators import *
from .stateoperators import *
from .integrators import *
from .measurements import *
| matthewwardrop/python-qubricks | qubricks/wall/__init__.py | Python | mit | 154 |
import _plotly_utils.basevalidators
class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bordercolor", parent_name="densitymapbox.colorbar", **kwargs
):
super(BordercolorValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_bordercolor.py | Python | mit | 441 |
version_info = (4, 3, 0)
__version__ = '.'.join(map(str, version_info))
| unnikrishnankgs/va | venv/lib/python3.5/site-packages/qtconsole/_version.py | Python | bsd-2-clause | 72 |
"""
Compatibility helpers for older Python versions.
"""
import sys
PY2 = sys.version_info[0] == 2
| praba230890/PYPOWER | pypower/_compat.py | Python | bsd-3-clause | 103 |
import copy
import os.path
import sys
class ModuleRegulator:
def __init__(self, sim, modName, biophys=None, signalling=None):
self.modName = modName
self.sim = sim
self.cellStates = sim.cellStates
self.biophys = biophys
self.signal = signalling
self.module = None
... | pakpoomton/CellmodellerShadow | CellModeller/Regulation/ModuleRegulator.py | Python | bsd-3-clause | 2,405 |
#!/usr/bin/env python
"""Test Arm Calibrator
Usage:
./calibrate.py [options]
Options:
-h, --help Show this help screen.
--version Show the version.
--ainroot=<ainroot> The location of the AIN raw files. [default: /sys/bus/iio/devices/iio:device0]
--pwmroot=<pwmroot> The location ... | ProjectHexapod/bbbStuff | testArm/calibrate.py | Python | mit | 2,442 |
#!/usr/bin/env python
import sys
from passlib.hash import sha512_crypt
print sha512_crypt.encrypt(sys.argv[1])
| dr-slump/larantuka | ansible/add_linux_multi_user/make_pass.py | Python | mit | 114 |
# Copyright 2013 IBM Corp.
#
# 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... | bigswitch/nova | nova/tests/unit/objects/test_objects.py | Python | apache-2.0 | 57,620 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygit2 import GIT_REF_OID
from pygit2 import GIT_REF_SYMBOLIC
from pygit2 import Signature
from ellen.utils import JagareError
def update_ref(repository, ref, newvalue):
"""git update-ref/symbolic-ref command, pygit2 wrapper.
:param ref: the full name of t... | douban/ellen | ellen/git/ref.py | Python | bsd-3-clause | 1,830 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/addons | tensorflow_addons/activations/tests/softshrink_test.py | Python | apache-2.0 | 1,364 |
# coding: utf-8
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import asyncio
import datetime
import hashlib
imp... | dpassante/ansible | hacking/build_library/build_ansible/announce.py | Python | gpl-3.0 | 9,475 |
# Copyright 2016 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.
"""Identifies key events related to user satisfaction.
Several lenses are defined, for example FirstTextPaintLens and
FirstSignificantPaintLens.
"""
import ... | junhuac/MQUIC | src/tools/android/loading/user_satisfied_lens.py | Python | mit | 5,080 |
'''
Prototype functionality for interacting with the Source model directly, including tab-completion in IPython/Jupyter. Eg
v = veneer.Veneer()
scenario = Queryable(v)
scenario.Name = 'New Scenario Name'
'''
class Queryable(object):
def __init__(self,v,path='scenario',namespace=None):
self._v = v
... | flowmatters/veneer-py | veneer/navigate.py | Python | isc | 2,265 |
"""Types used in configuration module for Spark's performance tests."""
class OptionSet(object):
"""Represents an option and a set of values for it to sweep over."""
def __init__(self, name, vals, can_scale=False):
self.name = name
self.vals = vals
self.can_scale = can_scale
def sc... | feynmanliang/spark-perf | lib/sparkperf/config_utils.py | Python | apache-2.0 | 2,005 |
import json
from django.test import TestCase, RequestFactory
from ..backends import get_oauthlib_core
from ..oauth2_backends import OAuthLibCore, JSONOAuthLibCore
class TestOAuthLibCoreBackend(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.oauthlib_core = OAuthLibCore()
de... | Gr1N/django-oauth-toolkit | oauth2_provider/tests/test_oauth2_backends.py | Python | bsd-2-clause | 2,421 |
from __future__ import with_statement
import os, \
mmap
import aleatory
import ctypes
np = None
try:
import numpy as np
except ImportError, err: pass
json = None
try:
import json
except:
try:
import simplejson as json
except ImportError, err: pass
etree = None
try:
import lxml.e... | jmercier/Codebench | shmem.py | Python | mit | 1,955 |
#!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | chrismeyersfsu/ansible-modules-core | cloud/docker/docker_service.py | Python | gpl-3.0 | 36,629 |
# -*- coding: utf-8 -*-
"""Tests of MathClass in pygeoc.utils
@author: Liangjun Zhu
@changlog:
- 17-09-16 lj - origin version.
"""
from pygeoc.utils import MathClass
import pytest
def test_mathclass_isnumerical():
assert MathClass.isnumerical('78') == True
assert MathClass.isnumerical('1.e-5') ... | lreis2415/PyGeoC | tests/test_utils_math.py | Python | mit | 425 |
import os.path
import thread
import console_helper
MKDIR_LOCK=thread.allocate_lock()
def get_ext_filename(filename):
if not '.' in filename:
return ''
else:
return filename[filename.rfind('.')+1:]
def get_obj_filename(filename):
ext = get_ext_filename(filename)
return ... | cnwzhjs/onemake | lib/path_helper.py | Python | bsd-2-clause | 1,119 |
# $Id: __init__.py 6433 2010-09-28 08:21:25Z milde $
# Authors: David Goodger <goodger@python.org>; Ueli Schlaepfer
# Copyright: This module has been placed in the public domain.
"""
This package contains modules for standard tree transforms available
to Docutils components. Tree transforms serve a variety of purposes... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/transforms/__init__.py | Python | gpl-2.0 | 6,505 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 ... | AMOboxTV/AMOBox.LegoBuild | plugin.video.titan/resources/lib/resolvers/ishared.py | Python | gpl-2.0 | 1,793 |
"""Definitions of data tables primarily coming from EIA-861."""
from typing import Any, Dict, List
RESOURCE_METADATA: Dict[str, Dict[str, Any]] = {
"advanced_metering_infrastructure_eia861": {
"description": "The data contain number of meters from automated meter readings (AMR) and advanced metering infras... | catalyst-cooperative/pudl | src/pudl/metadata/resources/eia861.py | Python | mit | 23,777 |
import re
import textwrap
import codewave_core.command as command
import codewave_core.util as util
import codewave_core.logger as logger
import codewave_core.detector as detector
import codewave_core.box_helper as box_helper
import codewave_core.edit_cmd_prop as edit_cmd_prop
def initCmds():
js = command.cmds.addCm... | kevthunder/codewave-subl | codewave_core/cmds/js.py | Python | gpl-2.0 | 1,288 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public t... | kinnou02/navitia | source/jormungandr/jormungandr/georef.py | Python | agpl-3.0 | 5,414 |
#!/bin/env python
# -*- coding: utf-8; -*-
#
# (c) 2016 FABtotum, http://www.fabtotum.com
#
# This file is part of FABUI.
#
# FABUI 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 Licen... | infinity0n3/fabtotum-experiments | fabtotum/fabui/database.py | Python | gpl-3.0 | 825 |
# coding: utf-8
# flake8: noqa
# Import all APIs into this package.
# If you have many APIs here with many many models used in each API this may
# raise a `RecursionError`.
# In order to avoid this, import only the API that you directly need like:
#
# from .api.autoscaler_api import AutoscalerApi
#
# or import this... | Yelp/paasta | paasta_tools/paastaapi/apis/__init__.py | Python | apache-2.0 | 776 |
from flask import session, flash, request, url_for, redirect
from flask_login import login_user
from flask_babel import gettext as _
from ..models import db, User
def login_success(email, access_token, remote_id, service_name, **kwargs):
user = User.query.filter_by(email=email).first()
if user is None:
... | zgoda/zakwasy | zkw/auth/utils.py | Python | mit | 955 |
"""Support for Logi Circle sensors."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_BATTERY_CHARGING,
CONF_MONITORED_CONDITIONS,
CONF_S... | lukas-hetzenecker/home-assistant | homeassistant/components/logi_circle/sensor.py | Python | apache-2.0 | 4,505 |
# -*- coding:Utf-8 -*-
from django.utils.timezone import now as datetime_now
from mongoengine import DynamicDocument, fields
from django.conf import settings
from realtime.utils import emit_to_channel
__all__ = (
'TimelineEntry',
)
class TimelineEntry(DynamicDocument):
tenant = fields.ReferenceField("Tena... | Naeka/vosae-app | www/timeline/models/base.py | Python | agpl-3.0 | 1,805 |
#!/usr/bin/env python
import gtk
from kiwi.ui.delegates import Delegate
class Farenheit(Delegate):
widgets = ["quitbutton", "temperature", "celsius", "farenheit",
"celsius_label" , "farenheit_label", "temperature_label"]
gladefile = "faren"
def __init__(self):
Delegate.__init__(self... | Schevo/kiwi | examples/framework/faren/faren3.py | Python | lgpl-2.1 | 1,226 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 TurboCoin
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test share/rpcauth/rpcauth.py
"""
import base64
import configparser
import hmac
import importlib
import os
import sys
imp... | Phonemetra/TurboCoin | test/util/rpcauth-test.py | Python | mit | 1,701 |
data = (
'Bo ', # 0x00
'Chi ', # 0x01
'Gua ', # 0x02
'Zhi ', # 0x03
'Kuo ', # 0x04
'Duo ', # 0x05
'Duo ', # 0x06
'Zhi ', # 0x07
'Qie ', # 0x08
'An ', # 0x09
'Nong ', # 0x0a
'Zhen ', # 0x0b
'Ge ', # 0x0c
'Jiao ', # 0x0d
'Ku ', # 0x0e
'Dong ', # 0x0f
'Ru ',... | gquirozbogner/contentbox-master | third_party/unidecode/x063.py | Python | apache-2.0 | 4,914 |
import urllib
class AppURLopener(urllib.FancyURLopener):
version = "gCn/1.0 (TI Graphing Calculator; Doors CS 7; Sandpaper)"
urllib._urlopener = AppURLopener()
from calcrepo import info
from calcrepo import repo
class TicalcRepository(repo.CalcRepository):
baseUrl = "http://www.ticalc.org"
def getRootFldr(self... | KermMartian/gCn | gcnftp/calcrepo/ticalc.py | Python | bsd-3-clause | 6,386 |
"""
*********
Shapefile
*********
Generates a networkx.DiGraph from point and line shapefiles.
"The Esri Shapefile or simply a shapefile is a popular geospatial vector
data format for geographic information systems software. It is developed
and regulated by Esri as a (mostly) open specification for data
interoperabil... | valiantljk/graph-partition | readwrite/nx_shp.py | Python | gpl-2.0 | 7,520 |
#!/usr/bin/env python
import boto
from boto.s3.connection import OrdinaryCallingFormat
from fabric.api import prompt
def confirm(message):
"""
Verify a users intentions.
"""
answer = prompt(message, default="Not at all")
if answer.lower() not in ('y', 'yes', 'buzz off', 'screw you'):
exit... | swastvedt/dailygraphics | fabfile/utils.py | Python | mit | 813 |
# Copyright 2016 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 law or agreed to in ... | openstack/mistral | mistral/db/sqlalchemy/migration/alembic_migrations/versions/015_add_unique_keys_for_non_locking_model.py | Python | apache-2.0 | 1,321 |
from django.db import models
from storage.models import Storage
class Box(models.Model): #extend django's Model class
#field in the database
tag = models.CharField(max_length = 100)
storage = models.ForeignKey(Storage) #f.key for the many-to-one relationship
def __str__(self):
return self.t... | gallardjm/TUM_WebTech_DjangoExample | webtech_django1/box/models.py | Python | mit | 324 |
"""
image.py
This module provides a simple interface to create a window, load an image and experiment
with image based algorithms. Many of which require pixel-by-pixel manipulation. This
is a educational module, its not intended to replace the excellent Python Image Library, in fact
it uses PIL.
The module and its... | mikar/image-filter | cImage.py | Python | mit | 14,510 |
import re
if re.search("j[a-zõ]u", "Ta jõudis vaevu-vaevu kohale."):
print("sisaldub")
else:
print("ei sisaldu") | captainhungrykaboom/MTAT.TK.006 | 20. märts - 26. märts ülesanded/proovi ül.py | Python | mit | 126 |
from .__version__ import __application_name__, __version__
from .pressenter2exit import PressEnter2Exit
from .pressenter2exitgui import PressEnter2ExitGUI
| jamesabel/pressenter2exit | pressenter2exit/__init__.py | Python | mit | 156 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-websecurityscanner | samples/generated_samples/websecurityscanner_v1alpha_generated_web_security_scanner_create_scan_config_async.py | Python | apache-2.0 | 1,816 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013,2018 ARM Limited
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 applic... | mesheven/pyOCD | pyocd/target/target_MKL27Z256xxx4.py | Python | apache-2.0 | 6,829 |
import argparse, csv, hashlib
parser = argparse.ArgumentParser(description='process some integers')
parser.add_argument('csv_path', type=str, nargs=1, help='set path to the csv file')
parser.add_argument('out_path', type=str, nargs=1, help='set path to the svm file')
args = parser.parse_args()
CSV_PATH, OUT_PATH = ar... | JasonWayne/avazu-essay | temp/add_dummy_label.py | Python | mit | 546 |
from .gsh_functions import hex_eval
from .gsh_functions import cub_eval
from .gsh_functions import tri_eval
from .gsh_functions import hex_basis_info
from .gsh_functions import cub_basis_info
from .gsh_functions import tri_basis_info
from .imag_ffts import _ImagFFTBasis
import numpy as np
class GSHBasis(_ImagFFTBasis... | davidbrough1/pymks | pymks/bases/gsh.py | Python | mit | 7,708 |
from orgparse import date
EVENTCLASS_DATECLASS_MAP = [
('scheduled', date.OrgDateScheduled),
('deadline', date.OrgDateDeadline),
('closed', date.OrgDateClosed),
('clock', date.OrgDateClock),
]
class Event(object):
"""
A class representing event.
Let's quickly create an org node and make... | tkf/orgviz | orgviz/event.py | Python | mit | 6,921 |
"""This module handles the Function class in Python.
"""
# Copyright (C) 2009-2014 Johan Hake
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3... | MiroK/dolfin | site-packages/dolfin/functions/function.py | Python | gpl-3.0 | 24,685 |
from django.db.models import get_model
from django.utils.translation import ugettext
# a notice like "foo and bar are now friends" is stored in the database
# as "{auth.User.5} and {auth.User.7} are now friends".
#
# encode_object takes an object and turns it into "{app.Model.pk}" or
# "{app.Model.pk.msgid}" if named ... | brosner/django-notification | notification/message.py | Python | mit | 3,596 |
# from matplotlib import pyplot as plt
from matplotlib import figure
import pygtk
pygtk.require("2.0")
import gtk
try:
from twisted.internet import gtk2reactor
gtk2reactor.install()
except:
pass
from twisted.internet import reactor
import numpy as np
from twisted.internet import task
from cPickle import loa... | schristakidis/p2ner | p2ner/components/ui/gtkgui/gtkgui/plotGui.py | Python | apache-2.0 | 10,154 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (C) 2009-2010 Nicolas P. Rougier
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#---------------... | Flavsditz/projects | eyeTracking/pupil/pupil_src/shared_modules/atb/constants.py | Python | gpl-2.0 | 1,491 |
from toee import *
def OnBeginSpellCast( spell ):
print "Heroes' Feast OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-conjuration-conjure", spell.caster )
def OnSpellEffect( spell ):
print "Heroes' Fea... | GrognardsFromHell/TemplePlus | tpdatasrc/co8infra/scr/Spell225 - Heroes' Feast.py | Python | mit | 1,697 |
try:
from django.conf.urls.defaults import patterns, url
except ImportError:
from django.conf.urls import patterns, url
urlpatterns = patterns(
'smart_selects.views',
url(r'^all/(?P<app>[\w\-]+)/(?P<model>[\w\-]+)/(?P<field>[\w\-]+)/(?P<value>[\w\-]+)/$',
'filterchain_all', name='chained_filter... | uraniumanchor/django-smart-selects | smart_selects/urls.py | Python | bsd-3-clause | 637 |
def __load():
import imp, os, sys
ext = 'pygame/pixelcopy.so'
for path in sys.path:
if not path.endswith('lib-dynload'):
continue
ext_path = os.path.join(path, ext)
if os.path.exists(ext_path):
mod = imp.load_dynamic(__name__, ext_path)
break
... | mokuki082/EggDrop | code/build/bdist.macosx-10.6-intel/python3.4-standalone/app/temp/pygame/pixelcopy.py | Python | gpl-3.0 | 398 |
"""
batch.py
Batch simulation for M1 model using NetPyNE
"""
from netpyne.batch import Batch
import numpy as np
def runBatch(b, label, setup='mpi_bulletin'):
b.batchLabel = label
b.saveFolder = 'data/'+b.batchLabel
b.method = 'grid'
if setup == 'mpi_bulletin':
b.runCfg = {'type': 'mpi_bulle... | Neurosim-lab/netpyne | examples/batchCellMapping/batch.py | Python | mit | 1,998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.