code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import openerp
from openerp import http, SUPERUSER_ID
from openerp.addons.web.controllers.main import Binary
import functools
from openerp.http import request, serialize_exception as _serialize_exception
from openerp.modules import get_module_resource
from cStringIO import StringIO
db_monodb = http.db_monodb
class Bi... | litnimax/addons-yelizariev | web_debranding/controllers/main.py | Python | lgpl-3.0 | 2,180 |
"""Support for Vera scenes."""
from __future__ import annotations
from typing import Any
import pyvera as veraApi
from homeassistant.components.scene import Scene
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEnt... | mezz64/home-assistant | homeassistant/components/vera/scene.py | Python | apache-2.0 | 1,873 |
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""This module defines the data structures used to represent a grammar.
These are a bit arcane because they are derived from the data
structures used by Python's 'pgen' parser generator.
There's also ... | havard024/prego | venv/lib/python2.7/site-packages/sphinx/pycode/pgen2/grammar.py | Python | mit | 4,968 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Makefile execution.
Multiple `makes` can be run within the same process. Each one has an entirely data.Makefile and ... | lizh06/pymake | pymake/command.py | Python | mit | 9,665 |
# -*- coding: utf-8 -*-
"""
Scales: Classes to define Vega scales
"""
from .core import grammar, GrammarClass
from ._compat import str_types
class DataRef(GrammarClass):
"""Definitions for how data is referenced by scales
Data can be referenced in multiple ways, and sometimes it makes sense to
referenc... | taohaoge/vincent | vincent/scales.py | Python | mit | 5,858 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Joseph Callen <jcallen () csc.com>
# Copyright: (c) 2017-2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = ... | roadmapper/ansible | lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py | Python | gpl-3.0 | 23,760 |
# Copyright (c) 2014-2015, Intel Corporation
# 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... | soaresm/parameter-framework | tools/clientSimulator/criterion/Criterion.py | Python | bsd-3-clause | 2,351 |
__version__ = (0, 3, 5)
import logging
import gevent
log = logging.getLogger(__name__)
def socketio_manage(environ, namespaces, request=None, error_handler=None,
json_loads=None, json_dumps=None):
"""Main SocketIO management function, call from within your Framework of
choice's view.
... | grokcore/dev.lexycross | wordsmithed/src/gevent-socketio/socketio/__init__.py | Python | mit | 3,463 |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('details')
class PluginDetails(object):
def on_task_start(self, task, config):
# Make a flag for tasks to declare if it is ok not to produ... | ratoaq2/Flexget | flexget/plugins/plugin_verbose_details.py | Python | mit | 1,696 |
import serial
import random, time, math
port = "\\\\.\\CNCB0"
ser = serial.Serial(port, 38400)
incycle = 0
while True:
t = int(random.randint(60, 80) * (1 + math.sin(incycle)))
x = ser.write(chr(t))
time.sleep(0.02)
incycle += 0.01
if incycle >= 2 * math.pi:
incycle ... | xzmagic/code-for-blog | 2009/plotting_data_monitor/sender_sim.py | Python | unlicense | 344 |
# Copyright 2017 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... | dyoung418/tensorflow | tensorflow/contrib/distributions/python/ops/bijectors/absolute_value.py | Python | apache-2.0 | 1,160 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | BorgERP/borg-erp-6of3 | server/openerp/addons/base/res/wizard/partner_wizard_massmail.py | Python | agpl-3.0 | 3,567 |
# Copyright 2012 Cloudbase Solutions Srl
# 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 r... | scripnichenko/nova | nova/virt/hyperv/hostops.py | Python | apache-2.0 | 6,811 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANS... | bregman-arie/ansible | lib/ansible/modules/cloud/azure/azure_rm_storageblob.py | Python | gpl-3.0 | 21,360 |
#!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
ANSIB... | ravibhure/ansible | lib/ansible/modules/network/avi/avi_alertconfig.py | Python | gpl-3.0 | 12,090 |
"""The tests for the Home Assistant HTTP component."""
import asyncio
import requests
from homeassistant import setup, const
import homeassistant.components.http as http
from tests.common import get_test_instance_port, get_test_home_assistant
API_PASSWORD = 'test1234'
SERVER_PORT = get_test_instance_port()
HTTP_BASE... | JshWright/home-assistant | tests/components/http/test_init.py | Python | apache-2.0 | 5,897 |
from IOCommon import IOCommon | sanjeevtripurari/HiBench | src/sparkbench/src/main/python/IOCommon/__init__.py | Python | apache-2.0 | 29 |
import time
class get_rate_limited_function(object):
"""
Close over a function and a time limit in seconds. The resulting object can
be called like the function, but will not delegate to the function if that
function was called through the object in the time limit.
Clients can ignore the time lim... | mambocab/cassandra-dtest | utils/funcutils.py | Python | apache-2.0 | 1,280 |
#!/usr/bin/env python
from bezmisc import *
from ffgeom import *
def maxdist(((p0x,p0y),(p1x,p1y),(p2x,p2y),(p3x,p3y))):
p0 = Point(p0x,p0y)
p1 = Point(p1x,p1y)
p2 = Point(p2x,p2y)
p3 = Point(p3x,p3y)
s1 = Segment(p0,p3)
return max(s1.distanceToPoint(p1),s1.distanceToPoint(p2))
def cspsu... | gtfierro/BAS | web/smapgeo/inkscape/cspsubdiv.py | Python | gpl-3.0 | 892 |
"""Abstract base classes related to import."""
from . import _bootstrap
from . import _bootstrap_external
from . import machinery
try:
import _frozen_importlib
# import _frozen_importlib_external
except ImportError as exc:
if exc.name != '_frozen_importlib':
raise
_frozen_importlib = None
try:
... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/importlib/abc.py | Python | gpl-3.0 | 10,821 |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
compat_parse_qs,
compat_urlparse,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'(?P<baseurl>http://(?:www\.)?franceculture\.fr/)player/reecouter\?play=(?P<id>[0-... | svagionitis/youtube-dl | youtube_dl/extractor/franceculture.py | Python | unlicense | 2,924 |
from datetime import datetime
from nose.tools import eq_
from kitsune.announcements.models import Announcement
from kitsune.announcements.tests import announcement
from kitsune.sumo.tests import TestCase
from kitsune.sumo.urlresolvers import reverse
from kitsune.users.tests import user, add_permission
from kitsune.wi... | orvi2014/kitsune | kitsune/announcements/tests/test_views.py | Python | bsd-3-clause | 3,299 |
from south.db import db
from django.db import models
from apps.feed_import.models import *
class Migration:
def forwards(self, orm):
# Adding model 'OAuthToken'
db.create_table('feed_import_oauthtoken', (
('id', orm['feed_import.oauthtoken:id']),
('user', orm[... | lucidbard/NewsBlur | apps/feed_import/migrations/0002_oauth.py | Python | mit | 4,508 |
"""tzlocal for OS X."""
import os
import dateutil.tz
import subprocess
_cache_tz = None
def _get_localzone():
tzname = subprocess.check_output(["systemsetup", "-gettimezone"]).decode('utf-8')
tzname = tzname.replace("Time Zone: ", "")
# OS X 10.9+, this command is root-only
if 'exiting!' in tzname:
... | s2hc-johan/nikola | nikola/packages/tzlocal/darwin.py | Python | mit | 1,082 |
#
# 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 us... | dhalperi/beam | sdks/python/apache_beam/runners/worker/logger.py | Python | apache-2.0 | 6,644 |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 ... | mlperf/inference_results_v0.7 | open/Inspur/code/dlrm/tensorrt/scripts/convert_dlrm_data.py | Python | apache-2.0 | 4,174 |
#!/usr/bin/env python
import re
import sys
import os
import codecs
include_pat = r'(<!--\s*#include\s*virtual\s*=\s*"([^"]+)"\s*-->)'
include_regex = re.compile(include_pat)
url_pat = r'(\s+href\s*=\s*")([^"#]+)(#[^"]+)?(")'
url_regex = re.compile(url_pat)
version_pat = r'(@SLURM_VERSION@)'
version_regex = re.compi... | pompp/slurm-power-management | slurm/doc/html/shtml2html.py | Python | gpl-2.0 | 2,196 |
#!/usr/bin/env python3
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# A database of locale data for all the languages known to glibc
# To regene... | ashang/calibre | setup/lc_data.py | Python | gpl-3.0 | 203,677 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.naming import make_autoname
from frappe import _, msgprint, throw
import frappe.defaults
from frappe.utils import flt
f... | treejames/erpnext | erpnext/selling/doctype/customer/customer.py | Python | agpl-3.0 | 8,704 |
from pkg3 import B
A<caret> | siosio/intellij-community | python/testData/completion/className/alreadyImportedModulesPreference/alreadyImportedModulesPreference.py | Python | apache-2.0 | 28 |
# 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... | kkk669/mxnet | example/cnn_chinese_text_classification/data_helpers.py | Python | apache-2.0 | 7,021 |
import unittest
import textwrap
import antlr3
import testbase
class T(testbase.ANTLRTest):
def testbug(self):
self.compileGrammar()
cStream = antlr3.StringStream("public fooze")
lexer = self.getLexer(cStream)
tStream = antlr3.CommonTokenStream(lexer)
parser = self.... | pballand/congress | thirdparty/antlr3-antlr-3.5/runtime/Python3/tests/t045dfabug.py | Python | apache-2.0 | 409 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | mheap/ansible | lib/ansible/plugins/action/ironware.py | Python | gpl-3.0 | 3,772 |
class SingleAPISpec:
"""
Convenience class used to help DataverseAPILink when making API functions
"""
ATTR_NAMES = ['new_function_name', 'name', 'url_path', 'use_api_key', 'num_id_vals', 'use_param_dict']
URL_PLACEHOLDER = '{{ID_VAL}}'
def __init__(self, spec_list):
if not ty... | bmckinney/dataverse-canonical | scripts/api/py_api_wrapper/single_api_spec.py | Python | apache-2.0 | 2,768 |
"""Default tags used by the template system, available to all templates."""
import os
import sys
import re
from datetime import datetime
from itertools import groupby, cycle as itertools_cycle
from django.conf import settings
from django.template.base import (Node, NodeList, Template, Library,
TemplateSyntaxError... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/template/defaulttags.py | Python | bsd-3-clause | 48,056 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, getdate, cint
from frappe import throw, _
from erpnext.utilities.transaction_base import Transacti... | indictranstech/focal-erpnext | support/doctype/maintenance_schedule/maintenance_schedule.py | Python | agpl-3.0 | 9,816 |
from util import foo
# <ref> | siosio/intellij-community | python/testData/resolve/multiFile/relativeAndSameDirectoryImports/plainDirectorySameDirectoryImportRegistryOff/plainDirectory/mod.py | Python | apache-2.0 | 44 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models # noqa
from . import report # noqa
| ddico/odoo | addons/sale_margin/__init__.py | Python | agpl-3.0 | 166 |
# Copyright (C) 2013-2014 Free Software Foundation, 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 3 of the License, or
# (at your option) any later version.
#
# This progr... | zxombie/aarch64-freebsd-binutils | gdb/testsuite/gdb.perf/disassemble.py | Python | gpl-2.0 | 1,514 |
import os
import django
# It should be possible to just set DJANGO_SETTINGS_MODULE in setup.cfg
# or pytest.ini, but it doesn't work because pytest tries to do some
# magic by detecting a manage.py (which we don't have for our test suite).
# So we need to go the manual route here.
def pytest_configure():
os.envir... | itbabu/django-oscar | tests/conftest.py | Python | bsd-3-clause | 397 |
# The MIT License
#
# Copyright 2014, 2015 Piotr Dabkowski
#
# 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 rights
# to use, copy, modif... | repotvsupertuga/tvsupertuga.repository | script.module.universalscrapers/lib/universalscrapers/modules/js2py/__init__.py | Python | gpl-2.0 | 2,684 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | tsdmgz/ansible | test/units/template/test_templar.py | Python | gpl-3.0 | 20,034 |
# 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 t... | FNST-OpenStack/horizon | horizon/test/jasmine/jasmine.py | Python | apache-2.0 | 697 |
# cmdline: -O
# test optimisation output
print(__debug__)
assert 0
| AriZuu/micropython | tests/cmdline/cmd_optimise.py | Python | mit | 67 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/system/beadm.py | Python | bsd-3-clause | 11,657 |
"""
Wheel command-line utility.
"""
import argparse
import hashlib
import json
import os
import sys
from glob import iglob
from .. import signatures
from ..install import WheelFile, VerifyingZipFile
from ..paths import get_install_command
from ..util import urlsafe_b64decode, urlsafe_b64encode, native, binary, matche... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/wheel/tool/__init__.py | Python | mit | 13,421 |
# Copyright 2017 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/timeseries/python/timeseries/__init__.py | Python | apache-2.0 | 1,292 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies file copies with --generator-output using an explicit build
target of 'all'.
"""
import TestGyp
# Android doesn't support --g... | guorendong/iridium-browser-ubuntu | tools/gyp/test/generator-output/gyptest-copies.py | Python | bsd-3-clause | 1,920 |
# -*- coding: utf-8 -*-
"""Tests for Beautiful Soup's tree traversal methods.
The tree traversal methods are the main advantage of using Beautiful
Soup over just using a parser.
Different parsers will build different Beautiful Soup trees given the
same markup, but all Beautiful Soup trees can be traversed with the
me... | tremby/deluge-yarss-plugin | yarss2/include/bs4/tests/test_tree.py | Python | gpl-3.0 | 65,254 |
"""HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
import string
try:
from urllib.parse import quote, unquote, urlsplit, urlunsplit
except ImportError: # Python 2
from urllib import quote, unquote
from urlparse import urlsplit, urlunsplit
from django.utils... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/utils/html.py | Python | bsd-3-clause | 11,180 |
class A:
def foo(self):
self.a = <caret>{"1": 1, "2":2 | asedunov/intellij-community | python/testData/codeInsight/smartEnter/dict.py | Python | apache-2.0 | 66 |
###
#
# Copyright Alan Kennedy.
#
# You may contact the copyright holder at this uri:
#
# http://www.xhaus.com/contact/modjy
#
# The licence under which this code is released is the Apache License v2.0.
#
# The terms and conditions of this license are listed in a file contained
# in the distribution that also cont... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/modjy/modjy_publish.py | Python | epl-1.0 | 6,547 |
__version__ = '3.6'
| cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/setuptools/version.py | Python | mit | 20 |
# -*- coding: utf-8 -*-
#
# SelfTest/Signature/test_pkcs1_pss.py: Self-test for PKCS#1 PSS signatures
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyon... | ktan2020/legacy-automation | win/Lib/site-packages/Crypto/SelfTest/Signature/test_pkcs1_pss.py | Python | mit | 20,598 |
from __future__ import print_function
import unittest
from scrapy.http import Request
from scrapy.utils.request import request_fingerprint, _fingerprint_cache, \
request_authenticate, request_httprepr
class UtilsRequestTest(unittest.TestCase):
def test_request_fingerprint(self):
r1 = Request("http://w... | agreen/scrapy | tests/test_utils_request.py | Python | bsd-3-clause | 3,836 |
# Copyright (C) 2013 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/QueueStatusServer/model/warninglog.py | Python | bsd-3-clause | 2,147 |
#!/usr/bin/env python
#
# Copyright 2011 The Closure Linter 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
#... | dstockwell/catapult | tracing/third_party/closure_linter/closure_linter/requireprovidesorter.py | Python | bsd-3-clause | 9,826 |
"""Copyright (c) 2010-2012 David Rio Vierra
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... | skinny121/MCEdit-TallWorlds | mcplatform.py | Python | isc | 47,038 |
import random
from animation import *
from loader import *
import player
import pygame
from pygame.locals import *
from pygame.sprite import *
#lista de explosoes a desenhar
#init explosoes
explosoes = []
weapon_pickups = []
health_pickups = []
toasty = False
def asteroids(player1,player2,playerSprite1,playerSpri... | borgaster/SpaceWarsEvolved | physics.py | Python | mit | 6,670 |
#!/usr/bin/env python3
# Copyright (c) 2016-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the bumpfee RPC.
Verifies that the bumpfee RPC creates replacement transactions successfully when... | ElementsProject/elements | test/functional/wallet_bumpfee.py | Python | mit | 29,549 |
#!/usr/bin/env python3
from ..action import Action
class ConsoleDeployer:
def __init__(self, logger):
self.logger = logger
def read(self, relative):
raise Exception('can\'t read from console deployer')
def send(self, work, actions):
for action in actions:
if action.t... | r3c/Creep | creep/src/deployers/console.py | Python | mit | 668 |
from datetime import datetime
from twitter_update import api # , get_server_availability
from log import log_twitter
if __name__ == "__main__":
server_statuses = api.GetHomeTimeline(exclude_replies=True, since_id=753756834154938368)
for s in server_statuses:
log_twitter.info(s)
server_statuses.sor... | fp12/sfv-bot | src/twitter_servers_availability.py | Python | mit | 828 |
import sys
N = int(input())
A = list(map(int, sys.stdin.readline().split(' ')))
cnt = 0
for a in A:
cnt += 1 if a & 1 == 1 else 0
print('YES' if cnt % 2 == 0 else 'NO')
| nel215/atcoder-grand-contest | agc010/a.py | Python | mit | 175 |
from hatch.template import File
from hatch.utils.fs import Path
from hatchling.__about__ import __version__
from hatchling.metadata.utils import DEFAULT_METADATA_VERSION
from ..new.licenses_multiple import get_files as get_template_files
from .utils import update_record_file_contents
def get_files(**kwargs):
met... | ofek/hatch | tests/helpers/templates/wheel/standard_default_license_multiple.py | Python | mit | 1,407 |
class Book(object):
def __init__(self, isbn, title, description=None, category=None):
self.isbn = isbn
self.title = title
self.description = description
self.score = 0
self.readers = []
self.category = category
def assign_rating(self, score):
self.score =... | gabalese/suggest-me-a-book | models/models.py | Python | mit | 1,001 |
"""
Django settings for aniauth project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | randomic/antinub-auth | aniauth/settings/base.py | Python | mit | 3,664 |
#!/usr/bin/env python
# compiler.py
# Dynamo
#
# Created by John Holdsworth on 18/06/2015.
# Copyright (c) 2015 John Holdsworth. All rights reserved.
import os
import re
productName = os.getenv( "PRODUCT_NAME" )
imports = ""
props = ""
code = {}
match = 0
file = open( productName+".shtml", "r" )
stml = file.r... | TribeMedia/Dynamo | Utilities/sspcompiler.py | Python | mit | 1,607 |
# pylint: disable=E1101
"""
BaseSink.py
"""
from cps2zmq.gather import BaseSink
# Filters/Handlers/Loggers would do bulk of work here
class LogSink(BaseSink):
def handle_pub(self, msg):
"""
Figure out extent to which this'll be overridden.
"""
self.msgs_recv += 1
self._logge... | goosechooser/cps2-zmq | cps2zmq/gather/LogSink.py | Python | mit | 969 |
# backwards!
from .upload_inline import UploadInlineMixin # noqa
| rouxcode/django-filer-addons | filer_addons/filer_gui/admin/inlines.py | Python | mit | 67 |
import pytari2600.cpu.instructions as instructions
import pytari2600.cpu.addressing as addressing
import pytari2600.cpu.pc_state as pc_state
import unittest
class DummyClocks(object):
def __init__(self):
self.system_clock = 0
class DummyMemory(object):
def __init__(self):
self.dummy_read =... | ajgrah2000/pytari2600 | pytari2600/test/test_instructions.py | Python | mit | 6,597 |
"""
=================
Confidence Levels
=================
When setting the sigma levels for ChainConsumer, we need to be careful
if we are talking about 1D or 2D Gaussians. For 1D Gaussians, 1 and 2 :math:`\sigma` correspond
to 68% and 95% confidence levels. However, for a a 2D Gaussian, integrating over 1 and 2 :math... | Samreay/ChainConsumer | examples/customisations/plot_confidence_levels.py | Python | mit | 1,673 |
import pytest
import mock
from team.server import app
def is_html(r):
assert r.status_code == 200
assert r.headers['Content-type'] == 'text/html; charset=utf-8'
def test_get_home():
client = app.test_client()
r = client.get('/')
is_html(r)
def test_get_cards():
client = app.test_client()
... | LandRegistry/team-dashboard | tests/test_server.py | Python | mit | 1,048 |
# -*- coding: utf-8 -*-
"""
Django settings for tempo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_liter... | EliotBerriot/tempo | config/settings/base.py | Python | mit | 10,605 |
from sikuli import *
import Constants
reload(Constants)
class MainMenu(object):
states = [
'Start',
'CollectStart',
'MailCollect',
'ChallengesCollect',
'ChallengesCollect',
'End'
]
def __init__(self, botInfo):
self.botInfo = botInfo;
self.st... | Stephen-Zhang/Ishtaria-Sikuli | MainMenu.sikuli/MainMenu.py | Python | mit | 2,447 |
#!/usr/bin/env python3
# Weather Summary
import argparse
import datetime
import fnmatch
import os
import piexif
from libxmp.utils import file_to_dict
from lib import srtm
parser = argparse.ArgumentParser(description="Lookup a weather report for the location/time an image was captured.")
parser.add_argument("project... | UASLab/ImageAnalysis | scripts/99-wx-report.py | Python | mit | 6,553 |
from flask import request, session
from flask import Blueprint
import api
import json
import mimetypes
import os.path
import api.auth
import asyncio
import threading
from api.annotations import api_wrapper
from api.common import flat_multi
from api.exceptions import *
blueprint = Blueprint("scoreboard_api", __name_... | EasyCTF/easyctf-2015 | api/api/routes/scoreboard.py | Python | mit | 355 |
import matplotlib.pyplot as plt
import time
import random
from collections import deque
import numpy as np
import datetime
from xbee import XBee,ZigBee
import serial
import time
a1 = deque([0]*100)
ax = plt.axes(xlim=(0, 20), ylim=(0, 10))
line, = plt.plot(a1,linewidth=4)
plt.ion()
plt.ylim([0,100])
... | GeorgePlukov/FloodWatch | graphingplotter2.py | Python | mit | 1,308 |
import base64
import hashlib
import hmac
import simplejson
import time
import os
from mod_drops.settings import DISQUS_SECRET_KEY, DISQUS_PUBLIC_KEY
from mod_drops.settings import STATIC_URL, BASE_DIR
def get_disqus_sso(user):
# generate icon and avatar
url = "http://localhost:8000/"
avatar = os.path.jo... | henry808/mod_drops | image/disqus.py | Python | mit | 1,752 |
#!/usr/bin/env python
import sys
import os
import atexit
import signal
import time
import inspect
import logging
import pyaas
pyaas.argparser.add_argument('daemon',
metavar='(start|stop|restart)',
help='Control the state of the service')
pyaas.argparser.add_argument('--instance',
help='Name an instance... | moertle/pyaas | pyaas/daemon.py | Python | mit | 4,433 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 rights to us... | EmanueleCannizzaro/scons | test/SWIG/live.py | Python | mit | 4,455 |
"""
WSGI config for mmpl 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.10/howto/deployment/wsgi/
"""
from __future__ import absolute_import, unicode_literals
import os
from django.core.wsgi import g... | benjiboi214/mmpl-wagtail | site/mmpl/wsgi.py | Python | mit | 455 |
#!/usr/bin/env python
'''
Based on:
Zenke, Friedemann, Everton J. Agnes, and Wulfram Gerstner.
"Diverse Synaptic Plasticity Mechanisms Orchestrated to Form and Retrieve Memories in Spiking Neural Networks."
Nature Communications 6 (April 21, 2015).
Part of Zenke's rule embedded in modified Brunel 2000 / Ostojic 2014... | h-mayorquin/camp_india_2016 | tutorials/LTPinnetworks2/Step3c_Zenke_etal_2014.py | Python | mit | 8,540 |
def user():
response.title = auth_title()
return dict(form=auth())
| tessercat/ddj | controllers/auth.py | Python | mit | 75 |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import argparse,sys,os
parser = argparse.ArgumentParser()
parser.add_argument("--ue4path", help="path to unreal engine base directory")
args = parser.parse_args()
ue4path=args.ue4path
if ue4path is None:
ue4path=os.environ.get('UE4PATH',None)
if ue4path is None... | orig74/UE4PyServer | Source/PyServer/build.py | Python | mit | 2,388 |
'''
This code is based on github.com/MagicStack/vmbench/blob/master/servers/asyncio_http_server.py
'''
import asyncio
import uvloop
from protocol import *
def httptools_server(loop, addr):
return loop.create_server(lambda: HttpProtocol(loop=loop), *addr)
if __name__ == '__main__':
loop = uvloop.new_event_... | rickiepark/openbidder | openbidder/server.py | Python | mit | 562 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py | Python | mit | 10,665 |
class PaginatorFactory(object):
def __init__(self, http_client):
self.http_client = http_client
def make(self, uri, data=None, union_key=None):
return Paginator(self.http_client, uri, data, union_key)
class Paginator(object):
def __init__(self, http_client, uri, data=None, union_key=None)... | webhue/appannie | appannie/paginator.py | Python | mit | 1,489 |
#!/usr/bin/env python
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# ... | AndrewCMartin/idb | selenium/selenium-3.7.0/setup.py | Python | mit | 3,806 |
"""
homeassistant.remote
~~~~~~~~~~~~~~~~~~~~
A module containing drop in replacements for core parts that will interface
with a remote instance of home assistant.
If a connection error occurs while communicating with the API a
HomeAssistantError will be raised.
"""
import threading
import logging
import json
import... | EnTeQuAk/home-assistant | homeassistant/remote.py | Python | mit | 12,864 |
import pytest
from authentise_services import errors
from authentise_services.session import Session
@pytest.mark.parametrize('status_code', [201,
pytest.mark.xfail((403), raises=errors.ResourceError),
])
def test_create_user(config, httpretty, status_code):
httpretty.reg... | DoWhileGeek/authentise-services | tests/test_session.py | Python | mit | 1,008 |
from setuptools import setup
setup(name='more_ascii_art',
version='1.4',
description='Cool ASCII art with python',
url='http://github.com/PenetratingShot/Python-ASCII-Art',
author='Shreyas Lad and Talon Bragg',
author_email='slad0716@gmail.com',
license='MIT',
packages=['more_... | PenetratingShot/Python-ASCII-Art | setup.py | Python | mit | 355 |
# Lesson 8
import math
# We can use j on a numeric literal to turn it into an imaginary number
x = 1 + 2j
y = 3 - 4j
z = 3
print(x * y)
print(x / y)
print(y - z)
# Unfortunately, the math library is not built with imaginary numbers in mind.
# print(math.sqrt(-4))
| JonTheBurger/python_class | chapter 3/lessons/complex.py | Python | mit | 267 |
from RanobeHonyaku.database import db
class Volume(db.Model):
__tablename__ = "volumes"
id = db.Column(db.Integer(), primary_key=True)
# The title of the volume
title = db.Column(db.String(120))
# The series id that the volume is associated with
series_id = db.Column(db.Integer(), db.Forei... | Ranobe-Honyaku/Website | RanobeHonyaku/models/volume.py | Python | mit | 624 |
#!/usr/bin/env python
"""
This application presents a 'console' prompt to the user asking for
subscribe commands which create SubscribeCOVRequests. The other commands are
for changing the type of reply to the confirmed COV notification that gets
sent.
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogg... | JoelBender/bacpypes | samples/COVClient.py | Python | mit | 8,225 |
import random
from copy import deepcopy
import pygame
from SystemPanic.Core import config
GameConfiguration = {
"players": None,
"enemies": None,
"player_missiles": None,
"enemy_missiles": None,
"background": None,
"level_generator": None,
"level_tiles": None,
"music": None,
}
def ... | xaroth8088/SystemPanic | SystemPanic/Core/game_configuration.py | Python | mit | 1,210 |
#! /usr/local/bin/Python3.5
import boto3
polly = boto3.Session(profile_name="gekko1").client('polly')
response = polly.synthesize_speech(
OutputFormat='mp3',
SampleRate='8000',
Text='Salut, je m\'appelle Benjamin',
TextType='text',
VoiceId='Mathieu'
)
# print(type(response['AudioStream'].read())... | Mythridor/aws-scripting | Polly/first_ouput.py | Python | mit | 403 |
from django.conf import settings
from django.db import models
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
from icalendar import Event
from .file import File
from .helper import DefaultFields, ShortableNameFields
from .location import Location
fr... | meine-stadt-transparent/meine-stadt-transparent | mainapp/models/meeting.py | Python | mit | 3,288 |
# -*- coding: utf-8 -*-
# This spider is used for HTML redirect crawling
import scrapy
from scrapy.selector import Selector
from scrapy.http import Request
from browser_simulator.items import BrowserSimulatorItem
class TestSpiderSpider(scrapy.Spider):
name = "html_redirect_spider"
# allowed_domains = ["yuyang... | skihyy/GT-Spring-2017-CS6262 | browser_simulator/browser_simulator/spiders/html_redirect_spider.py | Python | mit | 3,117 |
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render
from studyroom.forms import CreateSessionForm
from studyroom.models import Session
def create_session(request):
if request.method == "POST":
form = CreateSessionForm(request.POST)... | TejasM/wisely | wisely_project/studyroom/views.py | Python | mit | 999 |
from evostream.default import api
from evostream.management.base import BaseEvoStreamCommand
class Command(BaseEvoStreamCommand):
help = 'Returns a complete list of group name aliases.'
requires_system_checks = False
def get_results(self, *args, **options):
return api.list_group_name_aliases()
| tomi77/django-evostream | evostream/management/commands/listgroupnamealiases.py | Python | mit | 319 |