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 |
|---|---|---|---|---|---|
name = raw_input("Enter your name:")
print "Hello" , name
| Pontianak/Python-For-Informatics-Assignments | 2.2.py | Python | mit | 58 |
import re
from itertools import islice
from geopy import util, units, format
class Point(object):
"""
A geodetic point with latitude, longitude, and altitude.
Latitude and longitude are floating point values in degrees.
Altitude is a floating point value in kilometers. The reference level
is never... | pombredanne/geopy | geopy/point.py | Python | mit | 10,317 |
# -*- coding: utf-8 -*-
import os
import signal
import time
import subprocess
import pytest
class Mode(object):
STANDALONE = "standalone.sh"
DOMAIN = "domain.sh"
class InfinispanServer(object):
DOWNLOAD_URL = "http://downloads.jboss.org/infinispan/%s.Final/"
ZIP_NAME = "infinispan-server-%s.Final-b... | VaclavDedik/infinispan-py | tests/func/server.py | Python | mit | 2,231 |
#----------------------------------------------------------------------------
# Name: wx.lib.eventwatcher
# Purpose: A widget that allows some or all events for a particular widget
# to be captured and displayed.
#
# Author: Robin Dunn
#
# Created: 21-Jan-2009
# RCS-ID: $Id... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/lib/eventwatcher.py | Python | mit | 16,311 |
import unittest
from highest_number_cubed import highest_number_cubed
class TestHighestNumberCubed(unittest.TestCase):
def test_three(self):
self.assertEqual(highest_number_cubed(30), 3)
def test_two(self):
self.assertEqual(highest_number_cubed(12), 2)
def test_one(self):
self.... | rmotr-group-projects/itp-w1-highest-number-cubed | tests/test_main.py | Python | mit | 443 |
import Evaluator
from io import StringIO
import numpy as np
class BayesMatrixFactorEvaluator(Evaluator.Evaluator):
def __init__(self, details):
pass
def evaluate(self, input, target_output, output, log):
try:
M = output.split('\n\n')
U = np.loadtxt(StringIO(unicode(M[0]... | hunsteve/HWTester | MIHF/Bayes/BayesMatrixFactorEvaluator.py | Python | mit | 805 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: Philip J Grabner <grabner@cadit.com>
# date: 2013/07/31
# copy: (C) Copyright 2013 Cadit Health Inc., All Rights Reserved.
#-----------------------------------------------------------------------... | cadithealth/genemail | genemail/modifier/base.py | Python | mit | 2,085 |
from .base import *
import dj_database_url
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASES['default'] = dj_database_url.config()
REDIS_URL = urlparse(get_env_variable('REDISCLOUD_URL'))
SOCKETIO_URL = get_env_variable("S... | phildini/cards-against-django | cah/settings/prod.py | Python | mit | 923 |
from flask import current_app, jsonify, request, url_for
from app import authenticated_service
from app.dao import inbound_sms_dao
from app.schema_validation import validate
from app.v2.inbound_sms import v2_inbound_sms_blueprint
from app.v2.inbound_sms.inbound_sms_schemas import get_inbound_sms_request
@v2_inbound_... | alphagov/notifications-api | app/v2/inbound_sms/get_inbound_sms.py | Python | mit | 1,247 |
import pandas as pd
import numpy
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
content = []
data = []
common = []
def remove_non_ascii(text):
return ''.join([i if ord(i) < 128 else ' ' for i in text])
def remove_words(array):
final = []
words = []
for... | yrahul3910/chatting-style-recognizer | classify.py | Python | mit | 2,888 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com>
#
# Distributed under terms of the MIT license.
"""Test function from the generation of figures."""
import math
import gsd.hoomd
from hypothesis import given
from hypothesis.strategies import f... | malramsay64/MD-Molecules-Hoomd | test/figures_test.py | Python | mit | 1,269 |
import logging
import json
from flask import Blueprint, current_app, request, jsonify
from api.helpers import construct_response
from api import tasks
blueprint = Blueprint('api', __name__)
@blueprint.route('/example', methods=['POST'])
def example():
queues = current_app.config.get('QUEUES')
queue_name = qu... | spulec/PyQS | example/api/example.py | Python | mit | 1,239 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py | Python | mit | 15,195 |
import collections
import itertools
import sys
def count_homopolymers( fh ):
s = []
print "building..."
for line in fh:
if line.startswith( '>' ):
continue
s.append( line.strip() )
print "counting..."
runs = collections.defaultdict(int)
best = collections.defaultdict(int)
last = None
fo... | supernifty/mgsa | mgsa/count_homopolymers.py | Python | mit | 550 |
# -*- coding: utf-8 -*-
"""
this script is crap but I
don't feel like fixing it.
"""
import shutil
import os
import sys
import time
import tempfile
from bencode import *
base_dir = tempfile.gettempdir() + "\\ut-itunes-import"
item_list = []
file_count = 0
file_types = ['.mp3',]
if "--help" in str(sys.argv[1]).low... | smithbr/ut-itunes-import | import.py | Python | mit | 5,276 |
import json
import os
#This helper class allows to access members of the configuration
#as c.attr1.attr2.attr3 instead of c[attr1][attr2][attr3]
class DictToAttr( object ):
def __init__( self, dictionary ):
self.dict = dict( dictionary )
def __getattr__(self, attr):
... | giacomov/pyggop | pyggop/config/Configuration.py | Python | mit | 2,359 |
from django import template
from django.core.urlresolvers import reverse, reverse_lazy, NoReverseMatch
from django.template.loader import render_to_string
from django.db.models import Model
from django.utils.safestring import mark_safe
register = template.Library()
BASE_PATH = 'render'
class RenderObjectTemplateTagNo... | luzfcb/versionamento_testes | testapp/core/templatetags/core_tags.py | Python | mit | 5,536 |
# XOR gate. No hidden layer, basic logistic regression
# Demonstration - can't learn nonlinearity. Hidden layer is required
import numpy as np
import theano
import theano.tensor as T
import matplotlib.pyplot as plt
# Set inputs and correct output values
inputs = [[0,0], [1,1], [0,1], [1,0]]
outputs = [0, 0, 1, 1]
# ... | sho-87/python-machine-learning | Logistic Regression/xor_logistic.py | Python | mit | 2,256 |
from pocketworkers import worker, Pipeline
@worker
def compute(arg):
arg = arg + 10
return arg
@worker
def save_results(filename):
with open(filename, 'w') as f:
while True:
try:
result = yield
except GeneratorExit:
break
... | lulupac/quickworkers | examples/example_pipeline.py | Python | mit | 752 |
from django.apps import AppConfig
class UserloginpagesConfig(AppConfig):
name = 'userLoginPages'
| BDague/generic-image-server | genericImageServer/userLoginPages/apps.py | Python | mit | 103 |
#!/bin/env python
"""Simulates the traffic of one or more listeners or beacons."""
import time
import argparse
import asyncio
import os
import random
import struct
# from binascii import unhexlify
from enum import IntEnum
import lzo
# from Crypto.Cipher import AES
# from Crypto.Hash import CMAC
from .proto.common_p... | C3Wireless/c3-reference | src/c3reference/listener.py | Python | mit | 9,445 |
import argparse
def processCommand(mgr, args):
parser = argparse.ArgumentParser(usage='''maws ec2 <subcommand> [<args>]
maws ec2 help''')
parser.add_argument('subcommand', help='ec2 subcommand',
choices=[ 'help', 'create' ])
args = parser.parse_args(args)
if args.subcommand == "help":
... | uva-its/awstools | cli/ec2_cli.py | Python | mit | 912 |
#!/usr/bin/env python
"""
Bagelbot script for checking for attendance for an upcoming bagelbot meeting.
"""
import logging
import sys
import time
from datetime import datetime, timedelta
from config import ATTENDANCE_TIME_LIMIT
from utils import YES, NO, initialize, nostdout, download_shelve_from_s3, upload_shelve_to_... | statmuse/bagelbot | check_attendance.py | Python | mit | 6,699 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import re
import sys
import argparse
import warnings
import collections
from flask import current_app
from werkzeug.utils import cached_property
from . import mimetype
from . import compat
from .compat import deprecated, usedoc
def defaultsnamedtuple(name, fields, defa... | ergoithz/browsepy | browsepy/manager.py | Python | mit | 24,389 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import cloudinary.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... | andela/codango | codango/resources/migrations/0001_initial.py | Python | mit | 1,494 |
# Copyright (c) 2020-1 Matt Colligan
#
# 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, merge, publish, dis... | qtile/qtile | test/test_popup.py | Python | mit | 1,850 |
import requests
import lxml.html as lh
import json
url = 'http://pokemondb.net/pokedex/all'
page = requests.get(url)
doc = lh.fromstring(page.content)
#Store data from the table into a list
elements = doc.xpath('//tr')
col = []
i=0
# Store headers as tuples with each header being associated with a list
for e in ele... | kanishkamisra/pokedex | scraper.py | Python | mit | 1,483 |
from dict_validator import Field
class Choice(Field):
"""
Accept any type of input as long as it matches on of the choices
mentioned in the provided list.
:param choices: list of choices to match against
>>> from dict_validator import validate, describe
>>> class Schema:
... field =... | gurunars/dict-validator | dict_validator/fields/choice_field.py | Python | mit | 1,274 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py | Python | mit | 21,016 |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Jun 5 2014)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
##########################################################################... | Tary/Python-Tool | imageDL/MyFrame.py | Python | mit | 982 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | romanz/electrum | lib/storage.py | Python | mit | 22,431 |
# encoding: UTF-8
from __future__ import print_function
import hashlib
import hmac
import json
import ssl
import traceback
import base64
from queue import Queue, Empty
from multiprocessing.dummy import Pool
from time import time
from urlparse import urlparse
from copy import copy
from urllib import urlencode
from thr... | rrrrrr8/vnpy | vnpy/api/fcoin/vnfcoin.py | Python | mit | 8,705 |
#!/usr/bin/env python
from __future__ import print_function
import logging
import time
import bitmath
import bitmath.integrations
import argparse
import requests
import progressbar
import os
import tempfile
import atexit
import random
# Files of various sizes to use in the demo.
#
# Moar here: https://www.kernel.org/p... | pombredanne/bitmath | full_demo.py | Python | mit | 6,552 |
"""
Configuration for a project.
"""
rails = {
'models.engine': 'sqlalchemy',
'models.db.type': 'postgres',
'models.db.user': 'rails',
'models.db.password': 'rails',
'views.engine': 'jinja',
}
| PythonRails/examples | blog/config.py | Python | mit | 218 |
"""umongo fields"""
import collections
import datetime as dt
from bson import DBRef, ObjectId, Decimal128
import marshmallow as ma
# from .registerer import retrieve_document
from .document import DocumentImplementation
from .exceptions import NotRegisteredDocumentError, DocumentDefinitionError
from .template import ... | Scille/umongo | umongo/fields.py | Python | mit | 19,389 |
from .location import Location, Direction
from .move import Move
__all__ = ['converter', 'Location', 'Move', 'notation_const']
| LordDarkula/chess_py | chess_py/core/algebraic/__init__.py | Python | mit | 128 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture.py | Python | mit | 2,633 |
import pyfits as pyf
import pylab as pyl
full = pyf.getdata('./data/gs_all_tf_h_130511b_multi.fits')
sample = pyf.getdata('../samples/sample_1.5_3.5_gs_all.fits')
f = pyl.figure(1)
f1 = f.add_subplot(111)
for i in range(len(sample)):
ID = sample['ID'][i]
H_flux = full['WFC3_F160W_FLUX'][i-1]
H_flux_err =... | boada/ICD | sandbox/legacy_plot_code/ston_test.py | Python | mit | 488 |
# -*- coding: utf-8 -*-
#
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
#
# Copyright 2006,2007 Frank Scholz <coherence@beebits.net>
# Copyright 2014 Hartmut Goebel <h.goebel@crazy-compilers.com>
#
"""
little helper to get the proper ElementTree package
"""
import re
import exceptio... | coherence-project/Coherence | coherence/extern/et.py | Python | mit | 4,662 |
#! /usr/bin/python
import sys
import time
from PyQt4 import QtCore
from PyQt4 import QtGui
class WorkThread(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def __del__(self):
self.wait()
def run(self):
for i in range (6):
print ".",
tim... | CospanDesign/python | pyqt/threading/example1.py | Python | mit | 1,752 |
class LogicGate:
def __init__(self,n):
self.label = n
self.output = None
def getLabel(self):
return self.label
def getOutput(self):
self.output = self.performGateLogic()
return self.output
| robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_1_10.py | Python | mit | 244 |
import logging
def handle(term, context, cap_turple):
cap_name, increase_params = cap_turple
if hasattr(term, cap_name):
if increase_params:
for idx in range(len(context.params)):
context.params[idx] -= 1 if context.params[idx] != 0 else 0
getattr(ter... | stonewell/pymterm | pymterm/cap/unknown_cap.py | Python | mit | 443 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Optional
from hwt.serializer.mode import serializeParamsUniq
from hwt.synthesizer.interface import Interface
from hwt.synthesizer.param import Param
from hwtLib.abstract.busBridge import BusBridge
from hwtLib.amba.axi4 import Axi4, Axi4_addr
from hwtLi... | Nic30/hwtLib | hwtLib/amba/axiLite_comp/to_axi.py | Python | mit | 2,749 |
from dockyard.utils.mongo import Mongo
class Task(Mongo):
"""
channel
msg
receivers
expire
"""
| galileo-project/Galileo-dockyard | server/dockyard/driver/task/_model/__init__.py | Python | mit | 137 |
# -*- coding: utf-8 -*-
import os
import shutil
import xml.etree.ElementTree as ET
import zipfile
from PIL import Image
from StringIO import StringIO
from ql_exporter import tab_template
# from hurry.filesize import size
import requests
from tempfile import TemporaryFile
# TODO убрать это
dir = os.path.dirname(__file... | bazzile/helper | temp_DEIMOS.py | Python | mit | 4,584 |
"""This utility aims to provide an easy way to encode text inside of images."""
# TODO Write test cases.
# TODO Write own version of cImage.
# TODO Add interface.
# TODO Add offset.
# TODO Add random seed.
from cImage import FileImage
from cImage import EmptyImage
class Encode:
"""Class"""
def __init__(self... | matttilton/pySteg | pySteg.py | Python | mit | 3,694 |
import telnetlib
from time import sleep
import re
import os
HOST_IPs = [
"172.16.1.253", "172.16.1.254"
]
telnet_password = b"pass_here"
enable_password = b"pass_here"
show_commands_list = [
b"show run",
b"show ip arp",
b"show vlan",
b"show cdp neighbors",
b"show ip interface brief"
b"sh... | JamesKBowler/networking_scripts | cisco/cisco_telnet_recon.py | Python | mit | 1,465 |
# -*- 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 'Funday'
db.create_table('core_funday', (
('id', self.gf('django.db.models.fields... | wraithan/funday | anyday/core/migrations/0001_initial.py | Python | mit | 1,661 |
# -*- coding: utf-8 -*-
'''
This module is a central location for all salt exceptions
'''
from __future__ import absolute_import
# Import python libs
import copy
import logging
import time
# Import Salt libs
from .six import six
log = logging.getLogger(__name__)
'''
Classification of Salt exit code... | Inveracity/jinjabread | jinjabread/functions/salt/saltexceptions.py | Python | mit | 12,746 |
# UserAgent
# Lets me check if a user is using the site on mobile or on desktop.
# Also lets you check kind of precisely what device the user is
# Viewing the site on
def checkMobile(request):
"Lets you check to see if the user is on a mobile device."
agent = request.headers["User-Agent"]
deviceInfo = agen... | Mikumiku747/Student-Planner-Online-GAE | source/useragent.py | Python | mit | 1,406 |
# -*- coding: utf-8 -*-
# Geocluster - A simple and naive geo cluster
# (c) Régis FLORET 2014 and later
#
def convert_lat_from_gps(value):
"""
Convert a lattitude from GPS coordinate to decimal degrees
:param value: The lattitude as a float between 0 and -90
:return: The lattitude in decimal degrees
... | regisf/geocluster | geocluster/geoconvertion.py | Python | mit | 1,701 |
import logging
import sys
import os
FORMAT = "%(asctime)s %(levelname)s: %(message)s" # type: str
stdout_hdlr = logging.StreamHandler(sys.stdout) # type: logging.StreamHandler
stdout_hdlr.setFormatter(logging.Formatter(FORMAT))
stdout_hdlr.setLevel(
logging.ERROR if os.environ.get("NW_LOG") == "ERR" else logging... | metamarcdw/nowallet | nowallet/nowallet.py | Python | mit | 46,341 |
import subprocess
import sys
import tempfile
from textwrap import dedent
from bpython import args
from bpython.test import FixLanguageTestCase as TestCase
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from nose.plugins.attrib import attr
except ImportError:
def attr(func,... | aktorion/bpython | bpython/test/test_args.py | Python | mit | 1,098 |
from ledstripcontroller import LedStripController
from encoder import Encoder
def main():
enc = Encoder(pin_clk=13, pin_dt=12, pin_mode=Pin.PULL_UP,
min_val=40, max_val=1020, clicks=1, accel=5)
enc._value = 1020
controller = LedStripController(enc)
controller.run()
if __name__ == ... | HowManyOliversAreThere/led_strip | main.py | Python | mit | 343 |
#!/usr/bin/python
# Jake Kosberg
#
# Utilities
import os
import sys
import pygame
def cell_hovered(cell, mouse_pos):
mx, my = mouse_pos
if ((mx > cell.xpos and mx < cell.xpos + cell.width) and
(my > cell.ypos and my < cell.ypos + cell.height)):
return True
else:
return False
... | node-/tetra-master | src/utils.py | Python | mit | 1,092 |
"""Automatic differentation fallback for constructing derivative functions."""
import mici.autograd_wrapper as autograd_wrapper
"""List of names of valid differential operators.
Any automatic differentiation framework wrapper module will need to provide
all of these operators as callables (with a single function as... | matt-graham/hmc | mici/autodiff.py | Python | mit | 2,376 |
#!/usr/bin/python
# -*- coding: utf8 -*-
""" Application to create server for compta """
#import re
import locale
#import sys
#import os
#import ConfigParser
#from json import dumps, loads
#from datetime import datetime
#from decimal import Decimal
#from bottle.ext import sqlalchemy
#from sqlalchemy import create_en... | micmc/compta | lib/compta/server/server.py | Python | mit | 2,583 |
import os
from django.conf.urls import url
from . import views
from .earthquakes import viewsEarthquakes
from .weather import viewsWeather
from .gtfs import viewsGTFS
from django.http import HttpResponseRedirect
from .utils.utils import *
from django.db import connection
import simplekml
import time
import subprocess
... | navijo/FlOYBD | Django/mysite/floybd/urls.py | Python | mit | 10,036 |
from .exceptions import MalformedRequestException
class Request(object):
def __init__(self, version, metadata, arguments):
self._version = version
self._metadata = metadata
self._arguments = arguments
@property
def version(self):
return self._version
@property
def... | cbigler/jackrabbit | jackrabbit/request.py | Python | mit | 977 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/aio/operations/_express_route_links_operations.py | Python | mit | 8,718 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#dependence: paho-mqtt (pip install paho-mqtt)
# XBee (pip install XBee)
# PyYAML (pip install PyYaml)
# pyserial (pip install pyserial)
import os
import sys
import time
import logging
import yaml
from serial import Serial
from factory import *... | KillingJacky/CloudPan | pan2mqtt.py | Python | mit | 12,826 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/operations/_peer_express_route_circuit_connections_operations.py | Python | mit | 9,496 |
from django.conf.urls import url, include
try:
code_count = settings.HACKREF_CHARACTER_COUNT
except:
code_count = 8
from .views import CodeTrackingView
urlpatterns = [
url(r'^(?P<code>[\w0-9]{0,' + str(code_count) + '})/$',
CodeTrackingView.as_view(),
name="ref-code-redirect... | jmitchel3/django-hackref | hackref/urls.py | Python | mit | 326 |
import urllib2
# Made an api class in case more integration is needed in the future.
# This will be far more useful as the bot is built out.
class Api:
def post(self,data,url,headers={'Content-type': 'application/json'}):
request = urllib2.Request(url,data,headers)
try:
response = ur... | jwilson64/Facebook-Bot | sender.py | Python | mit | 501 |
#!/usr/bin/env python
from scipy import sparse
from sklearn.datasets import dump_svmlight_file
from sklearn.preprocessing import LabelEncoder
import argparse
import logging
import numpy as np
import os
import pandas as pd
from kaggler.util import encode_categorical_features, normalize_numerical_feature
logging.bas... | drivendata/countable-care-3rd-place | src/generate_feature9.py | Python | mit | 2,602 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.moves.urllib.parse import quote
import logging
from jinja2 import TemplateSyntaxError
from flexget import plugin
from flexget.event import event
from flexget.... | drwyrm/Flexget | flexget/plugins/sites/rss.py | Python | mit | 1,942 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/mgmt_avail_set/lib/models/__init__.py | Python | mit | 1,439 |
# coding: utf8
"""
Jogador básico
O seu Jogador deve ser implementado como uma subclasse de Jogador,
porem com o seu nome (p.ex. JoseSilva) como nome a classe. A subclasse deve
reimplementar os métodos escolha_de_cacada, resultado_da_cacada e
"""
import random
from estrategias.jogadores import Jogador
class Meu... | fccoelho/jogos_vorazes | estrategias/AntonioPulcherio.py | Python | mit | 1,175 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.strreplace
~~~~~~~~~~~~~~~~~~~~~~~
Provides functions for string search-and-replace.
You provide the module with the text string to search for, and what to replace
it with. Multiple search-and-replace pairs can be added. You can specify to
replace all... | nerevu/riko | riko/modules/strreplace.py | Python | mit | 6,865 |
# Copyright (c) 2018 The Bitcoin Unlimited developers
# Copyright (c) 2020 The Ion Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.ionlib import init, bin2hex, signTxInput, randombytes, pubkey, ... | ionomy/ion | test/functional/test_framework/__init__.py | Python | mit | 465 |
'''
This component package and its subpackages contain wrapper and glue code for database operations.
''' | exratione/thywill-python | thywill_server/src/thywill_server/database/__init__.py | Python | mit | 105 |
# coding=utf-8
from django.apps import AppConfig
from watson import search as watson
class CatalogConfig(AppConfig):
name = 'catalog'
verbose_name = 'Catálogo'
def ready(self):
Product = self.get_model('Product')
watson.register(Product)
| gileno/djangoecommerce | catalog/apps.py | Python | cc0-1.0 | 272 |
import os
from time import localtime, strftime
import re
import sys
from fabric.api import local, lcd, settings, task
from fabric.utils import puts
from blog_config import INPUT_PATH, OUTPUT_PATH
SETTINGS_FILE = 'blog_config'
# Load paths
ABS_DIR_PATH = os.path.dirname(os.path.abspath(__file__))
ABS_SETTINGS_FILE = ... | Gastove/blogric | new_post.py | Python | epl-1.0 | 3,746 |
from django.apps import apps as django_apps
from django.db import models
from .event import Event
class UpdatesOrCreatesCalenderEventModelError(Exception):
pass
class UpdatesOrCreatesCalenderEventModelMixin(models.Model):
"""A model mixin that creates or updates a calendar event
on post_save signal.
... | botswana-harvard/edc-calendar | edc_calendar/models/update_or_create_event_model_mixin.py | Python | gpl-2.0 | 2,108 |
#encoding=utf-8
from app.proto.common.data_parse import hex_to_dec, dec_to_hex
from app.proto.common.hachi.core import XBee
from app.proto.frames.RFIDFrames import rfid_frame
class RFIDController:
def __init__(self, escaped=True):
# self.xbee = XBee()
pass
def parse_pkgs(self, byte... | kooksee/TIOT | test/project/src/app/proto/controller/RFIDController.py | Python | gpl-2.0 | 4,692 |
#!/usr/local/bin/python
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2016, Intel Corporation
#
#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; Version 2.
#
#This pr... | raisfathin/chipsec | source/tool/chipsec/hal/spi_uefi.py | Python | gpl-2.0 | 26,618 |
from django.conf.urls import patterns, include, url
from apps.pages import views
# See: https://docs.djangoproject.com/en/dev/topics/http/urls/
urlpatterns = patterns('',
url(r'^$', views.home, name='home'),
)
| 10printhello/Blank-Heroku-Django-App | backoffice/backoffice/apps/pages/urls.py | Python | gpl-2.0 | 217 |
# $Id: Gatherer.py,v 1.2 2003/10/16 17:25:26 adamf Exp $ $
import types
class Gatherer:
def __init__(self, classesToCollectInfoAbout, classesToIgnore):
self.classesToCollectInfoAbout = classesToCollectInfoAbout
self.classesToIgnore = classesToIgnore
def __repr__(self):
raise "This method sho... | msabramo/PyUMLGraph | src/Gatherer.py | Python | gpl-2.0 | 1,616 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
CreateConstantRaster.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... | mvcsantos/QGIS | python/plugins/processing/algs/qgis/CreateConstantRaster.py | Python | gpl-2.0 | 2,710 |
from dbconnect import DBConnect
import tilecollection
from imagetile import ImageTile
from imagetilesizer import ImageTileSizer
from imagecontrolpanel import ImageControlPanel
from properties import Properties
import imagetools
import cPickle
import wx
p = Properties.getInstance()
db = DBConnect.getInstance()
# The... | afraser/CellProfiler-Analyst | cpa/sortbin.py | Python | gpl-2.0 | 12,471 |
rate = 100
first_generator = 1.0 * rate
second_generator = 1.5 * rate
third_generator = 2.0 * rate
print first_generator, second_generator, third_generator
# keys for connection type
GABA = 0
Glu = 1
ACh = 2
DA_ex = 3
DA_in = 4
# Quality of graphics
dpi_n = 120
k_IDs = 'IDs'
k_name = 'Name'
k_NN = 'NN'
k_model = ... | vitaliykomarov/NEUCOGAR | nest/appraisal/property.py | Python | gpl-2.0 | 936 |
from pygeo import *
explanation ="""Bezier curves are an interesting way to
visually explore issues related to permutations,
since unique curves are created by the same
control points provided in varying sequence to
the curve creation code"""
v=display(title="Bezier Permutations",scale=40,width=600,
axis=Fa... | eeue56/PyGeo2 | pygeo/examples/real/beziercurves.py | Python | gpl-2.0 | 2,623 |
#!/usr/bin/env python
#
#
#
# Copyright (c) 2008 University of Dundee.
#
# 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, either version 3 of the
# License, or (at your option) any la... | joshmoore/openmicroscopy | components/tools/OmeroWeb/omeroweb/webadmin/controller/uploadfile.py | Python | gpl-2.0 | 1,449 |
#!/usr/bin/env python
from db_test import DBDakTestCase
from daklib.dbconn import MetadataKey, BinaryMetadata, SourceMetadata
import unittest
class MetadataTestCase(DBDakTestCase):
"""
This TestCase checks the metadata handling.
"""
def setup_metadata(self):
'''
Setup the metadata o... | purism/pdak | tests/dbtest_metadata.py | Python | gpl-2.0 | 3,720 |
"""
Add material to support overhang or remove material at the overhang angle.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utili... | Pointedstick/ReplicatorG | skein_engines/skeinforge-44/fabmetheus_utilities/geometry/manipulation_paths/bevel.py | Python | gpl-2.0 | 2,387 |
#
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in the hope ... | ioggstream/mysql-utilities | mysql/fabric/services/resharding.py | Python | gpl-2.0 | 35,111 |
'''
Created on 7/01/2014
@author: Jorge Salcedo
'''
import settings
from importlib import import_module
from webengine import route, WSGIWebEngine
import logging
@route('/_ah/warmup')
def warmup(handler):
for app in settings.APPS:
for name in ('views', 'models', 'apis', 'admin_views'):
try:
... | jsalcedo09/webengine | webengine/views.py | Python | gpl-2.0 | 1,293 |
#!/usr/bin/env python
"""QX100 interfacing code for python"""
import json
import requests
import numpy as np
import cv2
import threading
from cmd import Cmd
class LiveviewThread(threading.Thread):
running = True
def __init(self, url):
threading.Thread.__init__(self)
self.url = url
self.running = True
... | UCSD-E4E/qx100-interfacing | qx100.py | Python | gpl-2.0 | 3,536 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | NeilBryant/check_mk | web/htdocs/bi.py | Python | gpl-2.0 | 77,412 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ParameterVector.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************... | bstroebl/QGIS | python/plugins/sextante/parameters/ParameterVector.py | Python | gpl-2.0 | 4,042 |
#! /usr/bin/env python
from zope.interface import implements
from twisted.trial.itrial import IReporter
from twisted.plugin import IPlugin
# register a plugin that can create our CoverageReporter. The reporter itself
# lives separately, in trialcoverage/trialcoverage.py.
# note that this trialcoveragereporterplugin.... | simplegeo/trialcoverage | twisted/plugins/trialcoveragereporterplugin.py | Python | gpl-2.0 | 1,724 |
#!/usr/bin/python3
# Copyright (C) 2015-2016 Pierre Blanc
#
# This file is part of WhiteRenamer.
#
# WhiteRenamer 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... | pierrecnalb/White-Renamer | whiterenamer/model/__init__.py | Python | gpl-2.0 | 846 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
IMPORT
Permite adaptar un exportado traducido a uno válido para hoa
Autor: PABLO PIZARRO @ github.com/ppizarror
Fecha: 2014-2015
Licencia: GPLv2
"""
__author__ = "ppizarror"
# Importación de librerías
import os
import sys
reload(sys)
# noinspection P... | ppizarror/korektor | bin/langeditor/_import.py | Python | gpl-2.0 | 1,200 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2019 Philipp Wolfer
#
# 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 Licen... | Sophist-UK/Sophist_picard | scripts/pyinstaller/macos-library-path-hook.py | Python | gpl-2.0 | 1,066 |
# -*- coding: utf-8 -*-
#
# The Linux Kernel documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 12 13:51:46 2016.
#
# 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 fi... | walac/linux | Documentation/conf.py | Python | gpl-2.0 | 20,998 |
#coding=utf-8
import argparse
import json
import os
from smartqq import start_qq, list_messages, create_db
def load_pluginconfig(configjson):
config = None
if configjson is not None:
if os.path.isfile(configjson):
with open(configjson, "r") as f:
config = json.load(f)
... | zhongjingjogy/SmartQQBot | smartqq/main.py | Python | gpl-2.0 | 2,757 |
from telebot.storage.memory_storage import StateMemoryStorage
from telebot.storage.redis_storage import StateRedisStorage
from telebot.storage.pickle_storage import StatePickleStorage
from telebot.storage.base_storage import StateContext,StateStorageBase
__all__ = [
'StateStorageBase', 'StateContext',
'Sta... | eternnoir/pyTelegramBotAPI | telebot/storage/__init__.py | Python | gpl-2.0 | 381 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010-2012 Infracom & Eurotechnia (support@webcampak.com)
# This file is part of the Webcampak project.
# Webcampak 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 Fo... | Webcampak/v1.0 | src/bin/wpakRtsp.py | Python | gpl-2.0 | 2,214 |
#!/usr/bin/python
import numpy as np
import cv2
import math
import sys
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.structure import SoftmaxLayer
def removeWhiteBackground(img):
img = cv2.cvtCol... | HackerSpaceMaringa/iJair | iJair.py | Python | gpl-2.0 | 3,580 |
# -*- coding: utf-8 -*-
import logging
import os
logger = logging.getLogger(__name__)
class KerberosCacheMiddleware(object):
"""Reloads the KRB5CCNAME environmental variable from the session for potential use in future
LDAP requests.
For a login request, the KRB5CCNAME environmental variable has
al... | jacobajit/ion | intranet/middleware/environment.py | Python | gpl-2.0 | 1,848 |