code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from fooster.web import web
import pytest
test_key = 'Magical'
test_value = 'header'
test_header = test_key + ': ' + test_value + '\r\n'
poor_key = 'not'
poor_value = 'good'
poor_header = poor_key + ':' + poor_value + '\r\n'
good_header = poor_key + ': ' + poor_value + '\r\n'
case_key = 'wEIrd'
case_key_title = c... | fkmclane/web.py | tests/test_header.py | Python | mit | 5,961 |
from {{appname}}.handlers.powhandler import PowHandler
from {{appname}}.conf.config import myapp
from {{appname}}.lib.application import app
import simplejson as json
import tornado.web
from tornado import gen
from {{appname}}.pow_dash import dispatcher
# Please import your model here. (from yourapp.models.dbtype)
@a... | pythononwheels/pow_devel | pythononwheels/start/stubs/dash_handler_template.py | Python | mit | 2,667 |
# -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from unach_photo_server.urls import urlpatterns as unach_photo_server_urls
urlpatterns = [
url(r'^', include(unach_photo_server_urls, namespace='unach_photo_server')),
]
| javierhuerta/unach-photo-server | tests/urls.py | Python | mit | 296 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-04 23:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0013_auto_20160903_0212'),
]
operations = [
migrations.RenameField(
... | aspc/mainsite | aspc/courses/migrations/0014_auto_20160904_2350.py | Python | mit | 1,605 |
from tornado.web import RequestHandler
class BaseHandler(RequestHandler):
def initialize(self):
_settings = self.application.settings
self.db = self.application.db
#self.redis = _settings["redis"]
self.log = _settings["log"]
| code-shoily/tornado-cljs | handlers/base.py | Python | mit | 264 |
from django.contrib import admin
from django.db import models
from pagedown.widgets import AdminPagedownWidget
from .models import Faq, Category
class FaqAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': AdminPagedownWidget},
}
fieldsets = [
('Faq', {'fields'... | ildoc/homeboard | faqs/admin.py | Python | mit | 900 |
from utils import Base, engine
Base.metadata.create_all(engine)
| MarkWh1te/xueqiu_predict | crawler/init_db.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'blog'
| LoveKano/hs_django_blog | blog/apps.py | Python | mit | 156 |
#-------------------------------------------------------------------------------
# Name: Main.py
# Purpose: This script creates chainages from a single or mutile line
#
# Author: smithc5
#
# Created: 10/02/2015
# Copyright: (c) smithc5 2015
# Licence: <your licence>
#------------------------... | smithchristian/arcpy-create-chainages | main.py | Python | mit | 2,746 |
import cPickle
import numpy as np
import cv2
def unpickle(file):
fo = open(file, 'rb')
dict = cPickle.load(fo)
fo.close()
return dict
files = ['../../datasets/svhn/cifar-10-batches-py/data_batch_1']
dict = unpickle(files[0])
images = dict['data'].reshape(-1, 3, 32, 32)
labels = np.array(dict['label... | penny4860/SVHN-deep-digit-detector | tests/cifar_loader.py | Python | mit | 487 |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.UGen import UGen
class TDelay(UGen):
r'''A trigger delay.
::
>>> source = ugentools.Dust.kr()
>>> tdelay = ugentools.TDelay.ar(
... duration=0.1,
... source=source,
... )
>>> tdelay
TDe... | andrewyoung1991/supriya | supriya/tools/ugentools/TDelay.py | Python | mit | 3,463 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TootList.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| gkoehler/TootList | TootList/manage.py | Python | mit | 257 |
#!/usr/bin/env python
import numpy as np
from astropy.io import fits
import scipy.ndimage
import scipy.fftpack
import scipy.optimize
def getcentroid(coordinates, values):
"""
Image centroid from image points im that match with a 2-d array pos, which
contains the locations of each point in an all-positive... | Saethlin/astrotools | photometry.py | Python | mit | 5,356 |
import pytest
from locuspocus import Chromosome
@pytest.fixture
def chr1():
return Chromosome("chr1", "A" * 500000)
@pytest.fixture
def chr2():
return Chromosome("chr1", "C" * 500000)
def test_init(chr1):
assert chr1
def test_init_from_seq():
x = Chromosome("chr1", ["a", "c", "g", "t"])
asse... | LinkageIO/LocusPocus | tests/test_Chromosome.py | Python | mit | 1,038 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-04 09:48
from __future__ import unicode_literals
import api.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [... | gitgik/updown | api/migrations/0001_initial.py | Python | mit | 1,477 |
import numpy as np
def index2onehot(n_labels, index):
return np.eye(n_labels)[index]
# From https://github.com/lisa-lab/DeepLearningTutorials/blob/master/code/utils.py
def scale_to_unit_interval(ndar, eps=1e-8):
""" Scales all values in the ndarray ndar to be between 0 and 1 """
ndar = ndar.copy()
nda... | briancheung/Peano | peano/utils.py | Python | mit | 5,009 |
from yaml import load_all
try:
from yaml import CLoader as Loader
except ImportError:
print("Using pure python YAML loader, it may be slow.")
from yaml import Loader
from iengine import IDocumentFormatter
__author__ = 'reyoung'
class YAMLFormatter(IDocumentFormatter):
def __init__(self, fn=None, con... | reyoung/SlideGen2 | slidegen2/yaml_formatter.py | Python | mit | 933 |
# -*- coding: utf-8 -*-
import datetime
from flask import jsonify, request
from app import token_auth
from app.models.user_token_model import UserTokenModel
@token_auth.verify_token
def verify_token(hashed):
token = UserTokenModel.query\
.filter(UserTokenModel.hashed == hashed, UserTokenModel.ip_address ... | h4wldev/Frest | app/modules/auth/token.py | Python | mit | 652 |
import unittest
import instruction_set
class TestInstructionSet(unittest.TestCase):
def test_generate(self):
self.assertIsInstance(instruction_set.generate(), list)
self.assertEqual(len(instruction_set.generate()), 64)
self.assertEqual(len(instruction_set.generate(32)), 32)
inse... | chuckeles/genetic-treasures | test_instruction_set.py | Python | mit | 2,849 |
import paho.mqtt.client as mqtt
import json, time
import RPi.GPIO as GPIO
from time import sleep
# The script as below using BCM GPIO 00..nn numbers
GPIO.setmode(GPIO.BCM)
# Set relay pins as output
GPIO.setup(24, GPIO.OUT)
# ----- CHANGE THESE FOR YOUR SETUP -----
MQTT_HOST = "190.97.168.236"
MQTT_PORT = 1883
US... | pumanzor/security | raspberrypi/relaycontrol.py | Python | mit | 1,611 |
from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse
from .models import UserProfile
from imagersite.tests import AuthenticatedTestCase
# Create your tests here.
class ProfileTestCase(TestCase):
"""TestCase for Profile"""
def setUp(self):
"""Set... | welliam/imagersite | user_profile/tests.py | Python | mit | 2,830 |
""" Define a simple framework for time-evolving a set of arbitrary agents and
monitoring their evolution.
"""
import numpy as np
def int_r(f):
""" Convert to nearest integer. """
return int(np.round(f))
class Simulation(object):
""" A class that manages the evolution of a set of agents.
This is a simple o... | ttesileanu/twostagelearning | simulation.py | Python | mit | 6,696 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | himaaaatti/qtile | libqtile/manager.py | Python | mit | 59,989 |
#
# lastilePro.py
#
# (c) 2013, martin isenburg - http://rapidlasso.com
# rapidlasso GmbH - fast tools to catch reality
#
# uses lastile.exe to compute a tiling for a folder
# worth of LiDAR files with a user-specified tile
# size (and an optional buffer)
#
# LiDAR input: LAS/LAZ/BIN/TXT/SHP/BIL/ASC/DTM... | strummerTFIU/TFG-IsometricMaps | LAStools/ArcGIS_toolbox/scripts_production/lastilePro.py | Python | mit | 4,971 |
"""
Simple utils to save and load from disk.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
# TODO(rbharath): Use standard joblib once old-data has been regenerated.
import joblib
from sklearn.externals import joblib as old_joblib
import gzip
import pi... | joegomes/deepchem | deepchem/utils/save.py | Python | mit | 5,030 |
import numpy as np
def data_concat(result_a):
return np.concatenate(result_a, axis=0)
def data_mean(result_a):
return np.mean(result_a)
def data_identity(result_a):
return result_a
def data_stack(result_a):
return np.stack(result_a)
def data_single(result_a):
return result_a[0]
def data_... | haihabi/simpy | simpy/core/result/base_function.py | Python | mit | 391 |
# _*_ coding: utf-8 _*_
import os
try:
from cStringIO import StringIO # python 2
except ImportError:
from io import StringIO # python 3
from collections import OrderedDict
import unittest
from tornado.escape import to_unicode
from tortik.util import make_qs, update_url, real_ip
from tortik.util.xml_etree im... | glibin/tortik | tortik_tests/util_test.py | Python | mit | 7,001 |
import numpy as np
from sklearn.grid_search import GridSearchCV
import sklearn.metrics as metrics
from sklearn import preprocessing as prep
from tr_utils import merge_two_dicts, isEmpty
class SKSupervisedLearning (object):
"""
Thin wrapper around some learning methods
"""
def __init__(self, classifi... | fierval/KaggleMalware | Learning/SupervisedLearning.py | Python | mit | 5,930 |
# Copyright 2015 John Reese
# Licensed under the MIT license
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import sys
class Module:
"""
This class provides a generic interface for the preprocessor to pass
data to the module and retrie... | jreese/markdown-pp | MarkdownPP/Module.py | Python | mit | 805 |
import pygame
class Face(pygame.sprite.Sprite):
def __init__(self, imagePaths, rect, player):
pygame.sprite.Sprite.__init__(self)
self.imagePath = imagePaths
self.images = {}
self.rect = pygame.Rect(rect)
self.player = player
self.stateCallback = player.stateOfMind
... | macobo/Bomberman | drawers/Face.py | Python | mit | 869 |
from markupsafe import escape
import re
from pymongo.objectid import ObjectId
from pymongo.errors import InvalidId
from app.people.people_model import People
from app.board.board_model import BoardTopic, BoardNode
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from lib.fi... | feilaoda/FlickBoard | project/cache/files.py | Python | mit | 3,576 |
#! /usr/bin/python
# @author: wtie
import subprocess
import sys
import time
import argparse
DIFF = False
FIRST = []
def get_floating_ips():
sql = """SELECT fip.floating_ip_address
FROM neutron.floatingips AS fip
JOIN neutron.ports AS p
JOIN neutron.securitygroupportbinding... | TieWei/openstack-kit | openstackkit/ping_working_public.py | Python | mit | 5,255 |
from gitbarry.reasons import start, finish, switch # , switch, publish
REASONS = {
'start': start,
'finish': finish,
'switch': switch,
# 'publish': publish,
}
| a1fred/git-barry | gitbarry/reasons/__init__.py | Python | mit | 177 |
"""
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from . import cluster
from .classification import accuracy_score
from .classification import brier_score_loss
from .classification import classification_report
from .classification im... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/sklearn/metrics/__init__.py | Python | mit | 3,388 |
#Sequences of actual rotors used in WWII, format is name, sequences, turnover notch(es)
rotor_sequences = {
'I': ('EKMFLGDQVZNTOWYHXUSPAIBRCJ', ('Q')),
'II': ('AJDKSIRUXBLHWTMCQGZNPYFVOE', ('E')),
'III': ('BDFHJLCPRTXVZNYEIWGAKMUSQO', ('V')),
'IV': ('ESOVPZJAYQUIRHXLNFTGKDCMWB', ('J')),
'V... | jossthomas/Enigma-Machine | components/Default_Settings.py | Python | mit | 2,231 |
# -*- coding: utf-8
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
try:
import simplejson as json
except ImportError:
import json
ADDRESS_FIELDS = (
'first', 'middle', 'last', 'salutation', 'email', 'phone',
'fax', 'mobile', 'addr1', 'addr2', ... | derekperry/oaxmlapi | oaxmlapi/utilities.py | Python | mit | 4,499 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cityhallmonitor', '0002_matter_attachments_obtained_at'),
]
operations = [
migrations.AddField(
model_name='matt... | NUKnightLab/cityhallmonitor | cityhallmonitor/migrations/0003_matterattachment_link_obtained_at.py | Python | mit | 440 |
from __future__ import absolute_import, division, print_function
import hashlib
import linecache
import sys
import warnings
from operator import itemgetter
from . import _config
from ._compat import PY2, isclass, iteritems, metadata_proxy, set_closure_cell
from .exceptions import (
DefaultAlreadySetError, Frozen... | nparley/mylatitude | lib/attr/_make.py | Python | mit | 49,291 |
# 053. Maximum Subarray
# The simple O(n) solution.
import unittest
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ret = nums[0]
pre = nums[0]
for i in nums[1:]:
if ret < i and ret < 0:
... | hanlin-he/UTD | leetcode/py/053.py | Python | mit | 1,020 |
"""
Transactional workflow control for Django models.
"""
| oblalex/django-workflow | src/workflow/__init__.py | Python | mit | 58 |
#!/usr/bin/ipython
library_file = open('/srv/http/.config/cmus/lib.pl');
tracks = library_file.readlines()
for x in tracks:
print('<li>' + x + '</li>')
| yisonPylkita/blace | Applications/Music_Player/getLibrary.py | Python | mit | 157 |
problem = """
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include leading zeros.)
"""
def is_palindromic(s):
return ... | lorenyu/project-euler | problem-036.py | Python | mit | 813 |
# -*- coding: utf-8 -*-
from flask import make_response
from flask.views import MethodView
class IndexView(MethodView):
def get(self):
return make_response('Congratulations!')
| iceihehe/flaskr | app/demo/views.py | Python | mit | 193 |
import logging
import sqlite3
from pyfcm import FCMNotification
def insert_token(token):
try:
con = sqlite3.connect('fcm.db')
cur = con.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS tokens(token TEXT)')
cur.execute('INSERT INTO tokens VALUES (?)', (token, ))
con.commi... | walkover/auto-tracking-cctv-gateway | gateway/firebase/fcm.py | Python | mit | 1,072 |
from unittest import TestCase
from aq.sqlite_util import connect, create_table, insert_all
class TestSqliteUtil(TestCase):
def test_dict_adapter(self):
with connect(':memory:') as conn:
conn.execute('CREATE TABLE foo (foo)')
conn.execute('INSERT INTO foo (foo) VALUES (?)', ({'bar'... | lebinh/aq | tests/test_sqlite_util.py | Python | mit | 2,855 |
"""Modulo que contiene la clase directorio de funciones
-----------------------------------------------------------------
Compilers Design Project
Tec de Monterrey
Julio Cesar Aguilar Villanueva A01152537
Jose Fernando Davila Orta A00999281
-----------------------------------------------------------------
DOCUM... | davilajose23/ProjectCobra | functions_dir.py | Python | mit | 10,907 |
from webhelpers import *
from datetime import datetime
def time_ago( x ):
return date.distance_of_time_in_words( x, datetime.utcnow() )
def iff( a, b, c ):
if a:
return b
else:
return c | dbcls/dbcls-galaxy | lib/galaxy/web/framework/helpers/__init__.py | Python | mit | 220 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import datetime
from collections import namedtuple
import mock
import six
from django.conf import settings
from django.test import TestCase
from django.utils import timezone
from wagtail.wagtailcore.models import Page
from articles.mode... | albertoconnor/website | wordpress_importer/tests/test_import_command.py | Python | mit | 41,498 |
# -*- coding:utf-8 -*-
# Copyright (c) 2013, Theo Crevon
# Copyright (c) 2013, Greg Leclercq
#
# See the file LICENSE for copying permission.
from itertools import groupby
from swf.models.event import EventFactory, CompiledEventFactory
from swf.models.event.workflow import WorkflowExecutionEvent
from swf.utils impor... | botify-labs/python-simple-workflow | swf/models/history/base.py | Python | mit | 7,957 |
import csv
import re
import datetime
import string
import collections
def get_nr_data():
''' returns a list of lists each entry represents one row of NiceRide data
in form -- [[11/1/2015, 21:55], '4th Street & 13th Ave SE', '30009',
[11/1/2015, 22:05], 'Logan Park', '30104', '565', 'Casual'] where the
... | stinbetz/nice_ride_charting | datify.py | Python | mit | 7,682 |
# -*- 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 'PushResult'
db.create_table(u'notos_pushresult', (
(u'id', self.gf('django.db.mo... | Sigmapoint/notos | src/notos/migrations/0001_initial.py | Python | mit | 3,961 |
from distutils.core import setup
setup(
name='bumpversion_demo',
version='0.1.0',
packages=[''],
url='https://github.com/tantale/bumpversion_demo',
license='MIT License',
author='Tantale',
author_email='tantale.solution@gmail.com',
description='Demonstration of ``bumpversion`` usage in ... | tantale/bumpversion_demo | setup.py | Python | mit | 356 |
import struct
from . import crc16
class PacketWriter:
MAX_PAYLOAD = 1584
MIN_LEN = 6
MAX_LEN = 1590
SOF = 0x01
OFFSET_SOF = 0
OFFSET_LENGTH = 1
OFFSET_CMD = 3
OFFSET_PAYLOAD = 4
def __init__(self):
self._packet = None
def Clear(self):
self._packet = None
... | openaps/dexcom_reader | dexcom_reader/packetwriter.py | Python | mit | 1,120 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = 'frey.maxim@gmail.com'
... | jeffthemaximum/jeffPD | config.py | Python | mit | 1,272 |
# coding:utf-8
import re
import sys
if sys.version < '3':
def u(x):
return x.decode('utf-8')
else:
unicode = str
def u(x):
return x
# Matches section start `interfaces {`
rx_section = re.compile(r'^([\w\-]+) \{$', re.UNICODE)
# Matches named section `ethernet eth0 {`
rx_named_section ... | hedin/vyatta-conf-parser | vyattaconfparser/parser.py | Python | mit | 5,394 |
""" Notices indicate how a regulation has changed since the last version. This
module contains code to compile a regulation from a notice's changes. """
from bisect import bisect
from collections import defaultdict
import copy
import itertools
import logging
from regparser.grammar.tokens import Verb
from regparser.tr... | EricSchles/regulations-parser | regparser/notice/compiler.py | Python | cc0-1.0 | 21,565 |
from django.apps import AppConfig
class TravellerConfig(AppConfig):
name = 'traveller'
| catherinedevlin/rideshare-matchmaker | traveller/apps.py | Python | cc0-1.0 | 93 |
# Copyright 2018 Red Hat, Inc. and others. 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 appli... | opendaylight/netvirt | resources/tools/odltools/odltools/cli_utils.py | Python | epl-1.0 | 1,857 |
#Author velociraptor Genjix <aphidia@hotmail.com>
from PySide.QtGui import *
from PySide.QtCore import *
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
button = QPushButton(self)
button.setGeometry(QRect(100, 100, 100, 100))
machine = QStateM... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/PySide/examples/state-machine/eventtrans.py | Python | epl-1.0 | 1,534 |
# encoding: 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 'SystemStats'
db.create_table('core_systemstats', (
('date', self.gf('djang... | Alwnikrotikz/kegbot | pykeg/src/pykeg/core/migrations/0047_add_system_stats.py | Python | gpl-2.0 | 26,712 |
#from .engine import CheckVersion, CreateVersion
from .versioner import DBVersioner, DBVersionCommander | sim1234/Versioning | py_versioning/db/__init__.py | Python | gpl-2.0 | 103 |
#!/bin/python
'''
Author: Yin Lin Date: September 23, 2013
The class object StarClass loads stars from the catalog.py and from the source extractor cat file and converts them into proper format.
The lists of stars are then passed to the subclass, StarCalibration, to cross match two lists and perform offset and ... | bmazin/ARCONS-pipeline | astrometry/guide-centroid/FitsAnalysis.py | Python | gpl-2.0 | 48,276 |
# -*- coding: utf-8 -*-
"""
(c) 2014-2016 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from __future__ import unicode_literals, absolute_import
import logging
import os
import flask
import pygit2
from binaryornot.helpers import is_binary_string
import pagure.config
import p... | pypingou/pagure | pagure/docs_server.py | Python | gpl-2.0 | 6,488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,sys, re, json, requests
from oxapi import *
def get_a_task(ox):
folder = ox.get_standard_folder('tasks')
task = list(ox.get_tasks(folder.id))[0]
return task
def upload(bean, args=[{'content':None,'file':None, 'mimetype':'text/plain','name':'attachme... | bstrebel/OxAPI | test/_attachment.py | Python | gpl-2.0 | 3,939 |
# -*- coding: utf-8 -*-
from tg.configuration import AppConfig, config
from tg import request
from pollandsurvey import model
from tgext.pyutilservice import Utility
import logging
log = logging.getLogger(__name__)
from tgext.pylogservice import LogDBHandler
class InterfaceWebService(object):
def __init__(self... | tongpa/PollSurveyWeb | pollandsurvey/service/interfacewebservice.py | Python | gpl-2.0 | 1,487 |
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributio... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/Cryptodome/SelfTest/Cipher/test_OCB.py | Python | gpl-2.0 | 25,029 |
#! /usr/bin/env python
'''
Arff loader for categorical and numerical attributes, based
on scipy.io.arff.arffloader With minor changes for this
project (eg. categorical attributes are mapped onto integers
and whole dataset is returned as numpy array of floats)
If any unsupported data types appear or if arff is malforme... | MiraHead/mlmvn | src/dataio/arffio.py | Python | gpl-2.0 | 8,420 |
'''
Modulo Movimiento Nanometros
@author: P1R0
import ObjSerial, sys;
ObjSer = ObjSerial.ObjSerial(0,9600)
ObjSer.cts = True
ObjSer.dtr = True
ObjSer.bytesize = 8
'''
SxN = 59.71 #Constante de Calibracion del Motor
#Funcion para inicializar Monocromador
def init(ObjSer,A):
ObjSer.flushOutput()
ObjSe... | P1R/freeMonoCrom | MM.py | Python | gpl-2.0 | 5,424 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
def add(x, y):
a=1
while a>0:
a = x & y
b = x ^ y
x = b
y = a << 1
return b
def vowel_count(word):
vowels_counter = 0
for letter in word:
if letter.isalpha():
if letter.upper() in 'AEIOUY':
vowels_co... | pybursa/homeworks | a_lusher/hw3/Lusher_Alexander_home_work_3_.py | Python | gpl-2.0 | 2,380 |
import argparse
import sys
import traceback as tb
from datetime import datetime
from cfme.utils.path import log_path
from cfme.utils.providers import list_provider_keys, get_mgmt
def parse_cmd_line():
parser = argparse.ArgumentParser(argument_default=None)
parser.add_argument('--nic-template',
... | jkandasa/integration_tests | scripts/azure_cleanup.py | Python | gpl-2.0 | 3,453 |
# Copyright (C) 2015 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd... | NorfairKing/sus-depot | shared/shared/vim/dotvim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/rust/rust_completer.py | Python | gpl-2.0 | 12,458 |
#!/usr/bin/python
import sys
import csv
import json
#test to make sure pyproj exists
try:
import pyproj
except ImportError:
sys.stderr.write("Please install the pyproj python module!\n")
sys.exit(3)
try:
from pymongo import MongoClient
except ImportError:
sys.stderr.write("Please install the pym... | LonnyGomes/DC-Crime-Heat-Map | scripts/parseCrimeDataCoords.py | Python | gpl-2.0 | 3,037 |
from django.db import models
from django.contrib.auth import models as auth
import datetime
from application import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
typeChoices = (
('task', 'Task'),
('userStory', 'User Story'),
)
statusChoices = (
('toDo', 'To do')... | Die-Turtles/application | taskCards/models.py | Python | gpl-2.0 | 3,381 |
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.http import *
from django.template import Template, Context
from django.shortcuts import render_to_response, redirect, render, RequestContext, HttpResponseRedirect
def login(request):
return ... | COMU/lazimlik | lazimlik/social_app/views.py | Python | gpl-2.0 | 568 |
#!/usr/bin/env python
"""
ConversionParser.py $Id: ConversionParser.py,v 1.5 2004/10/20 01:44:53 chrish Exp $
Copyright 2003 Bill Nalen <bill.nalen@towers.com>
Distributable under the GNU General Public License Version 2 or newer.
Provides methods to wrap external convertors to return PluckerTextDocument... | arpruss/plucker | parser/python/PyPlucker/ConversionParser.py | Python | gpl-2.0 | 2,897 |
###########################################################################
#
# Copyright (C) 2012 Zenoss Inc.
#
###########################################################################
from Products.Zuul.form import schema
from Products.Zuul.utils import ZuulMessageFactory as _t
from Products.Zuul.infos.component ... | zenoss/ZenPacks.zenoss.Puppet | ZenPacks/zenoss/Puppet/interfaces.py | Python | gpl-2.0 | 1,215 |
#!/usr/bin/env python3
# coding: utf-8
import BRT
from collections import namedtuple
import configparser
import os
import logging
from os.path import expanduser
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--submit', help='Execute the submission', action='store_true')
parser.add_argu... | jochym/brt | submit_batch.py | Python | gpl-2.0 | 2,720 |
#!/usr/bin/env python3
#
# Script for polling N64/GC SI bus devices
#
# This script uses the serial bridge and pool in loops
# for the buttons status.
#
# It currently supports N64 controllers, N64 mouses & GameCube controllers.
#
# --Jacques Gagnon <darthcloud@gmail.com>
#
from bus import Bus
from collections import ... | darthcloud/cube64-dx | notes/poll.py | Python | gpl-2.0 | 6,079 |
import requests
import yaml
class RequestsApi:
def __init__(self):
'init'
self.config = yaml.load(open("config/request_settings.yml", "r"))
def get_objects(self, sector):
'request to get objects'
objects_points = []
url = self.config['host'] + self.config['object_path'] % sector
response = requests.get... | veskopos/VMWare | api/requests_api.py | Python | gpl-2.0 | 1,010 |
#!/usr/bin/python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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 So... | pheanex/fail2ban | setup.py | Python | gpl-2.0 | 5,567 |
import greengraph
if __name__ == '__main__':
from matplotlib import pyplot as plt
mygraph = greengraph.Greengraph('New York','Chicago')
data = mygraph.green_between(20)
plt.plot(data)
plt.show()
| padraic-padraic/MPHYSG001_CW1 | example.py | Python | gpl-2.0 | 216 |
__author__ = 'Andy Gallagher <andy.gallagher@theguardian.com>'
import xml.etree.ElementTree as ET
import dateutil.parser
from .vidispine_api import always_string
class VSMetadata:
def __init__(self, initial_data={}):
self.contentDict=initial_data
self.primaryGroup = None
def addValue(self,key... | fredex42/gnmvidispine | gnmvidispine/vs_metadata.py | Python | gpl-2.0 | 5,748 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of overview archive.
# Copyright © 2015 seamus tuohy, <stuohy@internews.org>
#
# 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... | elationfoundation/overview_archive | overview_archive/utils/identify.py | Python | gpl-2.0 | 1,836 |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | rajul/tvb-framework | tvb/config/logger/cluster_handler.py | Python | gpl-2.0 | 3,331 |
#!/usr/bin/env python
from distutils.core import setup
from DistUtilsExtra.command import *
import glob
import os
setup(name='unattended-upgrades', version='0.1',
scripts=['unattended-upgrade'],
data_files=[
('../etc/apt/apt.conf.d/',
["data/50unattended-upgrades"]),
... | Jimdo/unattended-upgrades | setup.py | Python | gpl-2.0 | 968 |
from datetime import datetime, timedelta
import time
class Match:
def __init__(self, json):
i = (int)(json['_links']['competition']['href'].rfind('/') + 1)
self.competitionId = (int)(json['_links']['competition']['href'][i:])
ind = (int)(json['_links']['self']['href'].rfind('/') + 1)... | dimoynwa/DLivescore | data/match.py | Python | gpl-2.0 | 3,878 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class Mycar168Pipeline(object):
def process_item(self, item, spider):
return item
| yzhuan/car | crawler/mycar168/mycar168/pipelines.py | Python | gpl-2.0 | 262 |
'''
mysql> desc problem;
+-------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+----------------+
| pid | int(11) | NO | PRI | NULL | auto_increment |
| title... | CKboss/VirtualJudgePY | dao/problemdao.py | Python | gpl-2.0 | 5,683 |
#!/usr/bin/env python-i
# draws SUMMON logo
#
import math
import summon
from summon.core import *
from summon import shapes, colors
def interleave(a, b):
c = []
for i in xrange(0, len(a), 2):
c.extend(a[i:i+2] + b[i:i+2])
return c
def curve(x, y, start, end, radius, width):
p = shapes.arc_pa... | mdrasmus/summon | examples/18_summon.py | Python | gpl-2.0 | 2,904 |
import logging
from .model import LogEntry, LogLevels
class NGWLogHandler(logging.Handler):
"""
Simple standard log handler for nextgisweb_log
"""
def __init__(self, level=LogLevels.default_value, component=None, group=None):
logging.Handler.__init__(self, level=level)
self.component ... | nextgis/nextgisweb_log | nextgisweb_log/log_handler.py | Python | gpl-2.0 | 998 |
# GBRT for Luroeykalven case study site
# Training data: manually digitized training areas, including water pixels
# Predictors: results of FCLS spectral unmixing
# Authors: Stefan Blumentrath
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import datasets
from sklearn.uti... | NINAnor/sentinel4nature | Tree canopy cover/regression/GBRT_Luroeykalven_manual_FCLS.py | Python | gpl-2.0 | 8,821 |
#!/usr/local/bin/python3
import sys
import boto3
import os
from botocore.exceptions import ClientError
import json
import argparse
from botocore.utils import InstanceMetadataFetcher
from botocore.credentials import InstanceMetadataProvider
import platform
region = os.getenv('AWS_DEFAULT_REGION', 'us-east-1')
duration... | gwsu2008/automation | python/awscreds-custom.py | Python | gpl-2.0 | 2,552 |
# -*- coding: utf-8 -*-
"""
IMU Plugin
Copyright (C) 2015 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2015 Matthias Bolte <matthias@tinkerforge.com>
Copyright (C) 2019 Erik Fleckstein <erik@tinkerforge.com>
imu_3d_widget.py: IMU OpenGL representation
This program is free software; you can redistribute it and/or
mo... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/imu/imu_3d_widget.py | Python | gpl-2.0 | 2,398 |
#!/usr/bin/env python
############################################################################
#
# MODULE: ssr_params.py
# AUTHOR: Collin Bode, UC Berkeley
#
# PURPOSE: Consolidate parameters for all SSR scripts and to provide some
# common functions.
#
# DEPENDENCIES: requires fu... | cbode/ssr | ssr_params.py | Python | gpl-2.0 | 7,659 |
NAME = 'django-adminactions'
VERSION = __version__ = (0, 4, 0, 'final', 0)
__author__ = 'sax'
import subprocess
import datetime
import os
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
... | updatengine/updatengine-server | adminactions/__init__.py | Python | gpl-2.0 | 1,648 |
import os
import RecordTimer
import Components.ParentalControl
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.config import config
from Components.AVSwitch import AVSwitch
from Components.Console import Console
from Components.Impor... | blzr/enigma2 | lib/python/Screens/Standby.py | Python | gpl-2.0 | 14,247 |
"""Pure TTY chooser UI"""
from __future__ import print_function, absolute_import
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__license__ = "GNU GPL 2 or later"
import os
# Use readline if available but don't depend on it
try:
import readline
# Shut PyFlakes up
readline # pylint: disable=pointl... | ssokolow/lap | lap/ui/fallback_chooser.py | Python | gpl-2.0 | 1,853 |
#!/usr/bin/python
__author__ = 'Ben "TheX1le" Smith'
__email__ = 'thex1le@gmail.com'
__website__= 'http://trac.aircrack-ng.org/browser/trunk/scripts/airgraph-ng/'
__date__ = '03/02/09'
__version__ = ''
__file__ = 'airgraph-ng'
__data__ = 'This is the main airgraph-ng file'
"""
Welcome to airgraph written by TheX1le
Sp... | esurharun/aircrack-ng-cell | scripts/airgraph-ng/airgraph-ng.py | Python | gpl-2.0 | 16,007 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2020 RERO
# Copyright (C) 2020 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program ... | rero/reroils-app | tests/api/patron_transactions/test_patron_transactions_permissions.py | Python | gpl-2.0 | 7,427 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrclipextent.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... | Gaia3D/QGIS | python/plugins/processing/algs/gdal/ogr2ogrclipextent.py | Python | gpl-2.0 | 3,489 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.