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 -*-
# This file is part of https://github.com/26fe/jsonstat.py
# Copyright (C) 2016-2021 gf <gf@26fe.com>
# See LICENSE file
__version__ = '0.2.0'
| 26fe/jsonstat.py | jsonstat/version.py | Python | lgpl-3.0 | 168 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | state_of_sparsity/sparse_transformer/models/sparse_model.py | Python | apache-2.0 | 7,729 |
# -*- encoding: utf-8 -*-
"""Implements Operating System UI."""
from robottelo.constants import FILTER
from robottelo.ui.base import Base, UIError
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class OperatingSys(Base):
"""Manipulates Foreman... | danuzclaudes/robottelo | robottelo/ui/operatingsys.py | Python | gpl-3.0 | 8,335 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017,2020 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | chipaca/snapcraft | snapcraft/internal/pluginhandler/_plugin_loader.py | Python | gpl-3.0 | 7,482 |
# -*- coding: utf-8 -*-
from SPARQLWrapper import SPARQLWrapper, JSON
import ast
def queryDBnary(server, lemma, pos, language):
sparql = SPARQLWrapper(server)
sparql.setQuery("""
SELECT COUNT(distinct ?s) as ?numssenses WHERE {
?e a lemon:LexicalEntry;
dcterms:language lexvo:"""+language+""";... | besacier/WCE-LIG | tools/dbnary/extract_dbnary_data.py | Python | gpl-3.0 | 4,673 |
"""
Python Image Processor
"""
from kaa import imlib2
from sys import argv
import glob
import pprint
import time
try:
import json
except ImportError:
import simplejson as json
#Begin Functions#
def fetch_sort(folder, type):
files = glob.glob(str(folder)+'/*.'+str(type))
files.sort()
file_cn... | cgranados/PHPMGen | src/python/Sequencer.py | Python | mit | 2,011 |
__time = __import__('time')
exec "\n".join("%s = __time.%s" % (var, var) for var in dir(__time))
__patched__ = ['sleep']
from eventlet.greenthread import sleep
sleep # silence pyflakes
| simplegeo/eventlet | eventlet/green/time.py | Python | mit | 185 |
import datetime
import hashlib
import json
from django.db import models
class MonolithRecord(models.Model):
"""Data stored temporarily for monolith.
It contains a key (e.g. "app.install"), the date of the record, a user (a
string representing a unique user) and a value (which internally is stored
as... | ingenioustechie/zamboni | mkt/monolith/models.py | Python | bsd-3-clause | 1,757 |
###############################################################################
# The MIT License (MIT)
# Copyright (c) 2007-2016 Roman Rodyakin
#
# 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 Softw... | rodyakin/chilly-build | share/chilly-build/buildsupport/compilers/gcc.py | Python | mit | 10,751 |
import time
import gevent
import collections
from datetime import datetime
from sqlalchemy import asc, desc, bindparam
from inbox.api.kellogs import APIEncoder, encode
from inbox.models import Transaction, Message, Thread, Account, Namespace
from inbox.models.session import session_scope
from inbox.models.util import ... | nylas/sync-engine | inbox/transactions/delta_sync.py | Python | agpl-3.0 | 10,974 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sfml as sf
def main():
window = sf.RenderWindow(sf.VideoMode(640, 480), 'SFML vertices example')
window.framerate_limit = 60
running = True
vertices = [sf.Vertex((200, 150), sf.Color.RED),
sf.Vertex((200, 350), sf.Color.BLUE),
... | bastienleonard/pysfml-cython | examples/vertices.py | Python | bsd-2-clause | 737 |
# Copyright 2019 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.
import subprocess
import sys
if sys.platform.startswith('win'):
# Use the |git.bat| in the depot_tools/ on Windows.
GIT = 'git.bat'
else:
GIT = 'git'
... | endlessm/chromium-browser | tools/translation/helper/git_helper.py | Python | bsd-3-clause | 1,210 |
# Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/util/doctest24.py | Python | apache-2.0 | 99,418 |
#!/usr/bin/python
#------------------------------------------------------------------------------
#
# Copyright (C) 2016 Cisco Systems, Inc.
#
# 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 Fou... | ios-xr/iosxr-ansible | local/library/iosxr_clear_log.py | Python | gpl-3.0 | 2,465 |
# -*- coding: utf-8 -*-
"""
This file contains the dummy for a magnet interface.
Qudi 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.
Qudi... | drogenlied/qudi | hardware/magnet/magnet_dummy.py | Python | gpl-3.0 | 26,940 |
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
#... | bgris/ODL_bgris | odl/test/space/pspace_test.py | Python | gpl-3.0 | 21,616 |
import os
import sys
from shutil import rmtree
from setuptools import setup, find_packages, Command
from simple_model.__version__ import __version__
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
readme = '\n' + f.read()
class UploadCommand(Command):
"""S... | lamenezes/simple-model | setup.py | Python | mit | 1,962 |
from SerialClient import *
| GeodesicCarbon/protopaja-sick | src/rosserial_python/src/rosserial_python/__init__.py | Python | mit | 27 |
files_c=[
'C/7zCrc.c',
'C/7zCrcOpt.c',
'C/Alloc.c',
'C/CpuArch.c',
'C/Threads.c',
]
files_cpp=[
'CPP/7zip/Archive/Common/OutStreamWithCRC.cpp',
'CPP/7zip/Common/CreateCoder.cpp',
'CPP/7zip/Common/FilePathAutoRename.cpp',
'CPP/7zip/Common/FileStreams.cpp',
'CPP/7zip/Common/FilterCoder.cpp',
'CPP/7zip/Common... | punesemu/puNES | src/extra/p7zip-17.04/Utils/file_7zG.py | Python | gpl-2.0 | 3,531 |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import bs4 as bs
import urllib.request
from API_KEYS import EMAIL_ADDRESS, EMAIL_PASSWORD
# grab IP address
sauce = urllib.request.urlopen('http://checkip.dyndns.com/').read()
soup = bs.BeautifulSoup(sauce, 'lxml')
# c... | inflatus/Python | Networking/check_ip_email.py | Python | mit | 759 |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="reviewday",
version="0.2.0",
author="Dan Prince",
author_email="dan.prince@rackspace.com",
description=("Report generator for OpenStack code reviews."),
... | openstack-infra/reviewday | setup.py | Python | mit | 1,838 |
def len2mask(len):
"""Convert a bit length to a dotted netmask (aka. CIDR to netmask)"""
mask = ''
if not isinstance(len, int) or len < 0 or len > 32:
print "Illegal subnet length: %s (which is a %s)" % \
(str(len), type(len).__name__)
return None
for t in range(4):
... | kili/playbooks | filter_plugins/netmask_conversion.py | Python | gpl-3.0 | 1,194 |
"""
This command exports a course from CMS to a git repository.
It takes as arguments the course id to export (i.e MITx/999/2020 ) and
the repository to commit too. It takes username as an option for identifying
the commit, as well as a directory path to place the git repository.
By default it will use settings.GIT_R... | fintech-circle/edx-platform | cms/djangoapps/contentstore/management/commands/git_export.py | Python | agpl-3.0 | 2,816 |
# Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | consultit/Ely | ely/direct/data_structures_and_algorithms/ch02/vector.py | Python | lgpl-3.0 | 3,819 |
# coding=utf-8
import random
import re
import IrcClient
import worddb
import imp
import sys
def HandlerFunc(client, event, prefix, command, params, trailing):
if params != client.nick:
if command == "PRIVMSG":
e = re.compile('Talk about yourself,{0,1}\s+.*'+client.nick+'.*')
match = re.search(e,trailing)
i... | mkalte666/Dragonflame | TalkAboutYourselfHandler.py | Python | mit | 838 |
from Screens.Screen import Screen
from Components.Sources.CanvasSource import CanvasSource
from Components.ActionMap import ActionMap
from enigma import gFont
from enigma import RT_HALIGN_RIGHT, RT_WRAP
def RGB(r,g,b):
return (r<<16)|(g<<8)|b
class VideoFinetune(Screen):
skin = """
<screen position="0,0" size="72... | kakunbsc/enigma2 | lib/python/Plugins/SystemPlugins/VideoTune/VideoFinetune.py | Python | gpl-2.0 | 8,884 |
import os
import sys
import pytest
class SomeClass:
class SomeClass:
def twice(self, a):
something = os
return something
def twice(self, b):
pass
def some_function():
pass
@pytest.mark.parametrize(
'string, descriptions, kwargs', [
# No comp... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/test_api/test_search.py | Python | gpl-3.0 | 3,506 |
import subprocess
def run(cmd, max_minutes = 6000):
import time
sys.stderr.write("Running cmd: %s\n"%cmd)
p = subprocess.Popen(cmd ,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subproc... | davidaknowles/leafcutter | example_data/run_sQTL.py | Python | apache-2.0 | 5,156 |
from __future__ import unicode_literals
from zope.interface import Interface
class IMapping(Interface):
def getHadler(event):
"""
return name of mehod for handle event
"""
class IEventFactory(Interface):
def buildEvent(data):
"""
return instance of event initialize wi... | buben19/twistedinput | twistedinput/interfaces.py | Python | unlicense | 424 |
from onlineticket.generated.ticket import Ticket
from onlineticket.section import SectionParser
class TicketParser:
def parse(self, filename):
parsed = self._parse_kaitai(filename)
return self._map(parsed)
def _parse_kaitai(self, filename):
return Ticket.from_file(filename)
def _m... | joushx/Online-Ticket-Code | onlineticket/ticketparser.py | Python | mit | 860 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2012-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | runt18/nupic | tests/integration/nupic/opf/opf_checkpoint_test/experiments/temporal_anomaly/base.py | Python | agpl-3.0 | 14,979 |
from .ar_model import AR
from .arima_model import ARMA, ARIMA
from . import vector_ar as var
from .arima_process import arma_generate_sample, ArmaProcess
from .vector_ar.var_model import VAR
from .vector_ar.svar_model import SVAR
from .vector_ar.dynamic import DynamicVAR
from .filters import api as filters
from . impor... | detrout/debian-statsmodels | statsmodels/tsa/api.py | Python | bsd-3-clause | 661 |
import json
from flask.ext.api import status
import flask as fk
from api import app, check_access, upload_handler
from ddsmdb.common.models import ProjectModel
from ddsmdb.common.models import ContainerModel
from ddsmdb.common.models import UserModel
from ddsmdb.common.models import RecordModel
import mimetypes
imp... | faical-yannick-congo/ddsm-api | api/endpoints/project_rest.py | Python | mit | 11,514 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/operations/_network_management_client_operations.py | Python | mit | 4,144 |
# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# o... | benmezger/dotfiles | dot_config/qtile/config.py | Python | mit | 15,469 |
# Author: Pascal Bleser <pascal.bleser@opensuse.org>
# This file is licensed under the GNU General Public License version 2
# A copy of the license is available here: http://www.gnu.org/licenses/gpl-2.0.txt
from webpin.util import *
from webpin.const import *
class PackageManager:
def __init__(self, name):
self.na... | openSUSE/webpin-cli | webpin/PackageManager.py | Python | gpl-2.0 | 1,808 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# #
# This file is part of 3d Brain Atlas Reconstructor #
# ... | pmajka/3dbar | lib/pymodules/python2.6/bar/atlas_indexer.py | Python | gpl-3.0 | 71,984 |
"""Ncpol2SDPA
=====
Provides
1. A converter from a polynomial optimization problems of commuting and
noncommuting variables to a semidefinite programming relaxation.
2. Helper functions to define physics problems.
"""
__version__ = "1.11.1"
from .faacets_relaxation import FaacetsRelaxation
from .sdp_relaxation ... | cgogolin/ncpol2sdpa | ncpol2sdpa/__init__.py | Python | gpl-3.0 | 1,560 |
from os.path import dirname, realpath
from jinja2 import Environment, FileSystemLoader
from google.appengine.ext import ndb
DEBUG = True
SECRET_KEY = 'asdfjasdflkjsfewi23kjl3kjl45kjl56jk6hjb76vsjsa'
CONFIG = {
}
SRC_ROOT = dirname(realpath(__file__))
JINJA_ENVIRONMENT = Environment(
loader=FileSystemLoader(S... | Tjorriemorrie/housing | src/settings.py | Python | mit | 496 |
'''
Created by auto_sdk on 2015.09.11
'''
from top.api.base import RestApi
class OpenimTribeDismissRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.tribe_id = None
self.user = None
def getapiname(self):
return 'taobao.openim.tribe.di... | Akagi201/pycsc | top/api/rest/OpenimTribeDismissRequest.py | Python | mit | 328 |
""" Routines to support optional packages """
try:
import nose
except ImportError:
have_nose = False
else:
have_nose = True
from .tripwire import TripWire
def optional_package(name, trip_msg=None):
""" Return package-like thing and module setup for package `name`
Parameters
----------
na... | ME-ICA/me-ica | meica.libs/nibabel/optpkg.py | Python | lgpl-2.1 | 2,576 |
# Copyright 2013. Amazon Web Services, 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 a... | mdj924/py-flask-signup | tests/application-tests.py | Python | apache-2.0 | 1,745 |
# test brenda-node by generating small text files
# as stand-ins for real frames
import os, sys, time, optparse
parser = optparse.OptionParser()
parser.add_option("-o", "--out", dest="out",
help="output file")
parser.add_option("-p", "--pause", type="int", dest="pause", default=1,
... | jamesyonan/brenda | test/perframe.py | Python | gpl-3.0 | 1,198 |
#!/usr/bin/python
"""
Diaphora, a diffing plugin for IDA
Copyright (c) 2015, Joxean Koret
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any lat... | nihilus/diaphora | diaphora.py | Python | gpl-2.0 | 140,383 |
"""engine_config - command ``engine-config --all``
==================================================
This module provides access to ovirt-engine configuration parameters
by parsing output of command ``engine-config --all``.
"""
from collections import namedtuple
from operator import itemgetter
from .. import parser,... | RedHatInsights/insights-core | insights/parsers/engine_config.py | Python | apache-2.0 | 6,803 |
#!/usr/bin/env python
""" UCS worker class for pyflex
"""
from worker import FlexWorker
from functions.functions_ucs import UcsFunctions
from UcsSdk import *
class NexusWorker(FlexWorker):
"""
A child worker class that generates and
installs Nexus configurations
"""
def startworker(self):
... | Mierdin/pyflex | workers/nexus.py | Python | apache-2.0 | 1,172 |
from utils import getJson
from utils import getText
| inbloom/legacy-projects | lri-middleware/utils/__init__.py | Python | apache-2.0 | 52 |
def test(str):
str = str.replace(' ', '')
rev = str[::-1]
return 'true' if str == rev else 'false'
print test("never odd or even")
| DevCouch/coderbyte_python | easy/palindrome.py | Python | gpl-2.0 | 149 |
#$#HEADER-START
# vim:set expandtab ts=4 sw=4 ai ft=python:
#
# Reactor Configuration Event Engine
#
# Copyright (C) 2016 Brandon Gillespie
#
# 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 Fre... | srevenant/reactor | src/reactor/control.py | Python | agpl-3.0 | 6,339 |
from security.users_repository import UsersRepository
import uuid
class Users(object):
def __init__(self):
self.users_repository = UsersRepository()
def get_all_users(self):
return self.users_repository.get_all_users()
def get_user(self, name):
return self.users_repository.get_use... | CALlanoR/VirtShell | virtshell_server/virtshell_server/security/users.py | Python | gpl-2.0 | 647 |
from edmunds.support.serviceprovider import ServiceProvider
from werkzeug.exceptions import default_exceptions
from edmunds.exceptions.handler import Handler
class ExceptionsServiceProvider(ServiceProvider):
"""
Exceptions Service Provider
"""
def register(self):
"""
Register the ser... | LowieHuyghe/edmunds | edmunds/exceptions/exceptionsserviceprovider.py | Python | apache-2.0 | 1,277 |
#----------------------------------------------------------------------
# Copyright 2012-2020 EPCC, The University of Edinburgh
#
# This file is part of bolt.
#
# bolt 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 Found... | aturner-epcc/bolt | modules/__init__.py | Python | gpl-3.0 | 843 |
'''Multiple Testing and P-Value Correction
Author: Josef Perktold
License: BSD-3
'''
from statsmodels.compat.python import range
from statsmodels.compat.collections import OrderedDict
import numpy as np
#==============================================
#
# Part 1: Multiple Tests and P-Value Correction
#
#=========... | rgommers/statsmodels | statsmodels/stats/multitest.py | Python | bsd-3-clause | 16,540 |
# 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 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... | zouyapeng/horizon-newtouch | horizon/templatetags/horizon.py | Python | apache-2.0 | 6,643 |
#!/usr/bin/python
# this source is part of my Hackster.io project: https://www.hackster.io/mariocannistra/radio-astronomy-with-rtl-sdr-raspberrypi-and-amazon-aws-iot-45b617
# this program will determine the overall range of signal strengths received during the whole session.
# this program can be run standalone but... | mariocannistra/radio-astronomy-fftw | findsessionrangew.py | Python | mit | 3,584 |
# Copyright 2018 Camptocamp SA
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2016 ForgeFlow S.L. (https://www.forgeflow.com)
# Copyright 2016 Therp BV <http://therp.nl>
# Copyright 2019 JARSA Sistemas S.A. de C.V.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo.tests.co... | Vauxoo/stock-logistics-warehouse | stock_available_unreserved/tests/test_stock_available_unreserved.py | Python | agpl-3.0 | 16,208 |
from __future__ import unicode_literals
from .. import unittest
from compose.service import Service
from compose.project import Project
from compose.container import Container
from compose import config
import mock
import docker
class ProjectTest(unittest.TestCase):
def test_from_dict(self):
project = Pro... | hypriot/compose | tests/unit/project_test.py | Python | apache-2.0 | 8,045 |
import os
import bpy
import zipfile
import re
import xml.etree.ElementTree as ET
import base64
from .shading import *
from ..utils import *
def get_mecafig(context):
ob = context.active_object
childs = []
mecafig = []
if ob is not None:
if ob.type == 'ARMATURE':
if not ob.mecafig.... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/mecafig/functions/mecafig.py | Python | gpl-3.0 | 25,383 |
VERSION = (0, 10, 0)
| xgfone/homepage | homepage/homepage/django_packages/taggit/__init__.py | Python | bsd-3-clause | 21 |
import re
from autotest.client.shared import error
from virttest import utils_misc, aexpect, storage, data_dir
def run_pci_hotplug(test, params, env):
"""
Test hotplug of PCI devices.
(Elements between [] are configurable test parameters)
1) PCI add a deivce (NIC / block)
2) Compare output of mon... | suqinhuang/virt-test | qemu/tests/pci_hotplug.py | Python | gpl-2.0 | 8,562 |
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation 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 "... | burzillibus/RobHome | venv/lib/python2.7/site-packages/dns/rcode.py | Python | mit | 3,104 |
# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-13 Jim Easterbrook jim@jim-easterbrook.me.uk
# 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 F... | kenmcc/mypywws | src/pywws/device_pyusb1.py | Python | gpl-2.0 | 5,457 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | rev2004/android2cloud.app-engine | google_appengine/google/appengine/ext/remote_api/remote_api_stub.py | Python | mit | 19,484 |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import CameraInfo
def callback(data):
P = list(data.P);
P[3] = P[3] * scale
data.P = tuple(P);
pub.publish(data)
if __name__ == '__main__':
rospy.init_node('republish_camera_info', anonymous=True)
pub = rospy.Publisher('camera_info_out', ... | introlab/rtabmap_ros | launch/jfr2018/republish_camera_info.py | Python | bsd-3-clause | 472 |
from collections import OrderedDict
import cms
from .subcommands.base import SubcommandsCommand
from .subcommands.check import CheckInstallation
from .subcommands.copy import CopyCommand
from .subcommands.delete_orphaned_plugins import DeleteOrphanedPluginsCommand
from .subcommands.list import ListCommand
from .subco... | rsalmaso/django-cms | cms/management/commands/cms.py | Python | bsd-3-clause | 1,189 |
'''
title = "For loop simulated with a while loop"
level = "intro"
dificulty = "easy"
tags = ["iterators", "while-loop", "loops", "for-loop"]
description = """
Write a function that receives a list and prints every element in the list
using a while loop.
Example:
for_loop_simulated_with_while([3, 1, 2, 5])
> 3... | rmotr/whooshercises | assignments/for_simulated_with_while.py | Python | mit | 407 |
from odoo import fields, models, api
class ResCompany(models.Model):
_inherit = 'res.company'
url_policy = fields.Text(string="web privacy_policy", default='https://www.visiotechsecurity.com/en/legal-notice-and-the-privacy-policy',
help="link to the privacy policy", translate=Tru... | Comunitea/CMNT_004_15 | project-addons/custom_emails_company/models/company.py | Python | agpl-3.0 | 821 |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
def string_add(v):
return v + "_Python234"
def string_filter(v):
return len(v) <= 3
def string_fm(v):
return v.split()
def json_add(v):
v["c"] = v["a"] + 235
return v
def json_filter(v):
return v["a"] <= 100
def json_fm(v):
retu... | ibmkendrick/streamsx.topology | test/python/pubsub/pytest_funcs.py | Python | apache-2.0 | 832 |
"""
Counting Characters
"""
def main():
lower = "abcdefghijklmnopqrstuvwxyz"
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
count = [0 for i in xrange(26)]
while True:
try:
s = raw_input().strip()
for x in s:
if x.isalpha():
if x in lower: coun... | curryudon08/aoj | Lesson/ITP1/ITP1_8_C.py | Python | unlicense | 565 |
"""Takes care of fetching data via HTTP."""
import urllib2
import ssl
from socket import error as SocketError
import time
import re
from tempfile import mkstemp
import os
ENABLE_DEBUG_PRINT = False
MAX_RETRY_TIME_IN_SEC = 5
NUM_SEC_TIMEOUT = 30
NUM_SEC_SLEEP = 0
def looks_like_version(version):
"""Returns whethe... | kristovatlas/npm-dependency-check | http.py | Python | unlicense | 4,694 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:39876")
else:
access = Se... | fourty2/sinertaler | contrib/bitrpc/bitrpc.py | Python | mit | 7,837 |
import linecache
import os
import sys
from bson import ObjectId
from ereuse_utils.nested_lookup import NestedLookup
from flask import Config, json
from flask_caching import Cache
cache = Cache(config={'CACHE_TYPE': 'simple'})
def get_last_exception_info():
exc_type, exc_obj, tb = sys.exc_info()
f = tb.tb_fr... | eReuse/DeviceHub | ereuse_devicehub/utils.py | Python | agpl-3.0 | 3,149 |
###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | robbmcleod/numexpr | numexpr/tests/test_numexpr.py | Python | mit | 44,482 |
import unittest
from politicians import solution
class TestSolution(unittest.TestCase):
def test_two_names(self):
names = ("Euh", "Mlb")
s = solution(names)
self.assertEqual(s.candidates, [("Euh", "Mlb", "humble")], "'Euh' and 'Mlb' did not generate 'humble'.")
def test_three_... | johnobrien/pyshortz | solutions/20150419/test_politicians.py | Python | mit | 1,067 |
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | kubernetes-client/python | examples/out_of_cluster_config.py | Python | apache-2.0 | 1,204 |
import sys
import argparse
from .base import generate_word
def main():
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("amount", type=str,
help="Amount to convert in str... | pirsquare/chequeconvert-python | chequeconvert/main.py | Python | mit | 406 |
from httplib import NOT_FOUND, OK
import json
import os
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from opendebates.models import Submission, Vote, Flag, SiteMode
from .factories import UserFactory, VoterFactory, SubmissionFactory, RemovalFlagFactory... | ejucovy/django-opendebates | opendebates/tests/test_moderation.py | Python | apache-2.0 | 26,364 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('flyerapp', '0004_auto_20150616_1040'),
]
operations = [
migrations.AlterField(
model_name='fligh... | luzeduardo/antonov225 | flyer/flyerapp/migrations/0005_auto_20150616_1524.py | Python | gpl-2.0 | 929 |
import math
import re
import string
from datetime import datetime
"""
Collection of classes that comprise the row type objects
in a nacha file
"""
class AchError(Exception):
pass
class Ach(object):
"""
Base class for ACH record fields
"""
def make_space(self, spaces=1):
"""
Ret... | junian/python-ach | ach/data_types.py | Python | mit | 25,867 |
# Copyright 2019 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/clusterfuzz | src/appengine/handlers/fuzzer_stats.py | Python | apache-2.0 | 18,828 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('run_workflow')
@click.argument("workflow_id", type=str)
@click.option(
"--dataset_map",
help="A mapping of workflow inputs to datasets. The datasets source can be a LibraryD... | galaxy-iuc/parsec | parsec/commands/workflows/run_workflow.py | Python | apache-2.0 | 4,029 |
import math
from scipy.optimize import newton
PI = math.acos(-1)
def main() -> None:
A, B, C = map(int, input().split())
def g(t):
return A * t + B * math.sin(C * t * PI) - 100
def dg(t):
return A + B * math.cos(C * t * PI) * C * PI
def d2g(t):
return - B * math.sin(C * t *... | knuu/competitive-programming | atcoder/abc/abc026_d_scipy.py | Python | mit | 630 |
import config
def generate_prefixes():
'''
Uses namespaces defined in the config.py file to generate all the prefixes you might need in a SPARQL query.
Returns a string.
'''
s = ''
for key in config.namespaces.keys():
if key is 'root':
s += 'PREFIX : <{name}> '.format(name=c... | superphy/backend | app/modules/comparisons/sparql_utils.py | Python | apache-2.0 | 467 |
"""
Django settings for tango_with_django project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
... | raghuraju/tango-with-django-110 | tango_with_django/settings/base.py | Python | mit | 4,348 |
class AttrDict (dict):
def __getattr__ (self, k):
try:
return self[k]
except KeyError, detail:
raise AttributeError(detail)
def __setattr__ (self, k, v):
self[k] = v
| larsks/pydonet | lib/pydonet/utils/attrdict.py | Python | gpl-2.0 | 196 |
import os
import importlib
import logging
import json
import base64
from werkzeug.wrappers import Response
from .response_interface import ResponseInterface
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
class ApigatewayResponse(ResponseInterface):
"""Prepare response for apig... | liangrog/lmdo | lmdo/lmdo_handlers/wsgi/wsgi_apps/response/apigateway_response.py | Python | mit | 2,625 |
import os
from setuptools import setup
from tornadose import __version__
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="tornadose",
version=__version__,
author="Michael V. DePalatis",
author_email="mike@depalatis.net",
description="Tornado-se... | mivade/tornadose | setup.py | Python | mit | 988 |
#! /usr/local/bin/python
"""
Garden health measurement system.
Reads humidity, temperature around a plant and in the soil, writes to db and
takes the picture of the plant.
"""
import time
import os
from datetime import datetime
import sqlalchemy
from sqlalchemy.engine.url import URL
from sqlalchemy.orm i... | sinanm89/grow_motion | main.py | Python | mit | 5,618 |
from google.appengine.ext import vendor
vendor.add('lib')
from google.appengine.api import urlfetch
urlfetch.set_default_fetch_deadline(60)
from google.appengine.api import app_identity
from google.appengine.ext import ndb
from googleapiclient import discovery
from googleapiclient import errors
from oauth2client.cont... | grow/grow-ext-kintaro | watcher/main.py | Python | mit | 4,327 |
''' Plugin for CudaText editor
Authors:
Andrey Kvichansky (kvichans on github.com)
Version:
'2.3.13 2019-05-24'
ToDo: (see end of file)
'''
import re, os, sys, json, collections, itertools, webbrowser, tempfile, html, pickle, time, datetime
from itertools import *
from pathlib import PurePath as ... | vhanla/CudaText | app/py/cuda_options_editor/cd_opts_dlg.py | Python | mpl-2.0 | 113,411 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from __future__ import absolute_import
from... | claudep/pootle | tests/models/virtualfolder.py | Python | gpl-3.0 | 7,012 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="color",
parent_name="scattergl.marker.colorbar.title.font",
**kwargs
):
super(ColorValidator, self).__init__(
plotly_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattergl/marker/colorbar/title/font/_color.py | Python | mit | 456 |
# Copyright 2016 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/grid_rnn/__init__.py | Python | bsd-2-clause | 1,060 |
"""
"""
import os
import tempfile
import unittest
from .context import fabulist
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def setUp(self):
self.fab = fabulist.Fabulist()
self.temp_path = None
def tearDown(self):
self.fab = None
if self.temp_path:
... | mar10/fabulist | tests/test.py | Python | mit | 7,326 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0018_siteconfiguration_payment_support_url'),
]
operations = [
migrations.AddField(
model_name='siteconfiguration',
name='affiliate... | eduNEXT/edunext-ecommerce | ecommerce/core/migrations/0019_auto_20161012_1404.py | Python | agpl-3.0 | 794 |
import ckan.plugins as p
import paste.script
import db
import logging
from ckan.lib.cli import CkanCommand
from ckan import model
log = logging.getLogger(__name__)
class WebhookCommands(CkanCommand):
"""
ckanext-webhooks commands:
Usage::
paster webhooks migrate
"""
summary = __doc__.s... | deniszgonjanin/ckanext-webhooks | ckanext/webhooks/commands.py | Python | agpl-3.0 | 1,082 |
"""
Offer template automation rules.
For more details about this automation rule, please refer to the documentation
at https://home-assistant.io/components/automation/#template-trigger
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_VALUE_TEMPL... | kyvinh/home-assistant | homeassistant/components/automation/template.py | Python | apache-2.0 | 1,267 |
vm_ip = '192.168.76.50'
username = 'admin'
password = ''
config_file_1 = 'fortios_config_1.txt'
config_file_2 = 'fortios_config_2.txt' | sergiorua/pyfg | test/unit/config.py | Python | apache-2.0 | 134 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
from astropy.utils.decorators import format_doc
from astropy.coordinates import representation as r
from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc
from astropy.coordinates.att... | stargaser/astropy | astropy/coordinates/builtin_frames/ecliptic.py | Python | bsd-3-clause | 9,417 |
import LNdigitalIO
def switch_pressed(event):
event.chip.output_pins[event.pin_num].turn_on()
def switch_unpressed(event):
event.chip.output_pins[event.pin_num].turn_off()
if __name__ == "__main__":
LNdigital = LNdigitalIO.LNdigitals()
listener = LNdigitalIO.InputEventListener(chip=LNdigital)
... | LeMaker/LNdigitalIO | examples/presslights.py | Python | gpl-3.0 | 501 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.