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 os import platform import sys from logging.handlers import SysLogHandler LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] def get_logger_config(log_dir, logging_env="no_env", tracking_filename="tracking.log", edx_filename="edx.log...
yokose-ks/edx-platform
common/lib/logsettings.py
Python
agpl-3.0
5,212
#!/usr/bin/env python from nose.tools import ok_ from nose.tools import eq_ import networkx as nx from networkx.algorithms.approximation import min_weighted_dominating_set from networkx.algorithms.approximation import min_edge_dominating_set class TestMinWeightDominatingSet: def test_min_weighted_dominating_set(...
LumPenPacK/NetworkExtractionFromImages
win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/approximation/tests/test_dominating_set.py
Python
bsd-2-clause
2,410
""" Tests for file field behavior, and specifically #639, in which Model.save() gets called *again* for each FileField. This test will fail if calling a ModelForm's save() method causes Model.save() to be called more than once. """ from __future__ import absolute_import import os import shutil from django.core.files...
LethusTI/supportcenter
vendor/django/tests/regressiontests/bug639/tests.py
Python
gpl-3.0
1,365
"""Generic thread tests. Meant to be used by dummy_thread and thread. To allow for different modules to be used, test_main() can be called with the module to use as the thread implementation as its sole argument. """ import dummy_thread as _thread import time import Queue import random import unittest from test impo...
xbmc/atv2
xbmc/lib/libPython/Python/Lib/test/test_dummy_thread.py
Python
gpl-2.0
7,139
from statsmodels.regression.linear_model import GLS gls = GLS.from_formula from statsmodels.regression.linear_model import WLS wls = WLS.from_formula from statsmodels.regression.linear_model import OLS ols = OLS.from_formula from statsmodels.regression.linear_model import GLSAR glsar = GLSAR.from_formula from statsmode...
hlin117/statsmodels
statsmodels/formula/api.py
Python
bsd-3-clause
1,392
# Copyright (c) 2011 X.commerce, a business unit of eBay 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 req...
scripnichenko/nova
nova/api/openstack/compute/floating_ip_pools.py
Python
apache-2.0
2,196
import os # toolchains options ARCH = 'arm' CPU = 'cortex-m3' CROSS_TOOL = 'gcc' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = 'C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin' #EXEC_PATH = 'C:\Program Files ...
poranmeloge/test-github
stm32_rtt_wifi/bsp/efm32/rtconfig.py
Python
gpl-2.0
2,289
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008...
faarwa/EngSocP5
zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Platform/darwin.py
Python
gpl-3.0
1,758
"""Example: statsmodels.OLS """ from statsmodels.datasets.longley import load import statsmodels.api as sm from statsmodels.iolib.table import SimpleTable, default_txt_fmt import numpy as np data = load() data_orig = (data.endog.copy(), data.exog.copy()) #.. Note: In this example using zscored/standardized variable...
DonBeo/statsmodels
examples/incomplete/ols_table.py
Python
bsd-3-clause
1,999
#!/usr/bin/env python # # 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 optparse import os import subprocess import sys from util import build_utils def DoGcc(options): build_utils.MakeDirectory...
wangscript/libjingle-1
trunk/build/android/gyp/gcc_preprocess.py
Python
bsd-3-clause
1,415
# -*- coding: utf-8 -*- from framework.routing import Rule, json_renderer from website.addons.github import views settings_routes = { 'rules': [ # Configuration Rule( [ '/project/<pid>/github/settings/', '/project/<pid>/node/<nid>/github/settings/', ...
samanehsan/osf.io
website/addons/github/routes.py
Python
apache-2.0
3,429
class PythonVarArgsConstructor: def __init__(self, mandatory, *varargs): self.mandatory = mandatory self.varargs = varargs def get_args(self): return self.mandatory, ' '.join(self.varargs)
yahman72/robotframework
atest/testresources/testlibs/PythonVarArgsConstructor.py
Python
apache-2.0
228
from __future__ import print_function, division from sympy.core.numbers import nan from .function import Function class Mod(Function): """Represents a modulo operation on symbolic expressions. Receives two arguments, dividend p and divisor q. The convention used is the same as Python's: the remainder a...
Shaswat27/sympy
sympy/core/mod.py
Python
bsd-3-clause
4,488
# -*- coding: utf-8 -*- """ Unit tests for preference APIs. """ import datetime import ddt import unittest from mock import patch from pytz import UTC from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from django.test.utils import override_settings from dateu...
GbalsaC/bitnamiP
openedx/core/djangoapps/user_api/preferences/tests/test_api.py
Python
agpl-3.0
17,881
callback_classes = [ ['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', ...
kuropatkin/lte
src/virtual-net-device/bindings/callbacks_list.py
Python
gpl-2.0
1,101
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals from frappe.model import update_users_report_view_settings from erpnext.patches.v4_0.fields_to_be_renamed import rename_map def execute(): for dt,...
indictranstech/focal-erpnext
patches/v4_0/update_users_report_view_settings.py
Python
agpl-3.0
443
#!/usr/bin/env python # Copyright 2014 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. """Given the output of -t commands from a ninja build for a gyp and GN generated build, report on differences between the command line...
M4sse/chromium.src
tools/gn/bin/gyp_flag_compare.py
Python
bsd-3-clause
7,719
# -*- coding: utf-8 -*- """ Test the QgsSettings class Run with: ctest -V -R PyQgsSettings .. note:: 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 opti...
pblottiere/QGIS
tests/src/python/test_qgssettings.py
Python
gpl-2.0
23,013
# -*- coding: utf-8 -*- # Copyright (C) 2011 Chris Dekter # # 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 pr...
okroener/autokey
src/lib/gtkui/notifier.py
Python
gpl-3.0
12,947
# Copyright (c) 2001-2010 Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.application.strports}. """ from twisted.trial.unittest import TestCase from twisted.application import strports from twisted.application import internet from twisted.internet.test.test_endpoints import ParserTest...
eunchong/build
third_party/twisted_10_2/twisted/test/test_strports.py
Python
bsd-3-clause
5,121
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/service.py
Python
bsd-3-clause
7,923
# Copyright 2006 Georg Brandl. # Licensed to PSF under a Contributor Agreement. """Fixer for intern(). intern(s) -> sys.intern(s)""" # Local imports from .. import pytree from .. import fixer_base from ..fixer_util import Name, Attr, touch_import class FixIntern(fixer_base.BaseFix): BM_compatible...
nmercier/linux-cross-gcc
win32/bin/Lib/lib2to3/fixes/fix_intern.py
Python
bsd-3-clause
1,451
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
Slezhuk/ansible
lib/ansible/module_utils/_text.py
Python
gpl-3.0
12,325
import frappe def execute(): if "device" not in frappe.db.get_table_columns("Sessions"): frappe.db.sql("alter table tabSessions add column `device` varchar(255) default 'desktop'")
indautgrp/frappe
frappe/patches/v5_0/modify_session.py
Python
mit
185
# (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...
grimmjow8/ansible
test/units/executor/test_play_iterator.py
Python
gpl-3.0
18,831
import sys import os import unittest import cStringIO import warnings import re try: import json except ImportError: import simplejson as json from support import html5lib_test_files from html5lib.tokenizer import HTMLTokenizer from html5lib import constants class TokenizerTestParser(object): def __init_...
wangtaoking1/found_website
项目代码/html5lib/tests/test_tokenizer.py
Python
gpl-2.0
6,826
__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict'] # For bootstrapping reasons, the collection ABCs are defined in _abcoll.py. # They should however be considered an integral part of collections.py. from _abcoll import * import _abcoll __all__ += _abcoll.__all__ from _collections import deque, ...
Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86
usr/pkg/lib/python2.7/collections.py
Python
mit
25,363
"""Utilities to support packages.""" # NOTE: This module must remain compatible with Python 2.3, as it is shared # by setuptools for distribution with Python 2.3 and up. import os import sys import imp import os.path from types import ModuleType from org.python.core import imp as _imp, BytecodeLoader __all__ = [ ...
zephyrplugins/zephyr
zephyr.plugin.jython/jython2.5.2rc3/Lib/pkgutil.py
Python
epl-1.0
19,027
from . import foo
asedunov/intellij-community
python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/a.after.py
Python
apache-2.0
17
from __future__ import unicode_literals from django.apps import AppConfig class ProfileConfig(AppConfig): name = "profiles" verbose_name = 'User Profiles' def ready(self): from . import signals # noqa
ramaseshan/symptomchecker
symptomcheck/src/profiles/apps.py
Python
gpl-2.0
226
records = [select.query.decode(r) for r in records]
akosyakov/intellij-community
python/testData/joinLines/ListComprehension-after.py
Python
apache-2.0
51
class С: def __init__(self, x=None): if x is None: self.foo = { 'A': { 'x': 0, 'y': 0, }, } else: # init was given the previous state assert isinstance(x, С) self.foo = { ...
mdanielwork/intellij-community
python/testData/refactoring/rename/renameSelfAndParameterAttribute.py
Python
apache-2.0
460
# Since this package contains a "django" module, this is required on Python 2. from __future__ import absolute_import import sys import jinja2 from django.conf import settings from django.template import TemplateDoesNotExist, TemplateSyntaxError from django.utils import six from django.utils.module_loading import im...
Vvucinic/Wander
venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/template/backends/jinja2.py
Python
artistic-2.0
3,342
doctests = """ ########### Tests mostly copied from test_listcomps.py ############ Test simple loop with conditional >>> sum({i*i for i in range(100) if i&1 == 1}) 166650 Test simple case >>> {2*y + x + 1 for x in (0,) for y in (1,)} set([3]) Test simple nesting >>> list(sorted({(i,j) for i in...
teeple/pns_server
work/install/Python-2.7.4/Lib/test/test_setcomps.py
Python
gpl-2.0
3,847
# 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/. def main(request, response): headers = [] if 'Content-Type' in request.GET: headers += [('Content-Type'...
benschulz/servo
tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py
Python
mpl-2.0
443
# (c) 2014, Brian Coca, Josh Drake, et al # (c) 2017 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__ = type DOCUMENTATION = ''' cache: memory short_description: RAM ba...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/cache/memory.py
Python
bsd-3-clause
1,272
# settings file for builds. # if you want to have custom builds, copy this file to "localbuildsettings.py" and make changes there. # possible fields: # resourceBaseUrl - optional - the URL base for external resources (all resources embedded in standard IITC) # distUrlBase - optional - the base URL to use for update c...
McBen/ingress-intel-total-conversion
buildsettings.py
Python
isc
2,320
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os import shutil import sys import dirtyjson as json from ..decorators import linter from ..parsers.base import ParserBase @linter( name="coala", install=[ ["pipx", "install", "--spec", "coala-bears", "coala"], ...
guykisel/inline-plz
inlineplz/linters/coala.py
Python
isc
1,918
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2020 The SymbiFlow Authors. # # Use of this source code is governed by a ISC-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC """ This file defines the RoutingTree class wh...
SymbiFlow/python-fpga-interchange
fpga_interchange/route_stitching.py
Python
isc
16,298
#! /usr/bin/env python # this script does not perform full installation, # it is meant for use from Makefile import sys, os.path, re from distutils.core import setup from distutils.extension import Extension # check if configure has run if not os.path.isfile('config.mak'): print "please run ./configure && make f...
mpihlak/skytools-dev
setup_skytools.py
Python
isc
1,526
""" Based on :mod:`django.contrib.auth.tokens`. Supports the following settings: :setting:`WALDO_REGISTRATION_TIMEOUT_DAYS` The number of days a registration link will be valid before expiring. Default: 1. :setting:`WALDO_EMAIL_TIMEOUT_DAYS` The number of days an email change link will be valid before expiring. Def...
ithinksw/philo
philo/contrib/waldo/tokens.py
Python
isc
3,279
#!/usr/bin/env python import urllib.request import re import argparse parser = argparse.ArgumentParser() parser.add_argument("url", help="the URL whose HTML you want to extract telephone numbers from", type=str) args = parser.parse_args() with urllib.request.urlopen(args.url) as response: html = response.read().dec...
ArthurZey/toyproblems
phone_number_extractor.py
Python
mit
711
import difflib import shutil __author__ = 'Adam' import unittest import os import useful class TestFileContentProcedures(unittest.TestCase): @classmethod def setUpClass(cls): cls.test_dir = "./tests/data/" cls.text_file_name = "TextFile_UTF16_CRLF.txt" cls.text_file_path = os.path.j...
Adam01/Cylinder-server
tests/test_file_content_procedures.py
Python
mit
4,718
from axelrod import Player import random class Random(Player): """A player who randomly chooses between cooperating and defecting.""" name = 'Random' def strategy(self, opponent): return random.choice(['C','D'])
drvinceknight/Axelrod
axelrod/strategies/rand.py
Python
mit
235
import unittest import copy from scrapy.http import Headers class HeadersTest(unittest.TestCase): def test_basics(self): h = Headers({'Content-Type': 'text/html', 'Content-Length': 1234}) assert h['Content-Type'] assert h['Content-Length'] self.assertRaises(KeyError, h.__getitem__...
tashigaofei/BlogSpider
scrapy/tests/test_http_headers.py
Python
mit
4,934
''' mode | desc r 또는 rt | 텍스트 모드로 읽기 w 또는 wt | 텍스트 모드로 쓰기 a 또는 at | 텍스트 모드로 파일 마지막에 추가하기 rb | 바이너리 모드로 읽기 wb | 바이너리 모드로 쓰기 ab | 바이너리 모드로 파일 마지막에 추가하기 ''' f = open("./py200_sample.txt", "w") f.write("abcd") f.close() r = open("./py200_sample.txt", "r") print("-" * 60) ...
JaeGyu/PythonEx_1
p200_048.py
Python
mit
497
from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * from DistributedNPCToonBaseAI import * import ToonDNA from direct.task.Task import Task from toontown.ai import DatabaseObject from toontown.estate import ClosetGlobals class DistributedNPCTailorAI(DistributedNPCToonBaseAI): freeClothes = simbase....
ksmit799/Toontown-Source
toontown/toon/DistributedNPCTailorAI.py
Python
mit
8,113
# -*- coding: utf-8 -*- import os import time import logging import string import requests import unicodedata import base64 try: import cPickle as pickle except: import pickle import datetime from django.utils import timezone import json from pprint import pprint from django.shortcuts import render_to_response fr...
followyourheart/cloudly
vms/views.py
Python
mit
39,971
# -*- coding: utf-8 -*- """Checks/fixes are bundled in one namespace.""" import logging from rdflib.namespace import RDF, SKOS from .rdftools.namespace import SKOSEXT from .rdftools import localname, find_prop_overlap def _hierarchy_cycles_visit(rdf, node, parent, break_cycles, status): if status.get(node) is No...
NatLibFi/Skosify
skosify/check.py
Python
mit
8,938
# -*- coding:utf-8 -*- import unittest, sys, os sys.path[:0] = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) from saklient.cloud.enums.eserverinstancestatus import EServerInstanceStatus class TestEnum(unittest.TestCase): def test_should_be_defined(self): self.assertEqual(EServerInstance...
sakura-internet/saklient.python
tests/test_enum.py
Python
mit
1,117
__author__ = 'las3wh' print('goodbye')
lukestarchief/cs3240-labdemo
goodbye.py
Python
mit
39
# http://rosalind.info/problems/long/ def superstring(arr, accumulator=''): # We now have all strings if len(arr) == 0: return accumulator # Initial call elif len(accumulator) == 0: accumulator = arr.pop(0) return superstring(arr, accumulator) # Recursive call else: ...
AntoineAugusti/katas
rosalind/long.py
Python
mit
1,108
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('attracker_app', '0001_initial'), ] operations = [ migrations.AddField( model_name='segment', name='a...
chrispaul/attracker
attracker_app/migrations/0002_segment_additional_miles.py
Python
mit
455
# !/usr/local/bin/python3.4.2 # ----Copyright (c) 2017 Carnegie Hall | The MIT License (MIT)---- # ----For the full license terms, please visit https://github.com/CarnegieHall/linked-data/blob/master/LICENSE---- ##needs further refinement to eliminate non-instrument link results ## Argument[0] is script to run impor...
CarnegieHall/linked-data
scripts/scrape_mbz_instruments.py
Python
mit
1,346
#Synonyms experiment. Pass a string to see its "synonyms" from pyspark.sql import SparkSession, Row from pyspark.ml.feature import Word2Vec, Tokenizer, StopWordsRemover, Word2VecModel import sys; from string import punctuation def strip_punctuation(arr): return [''.join(c for c in s if c not in punctuation) for s ...
bcanvural/thesis
synonyms.py
Python
mit
1,419
from django.shortcuts import render,get_object_or_404 from django.http import Http404 # Create your views here. from django.http import HttpResponse def home(request): return render(request,'index.html');
iscarecrow/sb
server/views.py
Python
mit
208
from clickerft.cft import Cft from time import sleep class Suite(Cft): def test_buy_item_4(self): while int(self.clicksPerGeneration.text) < 2: if int(self.clicksOwned.text) < 1: sleep(.5) continue self.increaseClicksPerGeneration.click() w...
Victory/clicker-me-bliss
functional-tests/buy-item4.py
Python
mit
727
#-*- coding: utf-8 -*- import os from clang.cindex import Config, Index, TypeKind class ClangExtractor(object): def __init__(self, libclang_path, srcdir): if Config.library_file != libclang_path: Config.set_library_file(libclang_path) self.srcdir = srcdir def extract(self): ...
Frky/scat
src/shell/data/clangextractor.py
Python
mit
1,769
"""Contains utility functions for working with the shell""" from contextlib import contextmanager import datetime from decimal import Decimal import json import pprint import sys import time import traceback SHELL_CONTROL_SEQUENCES = { 'BLUE': '\033[34m', 'LTBLUE': '\033[94m', 'GREEN': '\033[32m', 'LT...
johnnadratowski/git-reviewers
python_lib/shell.py
Python
mit
8,544
""" Django settings for school 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, ...) imp...
raymondyan/django_school
school/settings.py
Python
mit
2,155
""" A simple client to query a TensorFlow Serving instance. Example: $ python client.py \ --images IMG_0932_sm.jpg \ --num_results 10 \ --model_name inception \ --host localhost \ --port 9000 \ --timeout 10 Author: Grant Van Horn """ from __future__ import absolute_import from __future__ import division from __futur...
visipedia/tf_classification
tfserving/client.py
Python
mit
2,561
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('merchants', '0006_classfy'), ] operations = [ migrations.CreateModel( name='RegionItem', fields=[ ...
myhearter/dianping
ddp/app/merchants/migrations/0007_auto_20171119_0852.py
Python
mit
807
import json import os from processes.postgres import Postgres from processes.gather_exception import GatherException try: DB_SERVER = os.environ['DB_SERVER'] DB_PORT = os.environ['DB_PORT'] DB_DATABASE = os.environ['DB_DATABASE'] DB_USER = os.environ['DB_USER'] DB_PASSWORD = os.environ['DB_PASSW...
kinoreel/kino-gather
processes/insert_movies.py
Python
mit
3,618
# mininode.py - Sscoin P2P network half-a-node # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # This python code was modified from ArtForz' public domain half-a-node, as # found in the mini-node branch of http://github.co...
rdqw/sscoin
qa/rpc-tests/test_framework/mininode.py
Python
mit
39,022
import urllib.parse import urllib.request import json import logging import requests log = logging.getLogger('tyggbot') class APIBase: @staticmethod def _get(url, headers={}): try: req = urllib.request.Request(url, None, headers) response = urllib.request.urlopen(req) ...
0rmi/tyggbot
apiwrappers.py
Python
mit
3,975
''' Created on Dec 13, 2015 @author: Shannon Litwin ''' import Adafruit_BBIO.GPIO as GPIO import Adafruit_BBIO.PWM as PWM import Lib_LCD as LCD import Lib_Main as BBB import sys import signal import time leftForward = "P8_46" leftBackward = "P8_45" rightForward = "P9_14" rightBackward = "P9_16" def Control_C_Exit(si...
ValRose/Rose_Bone
PythonLibraries/lcd_demo.py
Python
mit
1,617
""" Custom managers for Django models registered with the tagging application. """ from django.contrib.contenttypes.models import ContentType from django.db import models class ModelTagManager(models.Manager): """ A manager for retrieving tags for a particular model. """ def __init__(self, tag_model):...
mstepniowski/django-newtagging
newtagging/managers.py
Python
mit
2,765
import parsers import tokenizer import context html_escape_table = { "&": "&amp;", '"': "&quot;", "'": "&apos;", ">": "&gt;", "<": "&lt;", } def html_escape(text): """Produce entities within text.""" return "".join(html_escape_table.get(c,c) for c in unicode(text)) class Tag(object):...
ceko/cekolabs_empanada
cekolabs_empanada/tags.py
Python
mit
4,928
import os import sys import json from optional_django import staticfiles from optional_django.serializers import JSONEncoder from optional_django.safestring import mark_safe from optional_django import six from js_host.function import Function from js_host.exceptions import FunctionError from react.render import Rende...
HorizonXP/python-react-router
react_router/render.py
Python
mit
5,105
# Copyright (c) 2019-2020 Manfred Moitzi # License: MIT License import pytest import math import pickle # Import from 'ezdxf.math._vector' to test Python implementation from ezdxf.math._vector import Vec2, Vec3 from ezdxf.acc import USE_C_EXT all_vec_classes = [Vec2, Vec3] vec2_only = [Vec2] if USE_C_EXT: from e...
mozman/ezdxf
tests/test_06_math/test_603_vec2.py
Python
mit
8,066
from django.shortcuts import render # Create your views here. from .models import Course, Student, StudentCourse from .serializers import CourseSerializer, StudentSerialiser from rest_framework import viewsets from rest_framework.decorators import detail_route, list_route from rest_framework.response import Response...
Likegram/study_run
server/app/views.py
Python
mit
1,803
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Deuscoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test timestampindex generation and fetching # import time from test_framework.test_framework impor...
deuscoin-org/deuscoin-core
qa/rpc-tests/timestampindex.py
Python
mit
1,959
#!/usr/bin/env python # coding=utf-8 """ A simple example demonstrating the various ways to call cmd2.Cmd.read_input() for input history and tab completion """ from typing import ( List, ) import cmd2 EXAMPLE_COMMANDS = "Example Commands" class ReadInputApp(cmd2.Cmd): def __init__(self, *args, **kwargs) -> ...
python-cmd2/cmd2
examples/read_input.py
Python
mit
4,590
# 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/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_operations.py
Python
mit
3,780
from __future__ import absolute_import from .make_haploblocks import get_haploblocks from .genetic_models import check_genetic_models from .model_score import get_model_score from .fix_variant import make_print_version from .variant_annotator import VariantAnnotator
moonso/genmod
genmod/annotate_models/__init__.py
Python
mit
268
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- import copy import json import re from svtplay_dl.error import ServiceError from svtplay_dl.fetcher.hls import hlsparse from svtplay_dl.fetcher.http import HTTP from svtplay_dl.service import OpenGraphThumbMixin from svtplay_dl.se...
spaam/svtplay-dl
lib/svtplay_dl/service/vimeo.py
Python
mit
1,817
from django.apps import apps from django.contrib import admin AccessToken = apps.get_model('oauth2', 'AccessToken') Client = apps.get_model('oauth2', 'Client') Grant = apps.get_model('oauth2', 'Grant') RefreshToken = apps.get_model('oauth2', 'RefreshToken') class AccessTokenAdmin(admin.ModelAdmin): list_display ...
depop/django-oauth2-provider
provider/oauth2/admin.py
Python
mit
840
from rest_framework.permissions import BasePermission class IsBuilding(BasePermission): """Checks if a current building (preselected by middleware) has been assigned for this user""" def has_permission(self, request, view): return request.building is not None
danjac/ownblock
ownblock/ownblock/apps/buildings/permissions.py
Python
mit
284
from importlib import import_module def import_object(object_path): """ Import class or function by path :param object_path: path to the object for import :return: imported object """ module_path, class_name = object_path.rsplit('.', 1) module = import_module(module_path) return getatt...
novafloss/django-formidable
formidable/utils.py
Python
mit
342
#!/usr/bin/env python3 # Questo file legge il file di configurazione, # trova e modifica il parametro eseguendo il rispettivo "write*.py" # Serve per la parte di gestione html in python import cgi import cgitb # Abilita gli errori al server web/http cgitb.enable() # Le mie librerie Json, Html, flt (Thermo(Redis)) i...
raspibo/Thermo
var/www/cgi-bin/readsensors.py
Python
mit
3,144
import json from pprint import pprint import time import io # from http://www.codigomanso.com/en/2011/05/trucomanso-transformar-el-tiempo-en-formato-24h-a-formato-12h-python/ def ampmformat (hhmmss): """ This method converts time in 24h format to 12h format Example: "00:32" is "12:32 AM" "13...
inachen/cs171-hw4-chen-ina
ProblemGeoUSA/data_wrangle_total.py
Python
mit
1,779
#BitArray #Yu.Yang # class bitarray(): def __init__(self,length,defaultValue=False): if (length < 0): raise Exception("Length param error") self.array=[] self.length=length fillValue=defaultValue for i in range(self.length): self.array.append(defaultV...
NiuXWolf/Introduction-to-Algorithms
B/BitArray/BitArray.py
Python
mit
2,972
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import argparse from configparser import SafeConfigParser class Configurable(object): """ Configuration processing for the network """ def __i...
Impavidity/text-classification-cnn
configurable.py
Python
mit
4,672
from pyquery import PyQuery as pq from proxypool.schemas.proxy import Proxy from proxypool.crawlers.base import BaseCrawler from loguru import logger BASE_URL = 'https://www.xicidaili.com/' class XicidailiCrawler(BaseCrawler): """ xididaili crawler, https://www.xicidaili.com/ """ urls = [BASE_URL] ...
Python3WebSpider/ProxyPool
proxypool/crawlers/public/xicidaili.py
Python
mit
969
from django.contrib import admin from .models import Contact # Register your models here. admin.site.register(Contact)
Busaka/esl
src/contact/admin.py
Python
mit
121
from interface.design.ui_screen import Ui_wnd_gifextract from PyQt5 import QtWidgets import sys import listener import config import ffmpeg import queue import interface.menus.Frame_CreateGif import interface.menus.Frame_ExtractFrames import interface.menus.Frame_Queue class Screen(QtWidgets.QMainWindow): def ...
KaiAPaulhus/GifExtract
src/alpha.py
Python
mit
1,716
from django.core.management import call_command from django.test import TestCase from mock import call from mock import patch from kolibri.core.content import models as content class DeleteChannelTestCase(TestCase): """ Testcase for delete channel management command """ fixtures = ["content_test.jso...
indirectlylit/kolibri
kolibri/core/content/test/test_deletechannel.py
Python
mit
1,918
from wtforms import IntegerField, SelectMultipleField from wtforms.validators import NumberRange from dmutils.forms import DmForm import flask_featureflags class BriefSearchForm(DmForm): page = IntegerField(default=1, validators=(NumberRange(min=1),)) status = SelectMultipleField("Status", choices=( (...
AusDTO/dto-digitalmarketplace-buyer-frontend
app/main/forms/brief_forms.py
Python
mit
3,546
# coding=gbk import os import re import string def isMov(filename): # ÅжÏÊÇ·ñΪµçÓ°Îļþ suffix = filename.split('.')[-1].lower() # ÌáÈ¡ºó׺ pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv') if pattern.search(suffix): # Æ¥ÅäÊÇ·ñΪµçÓ°¸ñʽ return True...
windcode/xtools
CleanMoviePrefix.py
Python
mit
1,426
# coding: utf-8 import db_info import db_cancel import db_news import hashlib from tweeter import format_info, format_cancel, format_news import settings log = settings.log def add_info_to_queue(q, *args): try: # 更新した数をカウント updated = 0 for lec_info in args: id = db_info.add_in...
pddg/Qkou_kit
lib/add_db.py
Python
mit
2,046
import argparse from collections import defaultdict def calculateJaccardIndex(x,z,neighbours): shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate...
jakelever/knowledgediscovery
analysis/separate/jaccard.py
Python
mit
2,061
import scrapy import xml.etree.ElementTree as ET from locations.items import GeojsonPointItem URL = 'http://hosted.where2getit.com/auntieannes/2014/ajax?&xml_request=%3Crequest%3E%3Cappkey%3E6B95F8A2-0C8A-11DF-A056-A52C2C77206B%3C%2Fappkey%3E%3Cformdata+id%3D%22locatorsearch%22%3E%3Cdataview%3Estore_default%3C%2Fdat...
iandees/all-the-places
locations/spiders/aunt_annes.py
Python
mit
10,953
# 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/v2017_12_01/models/virtual_machine_update.py
Python
mit
6,810
"""Family module for Wikitech.""" # # (C) Pywikibot team, 2005-2020 # # Distributed under the terms of the MIT license. # from pywikibot import family # The Wikitech family class Family(family.WikimediaOrgFamily): """Family class for Wikitech.""" name = 'wikitech' code = 'en' def protocol(self, cod...
wikimedia/pywikibot-core
pywikibot/families/wikitech_family.py
Python
mit
405
# -*- coding: utf-8 -*- import os import argparse import datetime from lxml import etree, html from lxml.html.clean import Cleaner import fnmatch # To match files by pattern import re import time import pandas as pd def timeit(method): """Time methods.""" def timed(*args, **kw): ts = time.time() ...
chozelinek/europarl
meps_ie.py
Python
mit
9,953
# solve cliff-walking task with Q-Learning, very similar to SARSA # original example problem from the book, introduction for reinforcement learning # Author: Wenbin Li # numeric backend import pygame from pygame.locals import * import numpy as np grid_size = 100 n_row = 4 n_col = 12 state = np.zeros((n_row * grid_siz...
wenbinli/rl
cliffWalk_QL.py
Python
mit
6,866
__author__ = 'jdaniel' import copy import random import itertools import operator import math import struct import os import sys import json from collections import defaultdict class AlgorithmBase(object): def __init__(self, objective_function): """ Base Algorithm class which contains utility fun...
jldaniel/Gaia
Algorithms/algorithm_base.py
Python
mit
29,920
"""update cascading rules Revision ID: 619fe6fe066c Revises: 73ea6c072986 Create Date: 2017-03-15 10:51:12.494508 """ # revision identifiers, used by Alembic. revision = "619fe6fe066c" down_revision = "73ea6c072986" branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(...
Clinical-Genomics/housekeeper
alembic/versions/619fe6fe066c_update_cascading_rules.py
Python
mit
554
"""Freebox component constants.""" from __future__ import annotations import socket from homeassistant.components.sensor import SensorEntityDescription from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND, PERCENTAGE, Platform DOMAIN = "freebox" SERVICE_REBOOT = "reboot" APP_DESC = { "app_id": "hass",...
rohitranjan1991/home-assistant
homeassistant/components/freebox/const.py
Python
mit
2,269
""" Functions and classes dealing with commands. """
robobrobro/coffer
coffer/command/commands/__init__.py
Python
mit
53