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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# face_recognition documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in t... | ageitgey/face_recognition | docs/conf.py | Python | mit | 8,789 |
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) will be positive integers.
Elements in a combination (a1, a2, … , ak) mus... | UmassJin/Leetcode | Array/combination_sum1.py | Python | mit | 1,940 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('artist', '0002_auto_20150322_1630'),
]
operations = [
migrations.CreateModel(
name='Event',
fields=[... | fotcorn/liveinconcert | event/migrations/0001_initial.py | Python | mit | 777 |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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.
#
# ... | thesgc/cbh_core_model | docs/conf.py | Python | mit | 8,194 |
import numpy as np
import keras as ks
import matplotlib.pyplot as plt
from keras.datasets import boston_housing
from keras import models
from keras import layers
from keras.utils.np_utils import to_categorical
(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()
mean = train_data.mean(... | FiveEye/ml-notebook | dlp/ch3_3_boston_housing.py | Python | mit | 1,900 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanutils
~~~~~~~~~
Provides methods for interacting with a CKAN instance
Examples:
literal blocks::
python example_google.py
Attributes:
CKAN_KEYS (List[str]): available CKAN keyword arguments.
"""
from __future__ import (
absolute_import... | reubano/ckanutils | ckanutils.py | Python | mit | 29,704 |
#!/usr/bin/env python
# coding: utf-8
from .interactiveapp import InteractiveApplication, ENCODING
class InteractiveLoopApplication(InteractiveApplication):
def __init__(self, name, desc, version,
padding, margin, suffix, encoding=ENCODING):
super(InteractiveLoopApplication, self).__in... | alice1017/coadlib | coadlib/loopapp.py | Python | mit | 871 |
import re
import datetime
import time
#niru's git commit
while True:
#open the file for reading
file = open("test.txt")
content = file.read()
#Get timestamp
ts = time.time()
ist = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
#open file for read and close it nea... | cloud-engineering/Torpid | main.py | Python | mit | 777 |
'''
This module corresponds to ARDroneLib/Soft/Common/navdata_common.h
'''
import ctypes
import functools
from pyardrone.utils.structure import Structure
uint8_t = ctypes.c_uint8
uint16_t = ctypes.c_uint16
uint32_t = ctypes.c_uint32
int16_t = ctypes.c_int16
int32_t = ctypes.c_int32
bool_t = ctypes.c_uint32 # ARDro... | afg984/pyardrone | pyardrone/navdata/options.py | Python | mit | 14,941 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import numpy as np
import scipy
from sklearn import preprocessing
from sklearn.feature_extraction import DictVectorizer
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from collections import Counter
fro... | ptoman/icgauge | icgauge/experiment_frameworks.py | Python | mit | 11,989 |
import sys, os, fabric
class PiServicePolicies:
@staticmethod
def is_local():
return (not fabric.api.env.hosts or fabric.api.env.hosts[0] in ['localhost', '127.0.0.1', '::1'])
@staticmethod
def is_pi():
return os.path.isdir('/home/pi')
@staticmethod
def check_local_or_exit():
if not PiService... | creative-workflow/pi-setup | lib/piservices/policies.py | Python | mit | 867 |
import cv2, numpy as np
from dolphintracker.singlecam_tracker.camera_filter.FindDolphin import SearchBlobs
from dolphintracker.singlecam_tracker.camera_filter.BackGroundDetector import BackGroundDetector
import datetime
class PoolCamera(object):
def __init__(self, videofile, name, scene, maskObjectsNames, filters, f... | UmSenhorQualquer/d-track | dolphintracker/singlecam_tracker/pool_camera.py | Python | mit | 3,437 |
#!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['prev... | nrser/qb | dev/scratch/docker/image/qb_docker_image.scratch.py | Python | mit | 26,930 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('farms', '0024_rain_and_irrigation_allow_null'),
]
operations = [
m... | warnes/irrigatorpro | irrigator_pro/farms/migrations/0025_default_rain_irrigation_to_null.py | Python | mit | 2,383 |
#!/usr/bin/python
import math
def trapezint(f, a, b, n) :
"""
Just for testing - uses trapazoidal approximation from on f from a to b with
n trapazoids
"""
output = 0.0
for i in range(int(n)):
f_output_lower = f( a + i * (b - a) / n )
f_output_upper = f( a + (i + 1) * (b - a) / ... | chapman-phys227-2016s/hw-1-seama107 | adaptive_trapezint.py | Python | mit | 1,279 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 16:25:41 2016
@author: pavel
"""
from gi.repository import Gtk
import parameter_types as ptypes
from logger import Logger
logger = Logger.get_logger()
#
import gobject
gobject.threads_init()
#decorator is used to update gtk objects from ano... | i026e/python_ecg_graph | gtk_wrapper.py | Python | mit | 5,750 |
lookup = {}
lookup = dict()
lookup = {'age': 42, 'loc': 'Italy'}
lookup = dict(age=42, loc='Italy')
print(lookup)
print(lookup['loc'])
lookup['cat'] = 'cat'
if 'cat' in lookup:
print(lookup['cat'])
class Wizard:
# This actually creates a key value dictionary
def __init__(self, name, level... | derrickyoo/python-jumpstart | apps/09_real_estate_data_miner/concept_dicts.py | Python | mit | 933 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('course_selection', '0018_auto_20150830_0319'),
]
operations = [
migrations.AlterUniqueTogether(
name='friend_rel... | maximz/recal | course_selection/migrations/0019_auto_20150903_0458.py | Python | mit | 809 |
from django.conf.urls import url
from .views import (
semseterResultxlsx,
)
urlpatterns=[
url(r'^semester-xlsx/(?P<collegeCode>\d+)/(?P<branchCode>\d+)/(?P<yearOfJoining>\d+)/(?P<semester>\d+)/$',semseterResultxlsx,name='semseterResultxlsx')
]
| rpsingh21/resultanalysis | resultAnalysis/xlsx/urls.py | Python | mit | 249 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# run as:
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py
# or
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py -A gis
#
#
# Built with code/inspiration from MapFish, OpenLayers & Michael C... | smeissner/eden | static/scripts/tools/build.sahana.py | Python | mit | 14,872 |
"""
Consider this game: Write 8 blanks on a sheet of paper. Randomly pick a digit 0-9. After seeing the digit, choose one
of the 8 blanks to place that digit in. Randomly choose another digit (with replacement) and then choose one of the 7
remaining blanks to place it in. Repeat until you've filled all 8 blanks. You wi... | DayGitH/Python-Challenges | DailyProgrammer/20120430B.py | Python | mit | 1,804 |
definition = {
"where": "?subj a foaf:Organization .",
"fields": {
"name": {
"where": "?subj rdfs:label ?obj ."
}
}
} | gwu-libraries/vivo2notld | vivo2notld/definitions/organization_summary.py | Python | mit | 157 |
#!/usr/bin/python
import sys
import re
re_valid_email = re.compile(r'^[-_0-9a-zA-Z]+@[0-9a-zA-Z]+\.[0-9a-zA-Z]{1,3}$')
def valid_email(s):
return not (re_valid_email.search(s) == None)
N = int(raw_input().strip())
A = []
for i in range(N):
A += [ str(raw_input().strip()) ]
A.sort()
V = filter(valid_email, ... | nabin-info/hackerrank.com | validate-list-of-email-address-with-filter.py | Python | mit | 747 |
import argparse
from nltk.corpus import brown
import requests
import arrow
import json
parser = argparse.ArgumentParser()
parser.add_argument('host')
args = parser.parse_args()
def create_new_novel():
url = 'http://{host}/api/novel'.format(host=args.host)
response = requests.post(url, json={'title': 'Test No... | thebritican/anovelmous | anovelmous/tests/post_example_novel.py | Python | mit | 1,193 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms import models
from djanban.apps.hourly_rates.models import HourlyRate
from django import forms
# Hourly rate creation and edition form
class HourlyRateForm(models.ModelForm):
clas... | diegojromerolopez/djanban | src/djanban/apps/hourly_rates/forms.py | Python | mit | 1,137 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The daemon that calls auto_copy.py uppon optical disc insertion
"""
import signal
import sys
import time
sys.path.append('/usr/local/bin')
import auto_copy
SIGNAL_RECEIVED = False
def run_daemon(config):
"""
Run the damon
config: configParser object
... | shoubamzlibap/small_projects | auto_copy/auto_copy_daemon.py | Python | mit | 798 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import json
import os
import unittest
from monty.json import MontyDecoder
from pymatgen.apps.battery.conversion_battery import ConversionElectrode
from pymatgen.apps.battery.insertion_battery import InsertionElectrode
from ... | materialsproject/pymatgen | pymatgen/apps/battery/tests/test_plotter.py | Python | mit | 2,269 |
from abc import ABCMeta, abstractmethod
class AbstractAuthenticator(metaclass=ABCMeta):
def __init__(self):
"""
Every authenticator has to have a name
:param name:
"""
super().__init__()
@abstractmethod
def authorise_transaction(self, customer):
"""
... | lmzintgraf/MultiMAuS | authenticators/abstract_authenticator.py | Python | mit | 596 |
from django.conf.urls import url, include
urlpatterns = [
url(r'^postcode-lookup/', include('django_postcode_lookup.urls')),
]
| LabD/django-postcode-lookup | sandbox/urls.py | Python | mit | 132 |
import sys
[_, ms, _, ns] = list(sys.stdin)
ms = set(int(m) for m in ms.split(' '))
ns = set(int(n) for n in ns.split(' '))
print(sep='\n', *sorted(ms.difference(ns).union(ns.difference(ms))))
| alexander-matsievsky/HackerRank | All_Domains/Python/Sets/symmetric-difference.py | Python | mit | 194 |
import os
import numpy as np
class Dataset(object):
"""
This class represents a dataset and consists of a list of SongData along with some metadata about the dataset
"""
def __init__(self, songs_data=None):
if songs_data is None:
self.songs_data = []
else:
self... | Guitar-Machine-Learning-Group/guitar-transcriber | dataset.py | Python | mit | 2,586 |
import gevent
import time
def doit(i):
print "do it:%s" % (i)
gevent.sleep(2)
print "done:%s" %(i)
t2 = time.time()
threads = {}
for i in range(5):
t = gevent.spawn(doit, i)
threads[i] = t
#print dir(t)
gevent.sleep(1)
print threads
print threads[3].dead
threads[3]... | mabotech/maboss.py | maboss/motorx/scheduler/test01.py | Python | mit | 577 |
import sys
import os
import time
import numpy
import cv2
import cv2.cv as cv
from PIL import Image
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
from picture.util import define
from picture.util.system import POINT
from picture.util.log import LOG as L
THRESHOLD =... | setsulla/owanimo | lib/picture/bin/patternmatch.py | Python | mit | 1,439 |
def output_gpx(points, output_filename):
"""
Output a GPX file with latitude and longitude from the points DataFrame.
"""
from xml.dom.minidom import getDOMImplementation
def append_trkpt(pt, trkseg, doc):
trkpt = doc.createElement('trkpt')
trkpt.setAttribute('lat', '%.8f' % (pt['lat... | MockyJoke/numbers | ex3/code/calc_distance_hint.py | Python | mit | 1,089 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import urllib
import time
import datetime
#From PatMap by Jason Young, available on GitHub at github.com/JasYoung314/PatMap
#Function to get distance between 2 points from google maps. By default route is by car, distance is given in miles and time in minutes... | MatthewGWilliams/Staff-Transport | emergencyTransport/RouteFinder/GoogleDistances.py | Python | mit | 1,984 |
from datetime import date
NTESTS = 1
PREV_DAYS = 10
PERCENT_UP = 0.01
PERCENT_DOWN = 0.01
PERIOD = 'Hourly' # [5-min, 15-min, 30-min, Hourly, 2-hour, 6-hour, 12-hour, Daily, Weekly]
MARKET = 'bitstampUSD'
# DATE START
YEAR_START = 2011
MONTH_START = 9
DAY_START = 13
DATE_START = date(YEAR_START, MONTH_START, DAY_STAR... | bukosabino/btctrading | settings.py | Python | mit | 422 |
from rest_framework import test, status
from waldur_core.structure.models import CustomerRole, ProjectRole
from waldur_core.structure.tests import factories as structure_factories
from . import factories
class ServiceProjectLinkPermissionTest(test.APITransactionTestCase):
def setUp(self):
self.users = {... | opennode/nodeconductor-openstack | src/waldur_openstack/openstack/tests/test_service_project_link.py | Python | mit | 3,839 |
#!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# 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... | wolsen/secret-santa | secretsanta/mail.py | Python | mit | 4,308 |
# coding=utf-8
"""
Collect the elasticsearch stats for the local node
#### Dependencies
* urlib2
"""
import urllib2
import re
try:
import json
json # workaround for pyflakes issue #13
except ImportError:
import simplejson as json
import diamond.collector
RE_LOGSTASH_INDEX = re.compile('^(.*)-\d\d\... | metamx/Diamond | src/collectors/elasticsearch/elasticsearch.py | Python | mit | 11,323 |
# Inspired from VecEnv from OpenAI Baselines
class VecEnv(object):
"""
An abstract asynchronous, vectorized environment.
"""
def __init__(self, num_envs, observation_space, action_space):
self.num_envs = num_envs
self.observation_space = observation_space
self.action_space = act... | matthiasplappert/keras-rl | rl/common/vec_env/__init__.py | Python | mit | 2,310 |
EGA2RGB = [
(0x00, 0x00, 0x00),
(0x00, 0x00, 0xAA),
(0x00, 0xAA, 0x00),
(0x00, 0xAA, 0xAA),
(0xAA, 0x00, 0x00),
(0xAA, 0x00, 0xAA),
(0xAA, 0x55, 0x00),
(0xAA, 0xAA, 0xAA),
(0x55, 0x55, 0x55),
(0x55, 0x55, 0xFF),
(0x55, 0xFF, 0x55),
(0x55, 0xFF, 0xFF),
(0xFF, 0x55, 0x5... | jtauber/ultima4 | shapes.py | Python | mit | 800 |
from django.apps import AppConfig
class BallerShotCallerConfig(AppConfig):
name = 'baller_shot_caller'
| kizzen/Baller-Shot-Caller | web_site/baller_shot_caller/apps.py | Python | mit | 109 |
import json
from util import d
import os
__home = os.path.expanduser("~").replace('\\', '/') + "/PixelWeb/"
BASE_SERVER_CONFIG = d({
"id":"server_config",
"display": "server_config",
"preconfig": False,
"presets":[],
"params": [{
"id": "exter... | ManiacalLabs/PixelWeb | pixelweb/config.py | Python | mit | 3,791 |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 29 21:25:13 2014
@author: 27182_000
"""
# A palindromic number reads the same both ways. The largest palindrome made
# from the product of two 2-digit numbers is 9009 = 91 × 99.
# Find the largest palindrome made from the product of two 3-digit numbers.
import sys
ans... | ecotner/Learning-to-fly | Project Euler Python/Problem 04/problem4.py | Python | mit | 485 |
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return HttpResponse('Page content')
def custom(request):
return render(request, 'custom.html', {})
| geelweb/geelweb-django-contactform | tests/views.py | Python | mit | 202 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('content', '0009_auto_20150829_1417'),
]
operations = [
migrations.Crea... | sfowl/fowllanguage | content/migrations/0010_auto_20151019_1410.py | Python | mit | 1,608 |
'''
Manage Ruby gem packages. (see https://rubygems.org/ )
'''
from pyinfra.api import operation
from pyinfra.facts.gem import GemPackages
from .util.packaging import ensure_packages
@operation
def packages(packages=None, present=True, latest=False, state=None, host=None):
'''
Add/remove/update gem packages... | Fizzadar/pyinfra | pyinfra/operations/gem.py | Python | mit | 1,033 |
# -*- coding: utf-8 -*-
#
# partpy documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 16 18:56:06 2013.
#
# 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 ... | Nekroze/partpy | docs/conf.py | Python | mit | 9,097 |
import pytest
from clustaar.authorize.conditions import TrueCondition
@pytest.fixture
def condition():
return TrueCondition()
class TestCall(object):
def test_returns_true(self, condition):
assert condition({})
| Clustaar/clustaar.authorize | tests/authorize/conditions/test_true_condition.py | Python | mit | 231 |
# user.py is the autostart code for a ulnoiot node.
# Configure your devices, sensors and local interaction here.
# Always start with this to make everything from ulnoiot available.
# Therefore, do not delete the following line.
from ulnoiot import *
# The following is just example code, adjust to your needs accordin... | ulno/micropython-extra-ulno | examples/integriot_test/testnode1/files/autostart.py | Python | mit | 1,163 |
# Copyright (c) 2015 Uber Technologies, Inc.
#
# 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, publ... | Willyham/tchannel-python | tchannel/messages/cancel.py | Python | mit | 1,854 |
# coding: utf-8
import pygame
import os
from color import *
from pygame.locals import *
class Score(pygame.sprite.Sprite):
def __init__(self, score, player, width, height):
super(pygame.sprite.Sprite).__init__(Score)
self.score = int(score)
self.color = None
self.player = player
... | Ilphrin/TuxleTriad | Score.py | Python | mit | 1,523 |
from __future__ import unicode_literals
from django.db import models
from django.utils.timezone import now, timedelta
Q = models.Q
class LogisticJob(models.Model):
LOCK_FOR = (
(60*15, '15 minutes'),
(60*30, '30 minutes'),
(60*45, '45 minutes'),
(60*60, '1 hour'),
(60*60*... | mrcrgl/gge-storage | gge_proxy_manager/models/jobs.py | Python | mit | 3,505 |
"""Parse ISI journal abbreviations website."""
# Copyright (c) 2012 Andrew Dawson
#
# 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 righ... | ajdawson/jabr | lib/parser.py | Python | mit | 2,590 |
import glob
import os
import pandas as pd
class CTD(object):
"""docstring for CTD"""
def __init__(self):
self.format_l = []
self.td_l = []
self.iternum = 0
self.formatname = ""
def feature(self,index):
format_l = self.format_l
feature = ((float(format_l[inde... | wy36101299/NCKU_Machine-Learning-and-Bioinformatics | hw4_predictData/creatPredictdata.py | Python | mit | 2,986 |
"""
Running the template pre-processor standalone.
Input: Templated Antimony model (stdin)
Output: Expanded Antimony model (stdout)
"""
import fileinput
import os
import sys
directory = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(directory, "TemplateSB")
sys.path.append(path)
from template... | BioModelTools/TemplateSB | run.py | Python | mit | 543 |
from bottle import route, default_app
app = default_app()
data = {
"id": 78874,
"seriesName": "Firefly",
"aliases": [
"Serenity"
],
"banner": "graphical/78874-g3.jpg",
"seriesId": "7097",
"status": "Ended",
"firstAired": "2002-09-20",
"network": "FOX (US)",
"networkId": "... | romanvm/WsgiBoostServer | benchmarks/test_app.py | Python | mit | 1,229 |
#!/usr/bin/env python
# A Raspberry Pi GPIO based relay device
import RPi.GPIO as GPIO
from common.adafruit.Adafruit_MCP230xx.Adafruit_MCP230xx import Adafruit_MCP230XX
class Relay(object):
_mcp23017_chip = {} # Conceivably, we could have up to 8 of these as there are a possibility of 8 MCP chips on a bus.
... | mecworks/garden_pi | common/relay.py | Python | mit | 2,522 |
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.bcrypt import Bcrypt
from flask_sockets import Sockets
app = Flask(__name__, static_folder="../static/dist", template_folder="../static")
if os.environ.get('PRODUCTION'):
app.config.from_object('config.ProductionConfig')... | mortbauer/webapp | application/__init__.py | Python | mit | 444 |
# Generated by Django 2.2.12 on 2020-08-23 07:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('job_board', '0004_jobpost_is_from_recruiting_agency'),
]
operations = [
migrations.AlterField(
model_name='jobpost',
... | chicagopython/chipy.org | chipy_org/apps/job_board/migrations/0005_auto_20200823_0726.py | Python | mit | 793 |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import tree
from subprocess import call
# https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.names
#
# TODO: Load up the mushroom dataset into dataframe 'X'
# Verify you did it ... | Wittlich/DAT210x-Python | Module6/assignment5.py | Python | mit | 2,871 |
import os
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class DBConnector():
'''
where every row is the details one employee was paid for an entire month.
'''
@classmethod
def get_sess... | JasonThomasData/payslip_code_test | app/models/db_connector.py | Python | mit | 498 |
#!env /usr/bin/python3
import sys
import urllib.parse
import urllib.request
def main():
search = sys.argv[1]
url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search='
url = url + search
print(url)
req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"})
resp = urlli... | jadams/rarbg-get | rarbg-get.py | Python | mit | 409 |
"""
Module containing classes for HTTP client/server interactions
"""
# Python 2.x/3.x compatibility imports
try:
from urllib.error import HTTPError, URLError
from urllib.parse import urlencode
except ImportError:
from urllib2 import HTTPError, URLError
from urllib import urlencode
import socket
from ... | mpvoss/RickAndMortyWeatherTweets | env/lib/python3.5/site-packages/pyowm/commons/weather_client.py | Python | mit | 4,935 |
import unittest
import itertools
class TestWorld(object):
def __init__(self, **kw):
self.__dict__.update(kw)
self.components = self
self.entities = set()
self.new_entity_id = itertools.count().__next__
self.new_entity_id() # skip id 0
for comp in list(kw.values()):
comp.world = self
class TestComp... | caseman/grease | test/entity_test.py | Python | mit | 6,470 |
from django.db import models
from django.contrib.sites.models import Site
# Create your models here.
class Link(models.Model):
url = models.URLField(max_length=512)
site = models.ForeignKey(Site, on_delete=models.SET_NULL, null=True)
request_times = models.PositiveIntegerField(default=0)
updated = mod... | typefj/django-miniurl | shortener/models.py | Python | mit | 702 |
class InvalidValueState(ValueError):
pass
| szopu/datadiffs | datadiffs/exceptions.py | Python | mit | 46 |
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
import numpy as np
import sys
import scipy
from scipy import stats
data_file = sys.argv[1]
data = np.loadtxt(data_file)
slope, intercept, r_value, p_value, std_err = stats.linregress(data[499:2499,0], data[499:2499,1])
nf = open('linear_reg.dat', 'w')
... | rbdavid/MolecDynamics | Analysis/MSD/slope.py | Python | mit | 754 |
#!/usr/bin/env python3
import sys
import os
import urllib.request
import path_utils
# credit: https://stackoverflow.com/questions/22676/how-to-download-a-file-over-http
def download_url(source_url, target_path):
if os.path.exists(target_path):
return False, "Target path [%s] already exists" % target_pa... | mvendra/mvtools | download_url.py | Python | mit | 992 |
# Plot histogram
import os
import numpy as np
from plantcv.plantcv.threshold import binary as binary_threshold
from plantcv.plantcv import params
from plantcv.plantcv import fatal_error
from plantcv.plantcv._debug import _debug
import pandas as pd
from plotnine import ggplot, aes, geom_line, labels, scale_color_manual... | stiphyMT/plantcv | plantcv/plantcv/visualize/histogram.py | Python | mit | 6,304 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basicviz', '0002_auto_20160717_1939'),
]
operations = [
migrations.AlterField(
model_name='document',
... | sdrogers/ms2ldaviz | ms2ldaviz/basicviz/migrations/0003_auto_20160717_1943.py | Python | mit | 416 |
# -*- coding: utf-8 -*-
# pylint: disable=not-context-manager,useless-object-inheritance
# NOTE: The pylint not-content-manager warning is disabled pending the fix of
# a bug in pylint https://github.com/PyCQA/pylint/issues/782
# NOTE: useless-object-inheritance needed for Python 2.x compatability
"""This module con... | KennethNielsen/SoCo | soco/cache.py | Python | mit | 7,367 |
from logika import IGRALEC_R, IGRALEC_Y, PRAZNO, NEODLOCENO, NI_KONEC, MAKSIMALNO_STEVILO_POTEZ, nasprotnik
from five_logika import Five_logika
from powerup_logika import Powerup_logika, POWER_STOLPEC, POWER_ZETON, POWER_2X_NW, POWER_2X_W
from pop10_logika import Pop10_logika
from pop_logika import Pop_logika
import ra... | SamoFMF/stiri_v_vrsto | alphabeta.py | Python | mit | 17,907 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config im... | junranhe/tf-faster-rcnn | lib/model/config.py | Python | mit | 11,161 |
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... | csc8630Spring2014/Clusterizer | ete2/treeview/_open_newick.py | Python | mit | 2,493 |
from collections import Counter
from os.path import splitext
import matplotlib.pyplot as plt
from arcapix.fs.gpfs import ListProcessingRule, ManagementPolicy
def type_sizes(file_list):
c = Counter()
for f in file_list:
c.update({splitext(f.name): f.filesize})
return c
p = ManagementPolicy()
... | arcapix/gpfsapi-examples | type_sizes_piechart.py | Python | mit | 519 |
# _*_ encoding: utf-8 _*_
import timeit
def insertion_sort(nums):
"""Insertion Sort."""
for index in range(1, len(nums)):
val = nums[index]
left_index = index - 1
while left_index >= 0 and nums[left_index] > val:
nums[left_index + 1] = nums[left_index]
left_inde... | palindromed/data-structures2 | src/insertion_sort.py | Python | mit | 1,651 |
from django.db import models
class Citizen(models.Model):
"""
The insurance users.
"""
name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
# Contact information
email = models.EmailField()
phone = models.CharField(max_length=50)
# Citizen documents... | jaconsta/soat_cnpx | api/citizens/models.py | Python | mit | 672 |
import datetime
import typing
from . import helpers
from .tl import types, custom
Phone = str
Username = str
PeerID = int
Entity = typing.Union[types.User, types.Chat, types.Channel]
FullEntity = typing.Union[types.UserFull, types.messages.ChatFull, types.ChatFull, types.ChannelFull]
EntityLike = typing.Union[
P... | expectocode/Telethon | telethon/hints.py | Python | mit | 1,562 |
# coding=utf-8
#
# Copyright © 2015 VMware, Inc. 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, co... | vmware/nsxramlclient | tests/vdnConfig.py | Python | mit | 5,003 |
import numpy as np
import jarvis.helpers.helpers as helpers
from data_cleaner import DataCleaner
def get_data(csv=None, sep='|'):
dataset = create_dataset(csv, sep)
inputs = DataCleaner().clean(dataset[:, 0:1])
outputs = format_targets(dataset[:, 1])
train_data, test_data = inputs[::2], inputs[1::2]
train_ta... | whittlbc/jarvis | jarvis/learn/classify/data_prepper.py | Python | mit | 960 |
from jaspyx.visitor import BaseVisitor
class Return(BaseVisitor):
def visit_Return(self, node):
self.indent()
if node.value is not None:
self.output('return ')
self.visit(node.value)
else:
self.output('return')
self.finish()
| iksteen/jaspyx | jaspyx/visitor/return_.py | Python | mit | 299 |
import os
import os.path
from raiden.constants import RAIDEN_DB_VERSION
def database_from_privatekey(base_dir, app_number):
""" Format a database path based on the private key and app number. """
dbpath = os.path.join(base_dir, f"app{app_number}", f"v{RAIDEN_DB_VERSION}_log.db")
os.makedirs(os.path.dirna... | hackaugusto/raiden | raiden/tests/utils/app.py | Python | mit | 351 |
from django.apps import AppConfig
class ProxyConfig(AppConfig):
name = 'geoq.proxy'
verbose_name = 'GeoQ Proxy' | ngageoint/geoq | geoq/proxy/apps.py | Python | mit | 120 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/tensorflow/tools/pip_package/setup.py | Python | mit | 8,836 |
'''
Created on Jun 16, 2014
@author: lwoydziak
'''
import pexpect
import sys
from dynamic_machine.cli_commands import assertResultNotEquals, Command
class SshCli(object):
LOGGED_IN = 0
def __init__(self, host, loginUser, debug = False, trace = False, log=None, port=22, pexpectObject=None):
se... | Pipe-s/dynamic_machine | dynamic_machine/cli_ssh.py | Python | mit | 5,503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: test.py
#
# Copyright 2018 Costas Tyfoxylos
#
# 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 li... | costastf/python_library_cookiecutter | _CI/scripts/test.py | Python | mit | 3,282 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gramfuzz.fields import *
import names
TOP_CAT = "postal"
# Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
# The name rules have been modified and placed into names.py
class PDef(Def):
cat = "postal_def"
class PRef(Ref):
cat = "pos... | d0c-s4vage/gramfuzz | examples/grams/postal.py | Python | mit | 2,381 |
#!/usr/bin/env python3
"""Combine logs from multiple bitcore nodes as well as the test_framework log.
This streams the combined log output to stdout. Use combine_logs.py > outputfile
to write to an outputfile."""
import argparse
from collections import defaultdict, namedtuple
import heapq
import itertools
import os
i... | LIMXTEC/BitCore | test/functional/combine_logs.py | Python | mit | 4,611 |
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework_swagger.views import get_swagger_view
from . import views, views_api
# Django REST framework
router = DefaultRouter()
router.register(r'election', views_api.ElectionInterface)
router.register(r'district', vi... | OKFNat/offenewahlen-nrw17 | src/austria/urls.py | Python | mit | 1,055 |
'''
Created on Jan 15, 2014
@author: Jose Borreguero
'''
from setuptools import setup
setup(
name = 'dsfinterp',
packages = ['dsfinterp','dsfinterp/test' ],
version = '0.1',
description = 'Cubic Spline Interpolation of Dynamics Structure Factors',
long_description = open('README.md').read(),
author = 'J... | camm/dsfinterp | setup.py | Python | mit | 880 |
# -*- coding: utf-8 -*-
from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template
from django.template.loader import get_template
from helpers import ClientRouter, MailAssetsHelper, strip_accents
class UserMail:
"""
This class is responsible for firing emails for User... | atados/api | atados_core/emails.py | Python | mit | 7,061 |
# -*- coding: utf-8 -*-
"""
flask.ext.babelex
~~~~~~~~~~~~~~~~~
Implements i18n/l10n support for Flask applications based on Babel.
:copyright: (c) 2013 by Serge S. Koval, Armin Ronacher and contributors.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
impor... | initNirvana/Easyphotos | env/lib/python3.4/site-packages/flask_babelex/__init__.py | Python | mit | 22,503 |
try:
from tornado.websocket import WebSocketHandler
import tornado.ioloop
tornadoAvailable = True
except ImportError:
class WebSocketHandler(object): pass
tornadoAvailable = False
from json import loads as fromJS, dumps as toJS
from threading import Thread
from Log import console
import Settings
from utils impor... | mrozekma/Sprint | WebSocket.py | Python | mit | 3,192 |
# __init__.py: Yet Another Bayes Net library
# Contact: Jacob Schreiber ( jmschreiber91@gmail.com )
"""
For detailed documentation and examples, see the README.
"""
# Make our dependencies explicit so compiled Cython code won't segfault trying
# to load them.
import networkx, matplotlib.pyplot, scipy
import numpy as... | jmschrei/yabn | yabn/__init__.py | Python | mit | 1,279 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
make_loaddata.py
Convert ken_all.csv to loaddata
"""
import argparse
import csv
def merge_separated_line(args):
"""
yields line
yields a line.
if two (or more) lines has same postalcode,
merge them.
"""
def is_dup(line, buff):
""... | morinatsu/ZipCode | bin/make_loaddata.py | Python | mit | 2,655 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-23 08:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0003_auto_20171221_0336'),
]
operations = [
migrations.AlterField... | jeffshek/betterself | events/migrations/0004_auto_20171223_0859.py | Python | mit | 1,984 |
import aaf
import os
from optparse import OptionParser
parser = OptionParser()
(options, args) = parser.parse_args()
if not args:
parser.error("not enough argements")
path = args[0]
name, ext = os.path.splitext(path)
f = aaf.open(path, 'r')
f.save(name + ".xml")
f.close()
| markreidvfx/pyaaf | example/aaf2xml.py | Python | mit | 281 |
"""
telemetry full tests.
"""
import platform
import sys
from unittest import mock
import pytest
import wandb
def test_telemetry_finish(runner, live_mock_server, parse_ctx):
with runner.isolated_filesystem():
run = wandb.init()
run.finish()
ctx_util = parse_ctx(live_mock_server.get_ctx()... | wandb/client | tests/test_telemetry_full.py | Python | mit | 3,333 |
# -*- coding: utf-8 -*-
' 检查扩展名是否合法 '
__author__ = 'Ellery'
from app import app
import datetime, random
from PIL import Image
import os
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1] in app.config.get('ALLOWED_EXTENSIONS')
def unique_name():
now_time = dateti... | allotory/basilinna | app/main/upload_file.py | Python | mit | 1,433 |