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 |
|---|---|---|---|---|---|
import flickrapi
import csv
import sys
import datetime
import argparse
import os
# environment variable keys
ENV_KEY = 'FLICKR_API_KEY'
ENV_SECRET = 'FLICKR_API_SECRET'
MAX_PHOTOS_PER_PAGE = 500
# column headers for output file
columns = ['Title', 'Upload date', 'photo_id', 'url', 'Description',
'View cou... | jordanjoz1/flickr-views-counter | count_views.py | Python | mit | 4,590 |
# -*- coding: utf-8 -*-
import scrapy
class QasifengSpider(scrapy.Spider):
name = "QASifeng"
allowed_domains = ["ifeng.com"]
start_urls = ['http://ifeng.com/']
def parse(self, response):
pass
| lijiabogithub/QUANTAXIS | QUANTAXIS/QASpider/QAS/QAS/spiders/QASifeng.py | Python | mit | 219 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', 'apps.neo_graph_test.views.create_graph', name='create_graph'),
url(r'^', include('apps.citizens.urls')),
... | levithomason/neo | apps/neo_graph_test/urls.py | Python | mit | 388 |
import datetime
import tweepy
from geopy.geocoders import Nominatim
import json
from secret import *
import boto3
import re
import preprocessor as p
import time
p.set_options(p.OPT.URL, p.OPT.EMOJI)
# Get the service resource.
dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
table = dynamodb.Table('fuck... | Gknoblau/gladitude | twitter/twitter_tweepy.py | Python | mit | 3,076 |
import logging
# This is a minimal configuration to get you started with the Text mode.
# If you want to connect Errbot to chat services, checkout
# the options in the more complete config-template.py from here:
# https://raw.githubusercontent.com/errbotio/errbot/master/errbot/config-template.py
BACKEND = 'Text' # E... | PeytonXu/learn-python | cases/errbot/config.py | Python | mit | 761 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Lunzhy'
| lunzhy/PyShanbay | gui/__init__.py | Python | mit | 71 |
import requests
import json
import hashlib
"""
subscriber status codes for use with API: (undocumented in API)
1 active
2 activation pending
3 not activated
4 resigned
5 soft bouncing
8 hard bouncing
"""
class FreshMail(object):
"""
Custom class for Freshmail REST API
author: Dariusz Stepniak <stepniak.da... | deasek/freshmail-python | freshmail.py | Python | mit | 6,906 |
#!/usr/bin/env python
from __future__ import print_function
import multiprocessing
import gunicorn.app.base
from gunicorn.six import iteritems
import os, sys
import re
import shutil
import tempfile
import pyferret
from paste.request import parse_formvars
import subprocess
from jinja2 import Template
import itertoo... | KatiRG/wms-pyferret | pyferretWMS_flask.py | Python | mit | 14,186 |
import itertools
import random
from collections import defaultdict
from lampost.di.app import on_app_start
from lampost.di.config import on_config_change, config_value
from lampost.di.resource import Injected, module_inject
from lampost.event.zone import Attachable
from lampost.gameops.action import ActionCache
from l... | genzgd/Lampost-Mud | lampmud/env/room.py | Python | mit | 9,037 |
from autobreadcrumbs import site
from django.utils.translation import ugettext_lazy
site.update({
'po_projects:project-index': ugettext_lazy('PO Projects'),
'po_projects:project-create': ugettext_lazy('Create a new project'),
'po_projects:project-details': ugettext_lazy('<small class="subhead">Project</sma... | sveetch/PO-Projects | po_projects/crumbs.py | Python | mit | 697 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutClassMethods in the Ruby Koans
#
from runner.koan import *
class AboutClassAttributes(Koan):
class Dog:
pass
def test_objects_are_objects(self):
fido = self.Dog()
self.assertEqual(True, isinstance(fido, object))
def... | taw/python_koans | python3/koans/about_class_attributes.py | Python | mit | 4,920 |
# -*- coding: utf-8 -*-
"""
Created by chiesa on 18.01.16
Copyright 2015 Alpes Lasers SA, Neuchatel, Switzerland
"""
import json
import subprocess
from tempfile import NamedTemporaryFile
__author__ = 'chiesa'
__copyright__ = "Copyright 2015, Alpes Lasers SA"
def get_entry_points(venv_python_path, project_name):
... | chiesax/sandbox | sandbox/install_project/venv_inspect.py | Python | mit | 1,009 |
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
res = 0
left, right = 0, len(height) - 1
while left < right:
if height[left] <= height[right]:
res = max(res, height[left] * (right - l... | SF-Zhou/LeetCode.Solutions | solutions/container_with_most_water_2.py | Python | mit | 480 |
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Bob Leers (http://www.novacode.nl)
# See LICENSE file for full licensing details.
from datetime import datetime
from lxml import etree
from . import CommonTestCase
from ..controls import DateControl
class DateTestCase(CommonTestCase):
def setUp(self):
super... | bobslee/orbeon-xml-api | orbeon_xml_api/tests/controls/test_date.py | Python | mit | 2,535 |
from __future__ import absolute_import
from .exception import *
from .alpineobject import AlpineObject
from .user import User
import json
class Workspace(AlpineObject):
"""
A class for interacting with workspaces. The top-level methods deal with workspace properties. The subclass
`Member` can be used to... | AlpineNow/python-alpine-api | alpine/workspace.py | Python | mit | 18,353 |
"""
.. py:attribute:: terminal
Exactly like ``bearlibterminal.terminal``, but for any function that takes
arguments ``x, y``, ``dx, dy``, or ``x, y, width, height``, you can
instead pass a single argument of type :py:class:`Point` (for the first
two) or :py:class:`Rect` (for the last).
This makes ... | irskep/clubsandwich | clubsandwich/blt/nice_terminal.py | Python | mit | 3,101 |
import numpy as np
from sys import stdin, stdout, argv
# given a tree and a node, it returns all the descendant leaves from this node.
def get_leaves(tree, node):
# if node is already a leaf, return it
if node not in tree.keys():
return [node]
# otherwise explore the tree to get all leaves from th... | SembeiNorimaki/Bioinformatics | Bio_V/HierarchicalClustering.py | Python | mit | 3,386 |
import unittest
from ngram_window_test_case import NgramWindowTestCase
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(NgramWindowTestCase))
return suite
if __name__ == "__main__":
unittest.TextTestRunner().run(suite())
| FilippoC/anatomize | unittest/ngram/suite.py | Python | mit | 296 |
import platform
from base64 import b64encode
import re
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.defaultimpl.default_marshaller import \
DefaultMarshaller
from ingenico.connect.sdk.domain.metadata.shopping_cart_extension import ShoppingCartExtension
from request_header impor... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/meta_data_provider.py | Python | mit | 5,912 |
import warnings
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import authenticate
UNMASKED_DIGITS_TO_SHOW = 6
mask_password = lambda p: "%s%s" % (p[:UNMASKED_DIGITS_TO_SHOW], "*" * max(len(p) - UNMASKED_DIGITS_TO_SHOW, 0))
# Originally from django.contr... | edac-epscor/nmepscor-data-collection-form | application/builder/forms.py | Python | mit | 2,579 |
from cardboard import types
from cardboard.ability import (
AbilityNotImplemented, spell, activated, triggered, static
)
from cardboard.cards import card, common, keywords, match
@card("Crovax the Cursed")
def crovax_the_cursed(card, abilities):
def crovax_the_cursed():
return AbilityNotImplemented
... | Julian/cardboard | cardboard/cards/sets/stronghold.py | Python | mit | 26,294 |
# -*- coding: utf-8 -*-
from .parsers.parser import CsvMapParser
from .models.fields.base import ListField
from .models.fields import ModelDescriptor
class ConvertResult(object):
def __init__(self, map_result, models = None):
self.__map_result = map_result
self.__models = models
@property
... | eHanlin/csv-map-converter | csv_map_converter/converter.py | Python | mit | 2,150 |
'''
Collection of Windows-specific I/O functions
'''
import msvcrt
import time
import ctypes as ct
from pynhost.platforms import winconstants
EnumWindows = ct.windll.user32.EnumWindows
EnumWindowsProc = ct.WINFUNCTYPE(ct.c_bool, ct.POINTER(ct.c_int), ct.POINTER(ct.c_int))
GetWindowText = ct.windll.user32.GetWindowTex... | evfredericksen/pynacea | pynhost/pynhost/platforms/windows.py | Python | mit | 5,180 |
import os
import csv
from datetime import datetime
lethe_dir = os.path.dirname(__file__)
class PersonNotFoundError(BaseException):
pass
class Person(object):
"""
Class to store details of each person
"""
def __init__(self, name, email, dob, organiser, checksum):
"""
Constructor t... | mandshaw/lethe | lethe/rollardex.py | Python | mit | 2,314 |
"""Parse arguments from command line and configuration files."""
import fnmatch
import os
import sys
import re
import logging
from argparse import ArgumentParser
from . import __version__
from .libs.inirama import Namespace
from .lint.extensions import LINTERS
#: A default checkers
DEFAULT_LINTERS = 'pycodestyle', '... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylama/pylama/config.py | Python | mit | 8,032 |
from __future__ import division
import os
import unittest
import threading
import logging
from random import expovariate, random
from math import log
from feemodel.tests.config import (test_memblock_dbfile as dbfile, txref,
tmpdatadir_context)
from feemodel.txmempool import MemBlock... | bitcoinfees/bitcoin-feemodel | feemodel/tests/test_txrate.py | Python | mit | 6,229 |
"""Filters"""
from skimage.color import rgb2gray
from skimage.transform import resize
import numpy as np
from modular_rl import *
class ObFilterFF(object):
def __init__(self, new_width, new_height):
self.w = new_width
self.h = new_height
self.f = Flatten()
def __call__(self, ob):
... | domluna/ml_p5_capstone | filters.py | Python | mit | 1,135 |
__author__ = 'Chong-U Lim, culim@mit.edu'
import uinput
def Simulator():
def __init__(self):
pass
def test1(self):
device = uinput.Device([uinput.KEY_E, uinput.KEY_H, uinput.KEY_L, uinput.KEY_O])
device.emit_click(uinput.KEY_H)
| chongdashu/puzzlescript-analyze | python/simulator.py | Python | mit | 248 |
r"""
This module is a VTK Web server application.
The following command line illustrate how to use it::
$ vtkpython .../vtk_web_cone.py
Any VTK Web executable script come with a set of standard arguments that
can be overriden if need be::
--host localhost
Interfac... | timkrentz/SunTracker | IMU/VTK-6.2.0/Web/Applications/Cone/server/vtk_web_cone.py | Python | mit | 3,893 |
import _plotly_utils.basevalidators
class DtickValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="dtick", parent_name="scatter3d.line.colorbar", **kwargs
):
super(DtickValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/line/colorbar/_dtick.py | Python | mit | 496 |
from .cli import cli
if __name__ == "__main__":
cli()
| tdi/cfn-inspect | cfn_inspect/__main__.py | Python | mit | 58 |
#pylint: disable=C0301, C0103, W0212
"""
.. module:: radical.pilot.scheduler.Interface
:platform: Unix
:synopsis: The abstract interface class for all schedulers.
.. moduleauthor:: Ole Weidner <ole.weidner@rutgers.edu>
"""
__copyright__ = "Copyright 2013-2014, http://radical.rutgers.edu"
__license__ = "MIT"
... | JensTimmerman/radical.pilot | src/radical/pilot/scheduler/interface.py | Python | mit | 2,025 |
from mosek.fusion import Model, Domain, Expr, ObjectiveSense
import sys
# TODO: need a way to determine if we're adding something in front of an
# existing clique, or intersecting with it, etc.
# Example 2. Column generation approach.
# Iteration 2, subproblem.
# Output:
#
# Images:
# w_1 = 1
# ... | ryanjoneil/docker-image-construction | ipynb/examples/example2-3-sub.py | Python | mit | 7,365 |
#!/usr/bin/python
import subprocess
import os
import time
import sys
import threading
import signal
from upload import ftp_open, upload
import gpio
from gpio import setup,mode,read,set,cleanup
led_red=91
led_amber=90
led_green=65
button_switch=95
def updateIndicators(stop_event):
blinker=0
while not stop_event.... | sobi-wan/helmet | recipes-example/helmet-rootfs/helmet-rootfs-1.0.0/home/root/josh.py | Python | mit | 4,911 |
#*******************************************************************************
#
# Copyright (C) 2019 Xilinx, 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 w... | Xilinx/meta-petalinux | lib/devtool/plnx-sdk-update.py | Python | mit | 6,269 |
# voter/controllers_contacts.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from dateutil import parser
from wevote_functions.functions import positive_value_exists
from .models import VoterContactEmail, VoterManager
def assemble_contact_display_name(
first_name=None,
last_name=None,... | wevote/WeVoteServer | voter/controllers_contacts.py | Python | mit | 10,847 |
#from .brick import DominoesBrick as Brick
#from .pool import DominoesPool as Pool
#from .snake import DominoesSnake as Snake
class DominoesTable():
def __init__(self):
self.possible_bricks_in_pool = []
for side_a in range(7):
for side_b in range(side_a, 7):
self.possible_bricks_in_pool.append(... | theysconator/DominoesAI | dominoes/table.py | Python | mit | 638 |
from datetime import datetime, timedelta
import warnings
import operator
from textwrap import dedent
import numpy as np
from pandas._libs import (lib, index as libindex, tslib as libts,
algos as libalgos, join as libjoin,
Timedelta)
from pandas._libs.lib import is_da... | ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/pandas/core/indexes/base.py | Python | mit | 170,379 |
# -*- coding: utf-8 -*-
"""Autoscaling configuration for endpoints."""
from verta._internal_utils import documentation
from ._autoscaling import Autoscaling
documentation.reassign_module(
[Autoscaling],
module_name=__name__,
)
| mitdbg/modeldb | client/verta/verta/endpoint/autoscaling/__init__.py | Python | mit | 239 |
from django.db import models
class AbstractFormSetting(models.Model):
form = models.OneToOneField(
"wagtailstreamforms.Form",
on_delete=models.CASCADE,
related_name="advanced_settings",
)
class Meta:
abstract = True
def __str__(self):
return self.form.title
| AccentDesign/wagtailstreamforms | wagtailstreamforms/models/abstract.py | Python | mit | 318 |
# Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
import os
import pickle
import random
import re
import subprocess
import sys
import sysconfig
import textwrap
import time
import unittest
from test import support
from te... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_capi.py | Python | mit | 27,270 |
import ast
def square_it(x):
return x * x
class Transformer1(ast.NodeTransformer):
pass
| ucb-sejits/ast_tool_box | test/sample.py | Python | mit | 101 |
# coding: utf-8
# # Clean the raw data
#
# ## Data from U.S. Energy Information Administration
#
# Data URL: [eia.gov](http://www.eia.gov/coal/data.cfm)
#
# Combining and cleaning the raw csv files into a cleaned data set and coherent database.
#
# Generally a good idea to have a separate data folder with the ra... | jbwhit/OSCON-2015 | deliver/coal_data_cleanup.py | Python | mit | 2,214 |
import sys
with open(sys.argv[1]) as input_file:
for problem in input_file.readlines():
if (int(problem.strip()) % 2 == 0):
print(1)
else:
print(0)
| leaen/Codeeval-solutions | even-numbers.py | Python | mit | 160 |
import os
import csv
import numpy as np
from eqep.interpolation.rbf_pgvinterpolator import RbfPGVInterpolator
class EarthQuake:
"""Stores the data of an earthquake
It has a grid of coordinates with a certain (interpolated)
peak ground velocity for every cell.
This class is usually used in combinatio... | TGM-HIT/eqep-api | eqep/data/earthquake.py | Python | mit | 3,507 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def CustomizationStartedEvent(vim, *args, **kwargs):
'''The customization sequence has st... | xuru/pyvisdk | pyvisdk/do/customization_started_event.py | Python | mit | 1,190 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
# Add python-bitcoinrpc to module search path:
import os
import sys
sys.path.app... | bankonme/MUE-Src | qa/rpc-tests/test_framework.py | Python | mit | 4,729 |
"""
Server Density Plugin
ColdFusion stats
https://github.com/MWers/sd-coldfusion-plugin/
Version: 1.0.2
"""
import os
import platform
import subprocess
class ColdFusion:
sd_cfstat_opt = 'coldfusion_cfstat_path'
cfstat_locations = ['/opt/ColdFusion11/bin/cfstat',
'/opt/coldfusi... | MWers/sd-coldfusion-plugin | plugins/ColdFusion.py | Python | mit | 3,975 |
from flask import url_for
from tests import ZKWTestCase
from zkw.models import Sourdough, User
class SourdoughDetailsPageTests(ZKWTestCase):
def setUp(self):
super(SourdoughDetailsPageTests, self).setUp()
self.user_1 = User.get_by_email('user_1@example.com')
self.active_sd = Sourdough.q... | zgoda/zakwasy | tests/test_sddetails.py | Python | mit | 2,004 |
import os
from io import BytesIO
from tempfile import TemporaryDirectory
import pytest
from PilLite import Image
BASE_DIR = os.path.dirname(__file__)
SIZE = (256, 184)
@pytest.fixture(scope='function')
def tmpdir():
with TemporaryDirectory() as folder:
yield folder
@pytest.fixture(params=[
'.png', ... | alexa-infra/pil-lite | test/test_basic.py | Python | mit | 3,573 |
""" This file mainly exists to allow python setup.py test to work. """
import os
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'testdb',
}
},
INSTALLED_APPS=(
... | cschwede/django-userattributes | userattributes/runtests.py | Python | mit | 846 |
# -*- coding: utf-8 -*-
from mtlmurals.common.text import replace
def test_replace():
assert replace('this ; is a | test', (';', '-'), ('|', '--')) == 'this - is a -- test'
| ellmetha/mtlmurals | tests/pytests/unit/common/test_text.py | Python | mit | 180 |
from datetime import datetime
JIRA_FORMAT = "%Y/%m/%d %H:%M"
DB_FORMAT = "%d/%m/%Y %H:%M:%S"
def format_jira_date(date: str):
return datetime.strptime(date[0:19], "%Y-%m-%dT%H:%M:%S")
def to_jira_format(date: datetime):
return date.strftime(JIRA_FORMAT)
def to_str(date: datetime):
return date.strftim... | boggard/jira-telegram-bot | utils/date_util.py | Python | mit | 333 |
import os
from configurations import values
from boto.s3.connection import OrdinaryCallingFormat
from {{cookiecutter.app_name}}.config.common import Common
try:
# Python 2.x
import urlparse
except ImportError:
# Python 3.x
from urllib import parse as urlparse
class Production(Common):
# Honor th... | amitassaraf/angular2-django-boilerplate | {{cookiecutter.github_repository_name}}/src/{{cookiecutter.app_name}}/config/production.py | Python | mit | 3,763 |
#! /usr/bin/env python3
from torch.nn import ModuleList
from gpytorch.likelihoods import Likelihood
def _get_tuple_args_(*args):
for arg in args:
if isinstance(arg, tuple):
yield arg
else:
yield (arg,)
class LikelihoodList(Likelihood):
def __init__(self, *likelihood... | jrg365/gpytorch | gpytorch/likelihoods/likelihood_list.py | Python | mit | 1,999 |
from rest_framework import serializers
from products.models import Product
class ProductSerializer(serializers.ModelSerializer):
class Meta:
model = Product
fields = ('id', 'name', 'description', 'thumbnail')
| matachi/product-gallery | products/serializers.py | Python | mit | 230 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/job_get_options.py | Python | mit | 3,278 |
# 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/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py | Python | mit | 12,027 |
###Level builder feature list
#preview of current section of level
#background texture pallete
#foreground texture pallete
#save/load/new interface
#addition of item balls
#addition of npcs
#screenchangers: addition, connection, and
#reciprocity checking (for indivdual and level)
#is there another world at the... | mgavrin/Punkemon | level builder v0+0-0-1i.py | Python | mit | 21,712 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Rene Liebscher
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version.... | avatar29A/pyfuzzy | fuzzy/set/operations.py | Python | mit | 15,588 |
# -*- coding: ascii -*-
from urllib.request import urlparse
from urllib.parse import urljoin, urldefrag
def validate_url(url, parent_url='http:'):
"""
Validate a URL to be a string having an explicit recognized scheme.
Arguments:
url: string URL
parent_url: optional string URL from which... | samalba/image-spider | spider/validate_url.py | Python | mit | 987 |
"""
@brief test log(time=4s)
@author Xavier Dupre
"""
import sys
import os
import unittest
import warnings
import sphinx
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.helpgen import rst2html
from pyquickhelper.sphinxext import process_downloadlink_role
from pyquickhelper.te... | sdpython/pyquickhelper | _unittests/ut_sphinxext/test_downloadlink_extension.py | Python | mit | 3,427 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-26 11:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('codestreak', '0001_initial'),
]
operations = [
migrations.AlterField(
... | arlyon/codestreak | migrations/0002_auto_20170226_1202.py | Python | mit | 476 |
"""
Development settings
Data is kept within the project directory
(initialize as required, e.g. by copying initial testdata).
Service configuration is kept under personal home directory to
protect secret keys, etc.
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_f... | gklyne/annalist | src/annalist_root/annalist_site/settings/devel.py | Python | mit | 1,731 |
"""whoa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | htwenhe/DJOA | whoa/urls.py | Python | mit | 1,112 |
"""Abstract base classes for kernel client channels"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import abc
from IPython.utils.py3compat import with_metaclass
class ChannelABC(with_metaclass(abc.ABCMeta, object)):
"""A base class for all channel ABCs.... | mattvonrocketstein/smash | smashlib/ipy3x/kernel/channelsabc.py | Python | mit | 2,319 |
from __future__ import division
import bisect
import math
import random
from collections import defaultdict
from itertools import chain
from operator import attrgetter, itemgetter
######################################
# Non-Dominated Sorting (NSGA-II) #
######################################
def selNSGA2(indivi... | DailyActie/Surrogate-Model | 01-codes/deap-master/deap/tools/emo.py | Python | mit | 22,227 |
"""
Auto-drawer for http://pokedraw.net/
All coordinates assume a screen resolution of 1366x768, and Chrome
maximized with the Bookmarks Toolbar enabled.
Down key has been hit 4 times to center play area in browser, and Let's Draw has been clicked.
"""
import math
import win32api, win32con, win32gui
import ImageGrab
i... | wyliew/AutoPokeDraw | index.py | Python | mit | 3,166 |
#!/usr/bin/env python
import datetime
import math
import optparse
import os
import re
import sys
import threading
import time
import webbrowser
import logging
from collections import namedtuple, OrderedDict
from functools import wraps
from watchdog.observers.polling import PollingObserver
from watchdog.events import ... | leeahoward/sqlite-web | sqlite_web/sqlite_web.py | Python | mit | 28,483 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Version.version'
db.alter_column(u'pypi_version', 'version', self.gf('django.db.models.fi... | kitsunde/django-pypi | pypi/migrations/0004_auto__chg_field_version_version.py | Python | mit | 2,623 |
#!/usr/bin/env python
import os.path
from os import path
from datetime import date
import sys
import com
import release
import dev
import proj
upstream_org_url = "https://github.com/lvgl/"
workdir = "./release_tmp"
proj_list = [ "lv_sim_eclipse_sdl", "lv_sim_emscripten"]
def upstream(repo):
return upstream_org_u... | littlevgl/lvgl | scripts/release/main.py | Python | mit | 1,494 |
# -*- coding: utf-8 -*-
#
# c-simulations documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 19 12:55:22 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
# autogenerated file.... | gsmcwhirter/c-simulations | docs/source/conf.py | Python | mit | 8,316 |
import numpy as np
import os
__location__ = os.path.realpath(
os.path.join(os.getcwd(),
os.path.dirname(__file__))
) + "/"
class Dataset():
"""
I want to create a similar object to that one existing in R: Dataframe
"""
def __init__(self, tra... | omartrinidad/schiffsdiebe | schiffsdiebe/datasets/__init__.py | Python | mit | 2,327 |
import os
import json
from django.test import TestCase
from documents.models import Document
from documents.exporters.sql import (MysqlExporter, OracleExporter,
PostgresExporter, SQLiteExporter)
TEST_DOCUMENT_PATH = os.path.join(os.path.dirname(__file__),
... | fatiherikli/dbpatterns | web/dbpatterns/documents/tests.py | Python | mit | 3,562 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: github.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impo... | dhilipsiva/talks | assets/2019-11-30/github_pb2.py | Python | mit | 6,115 |
from .cart import Cart
def cart(request):
return {'cart': Cart(request)}
| IlyaDjurin/django-shop | cart/context_processors.py | Python | mit | 80 |
import pytest, sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../")
from unittest import TestCase
from pylogic.case import Case
from pylogic.knowledge_base import KnowledgeBase
from pylogic.functions import _, count_answers
class TestKnowledgeBase2(TestCase):
base2 = KnowledgeBase(3)
... | fran-bravo/pylogic-module | test/test_knowledge_base2.py | Python | mit | 1,776 |
import array
import struct
import numpy as np
class File(object):
def __init__(self, file_name):
""" Reads a gotetra grid file located at file_name. Returns an object
with various header fields along with a grid of positions ordered
according to their positions in the ICs.
Data gri... | phil-mansfield/gotetra | python/gtet.py | Python | mit | 3,817 |
from django.db import models
from django.contrib.auth.models import User
import requests
from datetime import datetime
from BeautifulSoup import BeautifulSoup
import re
SPOJ_ENDPOINT = "http://www.spoj.com/status/%s/signedlist/"
class SpojUser(models.Model):
user = models.OneToOneField(User)
spoj_handle = mo... | krisys/SpojBot | src/spojbot/bot/models.py | Python | mit | 6,922 |
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-tagcon',
version='0.1alpha1',
description="A template tag constructor library for Django.",
long_description=read('README.rst'),
author='Tom Tobin'... | rob-b/django-tagcon | setup.py | Python | mit | 783 |
from urllib.parse import urlparse
import os.path
import requests
from time import sleep
from random import randrange
import glob
import parsers
import time
import csv
import cleaner
AD_URL = 'http://m.finn.no/job/fulltime/ad.html?finnkode='
update = ['sqamlr1dlesu0qiarus6pvzjgh']
listdict = {}
for line in open('list... | wittrup/crap | sCRAPing/finn.no/jobb.py | Python | mit | 2,735 |
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_lazy as _
User = get_user_model()
class AdminUserCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widg... | kasper190/SPAforum | accounts/forms.py | Python | mit | 2,436 |
#!/usr/bin/env python
#
# restrict_long_contigs.py
#
# USAGE: restrict_long_contigs.py [options] <input_directory> \
# <output_directory>
#
# Options:
# -h, --help show this help message and exit
# -l MINLEN, --minlen=MINLEN
# Minimum length o... | widdowquinn/scripts | bioinformatics/restrict_long_contigs.py | Python | mit | 7,563 |
# coding=UTF-8
from decimal import Decimal
from kle2xy import KLE2xy
numpad_code = """["Numlock","/","*","-"],
["7\\nHome","8\\nUp","9\\nPgUp",{h:2},"+"],
["4\\nLeft","5","6\\nRight"],
["1\\nEnd","2\\nDown","3\\nPgDn",{h:2},"Enter"],
[{w:2},"0\\nIns",".\\nDel"]
"""
def test_numpad():
i = KLE2xy(numpad_code)
... | skullydazed/kle2xy | test_numpad.py | Python | mit | 4,105 |
#!/usr/bin/env python3
"""
>>> baralho = Baralho()
>>> len(baralho)
52
>>> baralho[0]
Carta(valor='2', naipe='paus')
>>> baralho[-1]
Carta(valor='A', naipe='espadas')
>>> from random import choice
>>> choice(baralho) #doctest:+SKIP
Carta(valor='4', naipe='paus')
... | pythonprobr/notmagic | pt-br/baralho.py | Python | mit | 4,006 |
#Generating prime numbers
def prime_number_generator(number):
my_numbers = []
if number in (0, 1):
return "Zero or One cannot be prime numbers."
if number < 2:
return "Prime numbers cannot be less than two."
if type(number) != int:
return "Only integers are allowed."
fo... | anthonyndunguwanja/Anthony-Ndungu-bootcamp-17 | Day 1/prime_numbers.py | Python | mit | 540 |
from django.apps import AppConfig
class GalleryAppConfig(AppConfig):
name = 'gallery'
verbose_name = 'Galeria' | patrickporto/soldajustica | soldajustica/gallery/apps.py | Python | mit | 123 |
import itertools
from os import sys
FILEPATH = 'A-large-practice'
sys.stdin = open(FILEPATH + '.in', 'r')
sys.stdout = open(FILEPATH + '.out', 'w')
def get_line(): return raw_input()
def get_int(): return int(get_line())
def get_str(): return str(get_line())
# def generate_char_count_table(strings):
# char_count_... | brendanzhao/GoogleCodeJam2014 | src/1b/the_repeater.py | Python | mit | 3,010 |
# -*- coding: utf-8 -*-
#
# s3fields unit tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3fields.py
#
import unittest
from gluon.languages import lazyT
from gluon.dal import Query
from s3.s3fields import *
# ==================================================... | gnarula/eden_deployment | modules/unit_tests/s3/s3fields.py | Python | mit | 47,235 |
from flask import jsonify, request, g, url_for, current_app
from .. import db
from ..models import Post, Permission, Comment
from . import api
from .decorators import permission_required
@api.route('/comments/')
def get_comments():
page = request.args.get('page', 1, type=int)
pagination = Comment.query.order_... | weqopy/blog_instance | app/api_1_0/comments.py | Python | mit | 2,341 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
VirtualDiskAdapterType = Enum(
'busLogic',
'ide',
'lsiLogic',
)
| xuru/pyvisdk | pyvisdk/enums/virtual_disk_adapter_type.py | Python | mit | 239 |
from threading import Event
import threading
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
class StopThread(threading.Thread):
""" Extends the `Thread` with an `Event` and the `terminate` method
like the `multiprocessing` api offers it.
Callin... | miniworld-project/miniworld_core | miniworld/concurrency/StopThread.py | Python | mit | 883 |
"""
Django settings for moobo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | puras/moobo | moobo/settings.py | Python | mit | 2,175 |
from django.http import HttpResponse
import pymongo
import MySQLdb
from course_dashboard_api.v2.dbv import *
sql_user = MYSQL_USER
sql_pswd = MYSQL_PSWD
mysql_db = MYSQL_DB
mongo_db = MONGO_DB
""" Description: Function to get quiz level grades of all students in a particular course.
Input Parameters:
... | jaygoswami2303/course_dashboard_api | v2/GradeAPI/api.py | Python | mit | 27,402 |
import sys, os
def stop(arv):
pwd = os.getcwd()
# if argv given, folders = [argv]
# else, folders = pwd
### for each folder in folders
##### check pwd/folder/temp/pids for existing pid files
####### kill -15 & rm files
def main():
print "Please don't try to run this script separately."
if __nam... | modcracker/Tork | tork/core/manage/stop.py | Python | mit | 347 |
import requests
import time
import traceback
import sys
print "Web Ping running..."
print "All connection exceptions will be output to stdout."
while True:
time.sleep(5)
try:
r = requests.get('http://web/')
except:
print "Exception in request:"
print '-'*60
traceback.print... | impulse-cloud/web-ping | run-web-ping.py | Python | mit | 364 |
# searchAgents.py
# ---------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley... | DominikDitoIvosevic/Uni | AI/lab1/searchAgents.py | Python | mit | 24,561 |
import csv
from StringIO import StringIO
from math import ceil
from collections import Mapping, Sequence
def __expand_container(cont, i, j, empty_sym=''):
""" Expand, if possible, the list of list cont of size (h, k) to a list
of lists of size (i, j). If the expansion is successful, newly
created ... | lucasoldaini/dict2csv | dict2csv.py | Python | mit | 3,606 |
import unittest
import json
from travel_penguin.travel.penguin_act import PenguinAct
from travel_penguin.model.move import Direction, Distance
from travel_penguin.model.place import Place
from travel_penguin.env import Environment
class TestPenguinAct(unittest.TestCase):
def test_parse_places(self):
plac... | icoxfog417/TravelPenguinBot | tests/test_penguin_act.py | Python | mit | 4,956 |
#! /usr/bin/python
# Derived from dupinator.py.
#
# This program takes a list of pathnames to audio files and moves them to a central archive.
# It replaces the original with a symbolic link to the archived version.
# The archived version will have several names (all hard-linked): the MD5 hash (with the extension)
# a... | jemenake/LogicProjectTools | AudioArchiver.py | Python | mit | 5,075 |