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 |
|---|---|---|---|---|---|
import os
## helper functions ##
def _ip_ok(handler):
using('basic')
# reject ip if not local
# this will not work if there is a proxy server
# because the proxy is seen as local
ip = handler.client_address[0]
return ip[:7]=='192.168' or ip[:9]=='127.0.0.1'
def _send_html(message):
using('u... | J-Adrian-Zimmer/ProgrammableServer | expanders/uploadPic.py | Python | mit | 1,825 |
# coding: utf-8
BACKUP_NAME = 'gae_backup_'
# back up entity kinds.
# BACKUP_KINDS = '*' # back up all kinds. except starts with '_' entities.
# BACKUP_KINDS = 'Model1'
# BACKUP_KINDS = ['Model1', 'Model2']
BACKUP_KINDS = '*'
# backup filesystem. 'gs' is Google Cloud Storage or blank is Blobstore
BACKUP_FILESYSTEM =... | t4kash/gae_backup_python | test/gae_backup_python/config.py | Python | mit | 447 |
import abc
import inspect
import logging
import random
import sys
from collections import namedtuple
log = logging.getLogger("edx.courseware")
# This is a tuple for holding scores, either from problems or sections.
# Section either indicates the name of the problem or the name of the section
Score = namedtuple("Scor... | B-MOOC/edx-platform | common/lib/xmodule/xmodule/graders.py | Python | agpl-3.0 | 17,288 |
#!/usr/bin/env python3
from lxml import etree
etree.set_default_parser(etree.HTMLParser())
import os
import subprocess
import requests
from urllib.parse import urljoin
from io import BytesIO
tmpdir = './tmp/'
indexes = [
'http://www.budget.gov.au/2014-15/content/bp1/html/index.htm',
'http://www.budget.gov.au/... | grahame/budget2014 | budget14.py | Python | apache-2.0 | 1,557 |
from django.apps import AppConfig
class BanConfig(AppConfig):
name = "django_sonic_screwdriver.apps.ban"
| rhazdon/django-sonic-screwdriver | django_sonic_screwdriver/apps/ban/apps.py | Python | mit | 111 |
## Copyright (c) 2015 Ryan Koesterer GNU General Public License v3
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any l... | rmkoesterer/uga | uga/RunSnvgroup.py | Python | gpl-3.0 | 13,158 |
from __future__ import print_function
import boto3
import sys
import hashlib
import botocore.exceptions
import json
import requests
print('Loading function')
with open('secret.txt', 'r') as f:
secret = f.read()
def hash_for(info):
return hashlib.sha256(info['email'] + info['name'] + secret).hexdigest()
de... | KenCoder/quarter | lambda/lambda_function.py | Python | epl-1.0 | 2,243 |
"""
Copyright (c) 2014, Samsung Electronics Co.,Ltd.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and... | ajkxyz/cuda4py | src/cuda4py/blas/_cublas.py | Python | bsd-2-clause | 14,674 |
import unittest
from test_vrh import *
from test_spin import *
from test_composite import *
import os, sys
sys.path.insert(1,os.path.abspath('..'))
import burnman
from burnman import minerals
class TestRock(unittest.TestCase):
def test_rock(self):
amount_perovskite = 0.3
rock = burnman.composite... | tjhei/burnman_old2 | tests/tests.py | Python | gpl-2.0 | 865 |
<<<<<<< HEAD
<<<<<<< HEAD
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Steve English <steve.english@navetas.com> #
# Copyright 2012 Vincent J... | ArcherSys/ArcherSys | Lib/site-packages/github/NamedUser.py | Python | mit | 67,937 |
# Copyright 2010 by Dana Larose
# This file is part of crashRun.
# crashRun 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.
# crashR... | DanaL/crashRun | src/OldComplex.py | Python | gpl-3.0 | 8,287 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/key_vault_key_reference_py3.py | Python | mit | 1,446 |
#from __future__ import absolute_import
#from . import initializations
#from . import layers
#from . import models
#from . import regularizers
#from . import trainings
__version__ = '0.3.2'
| yhalk/vw_challenge_ECR | src/jetson/acol/__init__.py | Python | apache-2.0 | 191 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='StockSubscription',
fields=[
('id', models.Auto... | bellisk/hypothesis-django-example | mysite/example/migrations/0001_initial.py | Python | mit | 632 |
def greater_than(left, right):
return left if left > right else right
def get_largest_product_in_number_line(number_line):
current_product = reduce(lambda x, y: x * y, number_line[:4])
largest_product = current_product
for j in range(4, len(number_line)):
# current_product /= number_line[j - 4... | PisoMojado/ProjectEuler- | src/euler/problems/problem11.py | Python | gpl-2.0 | 2,460 |
""" QDialog for "attaching" additional metadata from CSV file
"""
import logging
import os
from PyQt4 import QtCore, QtGui
import numpy as np
from ..ui_attach_md import Ui_AttachMd
from ..logger import qgis_log
from ..ts_driver.ts_manager import tsm
logger = logging.getLogger('tstools')
class AttachMetadata(QtGu... | ceholden/TSTools | tstools/src/controls/attach_md.py | Python | gpl-2.0 | 6,679 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Usage:
python app.py <user_id>
"""
import json
import os
import requests
import sys
from bs4 import BeautifulSoup
import concurrent.futures
def crawl(user_id, items=[], max_id=None):
url = 'https://twitter.com/i/profiles/show/' + user_id + '/media_... | rarcega/twitter-scraper | app.py | Python | unlicense | 1,778 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from .app.views import FooView
urlpatterns = patterns('',
url(r'^$', FooView.as_view(template_name='home.html'), name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^ratings/', include('star_ratings.urls', name... | webu/django-star-ratings | demo/demo/urls.py | Python | bsd-3-clause | 361 |
#!/usr/bin/env python3
"""
Copyright (c) 2014 by nurupo <nurupo.contributions@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the right... | TokTok/toxcore | other/fun/bootstrap_node_info.py | Python | gpl-3.0 | 4,847 |
coord = (47.606165, -122.332233); # Assignment
print "coord =", coord
## Tuple item access
# - Indexing
print "Latitude =", coord[0], \
", Longitude =", coord[1]
(latitude, longitude) = coord; # - Unpacking
print "Latitude =", latitu... | safl/chplforpyp-docs | docs/source/examples/tuples.py | Python | apache-2.0 | 357 |
#
# 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
# ... | openstack/heat | heat/engine/conditions.py | Python | apache-2.0 | 2,745 |
# Copyright 2015 Rackspace.
#
# 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 ... | gotostack/neutron-lbaas | neutron_lbaas/drivers/common/agent_callbacks.py | Python | apache-2.0 | 8,743 |
# Part of Patient Flow.
# See LICENSE file for full copyright and licensing details.
from openerp.tests import common
from datetime import datetime as dt
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as dtf
import logging
_logger = logging.getLogger(__name__)
from faker import Faker
fake = Faker()
seed = f... | NeovaHealth/patientflow | nh_patient_flow/tests/test_operations.py | Python | agpl-3.0 | 8,482 |
class GrammaticalError(Exception):
def __init__(self, expression, message):
self.expression = expression
self.message = message
class QuotationError(Exception):
def __init__(self, expression, message):
self.expression = expression
self.message = message
#class NounificationErro... | ProjetPP/PPP-QuestionParsing-Grammatical | ppp_questionparsing_grammatical/data/exceptions.py | Python | agpl-3.0 | 450 |
""" simple non-constant constant. Ie constant which does not get annotated as constant
"""
from rpython.rtyper.extregistry import ExtRegistryEntry
from rpython.flowspace.model import Constant
from rpython.annotator.model import not_const
class NonConstant(object):
def __init__(self, _constant):
self.__di... | oblique-labs/pyVM | rpython/rlib/nonconst.py | Python | mit | 1,205 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/rnacentral/genes/data/__init__.py | Python | apache-2.0 | 773 |
#!/usr/bin/env python
# -*- enc: utf-8 -*-
import sys, logging, glob
from PyQt4 import QtCore, QtGui
#from pytestqt.qt_compat import qWarning
import gui
import metadata
import xmeml
from gui import main
logging.basicConfig(level=logging.WARNING)
def test_basic_window(qtbot, tmpdir):
app = QtGui.QApplication... | havardgulldahl/pling-plong-odometer | test/test_gui.py | Python | gpl-3.0 | 765 |
from libdotfiles.packages import try_install
from libdotfiles.util import run
try_install("bluez")
try_install("bluez-utils")
try_install("blueman")
run(["sudo", "systemctl", "enable", "bluetooth"])
run(["sudo", "systemctl", "start", "bluetooth"])
run(
[
"sudo",
"sh",
"-c",
'sed -... | rr-/dotfiles | cfg/bluetooth/__main__.py | Python | mit | 396 |
"""
examples of reportlab document using
BaseDocTemplate with
2 PageTemplate (one and two columns)
"""
import os
from reportlab.platypus import BaseDocTemplate, Frame, Paragraph, NextPageTemplate, PageBreak, PageTemplate
from reportlab.lib.units import inch
from reportlab.lib.styles import getSampleStyleSheet
styles... | ActiveState/code | recipes/Python/123612_BaseDocTemplate_2/recipe-123612.py | Python | mit | 1,791 |
import os
import time
from unittest.mock import patch
import zmq
import pytest
from zerolog.receiver import Receiver
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
def test_main_receiver(context):
"""Receiver should correctly run"""
sender = context.socket(zmq.PUB)
sender.bind("tcp://127.0.0.1:... | TheGhouls/zerolog | tests/test_receiver.py | Python | mit | 1,791 |
import urllib.request, urllib.parse, urllib.error
from pyparsing import makeHTMLTags, SkipTo
# read HTML from a web page
serverListPage = urllib.request.urlopen( "http://www.yahoo.com" )
htmlText = serverListPage.read()
serverListPage.close()
# using makeHTMLTags to define opening and closing tags
anchorSt... | miguelalexanderdiaz/lenguajes_project | pyparsing-2.0.2/examples/makeHTMLTagExample.py | Python | gpl-2.0 | 796 |
import os
import sys
import mock
from nose.tools import with_setup, raises, ok_, eq_
from atve.application import AtveTestRunner
from atve.workspace import Workspace
from atve.exception import *
class TestAtveTestRunner(object):
@classmethod
def setup(cls):
cls.runner = AtveTestRunner()
cls.r... | TE-ToshiakiTanaka/atve | test/test_atvetestrunner.py | Python | mit | 4,794 |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import shutil
max_partition = 3
def check_remove_create(loc):
if os.path.exists(loc):
shutil.rmtree(loc)
os.mkdir(loc)
return loc
def check_create_dir(location_dir, sub_dir):
loc = os.path.join(location_dir, sub_dir)
... | ns-xlz/nginx_by_xlz | config/sample.py | Python | gpl-3.0 | 3,285 |
""" Tests for utils. """
import collections
import copy
import mock
from datetime import datetime, timedelta
from pytz import UTC
from django.test import TestCase
from django.test.utils import override_settings
from contentstore import utils
from contentstore.tests.utils import CourseTestCase
from xmodule.modulestore... | nicky-ji/edx-nicky | cms/djangoapps/contentstore/tests/test_utils.py | Python | agpl-3.0 | 15,281 |
# Generated by Django 2.2.2 on 2019-06-27 23:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0012_auto_20190627_2144'),
]
operations = [
migrations.AlterField(
model_name='bomitem'... | inventree/InvenTree | InvenTree/part/migrations/0013_auto_20190628_0951.py | Python | mit | 865 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Croc Bauges - Print Product module for Odoo
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you c... | grap/odoo-addons-crb | crb_print_product/models/print_product_wizard.py | Python | agpl-3.0 | 2,045 |
from TimeSeries import SessionFactory
class TestSessionFactory:
def setup(self):
self.connection_string = "sqlite:///:memory:"
self.session_factory = SessionFactory(self.connection_string, echo=True)
def test_create_session_factory(self):
assert repr(self.session_factory) == "<SessionFactory('Engine(%s)')>" ... | Castronova/EMIT | api_old/ODM1_1_1/tests/data_tests/test_session_factory.py | Python | gpl-2.0 | 530 |
""" Store packages in S3 """
import logging
from binascii import hexlify
from contextlib import contextmanager
from hashlib import md5
from io import BytesIO
from urllib.request import urlopen
from pyramid.httpexceptions import HTTPFound
from pyramid.settings import asbool
from pypicloud.models import Package
from .... | stevearc/pypicloud | pypicloud/storage/object_store.py | Python | mit | 4,039 |
# Copyright 2015 Kevin B Jacobs
#
# 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 wr... | bioinformed/vgraph | vgraph/bed.py | Python | apache-2.0 | 4,566 |
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
admin.autodiscover()
"""
Basic, reusable patterns
"""
faculty = r'(?P<faculty>\w+)'
department = r'(?P<department>\w{4})'
number = '(?P<number>\d{3}[DNJ]?[123]?)'
course = department + '_' + number
page_type = '(?P<page_type... | dellsystem/wikinotes | urls.py | Python | gpl-3.0 | 4,019 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function, unicode_literals
import os.path
import nose.tools as nose
import yvs.filter_refs as yvs
from tests import set_up, tear_down
from tests.decorators import use_user_prefs
@nose.with_setup(set_up, tear_down)
@use_user_prefs({'language': 'eng'... | caleb531/youversion-suggest | tests/test_filter_refs/test_prefs.py | Python | mit | 3,247 |
import requests
import math
import json
from os.path import expanduser
from datetime import datetime
from bs4 import BeautifulSoup
GOOGLE_API_KEY = "AIzaSyC79GdoRDJXfeWDQnx5bBr14I3HJgEBIH0"
def get_current_coordinates():
"""
Returns the current latitude and longitude
defined by IP address
"""
try... | georgi-gi/where2Go | where2Go/directions_and_durations.py | Python | gpl-2.0 | 4,747 |
from __future__ import unicode_literals
import base64
from hashlib import sha1
import hmac
import time
import uuid
from django.conf import settings
from django.contrib.auth import authenticate
from django.core.exceptions import ImproperlyConfigured
from django.middleware.csrf import _sanitize_token, constant_time_comp... | ocadotechnology/django-tastypie | tastypie/authentication.py | Python | bsd-3-clause | 17,744 |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
import mlpy
import matplotlib.pyplot as plot
import matplotlib.cm as cm
from random import ra... | christabor/MoAL | MOAL/algorithms/time_series/dynamic_timewarping.py | Python | apache-2.0 | 1,635 |
from osvr.ClientKitRaw import *
class Interface:
"""Interface object"""
def __init__(self, iface, ctx):
"""Initializes an interface object."""
self.interface = iface
self.context = ctx
self.freed = False
def registerCallback(self, cb, userdata):
"""Registers a callbac... | BlendOSVR/OSVR-Python | osvr/Interface.py | Python | apache-2.0 | 3,745 |
#!/usr/bin/env python
from generator.actions import Actions, encode
import random
import struct
class VM(Actions):
def start(self):
self.state['init_memory'] = random.randint(0, 0xFFFF)
self.state['init_registers'] = self.chance(0.5)
self.state['registers'] = []
while len(self.stat... | f0rki/cb-multios | original-challenges/stream_vm/poller/for-release/machine.py | Python | mit | 6,904 |
from datetime import date
from app.models import TimeExercisesHistory, TimeExercisesTaxonomy, Users
from app.service import TimeExercisesHistoryService, TimeExercisesTaxonomyService, UsersService
from app.service_tests.service_test_case import ServiceTestCase
class TimeExercisesHistoryTests(ServiceTestCase):
def ... | pbraunstein/trackercise | app/service_tests/time_exercises_history_service_tests.py | Python | mit | 10,888 |
"""empty message
Revision ID: 30dcafee101
Revises: 2474c24c055
Create Date: 2015-05-02 10:11:46.095370
"""
# revision identifiers, used by Alembic.
revision = '30dcafee101'
down_revision = '2474c24c055'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | anniejw6/art_flask | migrations/versions/30dcafee101_.py | Python | mit | 1,020 |
# 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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py | Python | mit | 683 |
'''
Created on 16 Sep 2016
@author: rizarse
'''
import jks, textwrap, base64
from os.path import expanduser
import os.path
import atexit
import shutil
from os import makedirs
class JksHandler(object):
def __init__(self, params):
pass
@staticmethod
def writePkAndCerts(ks, token):
... | magistral-io/MagistralPython | src/magistral/client/util/JksHandler.py | Python | mit | 3,975 |
import json, codecs, re
from abc import ABCMeta, abstractmethod
from PIL import Image, ExifTags
from witica.util import throw, sstr, suni
#regular expressions regarding item ids
RE_METAFILE = r'^meta\/[^\n]+$'
RE_FIRST_ITEMID = r'(?!meta\/)[^\n?@.]+'
RE_ITEMFILE_EXTENSION = r'[^\n?@\/]+'
RE_ITEMID = r'^' + RE_FIRST_... | bitsteller/witica | witica/metadata/extractor.py | Python | mit | 7,072 |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from flask import Flask
from commitsan.hooks_app import app as hooks
frontend = Flask(__name__)
frontend.config['DEBUG'] = True
class CombiningMiddleware(object):
"""Allows one t... | abusalimov/commitsan | commitsan/web_app.py | Python | mit | 1,160 |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
class MedicalMetaData:
def __init__(self):
self.medical_image_properties = None
self.direction_cosines = None
def close(self):
del self.medical_image_properties
del self.direction_cosin... | chrisidefix/devide | module_kits/misc_kit/devide_types.py | Python | bsd-3-clause | 720 |
"""Configuration(yaml_files=[...]) tests."""
from dependency_injector import providers
from pytest import fixture, mark, raises
@fixture
def config(config_type, yaml_config_file_1, yaml_config_file_2):
if config_type == "strict":
return providers.Configuration(strict=True)
elif config_type == "defaul... | ets-labs/python-dependency-injector | tests/unit/providers/configuration/test_yaml_files_in_init_py2_py3.py | Python | bsd-3-clause | 2,928 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald XMPP bot
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.5
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use ... | gattazr/cohorte-herald | python/herald/transports/xmpp/bot.py | Python | apache-2.0 | 3,169 |
#!flask/bin/python
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_migration.py' % (v+1))
tmp... | tsinghuariit/DMP | project_src/db_migrate.py | Python | apache-2.0 | 938 |
import os
import codecs
from ni.core.workspace import load_workspace
def load_settings_from_file(filename, klass):
settings = klass(filename)
try:
fle = open(filename)
try:
fields = set(settings.fields)
for line in fle.readlines():
try:
... | lerouxb/ni | editors/base/settings.py | Python | mit | 4,527 |
from django.conf import settings
import subprocess
class Zone(object):
@classmethod
def get_zone_list(cls, zone_file):
file = open(zone_file, 'r')
content = file.read()
zone_list = [line.strip() for line in content.split('\n') if line.strip() != '' and line.strip().find('//') != 0]
... | ragibkl/blackhole | website/common/utils.py | Python | gpl-3.0 | 3,481 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
from sklearn.metrics import fbeta_score
__all__ = ["BaseClassifier"]
class BaseClassifier(object):
def __init__(self):
return None
def train(self, predictors, classifications, **kwargs):
raise NotImpl... | GOTO-OBS/goto-vegas | classifier/base.py | Python | mit | 2,014 |
import kivy
from kivy.app import App
from kivy.uix.scatter import Scatter
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
class HelloApp(App):
def build(self):
f = FloatLayout()
s = Scatter()
l = Label(text="Hello, World!",
font_size=150)
... | izaharkin/kivy-simple-app | hello_world.py | Python | gpl-3.0 | 432 |
# written 2021-12-26 by mza
# last updated 2022-01-25 by mza
# to install on a circuitpython device:
# rsync -av *.py /media/circuitpython/
# cp -a particle_man.py /media/circuitpython/code.py
# cd ~/build/adafruit-circuitpython/bundle/lib
# rsync -r adafruit_register neopixel.mpy adafruit_pm25 adafruit_io adafruit_es... | mzandrew/bin | embedded/particle_man.py | Python | gpl-3.0 | 5,252 |
#!/usr/bin/env python
import os
import sys
import dotenv
PROJECT_PATH = os.path.dirname(__file__)
dotenv.load_dotenv(os.path.join(PROJECT_PATH, ".env"))
dotenv.load_dotenv(os.path.join(PROJECT_PATH, ".env_defaults"))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eth_alarm.settings"... | pipermerriam/ethereum-alarm-clock-web | manage.py | Python | mit | 429 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | oscarolar/odoo | openerp/addons/base/res/res_currency.py | Python | agpl-3.0 | 11,762 |
# Copyright 2013 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 logging
from pylib import android_commands
from pylib.device import device_utils
class OmapThrottlingDetector(object):
"""Class to detect and trac... | guorendong/iridium-browser-ubuntu | build/android/pylib/perf/thermal_throttle.py | Python | bsd-3-clause | 4,529 |
from typing import NamedTuple
class _version_info(NamedTuple):
# similar to sys._version_info
major: int
minor: int
micro: int
version_info = _version_info(0, 10, 1)
__version__ = '.'.join(map(str, version_info))
def config_for_app(config):
import warnings
warnings.warn((
"It is saf... | biothings/biothings.api | biothings/__init__.py | Python | apache-2.0 | 438 |
# Copyright (c) 2016-present, Facebook, 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... | davinwang/caffe2 | caffe2/python/layer_model_instantiator.py | Python | apache-2.0 | 4,254 |
# Generated by Django 2.1.7 on 2019-04-26 11:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("mediafiles", "0003_auto_20190119_1425"),
("assignments", "0006_auto_20190119_1425"),
]
operations = [
migrations.AddField(
... | jwinzer/OpenSlides | server/openslides/assignments/migrations/0007_assignment_attachments.py | Python | mit | 477 |
# 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 use ... | NexusIS/libcloud | libcloud/compute/drivers/ecs.py | Python | apache-2.0 | 59,910 |
# 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/v2021_05_01/operations/_ip_allocations_operations.py | Python | mit | 27,202 |
'''
Created on Jul 18, 2017
@author: I310003
'''
| BlessedAndy/Programming-Foundations-with-Python | Programming Foundations with Python/src/cn/careerwinner/sap/report_scheduler.py | Python | apache-2.0 | 55 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0015_auto_20160421_0000'),
]
operations = [
migrations.CreateModel(
name='ArticleListItemPlugin',
... | okfn/foundation | article_list_item/migrations/0001_initial.py | Python | mit | 749 |
# Copyright (C) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | atodorov/dnf | doc/examples/install_extension.py | Python | gpl-2.0 | 3,221 |
"""
Tests for the base connection class
"""
from unittest import TestCase
import six
from pynamodb.connection import Connection
from pynamodb.exceptions import (
TableError, DeleteError, UpdateError, PutError, GetError, ScanError, QueryError)
from pynamodb.constants import DEFAULT_REGION
from .data import DESCRIB... | mtsgrd/PynamoDB2 | pynamodb/tests/test_base_connection.py | Python | mit | 49,223 |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.Index import Index
class WrapIndex(Index):
r'''
::
>>> source = ugentools.In.ar(bus=0)
>>> wrap_index = ugentools.WrapIndex.ar(
... buffer_id=buffer_id,
... source=source,
... )
>>> wrap_index
... | andrewyoung1991/supriya | supriya/tools/pendingugentools/WrapIndex.py | Python | mit | 3,591 |
''' -- imports from python libraries -- '''
# from datetime import datetime
import datetime
import json
''' -- imports from installed packages -- '''
from django.http import HttpResponseRedirect # , HttpResponse uncomment when to use
from django.http import HttpResponse
from django.http import Http404
from django.sho... | sunnychaudhari/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/views/course.py | Python | agpl-3.0 | 54,618 |
import numpy as np
import math
import sys
import os
sys.path.insert(0,os.environ['learningml']+'/GoF/')
import classifier_eval
from classifier_eval import name_to_nclf, nclf, experiment, make_keras_model
from sklearn import tree
from sklearn.ensemble import AdaBoostClassifier
from sklearn.svm import SVC
from rep.estim... | weissercn/learningml | learningml/GoF/optimisation_and_evaluation/automatisation_monash_alphaSvalue_lower_level/automatisation_monash_alphaSvalue_low_level_optimisation_and_evaluation.py | Python | mit | 3,831 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/subnet_paged.py | Python | mit | 922 |
# -*- encoding: utf-8 -*-
from abjad.tools import scoretools
# TODO: remove in favor of layouttools.set_line_breaks_by_line_duration()
def set_line_breaks_by_line_duration_ge(
expr,
line_duration,
line_break_class=None,
add_empty_bars=False,
):
r'''Iterate `line_break_class` instances in `expr... | mscuthbert/abjad | abjad/tools/layouttools/set_line_breaks_by_line_duration_ge.py | Python | gpl-3.0 | 2,086 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import smtplib
import string
HOST="smtp.163.com" #使用的邮箱的smtp服务器地址,这里是163的smtp地址
SUBJECT = "test email from python" #定义邮件的主题
#TO = "2213561999@qq.com" #定义收件收件人
TO = "zhangyage@yazhoujuejin.com"
FROM="zhangyage2015@1... | zhangyage/Python-oldboy | python-auto/mail/163_send2.py | Python | apache-2.0 | 1,124 |
#!/usr/bin/env python3
#
# Gedit Scheme Editor
# https://github.com/jonocodes/GeditSchemer
#
# Copyright (C) Jono Finger 2013 <jono@foodnotblogs.com>
#
# The 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 Founda... | GNOME/gedit-plugins | plugins/colorschemer/schemer/__init__.py | Python | gpl-2.0 | 1,817 |
#
# 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
# distributed under ... | thinker0/aurora | src/main/python/apache/thermos/cli/commands/tail.py | Python | apache-2.0 | 3,381 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 9 13:55:16 2015
@author: adelpret
"""
from numpy import zeros as zeros
NJ = 30;
kp_pos = zeros(NJ); # joint position control proportional gains
kd_pos = zeros(NJ); # joint position control derivative gains
ki_pos = zeros(NJ); # joint position control integral gain... | andreadelprete/sot-torque-control | python/hrp2_joint_pos_ctrl_gains.py | Python | lgpl-3.0 | 1,941 |
import os
import tuned.logs
from . import base
from tuned.utils.commands import commands
log = tuned.logs.get()
class cpulist2hex(base.Function):
"""
Conversion function: converts CPU list to hexadecimal CPU mask
"""
def __init__(self):
# arbitrary number of arguments
super(cpulist2hex, self).__init__("cpulis... | redhat-performance/tuned | tuned/profiles/functions/function_cpulist2hex.py | Python | gpl-2.0 | 470 |
# Copyright 2013 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.
"""The tab switching measurement.
This measurement opens pages in different tabs. After all the tabs have opened,
it cycles through each tab in sequence, an... | aospx-kitkat/platform_external_chromium_org | tools/perf/measurements/tab_switching.py | Python | bsd-3-clause | 2,524 |
import ConfigurationFileProbe
| seblefevre/testerman | plugins/probes/configurationfile/__init__.py | Python | gpl-2.0 | 30 |
from __future__ import unicode_literals
from collections import OrderedDict
import datetime
from operator import attrgetter
import pickle
import unittest
import warnings
from django.core.exceptions import FieldError
from django.db import connection, DEFAULT_DB_ALIAS
from django.db.models import Count, F, Q
from djang... | runekaagaard/django-contrib-locking | tests/queries/tests.py | Python | bsd-3-clause | 154,394 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0003_event_is_published'),
]
operations = [
migrations.AlterModelOptions(
name='attendee',
... | PythonMid/pymidweb | pythonmid/apps/events/migrations/0004_auto_20150527_0123.py | Python | gpl-2.0 | 415 |
from jtapi import *
import os
import sys
import re
mfilename = re.search('(.*).py', os.path.basename(__file__)).group(1)
#########
# input #
#########
print('jt - %s:' % mfilename)
handles_stream = sys.stdin
handles = gethandles(handles_stream)
input_args = readinputargs(handles)
input_args = checkinputargs(input_... | brainy-minds/Jterator | skeleton/modules/myPythonModule.py | Python | mit | 532 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
LICENSE = open(os.path.join(os.path.dirname(__file__), 'LICENSE.txt')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup... | aptivate/django-spreadsheetresponsemixin | setup.py | Python | gpl-3.0 | 1,365 |
# -*- coding: utf-8 -*-
import os
import pytz
import time
import click
import signal
import threading
import speedtest_cli as stc
from collections import OrderedDict
from datetime import datetime as dt
stc.shutdown_event = threading.Event()
class SpeedTest(object):
def __init__(self, server_id=None):
s... | elbaschid/bandviz | bandviz/cli.py | Python | mit | 2,253 |
# Generated by Django 2.0.8 on 2018-10-03 17:24
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('adesao', '0011_sistemacultura_diligencia_simples'),
]
operations = [
migrations.AlterModelOptions(
... | culturagovbr/sistema-nacional-cultura | adesao/migrations/0014_auto_20181003_1424.py | Python | agpl-3.0 | 645 |
#!/usr/bin/python
"""
Software package management library.
This is an abstraction layer on top of the existing distributions high level
package managers. It supports package operations useful for testing purposes,
and multiple high level package managers (here called backends). If you want
to make this lib to support ... | libvirt/autotest | client/common_lib/software_manager.py | Python | gpl-2.0 | 23,931 |
import os
import numpy as np
np.random.seed(1337) # for reproducibility or os.getpid() for random
from keras.datasets import mnist
from keras.models import Sequential, Model
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from keras.layers.normalization import BatchNormali... | kornjas/data-science | create_res_basicblock.py | Python | bsd-3-clause | 2,043 |
import os
from collections import defaultdict
import boto3
import click
from infra_buddy.aws.cloudformation import CloudFormationBuddy
from infra_buddy.commandline import cli
from infra_buddy.context.deploy_ctx import DeployContext
from infra_buddy.deploy.cloudformation_deploy import CloudFormationDeploy
from infra_b... | AlienVault-Engineering/infra-buddy | src/main/python/infra_buddy/commands/introspect/command.py | Python | apache-2.0 | 1,430 |
"""Nutanix Integration for Cortex XSOAR - Unit Tests file"""
import io
import json
from datetime import datetime
from typing import *
import pytest
from CommonServerPython import DemistoException, CommandResults
from NutanixHypervisor import Client
from NutanixHypervisor import USECS_ENTRIES_MAPPING
from NutanixHype... | VirusTotal/content | Packs/NutanixHypervisor/Integrations/NutanixHypervisor/NutanixHypervisor_test.py | Python | mit | 18,687 |
import sys
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
... | eduNEXT/edunext-ecommerce | ecommerce/extensions/order/management/commands/prompt.py | Python | agpl-3.0 | 1,074 |
import bobo
@bobo.query('/')
def hello(person):
return 'Hello %s!' % person
| YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/attic/functions/hello.py | Python | gpl-3.0 | 86 |
# Copyright 2007 Google 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 Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the ho... | UPPMAX/nsscache | nss_cache/maps/group_test.py | Python | gpl-2.0 | 4,427 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join
import sys
def configuration(parent_package='',top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('sparse',parent_package,top_path,
... | sargas/scipy | scipy/sparse/setupscons.py | Python | bsd-3-clause | 656 |
# -*- coding: utf8 -*-
import logging
logger = logging.getLogger(__name__)
print(f"zeeguu_core initialized logger with name: {logger.name}")
logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(message)s")
def info(msg):
logger.info(msg)
def debug(msg):
logger.debug(msg)
def log(msg):
inf... | mircealungu/Zeeguu-Core | zeeguu_core/__init__.py | Python | mit | 462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.