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
# -*- coding: utf-8 -*- # python+selenium识别验证码 # import re import requests import pytesseract from selenium import webdriver from PIL import Image,Image import time # driver = webdriver.Chrome() driver.maximize_window() driver.get("https://higo.flycua.com/hp/html/login.html") driver.implicitly_wait(30) # 下面用户名和密码涉及到我个...
1065865483/0python_script
test/imag_test.py
Python
mit
3,355
import argparse import select def no_piped_input(arguments): inputs_ready, _, _ = select.select([arguments.file], [], [], 0) return not bool(inputs_ready) def parse_args(args, input): parser = argparse.ArgumentParser() parser.add_argument('--url', help="URL of the target data-set", ...
alphagov/backdropsend
backdropsend/argumentsparser.py
Python
mit
1,401
# Define a function sum() and a function multiply() # that sums and multiplies (respectively) all the numbers in a list of numbers. # For example, sum([1, 2, 3, 4]) should return 10, # and multiply([1, 2, 3, 4]) should return 24. def check_list(num_list): """Check if input is list""" if num_list is Non...
giantas/minor-python-tests
Operate List/operate_list.py
Python
mit
1,301
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2014 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
laenderoliveira/exerclivropy
exercicios_resolvidos/capitulo 05/exercicio-05-17.py
Python
mit
695
#!/bin/python # Solution for https://www.hackerrank.com/challenges/alien-username import re def is_valid_username(s): pattern = r'^[_\.][0-9]+[a-zA-Z]*_?$' match = re.match(pattern, s) return match n = int(raw_input().strip()) for i in range(n): s = raw_input().strip() if is_valid_username(s): ...
ernestoalarcon/competitiveprogramming
alien-username.py
Python
mit
373
# encoding: utf-8 """Implementations for various useful completers. These are all loaded by default by IPython. """ #----------------------------------------------------------------------------- # Copyright (C) 2010-2011 The IPython Development Team. # # Distributed under the terms of the BSD License. # # The full ...
lancezlin/ml_template_py
lib/python2.7/site-packages/IPython/core/completerlib.py
Python
mit
11,780
#! /usr/bin/python class Indexer: def __getitem__(self, index): return index ** 2 x = Indexer() for i in range(5): print x[i], class Stepper: def __getitem__(self, index): return self.data[index] s = Stepper() s.data = "spam" for x in s: print x, print s.data[0]
yuweijun/learning-programming
language-python/getitem.py
Python
mit
281
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "Osman Baskaya" """ Some utility functions for entailment project """ from collections import defaultdict as dd from metrics import * def get_eval_metric(metric_name): if metric_name == "jaccard": return jaccard_index elif metric_name == "1": ...
osmanbaskaya/text-entail
run/entail_utils.py
Python
mit
1,076
import numpy as np import cv2 from matplotlib import pyplot as plt face_cascade = cv2.CascadeClassifier('/home/tianyiz/user/601project/c/haarcascade_frontalface_alt.xml') cap = cv2.VideoCapture(0) fgbg = cv2.createBackgroundSubtractorMOG2() while 1: ret, img = cap.read() gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY...
Tianyi94/EC601Project_Somatic-Parkour-Game-based-on-OpenCV
Old Code/ControlPart/FaceDetection+BackgroundReduction.py
Python
mit
723
a = "1" b = 1 print("Arvud on " + 5 * a + " ja " + str(5 * b))
captainhungrykaboom/MTAT.TK.006
6. märts - 12. märts ülesanded/harjutus ülesanne 6.py
Python
mit
62
# coding:utf8 class Plugin(object): __doc__ = '''Плагин предназначен для остановки бота. Для использования необходимо иметь уровень доступа {protection} или выше Ключевые слова: [{keywords}] Использование: {keyword} Пример: {keyword}''' name = 'stop' keywords = (u'стоп', name, '!') pr...
Fogapod/VKBot
bot/plugins/plugin_stop.py
Python
mit
684
import math from pathlib import Path from tkinter import W, N, E, StringVar, PhotoImage from tkinter.ttk import Button, Label, LabelFrame from overrides import overrides from pyminutiaeviewer.gui_common import NotebookTabBase from pyminutiaeviewer.minutia import Minutia, MinutiaType class MinutiaeEditorFrame(Notebo...
IgniparousTempest/py-minutiae-viewer
pyminutiaeviewer/gui_editor.py
Python
mit
5,203
"""This screws up visualize.py""" """ import numpy as np from matplotlib import pyplot as plt from matplotlib.lines import Line2D from torch.autograd import Variable as Var from torch import Tensor class RealtimePlot(): def __init__(self, style='ggplot'): plt.style.use(style) plt.ion() se...
p-morais/rl
rl/utils/plotting.py
Python
mit
1,503
# 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. #---------------------------------------------------------------------...
lmazuel/azure-sdk-for-python
azure-mgmt-relay/tests/test_azure_mgmt_wcfrelay.py
Python
mit
7,326
from tkinter import * import mysql.connector as mysql from MySQLdb import dbConnect from HomeOOP import * import datetime from PIL import Image, ImageTk class MainMenu(Frame): def __init__(self, parent): #The very first screen of the web app Frame.__init__(self, parent) w, h = parent.winfo_screen...
ACBL-Bridge/Bridge-Application
Home Files/LoginandSignupV10.py
Python
mit
17,362
# -*- coding: utf-8 -*- from youtrack import YouTrackException def utf8encode(source): if isinstance(source, str): source = source.encode('utf-8') return source def _create_custom_field_prototype(connection, cf_type, cf_name, auto_attached=False, additional_params=None): if additional_params is ...
devopshq/youtrack
youtrack/import_helper.py
Python
mit
7,567
from __future__ import division
laowantong/mocodo
mocodo/tests/__init__.py
Python
mit
33
import inspect try: from collections.abc import Mapping except ImportError: from collections import Mapping import six from .reducers import tuple_reducer, path_reducer, dot_reducer, underscore_reducer from .splitters import tuple_splitter, path_splitter, dot_splitter, underscore_splitter REDUCER_DICT = { ...
ianlini/flatten-dict
src/flatten_dict/flatten_dict.py
Python
mit
5,769
from IPython.display import HTML from bs4 import BeautifulSoup import urllib f = open('chars.txt', 'w') r = urllib.urlopen('http://www.eventhubs.com/tiers/ssb4/').read() soup = BeautifulSoup(r, "lxml") characters = soup.find_all("td", class_="tierstdnorm") count = 1 tierCharList=[] for element in characters: if ...
bumshakabum/Kim_CSCI2270_FinalProject
websiteParser.py
Python
mit
852
# 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 the rights to use, copy, ...
beetbox/beets
beets/util/__init__.py
Python
mit
37,269
import pandas as pd import numpy as np import re from gensim import corpora, models, similarities from gensim.parsing.preprocessing import STOPWORDS def split(text): ''' Split the input text into words/tokens; ignoring stopwords and empty strings ''' delimiters = ".", ",", ";", ":", "-", "(", ")", " ", "\t" ...
CSC591ADBI-TeamProjects/Product-Search-Relevance
build_tfidf.py
Python
mit
1,752
# -*- coding: utf-8 -*- import win32process import win32api import win32con import ctypes import os, sys, string TH32CS_SNAPPROCESS = 0x00000002 class PROCESSENTRY32(ctypes.Structure): _fields_ = [("dwSize", ctypes.c_ulong), ("cntUsage", ctypes.c_ulong), ("th32P...
holdlg/PythonScript
Python2/bak_2014/sys3_process.py
Python
mit
3,492
from evosnap import constants class POSDevice: def __init__(self,**kwargs): self.__order = [ 'posDeviceType', 'posDeviceConnection', 'posDeviceColour', 'posDeviceQuantity', ] self.__lower_camelcase = constants.ALL_FIELDS self.pos_device_type = kwargs.get('pos_device_ty...
Zertifica/evosnap
evosnap/merchant_applications/pos_device.py
Python
mit
806
import numpy as np from snob import mixture_slf as slf n_samples, n_features, n_clusters, rank = 1000, 50, 6, 1 sigma = 0.5 true_homo_specific_variances = sigma**2 * np.ones((1, n_features)) rng = np.random.RandomState(321) U, _, _ = np.linalg.svd(rng.randn(n_features, n_features)) true_factor_loads = U[:, :rank]...
andycasey/snob
sandbox_mixture_slf.py
Python
mit
2,941
import os import shutil from codecs import open as codecs_open import numpy as np from setuptools import setup, find_packages from distutils.core import Distribution, Extension from distutils.command.build_ext import build_ext from distutils import errors from Cython.Build import cythonize from Cython.Compiler.Errors ...
kapadia/geoblend
setup.py
Python
mit
2,841
# vim: ts=4 sw=4 et ai: """This module implements all contexts for state handling during uploads and downloads, the main interface to which being the TftpContext base class. The concept is simple. Each context object represents a single upload or download, and the state object in the context object represents the curr...
msoulier/tftpy
tftpy/TftpContexts.py
Python
mit
15,584
import base64 import fnmatch import glob import json import os import re import shutil import stat import subprocess import urllib.parse import warnings from datetime import datetime, timedelta from distutils.util import strtobool from distutils.version import LooseVersion from typing import Tuple, Any, Union, List, Di...
VirusTotal/content
Tests/Marketplace/marketplace_services.py
Python
mit
150,166
#!/usr/bin/python # Code sourced from AdaFruit discussion board: https://www.adafruit.com/forums/viewtopic.php?f=8&t=34922 and https://github.com/seanbechhofer/raspberrypi/blob/master/python/TSL2561.py import sys import time import re import smbus class Adafruit_I2C(object): @staticmethod def getPiRevision(): ...
arek125/remote-GPIO-control-server
tsl2561.py
Python
mit
9,124
from .. import util from ..util import sqla_compat from . import schemaobj from sqlalchemy.types import NULLTYPE from .base import Operations, BatchOperations import re class MigrateOperation(object): """base class for migration command and organization objects. This system is part of the operation extensibi...
graingert/alembic
alembic/operations/ops.py
Python
mit
69,224
# -*- coding: utf-8 -*- """ Django settings for puput_demo project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ from __future__ import absolute_import, unicode_...
APSL/puput-demo
config/settings/common.py
Python
mit
7,805
import _plotly_utils.basevalidators class FamilysrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="familysrc", parent_name="barpolar.hoverlabel.font", **kwargs ): super(FamilysrcValidator, self).__init__( plotly_name=plotly_name, p...
plotly/python-api
packages/python/plotly/plotly/validators/barpolar/hoverlabel/font/_familysrc.py
Python
mit
475
# -*- coding: utf-8 -*- # # Discover the target host types in the subnet # # @author: Sreejith Kesavan <sreejithemk@gmail.com> import arp import oui import ipcalc import sys class Discovery(object): """ Find out the host types in the Ip range (CIDR) NOTE: This finds mac addresses only within the subnet. ...
semk/iDiscover
idiscover/discover.py
Python
mit
1,840
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding index on 'Place', fields ['place_id'] db.create_index('storybase_geo_place', ['place_id']) ...
denverfoundation/storybase
apps/storybase_geo/migrations/0004_auto.py
Python
mit
7,705
import csv #import datetime import numpy as np import HackApp.models as database from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): def handle(self, *args, **options): percentageAfterNine = 0.05 percentage3to50 = 0.7 longBound = [13.375556, 16.61...
EvaErzin/DragonHack
DragonHack/management/commands/dolocanjeGostisc.py
Python
mit
8,452
import os import mock import pytest import bridgy.inventory from bridgy.inventory import InventorySet, Instance from bridgy.inventory.aws import AwsInventory from bridgy.config import Config def get_aws_inventory(name): test_dir = os.path.dirname(os.path.abspath(__file__)) cache_dir = os.path.join(test_dir, '...
wagoodman/bridgy
tests/test_inventory_set.py
Python
mit
6,497
from bluepy.btle import * import time import serial from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg start_time = time.time() data = [] data2 = [] data3 = [] data4 = [] angles = [] pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') pen = pg.mkPen('k', width=8) app = QtGui.QAppl...
ac769/continuum_technologies
software/ble_live_read_graphical.py
Python
mit
2,073
""" GatewayScanner is an abstraction for searching for KNX/IP devices on the local network. * It walks through all network interfaces * and sends UDP multicast search requests * it returns the first found device """ from __future__ import annotations import asyncio from functools import partial import logging from ty...
XKNX/xknx
xknx/io/gateway_scanner.py
Python
mit
9,132
from django.db import models from django.utils.translation import ugettext_lazy as _ from feincms.module.page.models import Page from feincms.content.richtext.models import RichTextContent from feincms.content.medialibrary.models import MediaFileContent Page.register_extensions('feincms.module.extensions.datepublishe...
symroe/remakery
cms/models.py
Python
mit
615
import sublime, sublime_plugin def clean_layout(layout): row_set = set() col_set = set() for cell in layout["cells"]: row_set.add(cell[1]) row_set.add(cell[3]) col_set.add(cell[0]) col_set.add(cell[2]) row_set = sorted(row_set) col_set = sorted(col_set) rows =...
ciechowoj/minion
output.py
Python
mit
6,974
class Card: count = 0 url = "" name = "" sideboard = -1
Riizade/Magic-the-Gathering-Analysis
card.py
Python
mit
71
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu from __future__ import (unicode_literals, absolute_import, division, print_function) import re import unicodedata import datetime import subprocess from py3compat import string_types, text_type from django.utils impo...
yeleman/uninond
uninond/tools.py
Python
mit
6,367
from django.conf import settings from django.contrib import messages from django.forms import Form from django.http import Http404, HttpResponse, HttpResponseBadRequest from django.shortcuts import get_object_or_404, redirect, render from django.views.decorators.csrf import csrf_exempt from django.utils import timezone...
marceloomens/appointments
appointments/apps/common/views.py
Python
mit
7,355
from collections import defaultdict from typing import cast, Dict, List, NewType from backend.common.consts.api_version import ApiMajorVersion from backend.common.models.event_details import EventDetails from backend.common.models.keys import TeamKey from backend.common.queries.dict_converters.converter_base import Co...
the-blue-alliance/the-blue-alliance
src/backend/common/queries/dict_converters/event_details_converter.py
Python
mit
2,401
import setuptools with open("README.rst") as f: long_description = f.read() setuptools.setup( name='django-diplomacy', version="0.8.0", author='Jeff Bradberry', author_email='jeff.bradberry@gmail.com', description='A play-by-web app for Diplomacy', long_description=long_description, ...
jbradberry/django-diplomacy
setup.py
Python
mit
915
"""Signal pattern matching.""" import re from typing import Union class PatternError(Exception): """Pattern error.""" class Pattern: """Signal pattern representation.""" PATTERN_REGEX = re.compile(r"[01xX]+") PATTERN_REGEX_BYTES = re.compile(b"[01xX]+") def __init__(self, pattern: Union[str, ...
brunosmmm/hdltools
hdltools/patterns/__init__.py
Python
mit
2,709
#!/usr/bin/python import re import time import subprocess out=subprocess.check_output(["cat","/sys/class/net/eth0/address"]) print out print "hi"
vtill/SecyrIT
test/openvpn/main.py
Python
mit
149
# file: numpy_pi.py """Calculating pi with Monte Carlo Method and NumPy. """ from __future__ import print_function import numpy #1 @profile def pi_numpy(total): #2 """Compute pi. """ x = numpy.random.rand(total) ...
rawrgulmuffins/presentation_notes
pycon2016/tutorials/measure_dont_guess/handout/pi/numpy_pi.py
Python
mit
834
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2015-12-30 17:53 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wunderlist', '0011_auto_20151...
passuf/WunderHabit
wunderlist/migrations/0012_auto_20151230_1853.py
Python
mit
631
import os from channels.asgi import get_channel_layer os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ena.settings") channel_layer = get_channel_layer()
froggleston/ena_search_django
ena/ena/asgi.py
Python
mit
156
from rest_framework.serializers import ( HyperlinkedIdentityField, ModelSerializer, SerializerMethodField, ) from comments.api.serializers import CommentSerializer from accounts.api.serializers import UserDetailSerializer from comments.models import Comment from posts.models import Post class PostCreateUpdateSer...
rohitkyadav/blog-api
src/posts/api/serializers.py
Python
mit
1,539
import json import requests class SlackNotification(object): icon_url = "https://github-bogdal.s3.amazonaws.com/freepacktbook/icon.png" def __init__(self, slack_url, channel): self.slack_url = slack_url self.channel = channel if not self.channel.startswith("#"): self.chann...
bogdal/freepacktbook
freepacktbook/slack.py
Python
mit
1,181
""" KINCluster is clustering like KIN. release note: - version 0.1.6 fix settings update pipeline delete unused arguments fix convention by pylint now logging - version 0.1.5.5 fix using custom settings support both moudle and dict - version 0.1.5.4 Update tokenizer, remove stopwords ...
memento7/KINCluster
KINCluster/__init__.py
Python
mit
1,038
import sublime, sublime_plugin class SaveAllExistingFilesCommand(sublime_plugin.ApplicationCommand): def run(self): for w in sublime.windows(): self._save_files_in_window(w) def _save_files_in_window(self, w): for v in w.views(): self._save_existing_file_in_view(v) def _save_existing_file_in_view(self, v)...
app-git-hub/SendTo
examples/save.py
Python
mit
481
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "asteria.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
tunegoon/asteria
manage.py
Python
mit
250
from collections import deque import time import requests # Constants BRAZIL = 'br' EUROPE_NORDIC_EAST = 'eune' EUROPE_WEST = 'euw' KOREA = 'kr' LATIN_AMERICA_NORTH = 'lan' LATIN_AMERICA_SOUTH = 'las' NORTH_AMERICA = 'na' OCEANIA = 'oce' RUSSIA = 'ru' TURKEY = 'tr' # Platforms platforms = { BRAZIL: 'BR1', EUR...
gnozell/Yar-Ha-Har
lib/riotwatcher/riotwatcher.py
Python
mit
22,700
#!python # coding=utf-8 # Package level logger import logging logger = logging.getLogger("pocean") logger.addHandler(logging.NullHandler()) __version__ = "1.0.0"
joefutrelle/pocean-core
pocean/__init__.py
Python
mit
164
from .message import * from functools import wraps import datetime import pymongo import re from app import session class Singleton(type): instance = None def __call__(cls, *args, **kwargs): if not cls.instance: cls.instance = super(Singleton, cls).__call__(*args, **kwargs) return...
gomjellie/SoongSiri
legacy_codes/app/managers.py
Python
mit
10,044
from setuptools import setup with open('requirements.txt') as f: required = f.read().splitlines() setup( name="aloft.py", version="0.0.4", author="Nate Mara", author_email="natemara@gmail.com", description="A simple API for getting winds aloft data from NOAA", license="MIT", test_suite="tests", keywords="avi...
natemara/aloft.py
setup.py
Python
mit
568
from django.apps import AppConfig class AutodoappConfig(AppConfig): name = 'AutoDoApp'
AutoDo/AutoDo
AutoDoApp/apps.py
Python
mit
93
""" ================================================== Sparse linear algebra (:mod:`scipy.sparse.linalg`) ================================================== .. currentmodule:: scipy.sparse.linalg Abstract linear operators ------------------------- .. autosummary:: :toctree: generated/ LinearOperator -- abstra...
DailyActie/Surrogate-Model
01-codes/scipy-master/scipy/sparse/linalg/__init__.py
Python
mit
3,095
# -*- coding: utf-8 -*- # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and # is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012) from reversion.admin import VersionAdmin from django.contrib.gis import admin from .model...
ngageoint/geoq
geoq/agents/admin.py
Python
mit
710
import py from rpython.rlib.jit import JitDriver, hint, set_param from rpython.rlib.jit import unroll_safe, dont_look_inside, promote from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.debug import fatalerror from rpython.jit.metainterp.test.support import LLJitMixin from rpython.jit.codewriter.po...
oblique-labs/pyVM
rpython/jit/metainterp/test/test_recursive.py
Python
mit
47,329
"""Top-level module for releng-sop."""
release-engineering/releng-sop
releng_sop/__init__.py
Python
mit
39
# follow/models.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- from datetime import datetime, timedelta from django.db import models from election.models import ElectionManager from exception.models import handle_exception, handle_record_found_more_than_one_exception,\ handle_record_not_found_exc...
wevote/WeVoteServer
follow/models.py
Python
mit
78,451
# Copyright (c) 2010 by Dan Jacob. # # Some rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and t...
whtsky/parguments
parguments/cli.py
Python
mit
3,906
import unittest from stomp import backward3 class TestBackward3(unittest.TestCase): def test_pack_mixed_string_and_bytes(self): lines = ['SEND', '\n', 'header1:test', '\u6771'] self.assertEqual(backward3.encode(backward3.pack(lines)), b'SEND\nheader1:test\xe6\x9d...
GeneralizedLearningUtilities/SuperGLU
python_module/stomp/test/p3_backward_test.py
Python
mit
884
import collections class Change(object): def __init__(self): super(Change, self).__init__() def makeChange(self, change): coinVaulues = collections.OrderedDict() coinVaulues['h'] = 50 coinVaulues['q'] = 25 coinVaulues['d'] = 10 coinVaulues['n'] = 5 coinVaulues['p'] = 1 coi...
Bjornkjohnson/makeChangePython
Change.py
Python
mit
491
# -*- coding: utf-8 -*- from __future__ import unicode_literals from base64 import b64encode, b64decode import datetime import copy import json from django.conf import settings from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound, HttpResponseNotAllowed from gripcontrol import Channel, Ht...
fanout/webhookinbox
api/views.py
Python
mit
12,930
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT from verta._swagger.base_type import BaseType class UacGetOrganizationByIdResponse(BaseType): def __init__(self, organization=None): required = { "organization": False, } self.organization = organization for k, v in required.items(): if self[k] ...
mitdbg/modeldb
client/verta/verta/_swagger/_public/uac/model/UacGetOrganizationByIdResponse.py
Python
mit
653
from fibonacci import Fibonacci def ans(): return Fibonacci.index(Fibonacci.after(int('9' * 999))) if __name__ == '__main__': print(ans())
mackorone/euler
src/025.py
Python
mit
155
#! /usr/bin/python import yaml def main(): #f = open("data.yaml", "r") f = open("data2.yaml", "r") yd = yaml.load(f) #print "YAML Data: %s" % str(yd) for key in yd: print "%s" % key print "Type: %s" % str(type(yd[key])) print str(yd[key]) print "" def yaml_test():...
CospanDesign/python
yaml/example1.py
Python
mit
620
# -*- coding: utf-8 -*- import zmq import random import time def run(): context = zmq.Context() sender = context.socket(zmq.PUSH) sender.bind('tcp://*:5557') sink = context.socket(zmq.PUSH) sink.connect('tcp://localhost:5558') print 'Press Enter when the workers are ready: ' _ = raw...
disenone/zsync
test/parallel_task/ventilator.py
Python
mit
694
from __future__ import absolute_import, print_function, division import copy import os import re import urwid from mitmproxy import filt from mitmproxy import script from mitmproxy import utils from mitmproxy.console import common from mitmproxy.console import signals from netlib.http import cookies from netlib.http...
tdickers/mitmproxy
mitmproxy/console/grideditor.py
Python
mit
19,995
#!/usr/bin/env python # A library to scrape statistics from Arris CM820 and similar cable modems # Inspired by https://gist.github.com/berg/2651577 import BeautifulSoup import requests import time cm_time_format = '%a %Y-%m-%d %H:%M:%S' def get_status(baseurl): # Retrieve and process the page from the modem ...
wolrah/arris_stats
arris_scraper.py
Python
mit
5,303
import logging from src.settings import JINJA_ENVIRONMENT from src.base import BaseHandler from src.main.models import Torrent, UserTorrent from google.appengine.ext import ndb from google.appengine.api import users import arrow from time import sleep class IndexPage(BaseHandler): def get(self): # new mov...
Tjorriemorrie/trading
18_theoryofruns/app_old/src/main/main.py
Python
mit
3,167
from django.shortcuts import render from rest_framework import viewsets from waterfall_wall.serializers import ImageSerializer from waterfall_wall.models import Image def index(request): context = {} return render(request, 'waterfall_wall/index.html', context) class ImageViewSet(viewsets.ModelViewSet): "...
carlcarl/rcard
waterfall_wall/views.py
Python
mit
455
from django.core.management.base import BaseCommand from django.contrib.auth.models import User from photos.models import PhotoSceneCategory from photos.add import add_photo #from licenses.models import License class Command(BaseCommand): args = '<flickr_dir>' help = 'Adds photos from flickr' def handle...
seanbell/opensurfaces
server/photos/management/commands/add_special.py
Python
mit
1,191
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable=W0141 import sys from pandas.core.base import PandasObject from pandas.core.common import adjoin, notnull from pandas.core.index import Index, MultiIndex, _ensure_index from pandas import compat from pandas.compat import(StringIO, lzip, r...
sauloal/cnidaria
scripts/venv/lib/python2.7/site-packages/pandas/core/format.py
Python
mit
88,798
""" Custom made pose attribute for simulation """ import math from vector_3 import Vector3 from polar_vector import PolarVector class Pose: def __init__(self): self.position = Vector3() self.velocity = PolarVector()
comprobo-final-project/comprobo_final_project
comprobo_final_project/scripts/simulator/pose.py
Python
mit
241
# -*- coding: utf-8 -*- # # RADICAL-Pilot documentation build configuration file, created by # sphinx-quickstart on Mon Dec 3 21:55:42 2012. # # 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. #...
JensTimmerman/radical.pilot
docs/source/conf.py
Python
mit
12,807
import os import webapp2 from mako.template import Template from mako.lookup import TemplateLookup class MainHandler(webapp2.RequestHandler): def get(self): template_values = { 'some_foo': 'foo', 'some_bar': 'bar' } # the template file in our GAE app directory path = os.path.join(os.path....
swangui/ggrid
foobar.py
Python
mit
638
import time, sys import numpy as np import matplotlib.pyplot as plt sys.path.append('../../') from py2Periodic.physics import twoLayerQG from numpy import pi params = { 'f0' : 1.0e-4, 'Lx' : 1.0e6, 'beta' : 1.5e-11, 'defRadius' : 1.5e4, 'H1' : 500.0, 'H2' ...
glwagner/py2Periodic
tests/twoLayerQG/testTwoLayerQG.py
Python
mit
1,366
from __future__ import unicode_literals from rbpkg.package_manager.dep_graph import DependencyGraph from rbpkg.testing.testcases import TestCase class DependencyGraphTests(TestCase): """Unit tests for rbpkg.package_manager.dep_graph.DependencyGraph.""" def test_iter_sorted_simple(self): """Testing D...
reviewboard/rbpkg
rbpkg/package_manager/tests/test_dep_graph.py
Python
mit
1,217
import docker from cargo.container import Container from cargo.image import Image # this is a hack to get `__getattribute__` working for a few reserved properties RESERVED_METHODS = ['containers', '_client', 'images', 'info', 'start', 'stop'] class Dock(object): """Wrapper class for `docker-py` Client instances"""...
mvanveen/cargo
cargo/dock.py
Python
mit
2,845
""" Copyright: (c) 2012-2014 Artem Nezvigin <artem@artnez.com> License: MIT, see LICENSE for details """ from functools import wraps from flask import g, request, session, render_template, url_for, redirect from faceoff.models.user import find_user def templated(template_name=None): """ Automatically renders...
artnez/faceoff
faceoff/helpers/decorators.py
Python
mit
1,421
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of holmesalf. # https://github.com/holmes-app/holmes-alf # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2014 Pablo Aguiar scorphus@gmail.com from holmesalf import BaseAuthNZWrapper from alf.client i...
holmes-app/holmes-alf
holmesalf/wrapper.py
Python
mit
1,536
#!/usr/bin/env python # -*- coding: utf-8 -*- """ read-bookmark.py ~~~~~~~~~~~~~~~~ This module is an example of how to harness the Readability API w/ oAuth. This module expects the following environment variables to be set: - READABILITY_CONSUMER_KEY - READABILITY_CONSUMER_SECRET - READABILITY_ACCESS_TOKEN - READA...
alexwaters/python-readability-api
examples/read-bookmarks.py
Python
mit
2,034
from flask import render_template from . import main @main.app_errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @main.app_errorhandler(500) def internal_server_error(e): return render_template('500.html'), 500
hubinary/flasky
app/main/errors.py
Python
mit
255
from unittest import TestCase from paramiko import SSHException from pyinfra.api import Config, State from pyinfra.api.connect import connect_all from pyinfra.api.exceptions import NoGroupError, NoHostError, PyinfraError from ..paramiko_util import PatchSSHTestCase from ..util import make_inventory class TestInven...
Fizzadar/pyinfra
tests/test_api/test_api.py
Python
mit
2,193
import click import mock import pytest from click.testing import CliRunner from sigopt.cli import cli class TestRunCli(object): @pytest.mark.parametrize('opt_into_log_collection', [False, True]) @pytest.mark.parametrize('opt_into_cell_tracking', [False, True]) def test_config_command(self, opt_into_log_collect...
sigopt/sigopt-python
test/cli/test_cli_config.py
Python
mit
1,165
import unittest import ezgal.zf_grid import numpy as np import math # I put the test data for the zf_grid tests in # tests.zf_grid instead of in tests because # there is a lot of data but it is all # specific for this test. import tests.zf_grid class test_get_rest_mags(tests.zf_grid.test_zf_grid): def test_get_r...
cmancone/ezgal
tests/zf_grid/test_get_rest_mags.py
Python
mit
998
from __future__ import absolute_import import os import ming from ming import Session from ming.odm import ThreadLocalODMSession from ming import create_datastore from depot.fields.ming import DepotExtension mainsession = Session() DBSession = ThreadLocalODMSession(mainsession, extensions=(DepotExtension, )) database...
amol-/depot
tests/base_ming.py
Python
mit
896
from __future__ import absolute_import, division, print_function import ast from jaspyx.ast_util import ast_load, ast_call from jaspyx.visitor import BaseVisitor class BinOp(BaseVisitor): def visit_BinOp(self, node): attr = getattr(self, 'BinOp_%s' % node.op.__class__.__name__, None) attr(node.lef...
ztane/jaspyx
jaspyx/visitor/binop.py
Python
mit
1,067
#!/usr/bin/python3 import argparse import collections import json import string import sys header_template = """ #ifndef ASPARSERATIONS_GENERATED_${class_name}_H_ #define ASPARSERATIONS_GENERATED_${class_name}_H_ #include <array> #include <map> #include <memory> #include <set> #include <utility> #include <vector> $h...
TheAspiringHacker/Asparserations
bootstrap/parser_gen.py
Python
mit
13,102
#!/usr/bin/python # coding: utf-8 class Solution(object): def convertToTitle(self, n): """ :type n: int :rtype: str """ return "" if n == 0 else self.convertToTitle((n - 1) / 26) + chr((n - 1) % 26 + ord('A'))
Lanceolata/code-problems
python/leetcode/Question_168_Excel_Sheet_Column_Title.py
Python
mit
255
import requests import json import time import subprocess import re import os from collections import OrderedDict from test_framework.test_framework import OpenBazaarTestFramework, TestFailure from test_framework.smtp_server import SMTP_DUMPFILE class SMTPTest(OpenBazaarTestFramework): def __init__(self): ...
OpenBazaar/openbazaar-go
qa/smtp_notification.py
Python
mit
6,891
__author__ = 'djw' class FieldNodeItem(object): """ An item built on a player's field board, held within a node/cell on that board """ def __init__(self): self.cattle = 0 self.boars = 0 self.sheep = 0 self.grain = 0 self.vegetables = 0 def update_animals(s...
sourlows/pyagricola
src/field/node_item.py
Python
mit
3,158
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: ListNode) -> ListNode: current = head previous = None while current is not None: ...
danielgarm/Public-Algorithms
LeetCode/0206 - Reverse Linked List.py
Python
mit
472
import warnings class Yaku: yaku_id = None tenhou_id = None name = None han_open = None han_closed = None is_yakuman = None def __init__(self, yaku_id=None): self.tenhou_id = None self.yaku_id = yaku_id self.set_attributes() def __str__(self): return ...
MahjongRepository/mahjong
mahjong/hand_calculating/yaku.py
Python
mit
1,121
# Copyright (C) 2016 Fan Long, Martin Rianrd and MIT CSAIL # Prophet # # This file is part of Prophet. # # Prophet 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 y...
jyi/ITSP
prophet-gpl/tools/libtiff-prepare-test.py
Python
mit
1,700