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 |
|---|---|---|---|---|---|
"""
Given an array of integers nums, calculate the pivot index of this array.
The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
If the index is on the left edge of the array, then the left sum is 0 becau... | entrepidea/projects | python/tutorials/algo/leetcode/easy/pivot_index.py | Python | gpl-3.0 | 820 |
"""Module which contains the Loader."""
import os
class Loader():
"""Load external files into tamandua."""
__basedir = os.path.abspath(os.path.dirname(__file__))
@classmethod
def load_js(cls, file: str) -> str:
"""
Load a js file and return its content.
pat... | realmar/Tamandua | src/repository/js.py | Python | gpl-3.0 | 681 |
# This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
#
# MAUS 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.
# ... | mice-software/maus | src/common_py/docstore/root_document_store/_socket_manager.py | Python | gpl-3.0 | 14,450 |
# -*- coding: utf-8 -*-
# -*- Channel wikiseries -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
from channels import autoplay
from channels import filtertools
from core import httptools
from core import scrapertools
from core import servertools
from core import jsontool... | alfa-jor/addon | plugin.video.alfa/channels/wikiseries.py | Python | gpl-3.0 | 9,162 |
from flask_wtf import Form
from ..models import User, Player
from wtforms.validators import Required, Length, Email, Regexp
from wtforms import StringField, SubmitField, SelectField, BooleanField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
class PlayerForm(Form):
""" This class represents a form t... | haup/totoro | totoro/app/main/forms.py | Python | gpl-3.0 | 2,118 |
from __future__ import division
import numpy as np
import queue
import threading
from chainer.dataset.iterator import Iterator
def queue_worker(index_queue, batch_queue, dataset, xp):
while True:
batch_begin, batch_end = index_queue.get()
batches = xp.array(dataset[batch_begin:batch_end])
... | hrantzsch/signature-embedding | triplet_iterator.py | Python | gpl-3.0 | 2,320 |
'''Utils'''
import re
from typing import Tuple, List, Union, Iterable
from wpull.errors import ServerError
import datetime
from wpull.protocol.ftp.ls.listing import FileEntry
class ReplyCodes(object):
command_okay = 200
syntax_error_command_unrecognized = 500
syntax_error_in_parameters_or_arguments = 501... | chfoo/wpull | wpull/protocol/ftp/util.py | Python | gpl-3.0 | 5,974 |
'''
Pyazo is my final project for CS230 (Computing I)
More info in the README
'''
#import all the things
import sys
sys.path.append('./modules')
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QPainter, QColor, QFont, QCursor
from PyQt5.QtCore import Qt, QRect, QTimer
#Doing thi... | PorterK/pyazo | Gui.py | Python | gpl-3.0 | 4,131 |
# -*- coding: utf-8 -*-
"""
Copyright © 2017 - Alexandre Machado <axmachado@gmail.com>
This file is part of Simple POS Compiler.
Simnple POS Compiler 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 Found... | axmachado/simplepos | simplepos/api/ui.py | Python | gpl-3.0 | 3,780 |
import mutagen.mp4
from mutagen import Metadata
from mutagen._util import DictMixin, dict_match, utf8
from mutagen.mp4 import MP4, MP4Tags, error, delete
__all__ = ["EasyMP4Tags", "EasyMP4", "delete", "error"]
class EasyMP4KeyError(error, KeyError, ValueError):
pass
class EasyMP4Tags(DictMixin, Metadata):
... | hzlf/openbroadcast.org | website/tools/mutagen-v1.20.1/easymp4.py | Python | gpl-3.0 | 7,960 |
from django.conf import settings
from haystack import site
from haystack.indexes import *
from django.contrib.comments.models import Comment
import models
#This needs to be double checked
class TorrentIndex(RealTimeSearchIndex):
text = CharField(document=True, use_template=True)
description = CharFie... | twoolie/ProjectNarwhal | narwhal/core/torrent/search_indexes.py | Python | gpl-3.0 | 979 |
# -*- coding: utf-8 -*-
# Derived work from Facebook's tornado server.
"""Utilities for working with multiple processes."""
import os, sys, time, errno
import pluggdapps.utils as h
_task_id = None
def fork_processes( num_processes, max_restarts ):
"""Starts multiple listener cum worker processes.
If ``nu... | prataprc/pluggdapps | pluggdapps/.Attic/evserver/process.py | Python | gpl-3.0 | 3,484 |
import datetime
def main(le):
return sum(range(le + 1)) ** 2 - sum(x ** 2 for x in range(le + 1))
try:
para = int(input())
except:
para = 100
beg = datetime.datetime.now()
ans = main(para)
end = datetime.datetime.now()
print("answer:", ans)
print("time:", end - beg)
| nowsword/ProjectEuler | p006.py | Python | gpl-3.0 | 283 |
import os
import rospy
import rosnode
import json
import pygame
import pygame.display
from nips2016.srv import *
from nips2016.msg import *
from geometry_msgs.msg import PoseStamped
from sensor_msgs.msg import Joy
from std_msgs.msg import Bool
from pypot.creatures import PoppyErgoJr
from rospkg import RosPack
from os.p... | sebastien-forestier/NIPS2016 | ros/nips2016/src/nips2016/ergo/ergo.py | Python | gpl-3.0 | 7,815 |
# coding=utf-8
from popular_proposal.filters import (ProposalWithoutAreaFilter,
ProposalWithAreaFilter,
filterable_areas,
ProposalGeneratedAtFilter
)
from popular_propo... | ciudadanointeligente/votainteligente-portal-electoral | popular_proposal/tests/filter_tests.py | Python | gpl-3.0 | 9,392 |
# -*- coding: utf-8 -*-
"""
ORCA Open Remote Control Application
Copyright (C) 2013-2020 Carsten Thielepape
Please contact me by : http://www.orca-remote.org/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publish... | thica/ORCA-Remote | src/ORCA/utils/Wildcard.py | Python | gpl-3.0 | 2,302 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-04-24 15:15
from __future__ import unicode_literals
from django.db import migrations, models
def populate_thesis_providers(apps, schema_editor):
ThesisProvider = apps.get_model('erudit', 'ThesisProvider')
Collection = apps.get_model('erudit', 'Colle... | erudit/zenon | eruditorg/erudit/migrations/0089_thesisprovider.py | Python | gpl-3.0 | 1,746 |
from MappingItem import *
# tuto de list:
# http://effbot.org/zone/python-list.htm
class KeyMapReader:
m_mapFileName = None
m_hasRead = False
m_keyArgumentMap = {} # contains all the valid MappingItems, it is a dictionary
def __init__(self):
print("")
def setMapFileName(self, fileName):
... | jonathanlurie/MidiCombo | midiCombo/KeyMapReader.py | Python | gpl-3.0 | 1,329 |
# -*- coding: utf-8 -*-
#
# rbf documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 17 13:38:21 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | dandyvica/rbfpython | doc/conf.py | Python | gpl-3.0 | 8,168 |
#!/usr/bin/python
# -*- coding: utf8 -*-
#
# RDFohloh <http://rdfohloh.googlecode.com/>
# GetNT, a simple script to get triples from a RDF/XML file
#
# Copyright (C) 2008 Sergio Fernández
#
# This file is part of RDFohloh, a RDF wrapper of Ohloh.
#
# RDFohloh is free software: you can redistribute it and/or modify
# it... | wikier/rdfohloh | tools/rod/getnt.py | Python | gpl-3.0 | 1,644 |
import ipp
s = ipp.from_s("130.216.3.10")
print "s = %s" % s
print "version = %d, addr = %s, length = %d\n" % (
s.version, s.addr, s.length)
iph4 = {}
iph6 = {}
def add_to_iph(pref_s):
global iph4, iph6
s = ipp.from_s(pref_s)
if s.version == 4:
v = iph4.get(s)
if v:
iph4[... | nevil-brownlee/pypy-libtrace | lib/ipp/test-ipp-hash.py | Python | gpl-3.0 | 1,218 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''Dialog to edit metadata in bulk'''
import re, os
from collections import namedtuple, defaultdict
from threading import Thread
from PyQt5.Qt import Qt, QDialog, QGridLayout, QVBoxLayout, QFont, QLabel, \
pyq... | sharad/calibre | src/calibre/gui2/dialogs/metadata_bulk.py | Python | gpl-3.0 | 49,960 |
# coding=utf-8
import unittest
"""1027. Longest Arithmetic Sequence
https://leetcode.com/problems/longest-arithmetic-sequence/description/
Given an array `A` of integers, return the **length** of the longest
arithmetic subsequence in `A`.
Recall that a _subsequence_ of `A` is a list `A[i_1], A[i_2], ..., A[i_k]`
wit... | openqt/algorithms | leetcode/python/lc1027-longest-arithmetic-sequence.py | Python | gpl-3.0 | 1,327 |
from typing import List, Tuple, Callable
import gdspy
import numpy as np
from numpy import diff, floor, ceil, zeros, hstack, newaxis
import pickle
import warnings
import copy
from spins.gridlock.float_raster import raster_1D, raster_2D
from spins.gridlock import GridError, Direction, GridType
from spins.gridlock._he... | stanfordnqp/spins-b | spins/gridlock/grid.py | Python | gpl-3.0 | 47,797 |
from os.path import isfile as os_isfile
from lzma import compress as lzma_compress
from lzma import decompress as lzma_decompress
from json import loads as json_loads
from json import dumps as json_dumps
import codecs
import getpass
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto import Random... | zepto/lessinfo | old/crypttest.py | Python | gpl-3.0 | 8,690 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Paweł Krawczyk'
import hashlib
import hmac
from flask import make_response, redirect
from settings import CSRF_KEY, DEVELOPER_MACHINE
__author__ = 'Paweł Krawczyk'
def login_response(owner_id):
"""
Perform actual login action which is currently l... | kravietz/cspbuilder | apihelpers/auth.py | Python | gpl-3.0 | 1,656 |
# _*_ coding: utf-8 _*_
__author__ = 'bobby'
__date__ = '2017/6/8 10:58'
from django import forms
from .models import Comment
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ['name', 'email', 'url', 'text']
| TwocatWhelp/lizhen | comments/forms.py | Python | gpl-3.0 | 255 |
from collections import OrderedDict as OD
from copy import deepcopy
from math import ceil
from .callbacks import spi_efc_cmd_cb
from .ADF4350 import columns
from ..regs import RegsData, regs_cb
def Fout_src_cb(data, val):
REFin = float(data.get_value('REFin'))
B = float(data.get_value('B'))
R = float(data... | ivanovev/sg | gui/ADF4360_8.py | Python | gpl-3.0 | 1,908 |
from ..documents.constants import pubkey_regex
from ..documents.constants import hash_regex
from pypeg2 import *
class Pubkey(str):
regex = re.compile(pubkey_regex)
class Hash(str):
regex = re.compile(hash_regex)
class Int(str):
regex = re.compile(r"[0-9]+")
class SIG(str):
grammar = "SIG(", att... | vtexier/duniter-python-api | duniterpy/grammars/output.py | Python | gpl-3.0 | 3,068 |
import numpy as np
from gpaw.utilities import erf
class DipoleCorrection:
"""Dipole-correcting wrapper around another PoissonSolver."""
def __init__(self, poissonsolver, direction):
"""Construct dipole correction object.
poissonsolver is a GPAW Poisson solver.
direction is 0,... | ajylee/gpaw-rtxs | gpaw/dipole_correction.py | Python | gpl-3.0 | 3,480 |
# -*- coding: utf-8 -*-
from __future__ import print_function
class Cube(object):
def __init__(self, Connection, APIOutput):
APIOutput = APIOutput.split(';')
self.Sid = Connection.Sid
self.Client = Connection.Client
self.getUrlResult = Connection.getUrlResult
self.g... | opnmind/python-olapdb-palo-web | src/py3/PyJedoxWebApi/Cube.py | Python | gpl-3.0 | 15,820 |
# -*- coding: utf-8 -*-
"""project settings"""
# Copyright (C) 2015 ZetaOps Inc.
#
# This file is licensed under the GNU General Public License v3
# (GPLv3). See LICENSE.txt for details.
from zengine.settings import *
import os.path
__author__ = 'Evren Esat Ozkan'
BASE_DIR = os.path.dirname(os.path.realpath(__file... | zetaops/ulakbus | ulakbus/settings.py | Python | gpl-3.0 | 12,167 |
# -*- coding: utf-8 -*-
# crunchyfrog - a database schema browser and query tool
# Copyright (C) 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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, e... | angvp/angelvelasquez-crunchyfrog | cf/plugins/core.py | Python | gpl-3.0 | 12,547 |
"""
IPS ROM patch file formal
Implemented according to http://zerosoft.zophar.net/ips.php
"""
import struct
from collections import namedtuple
MAGIC = b'PATCH'
EOF = b'EOF'
EntryHeader = namedtuple('EntryHeader', [
'size',
'rle_size'])
EntryHeader.format = '2H'
| Schala/format-scripts | ips.py | Python | gpl-3.0 | 267 |
import datetime
import json
import logging
import re
import time
from multiprocessing import Process, Queue
import requests
class TheTVDBAPI:
API_KEY = "87EF0C7BB9CA4283"
url = 'https://api.thetvdb.com'
def __init__(self, test=False):
logging.getLogger("requests").setLevel(logging.WARNING)
... | sistason/show_archive_manager | a_argument_to_show/thetvdb_api.py | Python | gpl-3.0 | 10,199 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("tutorialv2", "0009_publishedcontent_authors"),
]
operations = [
migrations.AddField(
model_name="publishedcontent",
name="sizes",
field=models.CharField(... | ChantyTaguan/zds-site | zds/tutorialv2/migrations/0010_publishedcontent_sizes.py | Python | gpl-3.0 | 502 |
import tensorflow as tf
# 2D convolutional neural network which can mixed with fully-connected layers
class ConvNet:
#input_shape [rows columns]
def __init__(self, input_shape, layer_list):
self.session = tf.InteractiveSession()
self.input_shape = input_shape
for layer in layer_list:
... | kumkee/SURF2016 | src/network.py | Python | gpl-3.0 | 4,798 |
#! /usr/bin/python
from com.smartitengineering.cms.api.content.template import VariationGenerator
class MyVar(VariationGenerator):
def getVariationForField(self, field, params):
return field.value.value
if __name__ == "__main__":
rep = MyVar
| SmartITEngineering/smart-cms | spi-modules/content-spi-template-providers-impl/src/test/resources/scripts/python/var-script.py | Python | gpl-3.0 | 256 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from xbmctorrent import plugin
from xbmctorrent.scrapers import scraper
from xbmctorrent.ga import tracked
from xbmctorrent.caching import cached_route, shelf
from xbmctorrent.utils import ensure_fanart
from xbmctorrent.library import library_context
BASE_URL = "%s/" % p... | skipmodea1/plugin.video.xbmctorrent | resources/site-packages/xbmctorrent/scrapers/eztv.py | Python | gpl-3.0 | 11,348 |
class Matrix:
def __init__(self,y_size_or_matrix,x_size=None,inital_value=None):
import pandas
import random
self.pandas = pandas
self.random = random
if x_size != None and inital_value != None:
self.y_size = y_size_or_matrix
self.x_size = x_size
... | TNT-Samuel/Coding-Projects | Neural Networks/MatrixMath.py | Python | gpl-3.0 | 8,601 |
from builtins import range
import numpy as np
def affine_forward(x, w, b):
"""
Computes the forward pass for an affine (fully-connected) layer.
The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N
examples, where each example x[i] has shape (d_1, ..., d_k). We will
reshape each ... | ThyrixYang/LearningNotes | MOOC/stanford_cnn_cs231n/assignment2/cs231n/layers.py | Python | gpl-3.0 | 28,227 |
"""
Created on Feb 15, 2014
@author: alex
"""
from sqlalchemy import Column
from sqlalchemy.types import Float
from sqlalchemy.types import Integer
from sqlalchemy.types import SmallInteger
from sqlalchemy.types import Unicode
from sqlalchemy.orm import relationship
from farmgui.models import Base
from farmgui.model... | AlexanderLang/OpenAutomatedFarm | FarmGUI/farmgui/models/SetpointInterpolation.py | Python | gpl-3.0 | 4,921 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
import unicodedata
from django.db import models
from ox.django import fields
import ox
from item import utils
import item.models
import managers
import tasks
def get_name_sort(name, sortname=None):
name = unicod... | maysara/pandora_image | pandora/person/models.py | Python | gpl-3.0 | 3,404 |
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication
from gui.implement import MainWindow
if __name__ == '__main__':
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
app = QApplication(sys.argv)
master = MainWindow()
master.show()
... | tucuprum/jjal_downloader | main.py | Python | gpl-3.0 | 348 |
from contrib.rfc2460 import no_next_header_after_extension_header as suite
from scapy.all import *
from veripy.testability import ComplianceTestTestCase
class NoNextHeaderAfterExtensionHeaderEndNodeTestCase(ComplianceTestTestCase):
def test_no_next_header_after_extension_header(self):
o = self.get_outcom... | mwrlabs/veripy | contrib/rfc2460/tests/no_next_header_after_extension_header_test_case.py | Python | gpl-3.0 | 1,789 |
from mumax2 import *
# Standard Problem 4
Nx = 128
Ny = 32
Nz = 1
setgridsize(Nx, Ny, Nz)
setcellsize(500e-9/Nx, 125e-9/Ny, 3e-9/Nz)
load('micromagnetism')
load('anisotropy/uniaxial')
load('micromag/energy')
setv('Msat', 800e3)
setv('Aex', 1.3e-11)
setv('alpha', 1)
setv('dt', 1e-15)
setv('m_maxerror', 1./100)
setv(... | mumax/2 | tests/energy.py | Python | gpl-3.0 | 1,049 |
###########################################################
# SPEpy - simplified parquet equation solver for SIAM #
# Copyright (C) 2019 Vladislav Pokorny; pokornyv@fzu.cz #
# homepage: github.com/pokornyv/SPEpy #
# siam_parquet.py - solver for SPE #
# method described i... | pokornyv/SPEpy | siam_parquet.py | Python | gpl-3.0 | 15,368 |
#!/usr/bin/python
# This script generates a list of testsuites that should be run as part of
# the Samba 4 test suite.
# The output of this script is parsed by selftest.pl, which then decides
# which of the tests to actually run. It will, for example, skip all tests
# listed in selftest/skip or only run a subset durin... | starrybeam/samba | source4/selftest/tests.py | Python | gpl-3.0 | 46,933 |
#!/usr/bin/python
#-------------------------------------------------------------------------------------------------------------------
# Use to monitor DC sensors based in ACS758
# It uses the MCP3008 Analogue-to-digital converter
# It uploads values to m2mlight.com platform
#
# Credits:
# - http://henrysbench.capnf... | m2mlight/m2mData | example_server_functions_with_a_sensor_v2.py | Python | gpl-3.0 | 2,818 |
# -*- coding: utf-8 -*-
import bpy
from bpy.types import PropertyGroup
from bpy.props import BoolProperty, EnumProperty, FloatProperty, FloatVectorProperty, IntProperty, StringProperty
from mmd_tools import register_wrap
from mmd_tools.core import material
from mmd_tools.core.material import FnMaterial
from mmd_tools... | powroupi/blender_mmd_tools | mmd_tools/properties/material.py | Python | gpl-3.0 | 7,178 |
import json
import psycopg2
from planetwoo.tiletree import load_cutter, load_renderer
import planetwoo.tiletree.mapserver as mapserver
import planetwoo.tiletree.label as label
import planetwoo.tiletree.postgres as postgres
import planetwoo.tiletree.composite as composite
import planetwoo.tiletree.memcached as memcache... | blc56/PlanetWoo | www/__init__.py | Python | gpl-3.0 | 1,722 |
import bpy
class LIObjectExportSettingsOperator(bpy.types.Operator):
bl_idname = "wm.lipsofsuna_object_export_settings"
bl_label = "Object Exporting Settings"
bl_description = 'Control what data is exported of this object'
li_export = bpy.props.EnumProperty(name='Export mode', description='The type of data export... | bsmr-games/lipsofsuna | tool/lipsofsuna_export/object_export_settings_operator.py | Python | gpl-3.0 | 2,837 |
"""
This package contains all analyses modules. Analysis classes are
imported into a dictionary (similarly as with the 'devices'
package). Keys are the device types. So to create a new device just
use:
analyses.anClass['analysisType']
----------------------------------------------------------------------
This file ... | cechrist/cardoon | cardoon/analyses/__init__.py | Python | gpl-3.0 | 2,196 |
# -*- coding: utf-8 -*-
import ply.yacc as yacc
from lexLDM import tokens
import AST
def p_programme(p):
"""programme : bloc"""
p[0] = AST.ProgramNode(p[1])
def p_bloc(p):
"""bloc : BLOC_START instructions BLOC_END """
p[0] = AST.BlocNode(p[2])
def p_instructions(p):
"""instructions : instruction... | fa18swiss/LDM | parserLDM.py | Python | gpl-3.0 | 3,837 |
import pystan._chains as _chains
def ess(sim, n):
"""Calculate effective sample size
Parameters
----------
sim : chains
n : int
Parameter index starting from 0
"""
return _chains.effective_sample_size(sim, n)
def splitrhat(sim, n):
"""Calculate rhat
Parameters
-----... | chendaniely/pystan | pystan/chains.py | Python | gpl-3.0 | 684 |
"""erudit URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | thetoine/eruditorg | erudit/base/urls.py | Python | gpl-3.0 | 2,176 |
################################################################################
## ##
## This file is a part of TADEK. ##
## ... | tadek-project/tadek-ui | src/test/testview.py | Python | gpl-3.0 | 16,336 |
# Copyright (C) 2010-2019 Dzhelil S. Rufat. All Rights Reserved.
import numpy as np
import pybindcpp.ext.ufunc as uf
from pybindcpp.helper import eq
def test_1():
x = np.linspace(0, 1, 5)
x = x.astype('d')
assert eq(np.cos(x), uf.cos(x))
x = x.astype('f')
assert eq(np.sin(x), uf.sin(x))
def t... | drufat/pybindcpp | pybindcpp/ext/ufunc_test.py | Python | gpl-3.0 | 917 |
# Copyright (C) 2011-2016 2ndQuadrant Italia Srl
#
# This file is part of Barman.
#
# Barman 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 ver... | hareevs/pgbarman | barman/backup.py | Python | gpl-3.0 | 35,032 |
import colander
from colander import MappingSchema
from colander import SchemaNode
from colander import String
@colander.deferred
def deferred_name_default(node, kw):
if 'log_diagram' in kw:
name = kw['log_diagram'].name
if name is None:
return colander.null
return name
ret... | AlexanderLang/OpenAutomatedFarm | FarmGUI/farmgui/schemas/DisplaySchemas.py | Python | gpl-3.0 | 945 |
import os
from zipfile import ZipFile
from pupa.scrape import VoteEvent, Scraper
class NCVoteScraper(Scraper):
def scrape(self, chamber=None, session=None):
if not session:
session = self.latest_session()
self.info('no session specified, using %s', session)
chambers = [ch... | votervoice/openstates | openstates/nc/votes.py | Python | gpl-3.0 | 6,583 |
from registry.config.defaults import LOG_CONF
LOG_CONF['loggers']['root']['level'] = 'DEBUG'
| arsgeografica/kinderstadt-registry | registry/config/development.py | Python | gpl-3.0 | 94 |
"""
Copyright 2000, 2001 Astrolabe by William McClain
Forked in 2013 to Astronomia
Copyright 2013 Astronomia by Tim Cera
This file is part of Astronomia.
Astronomia is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
... | webplate/astrini | astronomia/globals.py | Python | gpl-3.0 | 2,736 |
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
import MySQLdb
from flask import _request_ctx_stack
class MySQL(object):
def __init__(self, app=None, **connect_args):
self.connect_args = connect_args
if app is not None:
self.app = app
self.init_app(self.app)... | yelongyu/chihu | venv/lib/python2.7/site-packages/flaskext/mysql.py | Python | gpl-3.0 | 2,365 |
# process Forsythe extTransects
import arcpy, time, os, pythonaddins, sys, math
sys.path.append(r"\\Mac\Home\Documents\scripting\TransectExtraction") # path to TransectExtraction module
from TransectExtraction import *
arcpy.env.overwriteOutput = True # Overwrite output?
arcpy.CheckOutExtension("Spatial") ... | esturdivant-usgs/plover_transect_extraction | TransectExtraction/archive/pre_prepandas/Forsythe_transects.py | Python | gpl-3.0 | 2,430 |
#!/bin/python
#
# Chisne ShengJi card game
# Song, Qiang <keeyang@ustc.edu>
#
# player action and player strategies
from Card import Card
class Player:
def __init__(self, _id = 0):
self.hands = dict({"S":list(), "D":list(), "H":list(),
"C":list(), "Z":list()})
self.playe... | songqiang/ShengJi | Player.py | Python | gpl-3.0 | 16,083 |
# 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 program is distributed in the hope that it will be useful,
# b... | fracpete/python-weka-wrapper-examples | src/wekaexamples/attribute_selection/attribute_selection_test.py | Python | gpl-3.0 | 4,279 |
import shelve
class Recoder:
def __init__(self):
print("Recoder Message: Recoder start")
# file = shelve.open("./record/list.db", protocol=2, flag='c')
# file['num'] = 0;
# file['dict'] = {0:['title'], 1:['id'], 2:['date'],3:['subtitle_en'], 4:['subtitle_cn'], 5:['download_video']... | fxt0706/YouTools | Recorder.py | Python | gpl-3.0 | 3,593 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 ZetaOps Inc.
#
# This file is licensed under the GNU General Public License v3
# (GPLv3). See LICENSE.txt for details.
from ulakbus.lib.common import is_akisini_belli_bir_adimdan_aktif_et
from ulakbus.models import BAPButcePlani, BAPRapor, Okutman, Permission, User, BAPSat... | zetaops/ulakbus | ulakbus/lib/komisyon_sonrasi_adimlar.py | Python | gpl-3.0 | 23,613 |
#!/usr/bin/env python
#coding:utf-8
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from grappelli.dashboard import modules, Dashboard
# from grappelli.dashboard.utils import get_admin_site_name
class AllRecentActions(modules.DashboardModule):
""... | cercisanat/cercisanat.com | cerci/dashboard.py | Python | gpl-3.0 | 4,170 |
from .network import SaveProtocol
class Capture:
"""PlanetaryImager capture manager.
Handles start, stop and pause recording, and gets information about fps and saved/dropped frames.
Can also be configured with callbacks to be executed when these events occur.
You can set callbacks by adding the pro... | GuLinux/PlanetaryImager | scripting_client/planetaryimager/capture.py | Python | gpl-3.0 | 3,976 |
import bpy
# -----------------------------------------------------------------------------
# Substance Project panel
# Draw the UI panel, only the Substance project options :
# - Create a new Substance Project
# - Remove from a Substance Project
# - Export and re-export
# ---------------------------------------------... | stilobique/SubstanceBridge | views/substanceproject.py | Python | gpl-3.0 | 2,575 |
"""
This file is part of Uzu.
Uzu is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Uzu is distributed in the hope that it will be use... | NoZip/uzu | uzu/db/field/__init__.py | Python | gpl-3.0 | 710 |
import libtcodpy as libtcod
import gameconfig
def target_tile(max_range=None):
global key, mouse
# returns x, y of a tile selected by a mouseclick
while True:
libtcod.console_flush()
libtcod.sys_check_for_event(libtcod.EVENT_KEY_PRESS|libtcod.EVENT_MOUSE, key, mouse)
render_all()
... | nerdyLawman/pyhack | src/interface/controls.py | Python | gpl-3.0 | 4,117 |
# -*- coding: utf-8 -*-
# daemon/runner.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2009–2016 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2003 Clark Evans
# Copyright © 2002 Noah Spurrier
# Copyright © 2001 Jürgen Herman... | dsu/orchestration-utilities | libs/daemon/runner.py | Python | gpl-3.0 | 10,099 |
# -*- coding: utf-8 -*-
from dec import dec
class Distribution():
def __init__(self, distd):
self.distd = distd
def calc(self, val, decimals=2):
sorted_keys = sorted(self.distd)
distlist = []
for el in sorted_keys:
distlist.append(dec(self.distd[el], decimals))
... | tedlaz/pyted | functions/dist.py | Python | gpl-3.0 | 1,427 |
numbers = list(range(1, 10)) + list(range(11, 20)) + list(range(10, 100, 10))
numbers_by_name = {input(): x for x in numbers}
s = 0
N = int(input())
for k in range(N):
x = 0
line = input()
for word in line.split():
if word in numbers_by_name:
x += numbers_by_name[word]
else:
... | tkhirianov/fox_inf10_2016 | lesson28/written_numbers.py | Python | gpl-3.0 | 412 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | r8b7xy/qutebrowser | qutebrowser/misc/editor.py | Python | gpl-3.0 | 4,806 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-07 17:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0005_auto_20170326_1520'),
]
operations = [
migrations.RenameField(
... | devolio/devolio | users/migrations/0006_auto_20170507_1704.py | Python | gpl-3.0 | 430 |
'''
SELECT DISTINCT * {
?a a <http://www.w3.org/2002/07/owl#Thing>.
?a a <http://dbpedia.org/class/yago/Anatomy106057539>.
?a a <http://dbpedia.org/ontology/AnatomicalStructure>.
?a ((!a)*/<http://dbpedia.org/ontology/drainsTo>)|(<http://dbpedia.org/ontology/drainsTo>/(!a)*) ?b.
?b a <http://www.w3.org/2002/07/owl#Thin... | SWRG/ESWC2015-paper-evaluation | test_2.py | Python | gpl-3.0 | 984 |
RIOT_API_KEY = "RGAPI-SOME-LONG-STRING"
| patillacode/tilt-o-meter | flaskr/secrets.sample.py | Python | gpl-3.0 | 40 |
#!/usr/bin/env python2
import tools
tools.login("kevin", "", get_xslt=False, parse_and_transform=False, do_static=False)
tools.get_choix(1, "Root", want_static=False, want_background=False, parse_and_transform=False)
tools.get_a_page("Database?action=TRUNK", save=False, parse_and_transform=False)
page = tools.get_a_... | wazari972/WebAlbums | WebAlbums-Downloader/git_bisect.py | Python | gpl-3.0 | 480 |
from __future__ import absolute_import
from .compat import _bytes, _str
from .VixHandle import VixHandle
from .VixError import VixError
from vix import _backend, API_ENCODING
import datetime
vix = _backend._vix
ffi = _backend._ffi
class VixJob(VixHandle):
"""Represnts a VIX Job handle.
.. note:: Internal us... | naim94a/vix | vix/VixJob.py | Python | gpl-3.0 | 6,745 |
# -*- coding: utf-8 -*-
"""
Created on Sat May 5 15:56:56 2018
@author: Han
"""
import numpy as np
from openpyxl import Workbook
def nparray2string(val):
'''
convert a numpy array to string
'''
x = np.array2string(val, threshold=np.nan,
max_line_width=... | luohancfd/FluidDynamicTools | Tecplot_Tools/py2tecplot.py | Python | gpl-3.0 | 7,403 |
from operator import itemgetter
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required, user_passes_test
from teams.models import Team, TeamCodingAnswer, TeamMcqAnswer, UploadFileModel
from mcqs.models import Question as McqQuestion
from coding.models import I... | shivamMg/malvo | scores/views.py | Python | gpl-3.0 | 6,411 |
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
import django
django.setup()
from tsk.models import Provoz
from datetime import datetime
from elasticsearch.helpers import streaming_bulk
from elasticsearch_dsl import DocType, Object, String, GeoPoint, Date, Integer, Float
from elastic... | auto-mat/stupneprovozu | es.py | Python | gpl-3.0 | 1,920 |
#!/usr/bin/python
import rpm as rpm_mod
import os
import shutil
import bdb
import sh
import fs
import logging
logger = logging.getLogger("yum")
#-----------------------------------------------------------------------------
def mklist(value):
if isinstance(value, list):
return value
elif isinstance(value, t... | dozzie/yumbootstrap | lib/yumbootstrap/yum.py | Python | gpl-3.0 | 6,008 |
ERROR_USAGE = 1
ERROR_COMMAND_SYNTAX_ERROR = 2
ERROR_NO_SUCH_COMMAND = 3
ERROR_AGENT_NOT_FOUND = 10
ERROR_AGENT_NOT_PRIMARY = 11
ERROR_AGENT_NOT_CONNECTED = 12
ERROR_AGENT_NOT_ENABLED = 13
ERROR_AGENT_NOT_SPECIFIED = 14
ERROR_AGENT_NO_SPACE = 15
ERROR_BUSY = 20
ERROR_WRONG_STATE = 21
ERROR_INVALID_PORT = 30
ERROR_NO... | palette-software/palette | controller/controller/clierror.py | Python | gpl-3.0 | 891 |
import configparser
class Config(object):
def __init__(self):
self.certificate_path = None
self.certificate_name = None
self.channel = None
self.base_url = None
self.upload_url = None
self.server_url = None
def parse_config(config_file):
config = configparser.... | beppec56/core | bin/update/config.py | Python | gpl-3.0 | 746 |
class MainClass:
def r2_init(self):
self.additional_string = None
def on_receive(self, msg, outputObject, source):
outputObject.AddMetadata("TestHeader", "baz")
if msg.Payload.Has("text"):
outputObject.Payload = msg.Payload.text
if self.additional_string is not None:
outputObject.Payload = outpu... | TordWessman/r2Project | TestData/test_server.py | Python | gpl-3.0 | 639 |
""""
This is dota2. All dota2 related functions are in here.
"""
import datetime
from Download import download_xml as download_xml
import xml.etree.ElementTree as et
class DotaData(object):
def __init__(self, account_id):
self.account_id = account_id
def get_account_id(self):
r... | nigh7fox/dota2_information_composition | Dota2.py | Python | gpl-3.0 | 8,863 |
#!/usr/bin/env python
# coding: utf-8
"""
Hotfile Downloader.
"""
import re
import time
import gobject
from guicavane.Utils.UrlOpen import UrlOpen
from guicavane.Paths import HOSTS_IMAGES_DIR, SEP
from CaptchaWindow import CaptchaWindow, CAPTCHA_IMAGE_PATH
from Base import BaseDownloader
RECAPTCHA_CHALLENGE_URL = ... | j0hn/guicavane | guicavane/Downloaders/Hotfile.py | Python | gpl-3.0 | 4,791 |
# Eyegrade: grading multiple choice questions with a webcam
# Copyright (C) 2010-2021 Jesus Arias Fisteus
#
# 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
# ... | jfisteus/eyegrade | tests/test_classifier.py | Python | gpl-3.0 | 1,817 |
#!/usr/bin/python3
import os
import sys
from web.libreScanWeb import LibreScanWeb
if __name__ == '__main__':
if len(sys.argv) < 2:
print('You most provide at least one argument.')
print('Usted debe de proveer al menos un argumento.')
sys.exit(0)
if sys.argv[1] == 'web':
os.env... | LabExperimental-SIUA/LibreScan | src/main.py | Python | gpl-3.0 | 601 |
#!/usr/bin/python
import sys, pygame
import random
import time
pygame.init()
class GameData:
def __init__(self):
self.size = width, height = 640, 480
self.screen = pygame.display.set_mode(self.size)
self.background = pygame.image.load("background.jpg").convert()
self.backrect = self... | majorsilence/PongLike | ponglike.py | Python | gpl-3.0 | 6,672 |
#!/bin/env python
# _*_ coding:utf-8 _*_
import pexpect
mypassword = "123456"
child = pexpect.spawn('ssh root@192.168.100.150') # spawn 启动scp 程序
child.expect('password:') #expect 方法等待子程序产生的输出,判断是否匹配定义的字符串#'Password:'
child.sendline(mypassword) # 匹配后则发送密码串进行回应'
| zhengjue/mytornado | study/5/demo.py | Python | gpl-3.0 | 347 |
# coding = utf-8
"""
5.9 特征选取
http://git.oschina.net/wizardforcel/sklearn-cb/blob/master/5.md
"""
import numpy as np
from sklearn import datasets
from sklearn import feature_selection
(x, y) = datasets.make_regression(n_samples=1000, n_features=10000)
(f, p) = feature_selection.f_regression(x, y)
print(f[:7])
print(p[... | Ginkgo-Biloba/Misc-Python | sklearn/SKLearn5SelectFeature.py | Python | gpl-3.0 | 1,206 |
from __future__ import print_function, absolute_import
def is_center_ground_line(lbot):
gsensors = lbot.getGroundSensors()
if gsensors is not None and gsensors["left"] is not None and gsensors["right"] is not None:
return gsensors["left"]<50 and gsensors["right"]<50
return False
| robocomp/learnbot | learnbot_dsl/functions/perceptual/groundsensors/is_center_ground_line.py | Python | gpl-3.0 | 286 |
# -*- coding: utf-8 -*-
import logging as log
import datetime as dt
from collections import defaultdict
def from_csv(file, separator=';', fmt=None):
check_string_type_of(separator)
format_of = fmt
number_of_transactions = 0
number_of_corrupted_records = 0
transactions = []
last_unique_items_o... | yedivanseven/bestPy | datastructures/traintest/read/from_csv.py | Python | gpl-3.0 | 3,459 |
# -*- coding: iso-8859-15 -*-
# (c) 2011-2012 Roland Kindermann
#
# This file is part of the Aalto Timed Model Checker ATMOC.
#
# ATMOC 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... | dc-aalto/atmoc | interactive.py | Python | gpl-3.0 | 10,094 |