text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
import sys, os
import tornado.ioloop
import tornado.web
import logging
import logging.handlers
import re
from urllib import unquote
import config
from vehiclenet import *
reload(sys)
sys.setdefaultencoding('utf8')
def deamon(chdir = False):
try:
if os.fork() > 0:
os._exit(0)
except OSError,... | codemeow5/vehiclenet-python | web.py | Python | gpl-2.0 | 2,732 | 0.027086 |
"""映射 集合 ... 高级数据结构类型"""
from string import Template
val_dict = {1: 'a', 2: 'b', 3: 'c'}
print(val_dict)
print(val_dict.keys())
print(val_dict.items())
print(val_dict.values())
factory_dict = dict((['x', 1], ['y', 2]))
print(factory_dict)
ddcit = {}.fromkeys(('x', 'y', 'z'), -24)
ddcit.update(val_dict) # 新值覆盖旧值
prin... | yanjinbin/learnPython | chapter_7/chapter7.py | Python | gpl-3.0 | 3,243 | 0.000699 |
# test seasonal.adjust_seasons() options handling
#
# adjust_seasons() handles a variety of optional arguments.
# verify that adjust_trend() correctly calledfor different option combinations.
#
# No noise in this test set.
#
from __future__ import division
import numpy as np
from seasonal import fit_trend, adjust_seaso... | welch/seasonal | tests/adjust_seasons_test.py | Python | mit | 1,815 | 0.007163 |
#!/usr/bin/env python
import subprocess
import praw
import datetime
import pyperclip
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
impor... | foobarbazblarg/stayclean | stayclean-2020-july/serve-challenge-with-flask.py | Python | mit | 12,690 | 0.003546 |
class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
reverse = 0
r = n
for i in range(32):
bit = r % 2
reverse += bit << (32-i-1)
r = r / 2
return reverse
s = Solution()
r = s.reverseBits(43261596)
print(r)... | lutianming/leetcode | reverse_bits.py | Python | mit | 321 | 0.003115 |
import unittest
from rsync_usb.ChunkLocation import ChunkLocation
class ChunkLocationTests(unittest.TestCase):
'''Test TargetHashesWriter and TargetHashesReader'''
def testProperties(self):
pos = ChunkLocation('dummy', 100, 10)
self.assertEqual(pos.path, 'dummy')
self.... | shearern/rsync-usb | src/rsync_usb_tests/ChunkLocationTests.py | Python | gpl-2.0 | 4,596 | 0.001958 |
# (c) 2013, Serge van Ginderachter <serge@vanginderachter.be>
#
# 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)... | wenottingham/ansible | lib/ansible/plugins/lookup/subelements.py | Python | gpl-3.0 | 4,311 | 0.002784 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2010 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | ntt-pf-lab/backup_keystone | keystone/middleware/remoteauth.py | Python | apache-2.0 | 4,006 | 0.00025 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Client module for connecting to and interacting with SmartyStreets API
"""
import json
import numbers
import requests
from .data import Address, AddressCollection
from .exceptions import SmartyStreetsError, ERROR_CODES
def validate_args(f):
"""
Ensures that... | audantic/smartystreets.py | smartystreets/client.py | Python | bsd-3-clause | 6,663 | 0.002852 |
from i3pystatus.playerctl import Playerctl
class Spotify(Playerctl):
"""
Get Spotify info using playerctl. Based on `Playerctl`_ module.
"""
player_name = "spotify"
| m45t3r/i3pystatus | i3pystatus/spotify.py | Python | mit | 183 | 0 |
from datetime import timedelta
from contentstore.utils import get_modulestore
from xmodule.modulestore.django import loc_mapper
from xblock.fields import Scope
class CourseGradingModel(object):
"""
Basically a DAO and Model combo for CRUD operations pertaining to grading policy.
"""
# Within this clas... | liuqr/edx-xiaodun | cms/djangoapps/models/settings/course_grading.py | Python | agpl-3.0 | 9,046 | 0.003869 |
# 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... | hehongliang/tensorflow | tensorflow/python/util/tf_export_test.py | Python | apache-2.0 | 6,573 | 0.005021 |
#!/usr/bin/env python3
# sudo apt-get install python3-tk
# This file is part of PFunc. PFunc provides a set of simple tools for users
# to analyze preference functions and other function-valued traits.
#
# Copyright 2016-2022 Joseph Kilmer
#
# PFunc is free software: you can redistribute it and/or modify
# it under th... | Joccalor/PFunc | PFunc.py | Python | gpl-3.0 | 130,625 | 0.000322 |
import random
from abc import ABC, abstractmethod
import logging
import numpy
import rlr
from typing import List
from typing_extensions import Protocol
import dedupe.sampling as sampling
import dedupe.core as core
import dedupe.training as training
import dedupe.datamodel as datamodel
from dedupe._typing import Train... | datamade/dedupe | dedupe/labeler.py | Python | mit | 15,590 | 0.000513 |
#!/usr/bin/env python2
from gimpfu import *
import time
import re
def preview (image, delay, loops, force_delay, ignore_hidden, restore_hide):
if not image:
raise "No image given."
layers = image.layers
nlayers = len (layers)
visible = []
length = []
i = 0
while i < nlayers:
... | rbong/gimptools | preview.py | Python | gpl-2.0 | 2,246 | 0.01959 |
# coding: utf-8
"""
Provides functions for finding and testing for locally `(k, l)`-connected
graphs.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)\nDan Schult (dschult@colgate.edu)"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <sw... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/hybrid.py | Python | bsd-2-clause | 6,084 | 0.010355 |
__author__ = 'Ostico <ostico@gmail.com>'
import sys
import os
import unittest
from pyorient.exceptions import *
from pyorient import OrientSocket
from pyorient.messages.database import *
from pyorient.messages.commands import *
from pyorient.messages.cluster import *
from pyorient.messages.records import *
from pyori... | mogui/pyorient | tests/test_raw_messages_2.py | Python | apache-2.0 | 12,897 | 0.016283 |
# -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... | clarkperkins/stackdio | stackdio/api/formulas/exceptions.py | Python | apache-2.0 | 753 | 0 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Download and build the data if it does not exist.
from parlai.core.build_data import DownloadableFile
import parlai.co... | facebookresearch/ParlAI | parlai/tasks/dialog_babi/build.py | Python | mit | 1,182 | 0 |
# -*- coding: UTF-8 -*-
from django.conf import settings as dsettings
from django.contrib.auth import models as authModels
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.http import HttpResponse, Http404
from django.shortcuts import render, render_to_response, get_object_or_404
from dja... | barrachri/epcon | microblog/views.py | Python | bsd-2-clause | 7,631 | 0.003014 |
#!/usr/bin/env python
import os
import numpy as np
import math
import fnmatch
from my_spectrogram import my_specgram
from collections import OrderedDict
from scipy.io import wavfile
import matplotlib.pylab as plt
from pylab import rcParams
from sklearn.model_selection import train_test_split
rcParams['figure.figsize']... | nick-monto/SpeechRecog_CNN | create_spectrograms_16k.py | Python | mit | 6,802 | 0.002205 |
#!/usr/bin/env python
import argparse
import bz2
import gzip
import os.path
import sys
from csvkit import CSVKitReader
from csvkit.exceptions import ColumnIdentifierError, RequiredHeaderError
def lazy_opener(fn):
def wrapped(self, *args, **kwargs):
self._lazy_open()
fn(*args, **kwargs)
return... | cypreess/csvkit | csvkit/cli.py | Python | mit | 15,243 | 0.007479 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Sun OS specific tests. These are implicitly run by test_psutil.py."""
import psutil
from test_psutil import *
class SunOSSpec... | szaydel/psutil | test/_sunos.py | Python | bsd-3-clause | 1,322 | 0.000756 |
#!/usr/bin/env python
# Blink an LED using the RPi.GPIO library.
import RPi.GPIO as GPIO
from time import sleep
# Use GPIO numbering:
GPIO.setmode(GPIO.BCM)
# Set pin GPIO 14 to be output:
GPIO.setup(14, GPIO.OUT)
try:
while True:
GPIO.output(14, GPIO.HIGH)
sleep(.5)
GPIO.output(14, GPI... | akkana/pi-zero-w-book | ch2/blink-rpigpio.py | Python | gpl-2.0 | 468 | 0 |
#!/usr/bin/python3
import os
import sys
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from lutris.util.wineregistry import WineRegistry
PREFIXES_PATH = os.path.expanduser("~/Games/wine/prefixes")
def get_registries():
registries = []
directories = os.listdir... | RobLoach/lutris | tests/check_prefixes.py | Python | gpl-3.0 | 1,465 | 0.002048 |
from __future__ import print_function
from numpy import pi, arange, sin
import numpy as np
import time
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
Plot, DataRange1d, DatetimeAxis,
Colu... | zrhans/python | exemplos/Examples.lnk/bokeh/glyphs/dateaxis.py | Python | gpl-2.0 | 1,293 | 0 |
import numpy as np
from square import Square
from constants import SQUARE_SIZE, BOARD_SIZE
class ChessboardFrame():
def __init__(self, img):
self.img = img
def square_at(self, i):
y = BOARD_SIZE - ((i / 8) % 8) * SQUARE_SIZE - SQUARE_SIZE
x = (i % 8) * SQUARE_SIZE
return Square... | joeymeyer/raspberryturk | raspberryturk/core/vision/chessboard_frame.py | Python | mit | 371 | 0.002695 |
class Solution(object):
def removeKdigits(self, num, k):
"""
:type num: str
:type k: int
:rtype: str
"""
stack = []
length = len(num) - k
for c in num:
while k and stack and stack[-1] > c:
stack.pop()
k -= 1
... | Mlieou/leetcode_python | leetcode/python/ex_402.py | Python | mit | 405 | 0.002469 |
""" Manage the TVTK scenes. """
# Enthought library imports.
from tvtk.pyface.tvtk_scene import TVTKScene
from pyface.workbench.api import WorkbenchWindow
from traits.api import HasTraits, List, Instance, Property
from traits.api import implements, on_trait_change
from tvtk.plugins.scene.scene_editor import SceneEdito... | liulion/mayavi | tvtk/plugins/scene/scene_manager.py | Python | bsd-3-clause | 2,756 | 0.002177 |
#! /usr/bin/env python
import sys
g = {}
n = {}
for line in sys.stdin:
(n1, n2, p, q, t, tg, x) = line.strip().split(' ')
t = int(t)
x = float(x)
key = ' '.join((n1,n2,p,q))
if not key in n:
n[key] = 0
g[key] = 0
n[key] += t
g[key] += x*t
for key in n:
print key, n... | vbeffara/Simulations | tools/massage-box.py | Python | gpl-3.0 | 341 | 0.01173 |
try:
# Python 3
import tkinter as tk
import tkinter.messagebox as tkm
import tkinter.simpledialog as tkd
except ImportError:
# Python 2
import Tkinter as tk
import tkMessageBox as tkm
import tkSimpleDialog as tkd
import networkx as nx
from networkx_viewer.graph_canvas import GraphCan... | jsexauer/networkx_viewer | networkx_viewer/viewer.py | Python | gpl-3.0 | 17,151 | 0.005073 |
# Copyright (c) OpenMMLab. All rights reserved.
import itertools
import os
from collections import defaultdict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from mmdet.core import INSTANCE_OFFSET
from .api_wrappers import COCO, pq_compute_multi_core
from .builde... | open-mmlab/mmdetection | mmdet/datasets/coco_panoptic.py | Python | apache-2.0 | 24,271 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# =================================================================
# =================================================================
# NOTE: notify message MUST follow these rules:
#
# - Messages must be wrappered with _() for translation
#
# - Replacement va... | windskyer/k_nova | paxes_nova/compute/notify_messages.py | Python | apache-2.0 | 4,325 | 0 |
"""
WSGI config for crowd_server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crowd_server.settings")
from dja... | codeaudit/ampcrowd | ampcrowd/crowd_server/wsgi.py | Python | apache-2.0 | 399 | 0.002506 |
# -*- coding: utf-8 -*-
# author: Alfred
import os
import re
DB_MODULE_PATTERN = re.compile(r'db2charts_models\.(?P<module>.*)_models')
class DB2ChartsRouter(object):
def db_for_module(self, module):
match = DB_MODULE_PATTERN.match(module)
if match:
return match.groupdict()['module']
... | Alfredx/django-db2charts | db2charts/router.py | Python | mit | 619 | 0.003231 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 th... | SickGear/SickGear | lib/apprise/plugins/NotifyD7Networks.py | Python | gpl-3.0 | 16,906 | 0 |
import platform
import socket
import sys
import os
from mule_local.JobGeneration import *
from mule.JobPlatformResources import *
from . import JobPlatformAutodetect
def _whoami(depth=1):
"""
String of function name to recycle code
https://www.oreilly.com/library/view/python-cookbook/0596001673/ch14s08.h... | schreiberx/sweet | mule/platforms/50_cheyenne_intel/JobPlatform.py | Python | mit | 8,312 | 0.006136 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<lang>[a-z]{2})?$', views.index, name='index'),
url(r'^sign/$', views.sign, name='sign'),
url(r'^confirm/([0-9a-z]{64})/$', views.confirm, name='confirm'),
]
| sandervenema/netzpolitik | petitions/urls.py | Python | gpl-2.0 | 251 | 0 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | tkaitchuck/nupic | examples/opf/experiments/spatial_classification/base/description.py | Python | gpl-3.0 | 14,847 | 0.002694 |
# 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... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/variable_mgr_util.py | Python | apache-2.0 | 26,469 | 0.005743 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/deckhand | deckhand/context.py | Python | apache-2.0 | 1,765 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Docente'
db.create_table('cadastro_docente', (
('id', self.gf('django.db.models.... | UFRB/chdocente | cadastro/migrations/0001_initial.py | Python | agpl-3.0 | 11,352 | 0.007488 |
# Copyright 2018 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... | GoogleCloudPlatform/ml-on-gcp | example_zoo/tensorflow/models/ncf_main/official/recommendation/ncf_main.py | Python | apache-2.0 | 17,012 | 0.006348 |
#!/usr/bin/env python
# coding:utf-8 vi:et:ts=2
# parabridge persistent settings module.
# Copyright 2013 Grigory Petrov
# See LICENSE for details.
import xmlrpclib
import socket
import sqlite3
import uuid
import info
SQL_CREATE = """
CREATE TABLE IF NOT EXISTS task (
guid TEXT UNIQUE,
name TEXT UNIQUE,
... | eyeofhell/parabridge | parabridge/settings.py | Python | gpl-3.0 | 3,770 | 0.032891 |
from bt_proximity import BluetoothRSSI
import time
import sys
import datetime
#////////////////////////////////
BT_ADDR = 'xx:xx:xx:xx:xx:xx'#/// Enter your bluetooth address here!
#////////////////////////////////
# ----------------------- DO NOT EDIT ANYTHING BELOW THIS LINE --------------------------- #
def ... | stan-cap/bt_rssi | test/main_test.py | Python | mit | 1,713 | 0.010508 |
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Plugins.Plugin import PluginDescriptor
def getUpgradeVersion():
import os
try:
r = os.popen("fpupgrade --version").read()
except IOError:
return None
if r[:16] != "FP update tool v":
return No... | atvcaptain/enigma2 | lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/plugin.py | Python | gpl-2.0 | 2,732 | 0.032211 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | schakrava/rockstor-core | src/rockstor/scripts/pwreset.py | Python | gpl-3.0 | 2,030 | 0.00197 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from django.views.i18n import JavaScriptCatalog
from demo.apps.app import application
js_info_dict = {
'package... | reinbach/django-machina | example_projects/demo/demo_project/urls.py | Python | bsd-3-clause | 1,208 | 0 |
"""
The Netio switch component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.netio/
"""
import logging
from collections import namedtuple
from datetime import timedelta
import voluptuous as vol
from homeassistant.core import callback
from home... | persandstrom/home-assistant | homeassistant/components/switch/netio.py | Python | apache-2.0 | 5,530 | 0 |
#!/usr/bin/env python3.7
from multiprocessing import Process
import time
import os
from printerState import main as printerStateMain
from server import main as serverMain
from websocket import main as websocketServerMain
servicesTemplate = {
'server': {
'name': 'Server',
'run': serverMain,
... | MakersLab/Farm-server | server/main.py | Python | gpl-3.0 | 3,234 | 0.002474 |
# -*- coding: utf-8 -*-
import sublime, sublime_plugin
import os
import shutil
import subprocess
import zipfile
import glob
import sys
import codecs
import re
import json
import xml.etree.ElementTree
###
### Global Value
###
PACKAGE_NAME = 'EPubMaker'
OPEN_COMMAND = 'epub_maker_open'
SAVE_COMMAND = 'epub_maker_s... | DaVinAhn/EPubMaker | EPubMaker.py | Python | mit | 16,500 | 0.030364 |
# ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | BRAINSia/ITK | Modules/Core/Common/wrapping/test/itkVariableLengthVectorTest.py | Python | apache-2.0 | 1,870 | 0 |
"""
Support for python 2 & 3, ripped pieces from six.py
"""
import sys
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
else:
string_types = basestring,
| drewrobb/marathon-python | marathon/_compat.py | Python | mit | 173 | 0 |
# Author: Pontus Laestadius.
# Since: 2nd of March, 2017.
# Maintained since: 17th of April 2017.
from receiver import Receiver
print("Version 2.2")
Receiver("172.24.1.1", 9005)
| DIT524-V17/group-7 | TCP raspberry/server.py | Python | gpl-3.0 | 181 | 0.005525 |
################################################################################
# #
# Copyright (C) 2010,2011,2012,2013,2014, 2015,2016 The ESPResSo project #
# ... | KonradBreitsprecher/espresso | doc/tutorials/06-active_matter/SOLUTIONS/rectification_geometry.py | Python | gpl-3.0 | 5,253 | 0.008186 |
def process(target, other):
result = [[] for ch in target]
ret = []
for xi, xv in enumerate(target):
for yi, yv in enumerate(other):
if xv != yv:
result[xi].append(0)
elif 0 == xi or 0 == yi:
result[xi].append(1)
else:
... | everyevery/programming_study | lgecodejam/2014-mar/c/c.py | Python | mit | 1,284 | 0.010125 |
# -*- coding: utf-8 -*-
#
# test_enable_multithread.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | tobikausk/nest-simulator | pynest/nest/tests/test_sp/test_enable_multithread.py | Python | gpl-2.0 | 2,237 | 0 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import xml.etree.ElementTree
from xml.etree.cElementTree import ElementTree, Element, SubElement
from xml.etree.cElementTree import fromstring, tostring
import ... | cnvogelg/fs-uae-gles | launcher/fs_uae_launcher/editor/XMLControl.py | Python | gpl-2.0 | 2,828 | 0.001061 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | gwq5210/litlib | thirdparty/sources/protobuf/python/google/protobuf/descriptor.py | Python | gpl-3.0 | 37,400 | 0.006364 |
class APIConnectionError(Exception):
pass
class DownloadError(Exception):
pass
class ProducerAPIError(APIConnectionError):
pass
class ConsumerAPIError(APIConnectionError):
pass
| hlmnrmr/liveblog | server/liveblog/syndication/exceptions.py | Python | agpl-3.0 | 199 | 0 |
"""
A Python interface to the primer3_core executable.
TODO: it is not possible to keep a persistent primer3 process
using subprocess module - communicate() terminates the input
stream and waits for the process to finish
Author: Libor Morkovsky 2012
"""
# This file is a part of Scrimer.
# See LICENSE.t... | libor-m/scrimer | scrimer/primer3_connector.py | Python | agpl-3.0 | 7,094 | 0.006061 |
import paho.mqtt.client as mqtt
import os,binascii
import logging
import time
from enum import Enum
from threading import Timer
import json
import random
import math
ID_STRING = binascii.hexlify(os.urandom(15)).decode('utf-8')[:4]
CLIENT_ID = "robot-emulator-" + ID_STRING
BROKER_HOST = "mosquitto"
TOPIC_STATUS = "twin... | EricssonResearch/scott-eu | robot-emulator/main.py | Python | apache-2.0 | 3,749 | 0.005346 |
import unittest
import mock
from ...management.resource_servers import ResourceServers
class TestResourceServers(unittest.TestCase):
def test_init_with_optionals(self):
t = ResourceServers(domain='domain', token='jwttoken', telemetry=False, timeout=(10, 2))
self.assertEqual(t.client.options.timeo... | auth0/auth0-python | auth0/v3/test/management/test_resource_servers.py | Python | mit | 3,056 | 0.000327 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Client actions related to plist files."""
import cStringIO
import types
from grr.client import actions
from grr.client import vfs
from grr.lib import plist as plist_lib
from grr.lib import rdfvalue
from grr.parsers import binplist
class ... | wandec/grr | client/client_actions/plist.py | Python | apache-2.0 | 2,452 | 0.008564 |
#! -*- coding: utf-8 -*-
from collections import OrderedDict
from sqlalchemy import Column, Date, ForeignKey, Index, String
from sqlalchemy import Integer
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common import MetaModelMixin, patient_id_column, patient_relationship, uuid... | renalreg/radar | radar/models/patient_addresses.py | Python | agpl-3.0 | 8,540 | 0.000117 |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... | erangre/Dioptas | dioptas/model/util/smooth_bruckner_python.py | Python | gpl-3.0 | 2,059 | 0.004371 |
#!/usr/bin/env python
"""
Standaone Rule
==============
This is a customer spec, parser and rule and can be run
against the local host using the following command::
$ insights-run -p examples.rules.stand_alone
or from the examples/rules directory::
$ ./stand_alone.py
"""
from __future__ import print_functio... | RedHatInsights/insights-core | examples/rules/stand_alone.py | Python | apache-2.0 | 2,746 | 0 |
from django.shortcuts import render
from django.template.loader import render_to_string
def home(request):
context_dict = {}
return render(request,'ms2ldaviz/index.html',context_dict)
def people(request):
context_dict = {}
return render(request,'ms2ldaviz/people.html',context_dict)
def api(request... | sdrogers/ms2ldaviz | ms2ldaviz/ms2ldaviz/views.py | Python | mit | 936 | 0.013889 |
# Speak.activity
# A simple front end to the espeak text-to-speech engine on the XO laptop
# http://wiki.laptop.org/go/Speak
#
# Copyright (C) 2008 Joshua Minor
# Copyright (C) 2014 Walter Bender
# This file is part of Speak.activity
#
# Parts of Speak.activity are based on code from Measure.activity
# Copyright (C) ... | walterbender/speak | sleepy.py | Python | gpl-3.0 | 2,928 | 0.000683 |
# -*- coding: utf-8 -*-
from minheap import minheap
class maxheap(minheap):
"""
Heap class - made of keys and items
methods: build_heap, heappush, heappop
"""
MAX_HEAP = True
def __str__(self):
return "Max-heap with %s items" % (len(self.heap))
def heapify(self, i):
l =... | NicovincX2/Python-3.5 | Algorithmique/Algorithme/Algorithme de tri/Tri par tas (Heapsort)/maxheap.py | Python | gpl-3.0 | 1,134 | 0.000882 |
from pygame import Rect
from widget import Widget
class GridView(Widget):
# cell_size (width, height) size of each cell
#
# Abstract methods:
#
# num_rows() --> no. of rows
# num_cols() --> no. of columns
# draw_cell(surface, row, col, rect)
# click_cell(row, col, event)
def __init__(se... | vejmelkam/emotiv-reader | albow/grid_view.py | Python | gpl-3.0 | 1,254 | 0.039075 |
# -*- coding: utf-8 -*-
import logging
from chisch.common.retwrapper import RetWrapper
import cores
logger = logging.getLogger('django')
def signature_url(request):
params_query_dict = request.GET
params = {k: v for k, v in params_query_dict.items()}
try:
url = cores.get_url()
except Excep... | zhaowenxiang/chisch | vod/views.py | Python | mit | 446 | 0 |
from django.conf.urls import patterns, url
from django.views.generic import RedirectView
from django.conf import settings
from . import views
products = r'/products/(?P<product>\w+)'
versions = r'/versions/(?P<versions>[;\w\.()]+)'
version = r'/versions/(?P<version>[;\w\.()]+)'
perm_legacy_redirect = settings.PERMA... | AdrianGaudebert/socorro | webapp-django/crashstats/crashstats/urls.py | Python | mpl-2.0 | 3,962 | 0.000252 |
"""Main view for geo locator application"""
from django.shortcuts import render
def index(request):
if request.location:
location = request.location
else:
location = None
return render(request, "homepage.html", {'location': location})
| mindcube/mindcube-django-cookiecutter | {{cookiecutter.repo_name}}/project/apps/geo_locator/views.py | Python | mit | 265 | 0.003774 |
# Generated file. Do not edit
__author__="drone"
from Abs import Abs
from And import And
from Average import Average
from Ceil import Ceil
from Cube import Cube
from Divide import Divide
from Double import Double
from Equal import Equal
from Even import Even
from Floor import Floor
from Greaterorequal import Greateror... | gcobos/rft | app/primitives/__init__.py | Python | agpl-3.0 | 1,163 | 0.029235 |
#!/usr/bin/env python
# Copyright (C) 2014-2017 Shea G Craig
#
# 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 ... | sheagcraig/python-jss | jss/misc_endpoints.py | Python | gpl-3.0 | 13,525 | 0.000074 |
from landscape.client.tests.helpers import LandscapeTest
from landscape.client.patch import UpgradeManager
from landscape.client.upgraders import monitor
class TestMonitorUpgraders(LandscapeTest):
def test_monitor_upgrade_manager(self):
self.assertEqual(type(monitor.upgrade_manager), UpgradeManager)
| CanonicalLtd/landscape-client | landscape/client/upgraders/tests/test_monitor.py | Python | gpl-2.0 | 317 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
##############################################################################
# Configuration paramete... | stryder199/RyarkAssignments | Assignment2/web2py/gaehandler.py | Python | mit | 3,279 | 0.005489 |
from typing import (Tuple,
List)
import matplotlib
# More info at
# http://matplotlib.org/faq/usage_faq.html#what-is-a-backend for details
# TODO: use this: https://stackoverflow.com/a/37605654/7851470
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from matplotlib.patches import Ellips... | wolvespack/alcor | alcor/services/plots/velocity_clouds.py | Python | mit | 7,567 | 0.000793 |
#!/usr/bin/python
from typing import List, Optional
"""
16. 3Sum Closest
https://leetcode.com/problems/3sum-closest/
"""
def bsearch(nums, left, right, res, i, j, target):
while left <= right:
middle = (left + right) // 2
candidate = nums[i] + nums[j] + nums[middle]
if res is None or ab... | pisskidney/leetcode | medium/16.py | Python | mit | 1,070 | 0 |
"""Generate test data for IDTxl network comparison unit and system tests.
Generate test data for IDTxl network comparison unit and system tests. Simulate
discrete and continous data from three correlated Gaussian data sets. Perform
network inference using bivariate/multivariate mutual information (MI)/transfer
entropy... | pwollstadt/IDTxl | test/generate_test_data.py | Python | gpl-3.0 | 8,187 | 0.000733 |
import sublime
from . import SblmCmmnFnctns
class Spinner:
SYMBOLS_ROW = u'←↑→↓'
SYMBOLS_BOX = u'⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
def __init__(self, symbols, view, startStr, endStr):
self.symbols = symbols
self.length = len(symbols)
self.position = 0
self.stopFlag = False
self.view = view
self.startStr = startStr
self.... | rusiv/BSScript | bsscript/bsscriptSblm/Spinner.py | Python | mit | 784 | 0.034392 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2009 Ars Aperta, Itaapy, Pierlis, Talend.
#
# Authors: David Versmisse <david.versmisse@itaapy.com>
#
# This file is part of Lpod (see: http://lpod-project.org).
# Lpod is free software; you can redistribute it and/or modify it under
# the terms of either:... | uliss/quneiform | tests/py/lpod/rst2odt.py | Python | gpl-3.0 | 22,265 | 0.00265 |
"""Provides all the generic data related to the address."""
COUNTRY_CODES = {
"a2": [
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AN",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
... | lk-geimfari/elizabeth | mimesis/data/int/address.py | Python | mit | 20,986 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import argparse
import asyncio
def parse_args():
usage = """usage: %prog [options] [hostname]:port ...
python3 select_get_poetry3.py port1 port2 port3 ...
"""
parser = argparse.ArgumentParser(usage)
parser.add_argument('port', nargs='+')... | a358003542/python-guide-book | codes/ch12/asyncio_get_poetry2.py | Python | gpl-2.0 | 1,899 | 0 |
from .design_inputs import *
| samcoveney/GP_emu_UQSA | gp_emu_uqsa/design_inputs/__init__.py | Python | gpl-3.0 | 29 | 0 |
#!/usr/bin/env python
# A bag contains one red disc and one blue disc. In a game of chance a player
# takes a disc at random and its colour is noted. After each turn the disc is
# returned to the bag, an extra red disc is added, and another disc is
# taken at random.
# The player... wins if they have taken more blue ... | dhermes/project-euler | python/complete/no121.py | Python | apache-2.0 | 2,079 | 0.000481 |
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Nicolas Bornand
#
# The licence is in the file __manifest__.py
#
########################################... | CompassionCH/compassion-modules | message_center_compassion/tests/test_onramp_controller.py | Python | agpl-3.0 | 2,068 | 0.000484 |
########################################################################
# #
# Anomalous Diffusion #
# #
############################... | CNS-OIST/STEPS_Example | publication_models/API_2/Chen_FNeuroinf_2014/AD/AD_single.py | Python | gpl-2.0 | 2,125 | 0.004706 |
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import *
import plugin.databaseConnect as database
from datetime import datetime
class sendMessageUI(QMainWindow):
def __init__(self, id = None, bulk = None, parent = None):
QMainWindow.__init__(self,None)
self.setMinimum... | Poom1997/GMan | sendMessageForm.py | Python | mit | 2,434 | 0.012736 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2020 T. Zachary Laine
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
prop_lookup_test_form = decls = '''\
// Copyright (C) 2020 T. Zachary Laine
//
... | wiltonlazary/arangodb | 3rdParty/iresearch/external/text/scripts/generate_unicode_break_tests.py | Python | apache-2.0 | 22,214 | 0.002206 |
#!/usr/bin/env python
path="/var/lib/gpu/gpu_locked.txt"
import os,sys
import ast
import socket
def getHost():
return socket.gethostname()
def getlocked():
hostname=getHost()
#print path
fp=open(path, "r")
info=fp.read()
#print info
d=ast.literal_eval(info)
#print len(d)
prin... | linzhaolover/myansible | openstackfile/getgpulocked.py | Python | apache-2.0 | 696 | 0.027299 |
#!/usr/bin/python
__author__ = 'anson'
import optparse
import re
import sys
from utils.utils_cmd import execute_sys_cmd
from lib_monitor.monitor_default_format import nagios_state_to_id
class messages_check():
def __init__(self, rex, config, type):
self.rex = rex
self.config = config
self.t... | AnsonShie/system_monitor | messages_monitor.py | Python | apache-2.0 | 2,645 | 0.003403 |
#!/usr/bin/env python2
"""
COSMO TECHNICAL TESTSUITE
General purpose script to compare two files containing tables
Only lines with given table pattern are considered
"""
# built-in modules
import os, sys, string
# information
__author__ = "Xavier Lapillonne"
__maintainer__ = "xavier.lapillonne@meteoswiss.ch"
... | C2SM-RCM/testsuite | tools/comp_table.py | Python | mit | 5,041 | 0.026384 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe
from erpnext.accounts.party import get_party_account_currency
from erpnext.controllers.accounts_controller import get_taxes_a... | neilLasrado/erpnext | erpnext/accounts/doctype/sales_invoice/pos.py | Python | gpl-3.0 | 21,154 | 0.02496 |
#!/usr/bin/env python
# Copyright (C) 2010-2011 Hideo Hattori
# Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
# Copyright (C) 2013-2015 Hideo Hattori, Steven Myint, Bill Wendling
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files... | JetChars/vim | vim/bundle/python-mode/pymode/autopep8.py | Python | apache-2.0 | 120,700 | 0.000033 |
#!/usr/bin/python
# 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 distributed... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/rds.py | Python | bsd-3-clause | 56,122 | 0.002441 |
# orm/interfaces.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
Contains various base classes used throughout the ORM.
Defines the now depreca... | sauloal/PiCastPy | sqlalchemy/orm/interfaces.py | Python | mit | 28,330 | 0.000671 |
#!/usr/bin/env python
import os
import shutil
import logging
from unicode_helper import p
__all__ = ["Renamer"]
def log():
"""Returns the logger for current file
"""
return logging.getLogger(__name__)
def same_partition(f1, f2):
"""Returns True if both files or directories are on the same partit... | lahwaacz/tvnamer | tvnamer/renamer.py | Python | unlicense | 4,157 | 0.001203 |
#!/usr/bin/python2
#!/usr/bin/env python
#
# Copyright 2010 dan collins <danc@badbytes.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Lice... | badbytes/pymeg | gui/gtk/data_editor.py | Python | gpl-3.0 | 30,723 | 0.01494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.