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 -*-
import sys
print('y1')
def main(filename):
raw_data = load_data(filename)
# TODO - Clean data
print(raw_data[0])
return raw_data
def load_data(filename):
with open(filename, 'r') as file:
raw = file.read()
raw_data = frames = raw.split... | JustinShenk/sonic-face | analyze.py | Python | mit | 514 |
import pandas as pd
# TODO:
# Load up the dataset, setting correct header labels.
df = pd.read_csv('Datasets/census.data', names=['education', 'age', 'capital-gain', 'race', 'capital-loss',
'hours-per-week', 'sex', 'classification'])
# TODO:
# Use basic pandas commands t... | Wittlich/DAT210x-Python | Module2/assignment5.py | Python | mit | 1,879 |
#!/usr/bin/env python
#-------------------------------------------------------------------
# The MIT License
#
# Copyright (c) 2009 Patrick Mueller
#
# 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... | pmuellr/nitro_pie | test/test_properties.py | Python | mit | 9,821 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: Philip J Grabner <grabner@cadit.com>
# date: 2013/10/02
# copy: (C) Copyright 2013 Cadit Health Inc., All Rights Reserved.
#-----------------------------------------------------------------------... | cadithealth/pyramid_describe | pyramid_describe/i18n.py | Python | mit | 733 |
# VirusShare.py
# download VirusShare hashes and search for specified hashes
# Author: Sent1ent
# Version: 1.0
# Date: February 22nd, 2016
import argparse
import os
import time
from urllib.request import urlopen
def downloader(directory, iteration):
# Downloads given URL
url = 'https://virusshare.com/hashfiles/Vir... | AdamGreenhill/VirusShare-Search | VirusShare-Search.py | Python | mit | 3,716 |
# Proximal
import sys
sys.path.append('../../')
from proximal.utils.utils import *
from proximal.utils.convergence_log import *
from proximal.utils.metrics import *
from proximal.halide.halide import *
from proximal.lin_ops import *
from proximal.prox_fns import *
from proximal.algorithms import *
import cvxpy as cvx... | timmeinhardt/ProxImaL | proximal/examples/test_precond.py | Python | mit | 5,494 |
#!/usr/bin/env python
import time
from fluidsynth import fluidsynth
settings = fluidsynth.FluidSettings()
settings.quality = "low"
synth = fluidsynth.FluidSynth(settings)
synth.load_soundfont("double.sf2")
driver = fluidsynth.FluidAudioDriver(settings, synth)
scale = (60, 62, 64, 65, 67, 69, 71, 72)
for i in sca... | MostAwesomeDude/pyfluidsynth | demos/scale.py | Python | mit | 495 |
#!/usr/bin/env python
#
# NSC_INSTCAL_SEXDAOPHOT.PY -- Run SExtractor and DAOPHOT on an exposure
#
from __future__ import print_function
__authors__ = 'David Nidever <dnidever@noao.edu>'
__version__ = '20180819' # yyyymmdd
import os
import sys
import numpy as np
import warnings
from astropy.io import fits
from astr... | dnidever/noaosourcecatalog | python/nsc_instcal_sexdaophot.py | Python | mit | 31,293 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | testthedocs/redactor | docs/conf.py | Python | mit | 4,942 |
import sys
import types
from minecraft_data.v1_8 import find_item_or_block, windows_list
from minecraft_data.v1_8 import windows as windows_by_id
from spock.mcdata import constants
from spock.utils import camel_case, snake_case
def make_slot_check(wanted):
"""
Creates and returns a function that takes a slo... | MrSwiss/SpockBot | spock/mcdata/windows.py | Python | mit | 14,390 |
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py | Python | mit | 4,595 |
# 04_thermomether_f.py
# From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com
from Tkinter import * # tkinter provides the graphical user interface (GUI)
import RPi.GPIO as GPIO
import time, math
C = 0.38 # uF - Tweek this value around 0.33 to improve accuracy
R1 = 1000 # Ohms... | simonmonk/pi_starter_kit | 04_thermometer_f.py | Python | mit | 4,117 |
from L500analysis.data_io.get_cluster_data import GetClusterData
from L500analysis.utils.utils import aexp2redshift
from L500analysis.plotting.tools.figure_formatting import *
from L500analysis.plotting.profiles.tools.profiles_percentile \
import *
from L500analysis.plotting.profiles.tools.select_profiles \
imp... | cavestruz/L500analysis | plotting/profiles/K_evolution/plot_K_nu_binned_r500c.py | Python | mit | 2,878 |
class Solution:
def hIndex(self, citations):
n = len(citations)
at_least = [0] * (n + 2)
for c in citations:
at_least[min(c, n + 1)] += 1
for i in xrange(n, -1, -1):
at_least[i] += at_least[i + 1]
for i in xrange(n, -1, -1):
if... | rahul-ramadas/leetcode | h-index/Solution.55533513.py | Python | mit | 366 |
__version__ = '5.0.0b3'
| ronekko/chainer | chainer/_version.py | Python | mit | 24 |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pastas.utils import timestep_weighted_resample, timestep_weighted_resample_fast
# make a daily series from monthly (mostly) values, without specifying the
# frequency of the original series
#series0 = pd.read_csv("data/tswr1.csv", index_col=0... | gwtsa/gwtsa | examples/example_timestep_weighted_resample.py | Python | mit | 1,352 |
import os
import sys
import inspect
import json
def attach_parameters(obj, params):
"""
Ataches common parameters to the data provider
"""
obj.timestamp = params.get('timestamp')
obj.instrument = params.get('instrument')
obj.pricebar = params.get('pricebar')
if hasattr(obj, 'algorithm') an... | quantnode/quantnode-client | quantnode/helpers.py | Python | mit | 4,129 |
from .aggregates import ConditionalSum, ConditionalCount # noqa
| anentropic/django-conditional-aggregates | djconnagg/__init__.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | LordSputnik/beets | beetsplug/fetchart.py | Python | mit | 25,041 |
import math
from abc import abstractmethod
from dataclasses import dataclass
from typing import (
Generic,
List,
Optional,
TypeVar,
Union,
overload,
Any,
Tuple,
Sequence,
)
import random
numpy_installed = False
try:
import numpy as np
numpy_installed = True
except ImportErr... | lebrice/SimpleParsing | simple_parsing/helpers/hparams/priors.py | Python | mit | 11,857 |
#!/usr/bin/python
"""MobWrite Nullifier
Copyright 2009 Google Inc.
http://code.google.com/p/google-mobwrite/
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/LICENS... | mjpizz/node-mobwrite | ext/google-mobwrite/tools/nullify.py | Python | mit | 1,360 |
"""Entry point for reading MGZ."""
# pylint: disable=invalid-name,no-name-in-module
from construct import (Struct, CString, Const, Int32ul, Embedded, Float32l, Terminated, If, Computed, this, Peek)
from mgz.util import MgzPrefixed, ZlibCompressed, Version, VersionAdapter, get_version
from mgz.header.ai import ai
from... | happyleavesaoc/aoc-mgz | mgz/__init__.py | Python | mit | 1,612 |
import new, sys
import galaxy.util
import parameters
from parameters import basic
from parameters import grouping
from elementtree.ElementTree import XML
class ToolTestBuilder( object ):
"""
Encapsulates information about a tool test, and allows creation of a
dynamic TestCase class (the unittest framework... | dbcls/dbcls-galaxy | lib/galaxy/tools/test.py | Python | mit | 2,997 |
""" Illustris Simulation: Public Data Release.
lhalotree.py: File I/O related to the LHaloTree merger tree files. """
import numpy as np
import h5py
from groupcat import gcPath
from util import partTypeNum
def treePath(basePath,chunkNum=0):
""" Return absolute path to a LHaloTree HDF5 file (modify as n... | linan7788626/hackday_03112016 | illustris_python/lhalotree.py | Python | mit | 5,231 |
from db import DB
import config
from gensim.corpora import Dictionary
from multiprocessing import Process
from helper import chunkFun
import psutil
class UserProfile:
def __init__(self, user_list = []):
self.threshold_num = config.threshold_num
self.lan = config.lan
self.user_list = user_... | weakties/infrastructure | component_twitter_networks/userProfile.py | Python | mit | 4,903 |
#! /usr/bin/env python
import sys
import os
import urllib
import re
import pytest
import time
import hubcheck
from hubcheck.exceptions import HCException
from hubcheck.testcase import TestCase2
from hubcheck.shell import ContainerManager
from hubcheck.shell import ToolSession
pytestmark = [ pytest.mark.website,
... | codedsk/hubcheck-hubzero-tests | hchztests/tests/test_website_parampass.py | Python | mit | 47,868 |
# 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_02_01/operations/_express_route_ports_operations.py | Python | mit | 30,439 |
# -*- coding: utf-8 -*-
import pygame
from pibooth.utils import LOGGER
from pibooth.controls import GPIO
BUTTON_DOWN = pygame.USEREVENT + 1
class PtbButton(object):
"""Physical button management
"""
def __init__(self, pin, bouncetime=0.1):
self.pin = pin
# Use internal pull up/down re... | werdeil/pibooth | pibooth/controls/button.py | Python | mit | 1,039 |
count = int(input("Enter the number of fruits: "))
list = []
for i in range(count):
fruit = raw_input("Enter the name of the fruit: ")
list.append(fruit)
print(list) | yatingupta10/Dev.py | Week 1/Student Submissions/Ayush_Jain/q3.py | Python | mit | 169 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lab01_authserver.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure ... | Boris-Barboris/rsoi | lab01/authserver/lab01_authserver/manage.py | Python | mit | 814 |
#!/usr/bin/env python3
class SpoonSliceModes(object):
""" Some Text """
PLAY='PLY'
RANDOM='RND'
MUTE='MTE'
SKIP='SKP'
REVERSE='RVS'
DOUBLE='DBL'
HALF='HLF'
def __init__(self):
return
def test_mode():
return SpoonSliceModes.PLAY
def is_va... | zarquin/SpoonFight | SpoonModes.py | Python | mit | 1,625 |
import time
from .payload import Payload
from .worker import Worker
from .features import is_available
if is_available("concurrency"):
from gevent import monkey, pool
class Consumer(Worker):
source_handlers = {
"ready": "spawn_job"
}
outputs = ['results']
def __init__(self, *args, **k... | wglass/rotterdam | rotterdam/consumer.py | Python | mit | 1,475 |
import sys, os
delete = os.path.join('src','tools')
root_path = os.getcwd().replace(delete,'')
sys.path.append(root_path)
| golsun/GPS | src/tools/add_root_path.py | Python | mit | 123 |
import sys
def traduction(N, M, table_traduction, s):
n_div = N/3
s_liste = []
decr = ''
q = 0
for i in range(0,n_div):
for v in table_traduction:
if (s[q:q+3] == v[0]):
if (decr == ''):
decr = v[1]
else:
... | Hugoo/Prologin | 2010 - Machine/QCM/acides amines.py | Python | mit | 618 |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['preview'], 'suppor... | TerryHowe/ansible-modules-hashivault | ansible/modules/hashivault/hashivault_pki_crl_get.py | Python | mit | 1,987 |
#!/usr/bin/env python
import sys
import math
f = sys.argv[1]
out1 = '%s_out1.spi' %(f[:-4])
out2 = '%s_out2.spi' %(f[:-4])
f1 = open(f,'r')
o1 = open(out1,'wa')
o2 = open(out2,'wa')
loop = 1
for line in f1:
l = line.split()
s = float(l[0])
if s < 0:
print '%f is less than 0' %(s)
new = s - 1
n = (ma... | mcianfrocco/Cianfrocco_et_al._2013 | Focused_classification_lobeA/renumber.py | Python | mit | 630 |
__author__ = 'heni'
import os
# This function aims to find the specific label of a phrase in the sentence
def find_label(element, labels):
c = 0
found = False
while c < len(labels) and not found:
if labels[c] in element:
found = True
else:
c += 1
return labels[... | hbenarab/mt-iebkg | preprocess/openie2iob_format.py | Python | mit | 4,633 |
# -*- coding: utf-8 -*-
"""
Yahoo Fantasy Sports API
:copyright: (c) 2018 by Marvin Huang
"""
from app import yahoo_oauth
# from app.models import User, Team, League, Category
class YahooAPI(object):
def __init__(self, yahoo_oauth):
self.oauth = yahoo_oauth
def get_current_user_guid(self):
... | namiszh/fba | WebApp/app/yahoo_api.py | Python | mit | 7,485 |
#
# Title : Data munging(AKA cleaning) the Titanic Data
# Author : Felan Carlo Garcia
#
# Notes:
# -- Code is based on the Kaggle Python Tutorial
# -- data cleaning prior to implementing a machine learning algorithm.
import numpy as np
import pandas as pd
def processdata(filename, outputname):
df = pd.read... | cadrev/Titanic-Prediction | data-munging.py | Python | mit | 3,412 |
import pypcd
import plyfile
import numpy
import scipy.spatial
import mcubes
import tempfile
import meshlabxml
from pyhull.convex_hull import ConvexHull
from curvox import pc_vox_utils
import types
# Binvox functions
def binvox_to_ply(voxel_grid, **kwargs):
"""
:param voxel_grid:
:type voxel_grid: binvo... | CRLab/curvox | src/curvox/cloud_to_mesh_conversions.py | Python | mit | 9,058 |
import numpy as np
import pandas as pd
import datetime
import util
class Participant:
# Need to update to have both network and retail tariffs as inputs
def __init__(self, participant_id, participant_type, retail_tariff_type, network_tariff_type,retailer):
self.participant_id = participant_id
... | lukasmarshall/embedded-network-model | participant.py | Python | mit | 2,188 |
from ._Calibrate import *
| sbragagnolo/xsens | src/xsens/srv/__init__.py | Python | mit | 26 |
"""Queries."""
from collections import ChainMap
from typing import Dict, List
from flask_sqlalchemy import BaseQuery
from sqlalchemy import or_
from sqlalchemy.orm import aliased
from sqlalchemy.orm.util import AliasedClass
from sqlalchemy.sql.elements import BooleanClauseList
from pma_api.models import db, Character... | joeflack4/pma-api | pma_api/queries.py | Python | mit | 28,165 |
from django.conf.urls import patterns, url
from admins import views
urlpatterns = patterns(
'',
# Control panels
url(r'^admin/overview/$', views.overview, name='admin_overview'),
)
| Sult/evehub | admins/urls.py | Python | mit | 197 |
"""A Dakotathon uncertainty quantification experiment with Hydrotrend.
This experiment uses the `Sampling`_ method to assess the effect of
uncertain mean annual temperature and total annual precipitation
values on the median value of suspended sediment load of the Waipaoa
River over a 10-year interval. The temperature... | mdpiper/AGU-2016 | hydrotrend-Qs-sampling-study/hydrotrend-sampling-study.py | Python | mit | 2,647 |
__author__ = 'Tauren'
from flask import abort
from flask.ext.restful import Resource, marshal, fields
from .models import Place
from app import db
place_fields = {
'id': fields.Integer,
'city': fields.String,
'zip': fields.String,
'state': fields.String,
'county': fields.String,
'latitude': f... | taurenk/PinPoint-Geocoder-Python | app/placeApi.py | Python | mit | 725 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/__init__.py | Python | mit | 34,093 |
from mox3.mox import MoxTestBase, IgnoreArg
import pycares
import pycares.errno
import gevent
from gevent import select
from gevent.event import AsyncResult
from slimta.util.dns import DNSResolver, DNSError
class TestDNS(MoxTestBase):
def test_get_query_type(self):
self.assertEqual(pycares.QUERY_TYPE_... | fisele/slimta-abusix | test/test_slimta_util_dns.py | Python | mit | 2,692 |
#!/usr/bin/env python3
from PIL import Image, ImageDraw, ImageFont, ImageColor
from configparser import ConfigParser
import os,sys,time, csv, operator, tempfile, stat, hashlib, colorsys
scriptpath = os.path.join(os.getcwd(),os.path.dirname(sys.argv[0]));
config = ConfigParser()
config.read(os.path.join(scriptpath,'ma... | lucaswo/idlerpgmap | map.py | Python | mit | 4,662 |
#@result Submitted a few seconds ago • Score: 10.00 Status: Accepted Test Case #0: 0s Test Case #1: 0s
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(raw_input())
b = int(raw_input())
print a / b
print a % b
print divmod(a, b)
| FeiZhan/Algo-Collection | answers/hackerrank/Mod Divmod.py | Python | mit | 262 |
from errno import EEXIST
import os
import sys
from functools import partial
is_python2 = lambda: sys.version_info < (3,)
if is_python2():
BUILTINS_NAME = "__builtin__"
def input(prompt):
return raw_input(prompt).decode("UTF-8")
def makedirs(name, exist_ok=False):
try:
os.make... | marcwebbie/pysswords | pysswords/python_two.py | Python | mit | 555 |
# -*- coding: utf-8 -*-
'''Management commands.'''
import os
import shutil
from flask.ext.script import Manager
from killtheyak.main import app, freezer
manager = Manager(app)
build_dir = app.config['FREEZER_DESTINATION']
HERE = os.path.dirname(os.path.abspath(__file__))
@manager.command
def install():
'''Inst... | vfulco/killtheyak.github.io | manage.py | Python | mit | 1,356 |
from configparser import RawConfigParser
import os.path
config = RawConfigParser(allow_no_value=True)
def init(defaults):
config.read_dict(defaults)
update()
def read(file):
config.read(file)
update()
def write(file):
new = not os.path.isfile(file)
with open(file, 'w+') as file:
... | stephcd/slake | slake/config.py | Python | mit | 485 |
# FirstReverse.py
# Using the Python language, have the function FirstReverse(str) take the str parameter being passed and return the string in reversed order. For example: if the input string is "Hello World and Coders" then your program should return the string sredoC dna dlroW olleH.
def FirstReverse(str):
#... | JunoJunho/coderbyte_challenge | FirstReverse.py | Python | mit | 507 |
# To change this license header, choose License Headers in Project Properties.
# Python Networking
# -----------------------------------------------------------------------------
# Python Networking Overview
# Telnet
# SSH
# SNMP
# Scapy (Creating your own packets)
#
#
#
# To change this template file, choose Tools... | keeyanajones/Samples | pythonProject/NetworkPythonProject/src/networkpythonproject.py | Python | mit | 441 |
# Generated by Django 3.2.5 on 2021-07-10 22:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app", "0022_auto_20210710_1644"),
]
operations = [
migrations.AddField(
model_name="symbol",
name="length",
... | johntellsall/shotglass | shotglass/app/migrations/0023_add_length.py | Python | mit | 415 |
for i in range(1, 13):
print(end=" ")
for j in range(1, 13):
print("{:4d}".format(i * j), end=" ")
print()
| wchuanghard/CS110-Python_Programming | lab6/ex_8_4.py | Python | mit | 127 |
#!/usr/bin/env python3
# Advent of Code 2016 - Day 8, Part One and Two
import sys
from itertools import chain
COLS = 50
ROWS = 6
def rect(display, x, y):
for r in range(y):
for c in range(x):
display[r][c] = '#'
def rotate_col(display, x, s):
d = list(zip(*display))
rotate_row(d, x... | mcbor/adventofcode | 2016/day08/day08.py | Python | mit | 1,538 |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2013-2014 Peter Williams <peter@newton.cx> and collaborators.
# Licensed under the MIT License.
"""pwkit.tabfile - I/O with typed tables of uncertain measurements.
Functions:
read - Read a typed table file.
vizread - Read a headerless table file, with columns spec... | pkgw/pwkit | pwkit/tabfile.py | Python | mit | 9,163 |
from urlparser import parse_string, MalformatUrlException
supported_schemes = ['http', 'https']
def _validate_url(url):
if url.get_scheme().lower() not in supported_schemes:
raise InvalidUrlException('Unsupported scheme.')
def normalize_url(input_url):
url = parse_string(input_url)
try:
_validate_url(url)
ex... | kafji/urlnormalizer | urlnormalizer.py | Python | mit | 996 |
"""
https://www.hackerrank.com/challenges/two-two
"""
def strength(a, i, j):
if a[i] == 0:
return 0
return int(''.join([str(x) for x in a[i:j+1]]))
def power_of_2(num):
return (num != 0) and ((num & (num - 1)) == 0)
def twotwo(a):
count = 0
for i in range(len(a)):
if a[i] == 0:... | capsci/chrome | practice/python/TwoTwo.py | Python | mit | 643 |
from __future__ import absolute_import
from __future__ import print_function
import os
import unittest
import functools
from six import PY3, binary_type, text_type
# noinspection PyUnresolvedReferences
from six.moves import range
from pybufrkit.decoder import Decoder
BASE_DIR = os.path.dirname(__file__)
DATA_DIR = ... | ywangd/pybufrkit | tests/test_Decoder.py | Python | mit | 3,732 |
import pyfits as PF
import sys
import os
from numpy import *
from scipy import *
#sys.path.append("../LIHSPcommon")
#inpath: filepath of input dark spool
#inname: filename of input dark spool
#method: avg med clip[,kappa]
#outpath: filepath of masterdark
#makefits: 1 prints masterdark to .fits
def rflat(filepath,fil... | fedhere/getlucky | LIHSPcommon/mflat.py | Python | mit | 2,975 |
#Text parameters
XSMALL = 7
SMALL = 9
NORMAL = 11
BIG = 13
#PADDING (%)
PAD = .05
MPL_COLORMAP= 'brg'
#LAYOUT CONFIGURATION
LEFT = 0.04
BOTTOM = 0.07
RIGHT = 0.98
TOP = 0.94
WSPACE = 0.17
HSPACE = 1.
#Line Width
LW_THIN = 0.3
LW_MEDIUM = 0.5
LW_NORMAL = 1
LW_TICK = 2
MAXIMIZE = 'maximize'
M... | adailsonfilho/DarwinEye | config.py | Python | mit | 785 |
from django.shortcuts import get_object_or_404
from django.template import Context, loader as template_loader
from django.conf import settings
from django.core.context_processors import csrf
from rest_framework import decorators, permissions, viewsets, status
from rest_framework.renderers import JSONPRenderer, JSONRen... | apparena/docs | readthedocs/restapi/views/footer_views.py | Python | mit | 3,436 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# jwt_apns_client 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 th... | Mobelux/jwt_apns_client | docs/conf.py | Python | mit | 8,505 |
#!/usr/bin/env python3
"""Implements getch. From: https://gist.github.com/chao787/2652257"""
# Last modified: <2012-05-10 18:04:45 Thursday by richard>
# @version 0.1
# @author : Richard Wong
# Email: chao787@gmail.com
class _Getch:
"""
Gets a single character from standard input. Does not echo to
the s... | dhylands/rshell | rshell/getch.py | Python | mit | 3,120 |
import _plotly_utils.basevalidators
class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="ticksuffix", parent_name="funnel.marker.colorbar", **kwargs
):
super(TicksuffixValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/funnel/marker/colorbar/_ticksuffix.py | Python | mit | 439 |
#! /usr/bin/env python
"""Date and time formatting and parsing functions.
"""
import datetime
from functional import compose
def convert_format(from_format, to_format):
"""convert_format(from_format, to_format)(timestr) -> str
Convert between two time formats.
>>> convert_format('%d/%m/%Y', '%Y-%m-... | nmbooker/python-funbox | funbox/dates.py | Python | mit | 1,207 |
from thinglang.compiler.buffer import CompilationBuffer
from thinglang.compiler.opcodes import OpcodeJumpConditional, OpcodeJump
from thinglang.compiler.tracker import ResolvableIndex
from thinglang.lexer.blocks.loops import LexicalRepeatWhile
from thinglang.parser.nodes.base_node import BaseNode
from thinglang.parser.... | ytanay/thinglang | thinglang/parser/blocks/loop.py | Python | mit | 1,434 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Resource'
db.create_table(u'workshop_resource', (
... | SSC-SUT/SSC-Site | src/ssc/workshop/migrations/0002_auto__add_resource__add_field_attendance_has_lunch__add_field_workshop.py | Python | mit | 8,903 |
""" Register allocation scheme.
"""
import os, sys
from rpython.jit.backend.llsupport import symbolic
from rpython.jit.backend.llsupport.descr import CallDescr, unpack_arraydescr
from rpython.jit.backend.llsupport.gcmap import allocate_gcmap
from rpython.jit.backend.llsupport.regalloc import (FrameManager, BaseRegall... | oblique-labs/pyVM | rpython/jit/backend/x86/regalloc.py | Python | mit | 66,392 |
import requests
import json
import traceback
import os
import time
#Simple log function so we can log events
def log(text):
logFile = open("netflixScrapper.log", "ab+")
logFile.write(text+"\n")
logFile.close()
log("START")
#Use basic cookie authentication from visiting http://netflix.com
session... | Healdb/healdb.github.io | grabNetflixFiles.py | Python | mit | 3,849 |
from rest_framework import routers
from imagefy.wishes.views import OfferViewSet, WishViewSet
router = routers.SimpleRouter()
router.register(r'wishes', WishViewSet)
router.register(r'offers', OfferViewSet)
| dvl/imagefy-web | imagefy/api.py | Python | mit | 209 |
# -*- coding: utf-8 -*-
#戦略を分ける
import os
import time
from decimal import Decimal
import csv
def moneyfmt(value, places=2, curr='', sep=',', dp='.',
pos='', neg='-', trailneg=''):
"""Decimal を通貨表現の文字列に変換します。
places: 小数点以下の値を表すのに必要な桁数
curr: 符号の前に置く通貨記号 (オプションで、空でもかまいません)
sep: 桁のグ... | t10471/python | practice/src/design_pattern/Strategy.py | Python | mit | 6,535 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | atsusy/TiImageCollectionView | build.py | Python | mit | 6,549 |
import pytest
from marshmallow import Schema, fields
from flask_resty import Api, ApiView
from flask_resty.fields import DelimitedList
from flask_resty.testing import assert_response
# -----------------------------------------------------------------------------
@pytest.fixture
def schemas():
class NameSchema(S... | 4Catalyzer/flask-jsonapiview | tests/test_args.py | Python | mit | 4,107 |
# Copyright 2010-2012 the SGC project developers.
# See the LICENSE file at the top-level directory of this distribution
# and at http://program.sambull.org/sgc/license.html.
"""
Dialog window, creates a popup window.
"""
import pygame.mouse
from pygame.locals import *
from pygame import draw
from ._locals import *... | OneOneFour/ICSP_Monte_Carlo | sgc/sgc/widgets/dialog.py | Python | mit | 5,678 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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... | dracorpg/python-ivi | ivi/agilent/agilent2000A.py | Python | mit | 16,685 |
import json
from flask import request, Response
from werkzeug.exceptions import BadRequest
from werkzeug.test import EnvironBuilder
class Aggregator(object):
def __init__(self, app=None, endpoint=None):
self.url_map = {}
self.endpoint = endpoint or "/aggregate"
if app:
self.i... | ramnes/flask-aggregator | flask_aggregator.py | Python | mit | 1,514 |
from django.contrib import admin
import models
class BatchJobAdmin(admin.ModelAdmin):
list_display = ['email', 'timestamp', 'completed', 'job']
search_fields = ['email']
list_filter = ['job', 'completed']
ordering = ['-timestamp']
admin.site.register(models.BatchJob, BatchJobAdmin)
admin.site.register(models.Grou... | riltsken/python-constant-contact | python_constantcontact/django_constantcontact/admin.py | Python | mit | 327 |
from theme_converter.base import BaseConverter
import os.path
class StatusConverter(BaseConverter):
_available_statuses = {
'Generic Available':'pidgin-status-available',
'Free for Chat':'pidgin-status-chat',
'Available for Friends Only':'',
'Generic Away':'pidgin-status-away',
... | hectron/adium_theme_converter | theme_converter/status_converter.py | Python | mit | 3,259 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Automated Expanded Attention + Multi-Objective.
Combines both expanded attention and multi-objective training object... | facebookresearch/ParlAI | parlai/zoo/light_whoami/expanded_and_multiobjective_1024.py | Python | mit | 514 |
from django.conf import settings
from . import defaults
__title__ = 'events.contrib.plugins.form_elements.fields.' \
'checkbox_select_multiple.conf'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('get_se... | mansonul/events | events/contrib/plugins/form_elements/fields/checkbox_select_multiple/conf.py | Python | mit | 1,137 |
print "From package1.__init__.py"
from . import z_test | bdlamprecht/python_class | neteng/package1/__init__.py | Python | mit | 54 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pyhkp documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 28 20:01:20 2014.
#
# 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
# auto... | eadil/pyhkp | doc/conf.py | Python | mit | 10,210 |
from .local import *
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow all host headers
ALLOWED_HOSTS = ['*']
# Static asset configuration
import os
BASE_DIR = o... | tranhnb/template | project_name/project_name/settings/local_heroku.py | Python | mit | 509 |
"""Test multiballs and multiball_locks."""
from mpf.tests.MpfGameTestCase import MpfGameTestCase
class TestMultiBall(MpfGameTestCase):
def get_config_file(self):
return 'config.yaml'
def get_machine_path(self):
return 'tests/machine_files/multiball/'
def get_platform(self):
retu... | missionpinball/mpf | mpf/tests/test_MultiBall.py | Python | mit | 45,871 |
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import helper
# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/sheets.googleapis... | vikramraman/portfolio-analyzer | analyzer/sheetsapi.py | Python | mit | 3,414 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import S3CustomController
THEME = "RedHat"
# =============================================================================
class index(S3CustomController):
""" Custom Home Page """
def __call__(self):
output = {}
# Allow editing of page c... | flavour/RedHat | modules/templates/RedHat/controllers.py | Python | mit | 5,254 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/views.ui'
#
# Created: Fri Sep 4 01:29:58 2015
# by: PyQt4 UI code generator 4.11.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attri... | argenortega/AUI | aui/gui/views/ui_views.py | Python | mit | 14,083 |
from struct import Struct
from collections import namedtuple
from shapy.framework.netlink.message import Attr
from shapy.framework.utils import nl_ticks2us, nl_us2ticks
from shapy.framework.netlink.constants import *
class NetemOptions(Attr):
#struct tc_netem_qopt {
# __u32 latency; /* added delay ... | praus/shapy | shapy/framework/netlink/netem.py | Python | mit | 1,477 |
# By Justin Walgran
# Copyright (c) 2012 Azavea, 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, ... | azavea/blend | blend/test/TestYUICompressorMinifier.py | Python | mit | 4,311 |
def powers(x, n0, n1=None):
if n1 is None:
n1 = n0
n0 = 1
if n0 == 0:
r = 1
elif n0 == 1:
r = x
else:
r = x ** n0
rs = [r]
for _ in range(n1 - n0):
r *= x
rs.append(r)
return rs
| frostburn/frostsynth | frostsynth/sequence.py | Python | mit | 262 |
import datetime
from .basic import Base
from .tables import *
class LoginInfo(Base):
__table__ = login_info
class User(Base):
__table__ = wbuser
def __init__(self, uid):
self.uid = uid
class SeedIds(Base):
__table__ = seed_ids
class KeyWords(Base):
__table__ = keywords
class KeyWo... | yzsz/weibospider | db/models.py | Python | mit | 3,047 |
from itertools import product
import pytest
from hatch.plugin.manager import PluginManager
from hatch.project.config import ProjectConfig
from hatch.project.env import RESERVED_OPTIONS
from hatch.utils.structures import EnvVars
from hatch.version.scheme.standard import StandardScheme
from hatchling.version.source.reg... | ofek/hatch | tests/project/test_config.py | Python | mit | 93,385 |
from .entity import Entity
class Message(Entity):
"""
Represents a single message.
Fields:
- id (string, max 34 characters)
* ID of the message
* Read-only
- direction
* Direction of the message: incoming messages are sent from one of your cont... | Telerivet/telerivet-python-client | telerivet/message.py | Python | mit | 11,412 |
from rest_framework import serializers
from .models import Performance, TopImage
class PerformanceSerializer(serializers.ModelSerializer):
class Meta:
model = Performance
fields = ('detector', 'average_precision', 'precision',
'recall', 'test_set')
class TopImageSerializer(seria... | mingot/detectme_server | detectme/leaderboards/serializers.py | Python | mit | 652 |
# python3
r"""Learners of generalized method of moments with deep networks.
References:
- DeepGMMLearner:
Andrew Bennett, Nathan Kallus, and Tobias Schnabel. Deep generalized method of
moments forinstrumental variable analysis. InAdvances in Neural Information
Processing Systems, pages3559–3569, 2019.
- Adver... | liyuan9988/IVOPEwithACME | src/ope/deep_gmm/learner.py | Python | mit | 25,153 |
import requests, json
url = 'http://educacao.dadosabertosbr.com/api/cidades/ce'
cidades = requests.get(url).content
cidades = cidades.decode('utf-8')
cidades = json.loads(cidades)
for cidade in cidades:
codigo, nome = cidade.split(':')
print(nome)
| santiagosilas/propython | raspagem/random/lista_cidades.py | Python | mit | 252 |