code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 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-policy-troubleshooter | google/cloud/policytroubleshooter_v1/services/iam_checker/transports/grpc_asyncio.py | Python | apache-2.0 | 12,111 |
""" This module mainly focuses on the details of the IRC protocol, so it covers
actions such as line parsing and validation.
"""
import socket
import struct
import re
#TODO: Add in mode parsing support.
name_symbols = {
"+": "voice",
"%": "halfop",
"@": "op",
"&": "protectedop",
"~": "owner"
... | farces/ircutils | protocol.py | Python | mit | 5,260 |
class BinaryTree:
def __init__(self,rootObj):
self.key = rootObj
self.leftChild = None
self.rightChild = None
def insertLeft(self,newNode):
if self.leftChild == None:
self.leftChild = BinaryTree(newNode)
else:
t = BinaryTree(newNode)
t.leftChild = self.leftChild
self.leftChild = t
def insertR... | BaReinhard/Hacktoberfest-Data-Structure-and-Algorithms | data_structures/binary_tree/python/binary_tree.py | Python | gpl-3.0 | 694 |
from .base import BaseOp
from .. import ssa_types, excepttypes
from ..constraints import IntConstraint, ObjectConstraint
from . import bitwise_util
import itertools
def getNewRange(w, zmin, zmax):
HN = 1 << w-1
zmin = zmin + HN
zmax = zmax + HN
split = (zmin>>w != zmax>>w)
if split:
retur... | alexkasko/krakatau-java | krakatau-lib/src/main/resources/Lib/Krakatau/ssa/ssa_ops/imath.py | Python | gpl-3.0 | 7,608 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from QLayout import QLayout
class QStackedLayout(QLayout):
"""
QStackedLayout()
QStackedLayout(QWidget)
QStackedLayout(QLayout)
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtGui/__init__/QStackedLayout.py | Python | gpl-2.0 | 3,413 |
import subprocess, shlex, time
REMOTE_SSH_EXEC = "ssh -o CheckHostIP=no -o StrictHostKeyChecking=no -o PasswordAuthentication=no root@%s \"%s\""
REMOTE_SCP = "scp -o CheckHostIP=no -o StrictHostKeyChecking=no %s root@%s:%s"
REMOTE_IPS = ["192.168.10.%d" % x for x in xrange(20,255)]
#REMOTE_IPS = ["192.168.10.%d" % x ... | fairdk/fair-ubuntu-centre | installscripts/postinstall/filesystem/opt/fair-apps/clientmanager/deploy.py | Python | gpl-3.0 | 1,161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.auth import get_user_model
from django.core import mail
from django.test import TestCase
class TestUsersModels(TestCase):
user_email = 'user@example.com'
user_password = 'pa$sw0Rd'
def create_user(self):
return get_user_model().ob... | mishbahr/django-users2 | tests/test_models.py | Python | bsd-3-clause | 2,142 |
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
wd.implicitly_wait(2)
request.add... | eugene-petrash/selenium-webdriver-full-tutorial | python-example/test_new_window.py | Python | apache-2.0 | 1,864 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.api import Environment, SUPERUSER_ID
def uninstall_hook(cr, registry):
env = Environment(cr, SUPERUSER_ID, {})
res_ids = env['ir.model.data'].search([
('model', '=', 'ir.ui.menu'),
('m... | maxive/erp | addons/account_invoicing/__init__.py | Python | agpl-3.0 | 717 |
import pandas as pd
df = pd.read_csv('data/combined_with_features.csv', index_col='id')
#Convert sex to binary variable
df.sex = df.sex.map({'male':0, 'female':1})
#df.drop('sex', axis=1, inplace=True)
#df.drop('p_class', axis=1, inplace=True)
#Name dummies
name_dummies = pd.get_dummies(df.name, prefix='name').asty... | edublancas/titanic | pipeline/old_prepare_for_training.py | Python | mit | 1,176 |
import argparse
import csv
import datetime
import getpass
import smtplib
import socket
import StringIO
import sys
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from rogers_usage.auth import get_auth_info
from rogers_usage.session import RogersSession
import rogers_usage.usa... | bsandrow/rogers-usage | rogers_usage/apps/usage_history.py | Python | mit | 3,531 |
#!/usr/bin/env python3
"""
Generate fonts.yaml entry based on the font directory.
Uses python3 (tested on python3.6), and requires
fonttools (https://github.com/fonttools/fonttools/) and for woff2
brotlipy (https://github.com/python-hyper/brotlipy/)
"""
import sys
import os
import re
from fontTools import ttLib
FON... | braver/fonts | scripts/fontDesc.py | Python | mit | 3,231 |
# Copyright (C) weslowskij
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope... | olga-weslowskij/olga.weslowskij | Gui/Screens/simonViewChallengeScreen.py | Python | gpl-2.0 | 2,614 |
"""Python example to connect and retrieve values from foursquare API."""
# the example gets instagram users associated with that location's lat/long
# Facebook killed Instagram's API so the second part does not work at all
# Date Updated: 1 July 2019
import datetime as dt # need date in v= as YYYYMMDD
import json # t... | jamesacampbell/python-examples | instagram_geo-example.py | Python | mit | 1,905 |
import subprocess
import sys
from os.path import expanduser
import configparser
def str2bool(string):
# type: (str) -> bool
return string.lower() in ("yes", "true", "y", "1")
# http://stackoverflow.com/questions/5980042/how-to-implement-the-verbose-or-v-option-into-a-script
def verboseprint(message):
i... | petrenkoas83/bginfopy | bginfopy/preferences.py | Python | gpl-3.0 | 2,982 |
"""
WSGI config for gw2ct project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gw2ct.settings")
from django.core.wsgi ... | watbe/gw2-battle-tools | gw2ct/wsgi.py | Python | mit | 385 |
# shipModuleRemoteTrackingComputer
#
# Used by:
# Modules from group: Remote Tracking Computer (8 of 8)
type = "projected", "active"
def handler(fit, module, context, **kwargs):
if "projected" in context:
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
... | bsmr-eve/Pyfa | eos/effects/shipmoduleremotetrackingcomputer.py | Python | gpl-3.0 | 975 |
import serial
import time
ser=serial.Serial('/dev/ttyAMA0',9600,timeout=1)
ser.open()
def user_input(value) :
if value=='1' :
ser.write("1")
time.sleep(1)
x=ser.read()
print "The state is:"
print(x)
elif value==2 :
ser.write("2")
time.sleep(1)
print "success"
try:
while 1:
value=... | rpihomeautomation/rpihomeautomation | Date Wise/16-09-2014/rpi.py | Python | mit | 414 |
#!/usr/bin/env python
import numpy
import scipy
from scipy import io
data_dict = scipy.io.loadmat('../data/hmsvm_data_large_integer.mat', struct_as_record=False)
parameter_list=[[data_dict]]
def structure_discrete_hmsvm_bmrm (m_data_dict=data_dict):
from modshogun import RealMatrixFeatures, SequenceLabels, HMSVMMo... | AzamYahya/shogun | examples/undocumented/python_modular/structure_discrete_hmsvm_bmrm.py | Python | gpl-3.0 | 1,113 |
import json
import math
import logging
from django.shortcuts import render, HttpResponse
from django.http import JsonResponse
from django.contrib.auth.decorators import login_required
from django.views.generic import View
from django.conf import settings
from .serializers import (AlertSerializer, HouseholdSurveyJSONS... | johanneswilm/eha-nutsurv-django | nutsurv/dashboard/views.py | Python | agpl-3.0 | 13,449 |
from config.manager import ConfigManager
from cvars.flags import ConVarFlags
from .info import info
config_manager = ConfigManager(info.basename, cvar_prefix="killerinfo_")
config_manager.header = 'KillerInfo Configuration File'
killerinfo_enabled = config_manager.cvar('enabled',
... | craziest/sp-killerinfo | addons/source-python/plugins/killerinfo/cvars.py | Python | mit | 554 |
import configparser
# create a config parser object
config = configparser.RawConfigParser()
# open and read the adressbook.cfg file into the config parser
config.read('addressbook.cfg')
# loop through the sections
for section in config.sections():
print(section)
# get all the options for the current section
... | ceeblet/OST_PythonCertificationTrack | Python3/Python3_Lesson12/src/config.py | Python | mit | 513 |
# -*- 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-monitoring | samples/generated_samples/monitoring_v3_generated_uptime_check_service_get_uptime_check_config_sync.py | Python | apache-2.0 | 1,519 |
##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | hradec/gaffer | python/GafferUI/SpreadsheetUI/_PlugTableView.py | Python | bsd-3-clause | 40,750 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import os
import re
import uuid
from lxml import etree
from odoo import models
from odoo.modules.module import get_resource_path, get_module_path
_match_asset_file_url_regex = re.compile("^/(\w+)/(.+?)(\... | t3dev/odoo | addons/web_editor/models/assets.py | Python | gpl-3.0 | 10,416 |
from pyspark import SparkConf, SparkContext
conf = SparkConf().setAppName("mj").set("spark.executor.memory", "4g");
sc = SparkContext(conf=conf);
execfile("/home/mert/mjrepo/apprecsys/script/context.py")
confin = parseDataRunAll("events.txt")
f = open('output.txt','w')
f.write(" ".join(str(x) for x in confin))
f.write... | rubattino/apprecsys | script/script.py | Python | bsd-2-clause | 336 |
"""add group column
Revision ID: 7f7b5aaaea78
Revises:
Create Date: 2017-03-17 19:05:51.167255
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7f7b5aaaea78'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.add_column('hosts'... | szatanszmatan/myrdp | app/database/updates/versions/7f7b5aaaea78_add_group_column.py | Python | gpl-2.0 | 488 |
# Copyright 2019,2020,2021 Sony Corporation.
#
# 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... | sony/nnabla | python/test/function/test_where.py | Python | apache-2.0 | 1,821 |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK code-generator.
#
# REDHAWK code-generator is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as pu... | RedhawkSDR/framework-codegen | redhawk/packagegen/octavePackage.py | Python | lgpl-3.0 | 6,395 |
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from .models import MyUser
class UserCreationTests(TestCase):
@classmethod
def setUpClass(cls):
# only called once per class
pass
@classmethod
def tearDownClass(cls):
... | shapiromatron/comp523-medcosts | myuser/tests.py | Python | mit | 3,505 |
#!/usr/bin/env python
from zipline import TradingAlgorithm
from zipline.transforms import MovingAverage
from zipline.utils.factory import load_from_yahoo
from datetime import datetime
import pytz
import matplotlib.pyplot as plt
class DualMovingAverage(TradingAlgorithm):
"""Dual Moving Average Crossover algorithm.... | ajayhk/quant | zipline/algos/sample_algo.py | Python | apache-2.0 | 2,828 |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .fields import HexIntegerField
try:
from django.db.models import UUIDField
except ImportError:
from uuidfield import UUIDField
class Device(models.Model):
name = models.CharField(max_length=25... | freakboy3742/django-push-notifications | push_notifications/models.py | Python | mit | 3,348 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2015 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 applicable law o... | 0xc0170/pyOCD | pyOCD/coresight/dwt.py | Python | apache-2.0 | 4,553 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Service providing handler
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.5.8
:status: Beta
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you... | isandlaTech/cohorte-demos | led/dump/led-demo-yun/cohorte/dist/cohorte-1.0.0-20141216.234517-57-python-distribution/repo/pelix/ipopo/handlers/provides.py | Python | apache-2.0 | 9,991 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | maui-packages/qt-creator | tests/system/suite_editors/tst_rename_macros/test.py | Python | lgpl-2.1 | 7,635 |
condition = True
q = [3] if condition else [2]
r = [2.0] and [1, 2]
rr = r[0] * 2
s = q + r
t = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
u = 2
v = 8
w = t[u:v:u]
x = w[u]
# q := List[float]
# r := List[float]
# rr := float
# s := List[float]
# t := List[int]
# u := int
# v := int
# w := List[int]
# x := int | caterinaurban/Typpete | typpete/unittests/inference/expressions2.py | Python | mpl-2.0 | 300 |
# Chess Analyses by Jan van Reek
# http://www.endgame.nl/index.html
JvR_links = (
("http://www.endgame.nl/match.htm", "http://www.endgame.nl/MATCHPGN.ZIP"),
("http://www.endgame.nl/bad1870.htm", "http://www.endgame.nl/bad1870.pgn"),
("http://www.endgame.nl/wfairs.htm", "http://www.endgame.nl/wfairs.pgn"),
... | pychess/pychess | lib/pychess/Database/JvR.py | Python | gpl-3.0 | 6,560 |
# -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (
Blueprint, request, render_template, flash, url_for,
redirect, session
)
from flask.ext.login import login_user, login_required, logout_user
from clearstate.extensions import login_manager
from clearstate.user.mode... | sharoonthomas/clearstate | clearstate/public/views.py | Python | bsd-3-clause | 2,490 |
"""Test the habitica config flow."""
from unittest.mock import AsyncMock, MagicMock, patch
from aiohttp import ClientResponseError
from homeassistant import config_entries, setup
from homeassistant.components.habitica.const import DEFAULT_URL, DOMAIN
from tests.common import MockConfigEntry
async def test_form(has... | sander76/home-assistant | tests/components/habitica/test_config_flow.py | Python | apache-2.0 | 4,281 |
from __future__ import unicode_literals
from .testcases import DockerClientTestCase
from compose import config
from compose.const import LABEL_PROJECT
from compose.container import Container
from compose.project import Project
from compose.service import ConvergenceStrategy
def build_service_dicts(service_config):
... | ph-One/compose | tests/integration/project_test.py | Python | apache-2.0 | 14,809 |
import factory
import factory.fuzzy
from opendebates_emails.models import EmailTemplate
class EmailTemplateFactory(factory.DjangoModelFactory):
class Meta:
model = EmailTemplate
| ejucovy/django-opendebates | opendebates_emails/tests/factories.py | Python | apache-2.0 | 193 |
# Copyright 2015 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... | AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/layers/python/layers/feature_column.py | Python | apache-2.0 | 89,309 |
import asyncio
import enum
import logging
import concurrent.futures
logger = logging.getLogger("botcore")
@enum.unique
class EventType(enum.Enum):
message = 0
action = 1
# TODO: Do we actually want to have a 'notice' event type? Should the NOTICE command be a 'message' type?
notice = 2
join = 3
... | FurCode/SubChannel | botcore/event.py | Python | gpl-2.0 | 15,181 |
#
# Baruwa - Web 2.0 MailScanner front-end.
# Copyright (C) 2010-2012 Andrew Colin Kissa <andrew@topdog.za.net>
#
# 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... | liveaverage/baruwa | src/baruwa/messages/management/commands/dbclean.py | Python | gpl-2.0 | 2,320 |
import cv2
import numpy as np
import time
image = cv2.imread('test.png')
image = cv2.flip(image,2)
rows, cols,_ = image.shape
M = cv2.getRotationMatrix2D((cols/2,rows/2),40,1)
image = cv2.warpAffine(image,M,(cols,rows))
mask=cv2.inRange(image, np.array([0, 180, 255],dtype='uint8'),np.array([0, 180, 255],dtype='uint8'... | RoboticsClubatUCF/RoboSub | ucf_sub_catkin_ros/src/sub_utils/src/linefinder.py | Python | mit | 1,400 |
# [h] append hTools2 to sys.path
import sys
sys.path.append('/_code/hTools2/Lib')
| gferreira/hTools2_extension | hTools2.roboFontExt/lib/add-sys-path.py | Python | bsd-3-clause | 84 |
import unittest
import tempfile
import os
import shutil
import cwltool.expression as expr
import cwltool.factory
import cwltool.pathmapper
import cwltool.process
import cwltool.workflow
from .util import get_data
from cwltool.main import main
class TestListing(unittest.TestCase):
def test_missing_enable_ext(self)... | chapmanb/cwltool | tests/test_ext.py | Python | apache-2.0 | 5,706 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tqchen/tvm | tests/python/topi/python/test_fifo_buffer.py | Python | apache-2.0 | 9,219 |
from StringIO import StringIO
from binascii import hexlify
from hashlib import sha256
from twisted.internet.protocol import Factory, Protocol
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet import reactor
import msgpack
from core import MsgPackProtocol
class CheckerProtocol(MsgPackPr... | gdanezis/rousseau-chain | rousseau-package/attic/checker.py | Python | bsd-2-clause | 2,982 |
#!/usr/bin/env python
import os
import subprocess
import sys
import shutil
import zipfile
from contextlib import contextmanager
import click
def get_platform():
""" a name for the platform """
if sys.platform.startswith('win'):
return 'win'
elif sys.platform == 'darwin':
return 'osx'
... | Senryoku/SenBoy | ext/discord-rpc/build.py | Python | mit | 11,015 |
from spd import SPD
import sys
usage = ""
if len(sys.argv) < 2:
print usage
exit(1)
iname = sys.argv[1]
f = open(iname, "r")
bdata = f.read()
f.close()
spd = SPD(bdata)
print spd.info
| snegovick/pyspd | spd_reader.py | Python | mit | 195 |
# $ProjectHeader: sexprmodule 0.2.1 Wed, 05 Apr 2000 23:33:53 -0600 nas $
# originally from: http://arctrix.com/nas/python/
# modified to understand \-escaped quotes instead of "" escaping - pj 20060809
import string
# tokens
[T_EOF, T_ERROR, T_SYMBOL, T_STRING,
T_INTEGER, T_FLOAT, T_OPEN, T_CLOSE] = range(8)
# st... | pjz/MHI | mhi/sexpr.py | Python | gpl-3.0 | 3,283 |
# -*- coding: utf-8 -*-
# daemon/daemon.py
# Part of python-daemon, an implementation of PEP 3143.
#
# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2004–2005 Chad J. Schroeder
# Copyright © 2003 Clark Evans
# Copyright © 2002 Noah S... | mountainpenguin/BySH | server/lib/daemon/daemon.py | Python | gpl-3.0 | 25,062 |
from django import forms
from .models import Status, StandupUser
class StatusizeForm(forms.ModelForm):
class Meta:
model = Status
fields = ['content', 'project', 'user']
widgets = {
'user': forms.HiddenInput(),
'project': forms.HiddenInput(),
}
class Prof... | mozilla/standup | standup/status/forms.py | Python | bsd-3-clause | 931 |
import unittest
from lbry.extras.daemon.Daemon import sort_claim_results
class ClaimsComparatorTest(unittest.TestCase):
def test_sort_claim_results_when_sorted_by_claim_id(self):
results = [{"height": 1, "name": "res", "claim_id": "ccc", "nout": 0, "txid": "fdsafa"},
{"height": 1, "nam... | lbryio/lbry | lbry/tests/unit/lbrynet_daemon/test_claims_comparator.py | Python | mit | 2,377 |
import jobs
import config
from utils.various import bound
from utils.colors import mix_colors
from notifiers import notifier
from db.models import StatusColor
class ColorNotifier(notifier.Notifier):
def _check(self):
current = self.job.status
if current.error:
self.set_color(config.ERR... | vincent-psarga/job-sensors | src/jobsensors/notifiers/colors.py | Python | gpl-2.0 | 1,823 |
#!/usr/bin/python3
import os
import sys
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from lutris.util.wineregistry import WineRegistry
PREFIXES_PATH = os.path.expanduser("~/Games/wine/prefixes")
def get_registries():
registries = []
directories = os.listdir... | RobLoach/lutris | tests/check_prefixes.py | Python | gpl-3.0 | 1,465 |
from serial import Serial
import config
import psycopg2
import requests
import json
def listenPort():
ser = Serial(port=config.serialPort, baudrate=config.serialBaudrate, timeout=1)
print("connected to: " + ser.portstr)
while True:
line = ser.readline()
if line:
parse(line)
... | tedor/arduino-weather-station | client/daemon.py | Python | bsd-3-clause | 2,221 |
# *********************************************************************************************
# Copyright (C) 2017 Joel Becker, Jillian Anderson, Steve McColl and Dr. John McLevey
#
# This file is part of the tidyextractors package developed for Dr John McLevey's Networks Lab
# at the University of Waterloo. For mor... | networks-lab/tidyextractors | tidyextractors/tidymbox/mbox_to_pandas.py | Python | gpl-3.0 | 6,462 |
# 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, software
# distrib... | openstack/python-openstackclient | openstackclient/tests/unit/integ/cli/test_shell.py | Python | apache-2.0 | 18,819 |
#----------------------------------------------------------------------
# Copyright (c) 2008 Board of Trustees, Princeton University
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, i... | EICT/C-BAS | src/vendor/geniv3rpc/ext/sfa/trust/certificate.py | Python | bsd-3-clause | 29,031 |
from datetime import date, datetime
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
class EventDateFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _('Date')
# Pa... | gitsimon/tq_website | events/filters/event_date_filter.py | Python | gpl-2.0 | 1,298 |
## @example pyfast_and_pyside2_custom_window.py
# This example demonstrates how to use FAST in an existing PySide2 application.
#
# @m_class{m-block m-warning} @par PySide2 Qt Version
# @parblock
# For this example you <b>must</b> use the same Qt version of PySide2 as used in FAST (5.14.0)
# Do this with: <b>pi... | smistad/FAST | source/FAST/Examples/Python/pyfast_and_pyside2_custom_window.py | Python | bsd-2-clause | 2,566 |
import os
# This test is designed to look for an error that was fixed in mantis ticket #1018. The issue was
# having two images with the same serial number.
def main():
try:
os.mkdir(os.path.expandvars('$ISISROOT/src/qisis/tsts/SquishTests/output'))
except Exception:
pass
try:
os.un... | corburn/ISIS | isis/src/qisis/tsts/SquishTests/suites/suite_qnet/tst_Duplicate Serial m01018/test.py | Python | gpl-3.0 | 4,623 |
from django.contrib import admin
from datetime import datetime
from .models import Categoria, Post
class CategoriaAdmin(admin.ModelAdmin):
list_display = ('id', 'nome')
list_display_links = ('id', 'nome')
class PostAdmin(admin.ModelAdmin):
fields = ('titulo', 'publicado', 'categoria', 'imagem', 'conteudo')
list... | davidjc7/sweb | blog/admin.py | Python | gpl-2.0 | 917 |
# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution.... | joerango/single-machine-emulation-mascots-2015 | FullVMNode/ptvsd/visualstudio_py_debugger.py | Python | gpl-3.0 | 88,367 |
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
from . import config_option
from . import prompt
class SecretKeyOption(config_option.Option):
@staticmethod
def config_file_key():
return 'secret_key'
@classmethod
def visibi... | dongjoon-hyun/DIGITS | digits/config/secret_key.py | Python | bsd-3-clause | 524 |
"""Service layer (domain model) of practice app
"""
| effa/flocs | practice/services/__init__.py | Python | gpl-2.0 | 53 |
#!/usr/bin/env python
"""
Gather all information about the software
"""
NAME = "BibtexParser"
URL = "https://github.com/sciunto/python-bibtexparser"
LICENSE = "LGPLv3"
EMAIL = "fboulogne@sciunto.org"
VERSION = "0.5.1"
SHORT_DESCRIPTION = "Bibtex parser for python3"
AUHTORS = ["Francois Boulogne <fboulogne@sciunto.o... | pkgw/bibtools | bibtools/hacked_bibtexparser/info.py | Python | mit | 327 |
import sys
import math
import random
from decimal import *
from mrjob.job import MRJob
from mrjob.protocol import JSONProtocol
from mrjob.step import MRStep
from mrjob.step import JarStep
from mrjob.util import bash_wrap
from GlobalHeader import *
class CalculateEigenPair4(MRJob):
INPUT_PROTOCOL = JSONProtocol
... | oraclechang/CommunityDetection | CalculateEigenPair4.py | Python | gpl-2.0 | 793 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# CMS Firmware Wrapper
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc4108.txt
#
from pyasn1.... | catapult-project/catapult | third_party/pyasn1_modules/pyasn1_modules/rfc4108.py | Python | bsd-3-clause | 8,709 |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-google/cirq_google/json_resolver_cache.py | Python | apache-2.0 | 3,603 |
# 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 ... | zeinsteinz/tacker | tacker/db/migration/alembic_migrations/versions/b07673bb8654_set_status_type_tenant_id_length.py | Python | apache-2.0 | 1,847 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
from mezzanine.utils.conf import real_project_name
settings_module = "%s.settings" % real_project_name("linuxchixar")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
from django.core.management import execute_from... | linuxchixar/web | manage.py | Python | gpl-2.0 | 375 |
# Copyright 2017 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 applicable law or a... | GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/10_recommend/labs/hybrid_recommendations/hybrid_recommendations_module/trainer/task.py | Python | apache-2.0 | 3,907 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Totient permutation" – Project Euler Problem No. 70
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=70
def is_permutation_of(n, m):
n, m = str(n), str(m)
if len(m) ... | fbcom/project-euler | 070_totient_permutation.py | Python | mit | 1,053 |
from django.db import models
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django_pgjson.fields import JsonField
class IndicatorLookupBase(models.Model):
"""
Base model for indicator lookups
"""
owner = models.ForeignKey(settings.AUTH_USER_MODEL)
creat... | gdit-cnd/RAPID | monitors/models.py | Python | mit | 3,966 |
# 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, software
# d... | ankur-gupta91/horizon-net-ip | openstack_dashboard/test/integration_tests/pages/admin/system/volumes/volumetypespage.py | Python | apache-2.0 | 4,322 |
import cgi
import traceback
import datetime
import os
import re
import itertools
import xml.etree.ElementTree as ET
from django.conf import settings
from django.contrib.auth.models import Group, Permission
from django.core.urlresolvers import reverse
from django.test import TestCase
from ..models import \
Airport... | shapiromatron/amy | workshops/test/base.py | Python | mit | 17,718 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
stdm
A QGIS plugin
Securing land and property rights for all
-------------------
begin : 2014-03-04
copyright ... | gltn/stdm | stdm/data/configfile_paths.py | Python | gpl-2.0 | 8,889 |
# Based on netprowl by the following authors.
# Altered 1st October 2010 - Tim Child.
# Have added the ability for the command line arguments to take a password.
# Altered 1-17-2010 - Tanner Stokes - www.tannr.com
# Added support for command line arguments
# ORIGINAL CREDITS
# """Growl 0.6 Network Protocol Client fo... | gboudreau/CouchPotato | app/lib/growl.py | Python | gpl-3.0 | 5,432 |
"""
birthday.py
Author: Adam Pikielny
Credit: I read the readme
Assignment:
Your program will ask the user the following questions, in this order:
1. Their name.
2. The name of the month they were born in (e.g. "September").
3. The year they were born in (e.g. "1962").
4. The day they were born on (e.g. "11").
If th... | APikielny/Birthday-quiz | birthday.py | Python | mit | 1,937 |
#!/usr/bin/env python
import sys
import os
import re
import commands
import subprocess
import argparse
import inspect
def fail(message):
file_name = __file__
current_line_no = inspect.stack()[1][2]
current_function_name = inspect.stack()[1][3]
print 'Failure in:', file_name, current_line_no, curren... | WhisperSystems/Signal-iOS | Scripts/bump_build_tag.py | Python | gpl-3.0 | 7,216 |
#!/usr/bin/env python
import unicornhat as unicorn
import time, colorsys
from matrix import ukfast
def christmas_tree():
unicorn.brightness(0.4)
r = int(0)
g = int(255)
b = int(0)
rt = int(102)
gt = int(51)
bt = int(0)
unicorn.set_pixel(0,5,255,0,0)
unicorn.set_pixel(1,5,r,... | tommybobbins/ChristmasUnicornHat | ukfast.py | Python | gpl-2.0 | 2,193 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil.
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundat... | MauHernandez/cyclope | demo/cyclope_project/__init__.py | Python | gpl-3.0 | 781 |
from logic.rubiks_cube_converter import RubiksCubeConverter
from object_visual.v_rubiks_cube import VRubiksCube
class CubeStorage:
def __init__(self, display, cube_size):
self.cube_size = cube_size
self.current_cube = None
self._start_cube = VRubiksCube(self.cube_size, None, None, None,... | Willempie/Artificial_Intelligence_Cube | logic/handling/cube_storage.py | Python | apache-2.0 | 1,463 |
# Raphael Elspas
# Project Solenoise
#####################################################################
# This converts a csv file to a dot h file that an arduino can read #
#####################################################################
################################################################... | spacerafe/Solenoise | python8.py | Python | mit | 7,087 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# logout - force-expire active login session
# Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | heromod/migrid | mig/cgi-bin/logout.py | Python | gpl-2.0 | 1,078 |
from __future__ import absolute_import, print_function
import os
import sys
import pytest
from ..pyautoupdate.launcher import Launcher
@pytest.fixture(scope='function')
def create_update_dir(request):
"""Fixture that populates a downloads folder with a bunch of files,
including the project.zip file
""... | rlee287/pyautoupdate | test/test_rm_dirs.py | Python | lgpl-2.1 | 2,043 |
from sympy import Symbol, symbols, together, hypersimp, factorial, binomial, \
collect, Function, powsimp, separate, sin, exp, Rational, fraction, \
simplify, trigsimp, cos, tan, cot, log, ratsimp, Matrix, pi, integrate, \
solve, nsimplify, GoldenRatio, sqrt, E, I, sympify, atan, Derivative, S, ... | ryanGT/sympy | sympy/simplify/tests/test_simplify.py | Python | bsd-3-clause | 12,491 |
#!/usr/bin/python
"""
Replacement for runtest target in Makefile.
Call script with '-h' as an option to see a helpful message.
"""
from __future__ import print_function
import glob
import os
import os.path
import platform
import re
import subprocess
import sys
import time
from argparse import ArgumentParser, RawTex... | stan-dev/math | runTests.py | Python | bsd-3-clause | 11,496 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'LibertyProvider.federation_source'
db.add_column('saml_libertyprovider', 'federation_sourc... | incuna/authentic | authentic2/saml/migrations/0002_auto__add_field_libertyprovider_federation_source.py | Python | agpl-3.0 | 15,262 |
from django.contrib import admin
from .models import Lesson, Course, CourseLead, QA
# from django.utils.translation import ugettext_lazy as _
from ordered_model.admin import OrderedModelAdmin
from core.models import User
# from adminfilters.models import Species, Breed
class UserAdminInline(admin.TabularInline):
... | pashinin-com/pashinin.com | src/pashinin/admin.py | Python | gpl-3.0 | 1,211 |
from flask import Flask
from flask import request
from flask import render_template
from flask import abort, redirect, url_for
import pymongo
from pymongo import MongoClient
import smtplib
from email.mime.text import MIMEText
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template('minifile.... | frogeyedpeas/ChalupaCity | YO/MicroProto/starter.py | Python | mit | 642 |
"""Printing subsystem driver
SymPy's printing system works the following way: Any expression can be
passed to a designated Printer who then is responsible to return an
adequate representation of that expression.
The basic concept is the following:
1. Let the object print itself if it knows how.
2. Take the best f... | NikNitro/Python-iBeacon-Scan | sympy/printing/printer.py | Python | gpl-3.0 | 9,328 |
"""Connections to a Ceph RADOS Gateway (radosgw) service."""
import requests
import json
from awsauth import S3Auth
class Connection(object):
def __init__(self, server, access_key, secret_key, is_secure=False):
self._access_key = access_key
self._secret_key = secret_key
self._server = ser... | safiyat/rgwcmd | rgwcmd/connection.py | Python | gpl-2.0 | 2,069 |
# Copyright 2018 Onestein
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Website Image Dimensions',
'summary': 'Shows the width and height of images on the website '
'when hovered upon.',
'category': 'Website',
'version': '12.0.1.0.0',
'author': 'Onestein, ... | Vauxoo/website | website_img_dimension/__manifest__.py | Python | agpl-3.0 | 524 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Zoa Chou'
# see http://www.mudoom.com/Article/show/id/30.html for detail
import sys
import os
import logging
from factory import make_celery
from mailer import Mailer, MailerException
from celery.exceptions import MaxRetriesExceededError
sys.path.append(os.p... | ZoaChou/Python-learn | application/controller/tasks.py | Python | gpl-3.0 | 2,198 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import print_function, unicode_literals
import frappe
from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS
from .default_success_acti... | ESS-LLP/erpnext | erpnext/setup/install.py | Python | gpl-3.0 | 5,082 |
# -*- coding: utf-8 -*-
"""
Extensible permission system for pybbm
"""
from __future__ import unicode_literals
from django.db.models import Q
from pybb import defaults, util
class DefaultPermissionHandler(object):
"""
Default Permission handler. If you want to implement custom permissions (for example,
... | skolsuper/pybbm | pybb/permissions.py | Python | bsd-2-clause | 7,490 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.