code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
##############################################################################
#
# Romanian accounting localization for OpenERP V7
# @author - Fekete Mihai, Tatár Attila <atta@nvm.ro>
# Copyright (C) 2011-2013 TOTAL PC SYSTEMS (http://www.www.erpsystems.ro).
# Copyright (C)... | yoyo2k/l10n-romania | partner_create_by_vat/res_partner.py | Python | agpl-3.0 | 9,585 |
# -*- coding: utf-8 -*-
"""Tree utilities
"""
class TranslationKind(object):
in_ = 'in'
out_ = 'out'
def _normalize_branche(branche, node_mapping):
new_branches = []
if node_mapping:
node_id = node_mapping.get('node_id')
parts = node_id.split('/')
aliases = node_mapping.get('... | ecreall/deform_treepy | deform_treepy/utilities/tree_utility.py | Python | agpl-3.0 | 11,176 |
def fail_acquire_settings(log_printer, settings_names_dict):
"""
This method throws an exception if any setting needs to be acquired.
:param log_printer: Printer responsible for logging the messages.
:param settings: A dictionary with the settings name as key and
... | Tanmay28/coala | coalib/output/Interactions.py | Python | agpl-3.0 | 1,188 |
import discord
from discord.ext import commands
import json
import asyncio
import sys
import checks
import os
try:
from urllib.request import urlretrieve
except Exception as e:
pass
import json
import unicodedata
os.chdir(os.path.dirname(os.path.realpath(__file__)))
with open('config.json') as json_data_file:
c... | jelliedpizza/RoleBot | RoleBot/brain.py | Python | agpl-3.0 | 4,740 |
#coding: utf-8
from flask import current_app
from flask_restplus import marshal
from APITaxi_models.hail import Hail, HailLog
from ..descriptors.hail import hail_model
from ..extensions import celery, redis_store_saved
import requests, json
@celery.task()
def send_request_operator(hail_id, endpoint, operator_header_n... | l-vincent-l/APITaxi | APITaxi/tasks/send_request_operator.py | Python | agpl-3.0 | 2,485 |
# imports from python libraries
import os
import hashlib
import datetime
import json
from itertools import chain # Using from_iterable()
# imports from installed packages
from django.contrib.auth.models import User
from django.db import models
from django_mongokit import connection
from django_mongokit import get_d... | supriyasawant/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/models.py | Python | agpl-3.0 | 72,774 |
# -*- coding: utf-8 -*-
#
# mete0r.gpl : Manage GPL'ed source code files
# Copyright (C) 2015 mete0r <mete0r@sarangbang.or.kr>
#
# 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, ... | mete0r/gpl | mete0r_gpl/__init__.py | Python | agpl-3.0 | 810 |
from people.models import Person
from optparse import make_option
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
raise ImportError("Neither json or simplejson are available on your system")
from django.core.management.base import BaseCommand, CommandE... | gdetrez/MyConf | apps/people/management/commands/addperson.py | Python | agpl-3.0 | 933 |
# -*- coding:Utf-8 -*-
from django.utils.translation import pgettext_lazy
from mongoengine import EmbeddedDocument, fields
__all__ = (
'Address',
)
class Address(EmbeddedDocument):
"""An address wrapper which can be embedded in any object."""
TYPES = (
("HOME", pgettext_lazy("address type", "H... | Naeka/vosae-app | www/contacts/models/embedded/address.py | Python | agpl-3.0 | 2,877 |
from fitbit import Fitbit
from datetime import date, datetime, time, timedelta
import json
# '''merges two response dicts based on the keys'''
# def combine(a, b):
# c = {}
# for key in a.keys():
# if (key.endswith('-intraday')):
# c[key] = a[key]
# c[key]['dataset'].extend(b[ke... | sociam/indx | apps/fitbit/bin/fitbit/fitbit_intraday.py | Python | agpl-3.0 | 3,324 |
try:
import cProfile as profile
except ImportError:
import profile
import pstats
from io import StringIO
from django.conf import settings
class ProfilerMiddleware(object):
"""
Simple profile middleware to profile django views. To run it, add ?prof to
the URL like this:
http://localhost:80... | kansanmuisti/kamu | profiler/middleware.py | Python | agpl-3.0 | 2,022 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields, api, _
from odoo.exceptions import UserE... | ingadhoc/purchase | purchase_stock_ux/models/purchase_order_line.py | Python | agpl-3.0 | 7,593 |
# coding=utf-8
from __future__ import absolute_import
import flask
import threading
import os
import yaml
import codecs
import time
from binascii import hexlify
from collections import defaultdict
from flask_babel import gettext
import octoprint.plugin
from octoprint.settings import valid_boolean_trues
from octoprint... | Jaesin/OctoPrint | src/octoprint/plugins/appkeys/__init__.py | Python | agpl-3.0 | 13,069 |
# -*- coding: utf-8 -*-
#
# Author: Andrea Gallina
# © 2015 Apulia Software srl
#
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
class TestInvoiceDueCost(TransactionCase):
def _create_pterm(self):
return self.env['account.payment.te... | hurrinico/l10n-italy | l10n_it_ricevute_bancarie/tests/test_invoice_due_cost.py | Python | agpl-3.0 | 5,359 |
from collections import defaultdict
from django.db import migrations
def set_post_election_from_post(apps, schema_editor):
"""
This is far from ideal. Try to guess the PostExtraElection
that this PostResult relates to. This will have to be done by looking
and the related memberships and assuming they... | DemocracyClub/yournextrepresentative | ynr/apps/uk_results/migrations/0030_populate_postresult_post_election.py | Python | agpl-3.0 | 3,360 |
from erukar.system.engine import MaterialGood
class AnimalHide(MaterialGood):
BaseName = "Animal Hide"
BriefDescription = "an animal's hide"
BasePricePerSingle = 13
WeightPerSingle = 0.9
| etkirsch/legends-of-erukar | erukar/content/inventory/materials/raw/AnimalHide.py | Python | agpl-3.0 | 204 |
"""
SkCode text align tag definitions code.
"""
from ..etree import TreeNode
class TextAlignBaseTreeNode(TreeNode):
""" Base class for all text alignment tag class. """
# HTML template for rendering
html_render_template = '<p class="text-{text_alignment}">{inner_html}</p>\n'
# Default text alignmen... | TamiaLab/PySkCode | skcode/tags/textalign.py | Python | agpl-3.0 | 1,809 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron and Valeureux Copyright Valeureux.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | Valeureux/wezer-exchange | __unreviewed__/community_marketplace/community_marketplace.py | Python | agpl-3.0 | 2,488 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Remittance Advice for Odoo
# Copyright (C) 2014 OpusVL
#
# 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 F... | OpusVL/odoo-remittance-advice | remittance_advice/__openerp__.py | Python | agpl-3.0 | 1,877 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
fiscalcode = fields.Char(
related="partner_id.fiscalcode", store=True, readonly=False
)
| OCA/l10n-italy | l10n_it_fiscalcode/model/res_company.py | Python | agpl-3.0 | 266 |
"""
Handle audited data changes.
"""
import logging
from functools import partial
from pymongo.errors import OperationFailure
from .versioned_item import VersionedItem, ChangedItem
from .._util import are_equals
from ..decorators import _get_host
from ..exceptions import NoDataFoundException, ConcurrentModificationEx... | manahl/arctic | arctic/store/audit.py | Python | lgpl-2.1 | 6,512 |
'''
@author: David W.H. Swenson
'''
from __future__ import division
from __future__ import absolute_import
from builtins import zip
from past.utils import old_div
from builtins import object
import os
from nose.tools import (assert_equal, assert_not_equal, assert_almost_equal)
from nose.plugins.skip import SkipTest
... | jhprinz/openpathsampling | openpathsampling/tests/test_toy_dynamics.py | Python | lgpl-2.1 | 12,227 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/libhio/package.py | Python | lgpl-2.1 | 2,974 |
# moosetree.py ---
#
# Filename: moosetree.py
# Description:
# Author: subhasis ray
# Maintainer:
# Created: Tue Jun 23 18:54:14 2009 (+0530)
# Version:
# Last-Updated: Sun Jul 5 01:35:11 2009 (+0530)
# By: subhasis ray
# Update #: 137
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
... | BhallaLab/moose-thalamocortical | pymoose/gui/moosetree.py | Python | lgpl-2.1 | 3,777 |
#
# This file is part of Mapnik (C++/Python mapping toolkit)
# Copyright (C) 2009 Artem Pavlenko
#
# Mapnik 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 any later versi... | qianwenming/mapnik | bindings/python/mapnik/__init__.py | Python | lgpl-2.1 | 35,583 |
import re
romanNumeralRegex = re.compile( "(?:.*\s+\(?)(([(?=[mclxvi])m*(c[md]|d?c*)(x[cl]|l?x*)(i[xv]|v?i*))(?:\.\s.*)", re.IGNORECASE )
romanNumeralChapterVerseRegex = re.compile( "(?:.*\s+\(?)(([(?=[mdclxvi])m*(c[md]|d?c*)(x[cl]|l?x*)(i[xv]|v?i*)(\.\s[0123456789]?[0123456789]))(?:.*)", re.IGNORECASE )
def regexMat... | MarkNenadov/TextFinch | regex.py | Python | lgpl-2.1 | 712 |
import sys
from ctypes import create_string_buffer
from ._libsoc import (
BITS_8, BITS_16, BPW_ERROR,
MODE_0, MODE_1, MODE_2, MODE_3, MODE_ERROR, api
)
PY3 = sys.version_info >= (3, 0)
class SPI(object):
def __init__(self, spidev_device, chip_select, mode, speed, bpw):
if not isin... | janick/libsoc | bindings/python/spi.py | Python | lgpl-2.1 | 4,256 |
#!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# 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
# v... | suizokukan/urwid | urwid/html_fragment.py | Python | lgpl-2.1 | 8,175 |
# -*- coding: utf-8 -*-
#
# Kate/Pâté plugins to work with C++ code formatting
# Copyright 2010-2013 by Alex Turbov <i.zaufi@gmail.com>
#
#
# This software 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... | hlamer/kate | addons/kate/pate/src/plugins/format.py | Python | lgpl-2.1 | 19,591 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | fifengine/fifengine-demos | pychan_demo/styling.py | Python | lgpl-2.1 | 3,586 |
import wx
import wx.grid
class GenericTable(wx.grid.GridTableBase):
def __init__(self, data, rowLabels=None, colLabels=None):
wx.grid.GridTableBase.__init__(self)
self.data = data
self.rowLabels = rowLabels
self.colLabels = colLabels
def GetNumberRows(self):
return len... | joseamaita/guiprog-python | wxpython/files/generictable.py | Python | lgpl-3.0 | 787 |
# This file is part of Pebble.
# Copyright (c) 2013-2021, Matteo Cafasso
# Pebble 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 of the License, or (at your option) any later versio... | noxdafox/pebble | pebble/concurrent/process.py | Python | lgpl-3.0 | 6,966 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris 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 of the License, or
# (at your option) any later ve... | Jozhogg/iris | lib/iris/tests/unit/fileformats/grib/load_convert/test_time_range_unit.py | Python | lgpl-3.0 | 1,951 |
# -*- coding: utf-8 -*-
# Copyright(C) 2009-2014 Florent Fourcot, Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob 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, either ... | vicnet/weboob | modules/ing/web/accounts_list.py | Python | lgpl-3.0 | 19,513 |
#!/usr/bin/env python
"""
################################################################################
# #
# rec #
# ... | wdbm/goutong | rec.py | Python | lgpl-3.0 | 3,034 |
# This file is part of the Universal Schema.
#
# The Universal Schema 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.
#... | genixpro/universal_schema | universal_schema/formats/emberdataformat.py | Python | lgpl-3.0 | 2,018 |
from six.moves import zip
from numpy import arange, searchsorted, array, eye, ones
from numpy.linalg import norm
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.bdf_interface.assign_type import integer, integer_or_blank
from pyNastran.bdf.dev_vectorized.cards.elements.solid.chexa8 import quad... | saullocastro/pyNastran | pyNastran/bdf/dev_vectorized/cards/elements/solid/chexa20.py | Python | lgpl-3.0 | 13,197 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/eve_obj/effect/repairs/ship_module_ancillary_remote_shield_booster.py | Python | lgpl-3.0 | 1,564 |
"""
PyLEMS API module.
:author: Gautham Ganapathy
:organization: LEMS (https://github.com/organizations/LEMS)
"""
from lems.model.fundamental import *
from lems.model.structure import *
from lems.model.dynamics import *
from lems.model.simulation import *
from lems.model.component import *
from lems.model.model impor... | LEMS/pylems | lems/api.py | Python | lgpl-3.0 | 328 |
# -*- coding: utf-8 -*-
__author__ = 'chinfeng'
__gum__ = 'web_console'
from .server import WebConsoleServer | chinfeng/gumpy | plugins/web_console/__init__.py | Python | lgpl-3.0 | 110 |
# -*- coding: utf-8 -*-
#
# pail documentation build configuration file, created by
# sphinx-quickstart on Sat May 4 03:26:35 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | ulif/pail | docs/conf.py | Python | lgpl-3.0 | 8,125 |
"""
KaraCos - web platform engine - http://karacos.org/
Copyright (C) 2009-2010 Nicolas Karageuzian - Cyril Gratecis
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... | karacos/karacos-wsgi | py/karacos/core/mail.py | Python | lgpl-3.0 | 2,688 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "clone.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sigma-geosistemas/clone | src/manage.py | Python | lgpl-3.0 | 248 |
# -*- coding: utf-8 -*-
{
"name": """Start-End dates in invoice and analytic lines""",
"summary": """Technical core for other modules""",
"category": "Accounting",
"images": [],
"version": "1.0.0",
"author": "IT-Projects LLC, Ivan Yelizariev",
"website": "https://it-projects.info",
"lic... | meta-it/misc-addons | account_invoice_dates/__openerp__.py | Python | lgpl-3.0 | 601 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 by Clearcode <http://clearcode.cc>
# and associates (see AUTHORS.md).
# This file is part of ianitor.
# ianitor 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 Foundat... | msabramo/ianitor | src/ianitor/service.py | Python | lgpl-3.0 | 4,043 |
from distutils.core import setup
setup(name = "pywapi-dbus",
version = "0.1-git",
description = "D-Bus Python Weather API Service is a D-Bus service providing weather information",
author = "Sasu Karttunen",
author_email = "sasu.karttunen@tpnet.fi",
url = "https://github.com/skfin/pywapi-dbus",
... | GunioRobot/pywapi-dbus | setup.py | Python | lgpl-3.0 | 1,419 |
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import gzip
from UM.Mesh.MeshReader import MeshReader #The class we're extending/implementing.
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType #To add the .gcode.gz files to the MIME type database.
from UM.Plugi... | Ultimaker/Cura | plugins/GCodeGzReader/GCodeGzReader.py | Python | lgpl-3.0 | 1,298 |
#
from .parser.statement import StatementReader
| akretion/python-cfonb | cfonb/__init__.py | Python | lgpl-3.0 | 48 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import argparse, re, os, glob, sys, pprint, itertools
import inspect
import numpy as np
config = {
'end': '\n',
'fmt': '%s ',
'sep': '->',
'file': None,... | NTMatBoiseState/FiberFit | src/fiberfit_model/helpers.py | Python | lgpl-3.0 | 1,174 |
import hou
from PySide2.QtCore import Slot, QSortFilterProxyModel, QRegExp, Qt
from PySide2.QtWidgets import QInputDialog, QMessageBox
from . import hpaste
from .hcollections.collectionwidget import CollectionWidget
from .hcollections.collectionbase import CollectionSyncError, CollectionItem
from .hcollections.github... | pedohorse/hpaste | python3.7libs/hpaste/hpastecollectionwidget.py | Python | lgpl-3.0 | 12,806 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: py_compile.py
"""Routine to "compile" a .py file to a .pyc (or .pyo) file.
This module has intimate knowledge of the format of .pyc files.
"""
impor... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/py_compile.py | Python | unlicense | 6,128 |
import os
from pathlib import Path
from PIL import Image
import pyconfig
import pydice
class ImageNotSupported(Exception):
pass
class BeardedDie:
def __init__(self, die):
self.die = die
# Time to strap our to_image to pydice's Die
if pyconfig.get('dicebeard.images_path'):
... | nasfarley88/dicebeard | python/dicebeard/skb_roll/beardeddie.py | Python | unlicense | 1,060 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
exts = [Extension("cython_hello_world",
["cython_hello_world.pyx"],
)]
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = exts,
)
| jeffzhengye/pylearn | speed/cython/scipy2013-cython-tutorial-master/exercises/hello-world/setup.py | Python | unlicense | 299 |
'''
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
'''
#Code is here
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# s... | zzzzzzzlmy/MyLeetCode | 83. Remove Duplicates from Sorted List.py | Python | unlicense | 742 |
import sys
import _pygeapi
class event_loop(object):
def __init__(self):
pass
def run(self):
while True:
cmd = _pygeapi.py_thread_next_cmd(sys.pygeapi_py_thread, 1000)
if cmd is None: continue
print(">", sys.pygeapi_py_thread, cmd)
if cmd == 1: break
def listen(self, hostname, port, backlog=... | ateska/striga2-pocs | greenev/pyge/evloop.py | Python | unlicense | 406 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 14. 先頭からN行を出力
import sys
if len(sys.argv) != 3:
print("Usage: python {} filename [num]".format(sys.argv[0]))
sys.exit()
with open(sys.argv[1]) as f:
print("".join(f.readlines()[:int(sys.argv[2])]))
| jtwp470/my-programming-learning-book | nlp100/python/14.py | Python | unlicense | 278 |
# -*- coding: utf-8 -*-
import Tkinter as tk
import tkFont
import ttk
from CMApp import *
class CMExportToolView(ttk.Frame):
"""
export excel table tool view
"""
def __init__(self, root, parent, width_):
ttk.Frame.__init__(self, parent, class_="CMExportToolView", width=width_)
se... | pengphei/cinemaman | ui/ExportToolView.py | Python | unlicense | 1,165 |
__author__="vvladych"
__date__ ="$09.10.2014 23:01:15$"
from forecastmgmt.dao.db_connection import get_db_connection
import psycopg2.extras
from MDO import MDO
from person_name import PersonName
class Person(MDO):
sql_dict={"get_all":"SELECT sid, common_name, birth_date, birth_place, person_uuid FROM fc_... | vvladych/forecastmgmt | src/forecastmgmt/model/person.py | Python | unlicense | 2,819 |
# pyOCD debugger
# Copyright (c) 2019 Arm Limited
# Copyright (c) 2020 Men Shiyun
# SPDX-License-Identifier: Apache-2.0
#
# 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.apac... | mbedmicro/pyOCD | pyocd/target/pack/cmsis_pack.py | Python | apache-2.0 | 22,742 |
import os
from anchore_engine.analyzers.syft.handlers.common import save_entry_to_findings
from anchore_engine.analyzers.utils import dig
def save_entry(findings, engine_entry, pkg_key=None):
if not pkg_key:
pkg_name = engine_entry.get("name", "")
pkg_version = engine_entry.get(
"vers... | anchore/anchore-engine | anchore_engine/analyzers/syft/handlers/python.py | Python | apache-2.0 | 2,570 |
# -*- coding: utf8 -*-
'''
Python SSAP API
Version 1.5
© Indra Sistemas, S.A.
2014 SPAIN
All rights reserved
'''
import sys
def bytes2String(data):
'''
Converts a Python 3 bytes object to a string.
'''
if sys.version_info[0] < 3:
return data
else:
return data.decode("utf... | Sofia2/python-api | src/ssap/utils/strings.py | Python | apache-2.0 | 334 |
# Copyright (c) 2012 OpenStack, LLC.
# 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 requi... | maoy/zknova | nova/scheduler/filters/io_ops_filter.py | Python | apache-2.0 | 1,650 |
import os
import sys
import json
import pytest
import subprocess
import time
from kat.harness import Query, is_ingress_class_compatible
from abstract_tests import AmbassadorTest, HTTP, ServiceType
from kat.utils import namespace_manifest
from tests.utils import KUBESTATUS_PATH
from ambassador.utils import parse_bool
... | datawire/ambassador | python/tests/kat/t_ingress.py | Python | apache-2.0 | 16,179 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/GetJobDocumentsResponse.py | Python | apache-2.0 | 1,161 |
# -*- 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-compute | google/cloud/compute_v1/services/forwarding_rules/transports/__init__.py | Python | apache-2.0 | 1,111 |
"""
For now just Alazar cards but should also support Acquiris.
"""
from Instrument import Instrument
from atom.api import Atom, Str, Int, Float, Bool, Enum, List, Dict, Coerced
import itertools, ast
import enaml
from enaml.qt.qt_application import QtApplication
class Digitizer(Instrument):
pass
class AlazarATS987... | rmcgurrin/PyQLab | instruments/Digitizers.py | Python | apache-2.0 | 6,043 |
#! /usr/bin/python
import MDAnalysis
import sys
from pylab import *
my_traj = sys.argv[1]
myTitle = sys.argv[2]
u = MDAnalysis.Universe(my_traj,my_traj)
OH = u.selectAtoms("segid B and resid 18 and name HO")
xArr = []
yArr = []
zArr = []
data = []
for ts in u.trajectory:
xArr.append(OH.coordinates()[0,0])
... | demharters/git_scripts | calc_movement_HO.py | Python | apache-2.0 | 795 |
import time
import sys
import os
import glob
from optparse import OptionParser, OptionGroup
import re
from source_coverage import source_coverage
from compose_units import get_top_level_funcs, get_outlier_funcs
from read_ktest import generate_assert_code, get_location_to_insert, modify_unit_files, get_lines_to_insert
f... | tum-i22/macke | leagacy/batch_klee.py | Python | apache-2.0 | 8,300 |
# Copyright 2016 Autodesk 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 writing... | tkzeng/molecular-design-toolkit | moldesign/exceptions.py | Python | apache-2.0 | 1,118 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio-core | platformio/util.py | Python | apache-2.0 | 9,050 |
##############################################################################
# Copyright 2016-2019 Rigetti Computing
#
# 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... | rigetticomputing/pyquil | pyquil/latex/latex_generation.py | Python | apache-2.0 | 1,266 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
from pyro.infer import TraceMeanField_ELBO
from pyro.infer.util import torch_backward, torch_item
def conditional(
Xnew,
X,
kernel,
f_loc,
f_scale_tril=None,
Lff=None,
full_cov=False,
... | uber/pyro | pyro/contrib/gp/util.py | Python | apache-2.0 | 7,130 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | noironetworks/horizon | openstack_dashboard/dashboards/identity/users/forms.py | Python | apache-2.0 | 14,486 |
from __future__ import unicode_literals
import logging
import re
import uuid
from tornado import gen
from zoonado import exc, WatchEvent
from .recipe import Recipe
log = logging.getLogger(__name__)
sequential_re = re.compile(r'.*[0-9]{10}$')
class SequentialRecipe(Recipe):
def __init__(self, base_path):
... | wglass/zoonado | zoonado/recipes/sequential.py | Python | apache-2.0 | 2,484 |
# Copyright 2021 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, ... | GoogleCloudPlatform/gcpdiag | gcpdiag/queries/gaes_stub.py | Python | apache-2.0 | 1,663 |
"""
A naming convention and discovery mechanism for HTTP endpoints.
Operations provide a naming convention for references between endpoints,
allowing easy construction of links or audit trails for external consumption.
"""
from collections import namedtuple
from enum import Enum, unique
# metadata for an operation
... | globality-corp/microcosm-flask | microcosm_flask/operations.py | Python | apache-2.0 | 3,019 |
# Copyright 2018 The GraphNets 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 applicabl... | deepmind/graph_nets | graph_nets/tests/blocks_test.py | Python | apache-2.0 | 43,860 |
#!/usr/bin/env python
"""CharRec.py: Runs a suite of ML algorithms on a character dataset"""
import logging
import numpy as np
import pandas as pd
from skimage import io, filters, exposure, morphology
from sklearn import tree, ensemble, neighbors, neural_network, multiclass
from sklearn.model_selection import cross... | DrigerG/IIITB-ML | project/CharRec/CharRec.py | Python | apache-2.0 | 4,197 |
# -*- coding:utf-8 -*-
# @version: 1.0
# @author:
# @date: '14-4-10'
import os
import logging
import threading
from ConfigParser import ConfigParser
from ConfigParser import NoSectionError, InterpolationMissingOptionError, Error
import simplejson as json
from utils.logger import Logger
_lock = ... | ChainBoy/init_python_project | utils/environment.py | Python | apache-2.0 | 5,907 |
# coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class GalleryForm(ModelForm):
class Meta:
... | trea-uy/djangocms-plugin-image-gallery | image_gallerys/cms_plugins.py | Python | apache-2.0 | 1,027 |
#!/usr/bin/env python3
# Copyright 2021 The CFU-Playground 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 a... | google/CFU-Playground | .github/scripts/generate_ci_matrix.py | Python | apache-2.0 | 3,604 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | examples/pipeline/data_transform/pipeline-data-transform-dense.py | Python | apache-2.0 | 2,334 |
from argparse import ArgumentParser
VERSION = "2.0.0"
def parse_args():
"""Parse args with argparse
:returns: args
"""
parser = ArgumentParser(description=f"Pymage Downloader {VERSION} - Download pics from different sites")
build_site_subparsers(parser)
parser.add_argument('--destination', ... | CharlieCorner/pymage_downloader | argparsers.py | Python | apache-2.0 | 5,447 |
# -*- coding: utf-8 -*-
import pytest
import sys
from aerospike import exception as e
from .test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys.exit(1)
@pytest.mark.usefixtures("as_connectio... | aerospike/aerospike-client-python | test/new_tests/test_info_all.py | Python | apache-2.0 | 3,320 |
"""
Tests for Algorithms using the Pipeline API.
"""
from unittest import TestCase
from os.path import (
dirname,
join,
realpath,
)
from nose_parameterized import parameterized
from numpy import (
array,
arange,
full_like,
float64,
nan,
uint32,
)
from numpy.testing import assert_alm... | grundgruen/zipline | tests/pipeline/test_pipeline_algo.py | Python | apache-2.0 | 19,700 |
#
# Copyright (C) 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | flavio-fernandes/networking-odl | networking_odl/fwaas/driver.py | Python | apache-2.0 | 2,105 |
# coding=utf-8
from __future__ import print_function
import cmd
import inspect
import sys
from panshell.base import FS
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.stack = []
self.fsmap = {}
self.fs = None
self._funcs = []
self._keyword... | alingse/panshell | panshell/core.py | Python | apache-2.0 | 2,543 |
import os
def ensure_dir(directory):
"""Ensures that the path specified is an existing directory.
If not, create it"""
if not os.path.exists(directory):
os.makedirs(directory)
| dimagi/commcare-android | images/utils.py | Python | apache-2.0 | 198 |
def function4():
return "function4"
| bazelbuild/rules_python | gazelle/testdata/relative_imports/package2/module4.py | Python | apache-2.0 | 40 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Midokura Japan K.K.
# Copyright (C) 2013 Midokura PTE LTD
# Copyright (C) 2014 Midokura SARL.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licen... | midokura/python-neutron-plugin-midonet | midonet/neutron/plugin.py | Python | apache-2.0 | 35,809 |
# 说明:修改文件内容,为 IAR 工程合并前做处理
# 1. 除 “Ref_Dir”,“协议栈demo基本连接关系图”,“协议栈demo实物连接图”,“demo1_plc”
# 四个文件夹不处理,其他文件夹均做如下处理
# 2. 将每个 xml 文件里的 "$PROJ_DIR$" 替换为 "$PROJ_DIR$\.."
#
# @Author: labc
# Created on June 20 2017
#
#
import os
import shutil
d_ewp = ".ewp"
d_eww = ".eww"
d_ewt = ".ewt"
d_ewd = ".ewd"
d_icf = ".icf"
d_xml... | xqt2010a/Python_Study | python/01_IAR&Keil_Bat_b.py | Python | apache-2.0 | 1,670 |
# Copyright 2018 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 applicab... | cshallue/models | research/deeplab/core/feature_extractor.py | Python | apache-2.0 | 12,226 |
#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | google/ashier | ashierlib/test/utils_test.py | Python | apache-2.0 | 2,733 |
# for backwards compatibility with earlier python versions
unit_test_module = None
def get_unit_test_module():
try:
import unittest
unit_test_module = unittest
except ImportError:
import unittest2
unit_test_module = unittest2
return unit_test_module
| parallel-fs-utils/fs-drift | unit_test_module.py | Python | apache-2.0 | 295 |
class Config:
STREAMING_JOB_NAME = "streaming.job.name"
STREAMING_OP_NAME = "streaming.op_name"
TASK_JOB_ID = "streaming.task_job_id"
STREAMING_WORKER_NAME = "streaming.worker_name"
# channel
CHANNEL_TYPE = "channel_type"
MEMORY_CHANNEL = "memory_channel"
NATIVE_CHANNEL = "native_channel... | stephanie-wang/ray | streaming/python/config.py | Python | apache-2.0 | 859 |
# -*- coding: utf-8 -*-
import logging
from google.appengine.api import urlfetch
get_request = urlfetch.GET
post_request = urlfetch.POST
def post(url, headers, payload):
try:
result = urlfetch.fetch(
url=url,
payload=payload,
method=post_request,
headers=headers,
)
logging.debug(result.content)
... | adamtache/duke-campus-bot | util/requests/http_requestor.py | Python | apache-2.0 | 554 |
#!/usr/bin/env python
import unittest, os
from poetri.sign_poet import sign_poet
#This key is for testing and the CN is "transparenthealth.org"
test_private_key = """
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQComk77MDN73N/w
FphyPbL0uc0jzKvSI8qK/TGvDx+9ygPFzYq6RdsgNE5cOHdtXk6/ukaMt7s... | TransparentHealth/python-poetri | tests/test_sign_poet.py | Python | apache-2.0 | 2,235 |
"""
Support for APT (Advanced Packaging Tool)
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
For reposit... | saltstack/salt | salt/modules/aptpkg.py | Python | apache-2.0 | 105,007 |
#!/usr/bin/python
#
# Load the mail graph and try to filter the messages
# by count of target addresses
import string
import re
from traceparser import traceparser
class SendRecvFilter:
def __init__( self, filename ) :
self.parser = traceparser(filename)
self.senders = set()
self.... | ShoufuLuo/csaw | 3rd/byzauth/tools/mail_trace_scripts/filter_by_sendrecv.py | Python | apache-2.0 | 941 |
from __future__ import print_function
import unittest
from kubeflow.testing import cleanup_ci
import os
import yaml
class CleanupCiTest(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.join(os.path.dirname(__file__), "test-data")
def test_wait_for_workflow(self):
with open(os.path.join(self.... | kubeflow/testing | py/kubeflow/tests/cleanup_ci_test.py | Python | apache-2.0 | 1,738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.