code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-27 19:05
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | we-inc/mms-snow-white-and-the-seven-pandas | webserver/apps/users/migrations/0001_initial.py | Python | mit | 2,969 |
import requests
from bs4 import BeautifulSoup
import urllib2 # require python 2.0
"""
1. Get all subreddit name from redditlist.com
using urllib and BeautifulSoup library
"""
def get_subreddit_list(max_pages):
"""
Get all of the top ~4000 subreddits
from http://www.redditlist.com
... | parndepu/Recommendit | 01_RedditlistCrawler.py | Python | mit | 1,557 |
#!/usr/bin/env python
"""stack.py: Stack implementation"""
__author__ = 'Rohit Sinha'
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
... | rohitsinha54/Learning-Python | algorithms/stack.py | Python | mit | 716 |
# -*- coding: utf-8 -*-
"""
@author: mthh
"""
import matplotlib
import numpy as np
from geopandas import GeoDataFrame, pd
from shapely.geometry import MultiPolygon, Polygon, Point
from . import RequestConfig, Point as _Point
from .core import table
if not matplotlib.get_backend():
matplotlib.use('Agg')
import mat... | ustroetz/python-osrm | osrm/extra.py | Python | mit | 9,281 |
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'visualization'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'network'
# Python panel class of the PANEL to be added.
ADD_PA... | garyphone/com_nets | visualization/enabled/_10010_project_visualization_panel.py | Python | mit | 401 |
import sys
import math
import CSVReader
import DecisionTree
# GLOBALS
attributes = list()
data = list(list())
pre_prune_tree = True
# MATH FUNCTIONS
def Entropy( yesNo ):
yes = yesNo[0]; no = yesNo[1]
if no == 0 or yes == 0: return 0
total = no + yes
return ( -( yes / total ) * math.log( yes / total, 2 )
... | CKPalk/MachineLearning | Assignment1/id3.py | Python | mit | 4,116 |
#!/usr/bin/python
import sys
sys.path.append("../../")
#import pyRay as ra
import pyRay.scene as scn
# TODO : how to pass arguments from function header?
object1 = ("obj1",(), [( "U","sdBox" ,"%s",((1.0,1.0,1.0),) ),( "S","sdSphere","%s",(1.2,) )])
object2 = ("obj1",("f","f3"),[( "U","sdBox" ,"%s",(... | ProkopHapala/SimpleSimulationEngine | python/pyRay/tests/testSceneList.py | Python | mit | 624 |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import os
import sys
import json
import re
import uuid
import base64
import models
from models.movie_trailer_model import Base, MovieTrailerModel
rows = models.delete_movie_trailers()
print("%d rows were deleted from table", rows)
| DuCalixte/last_week_rotten_trailer | app/database_cleanup.py | Python | mit | 311 |
"""962. Maximum Width Ramp
https://leetcode.com/problems/maximum-width-ramp/
Given an array A of integers, a ramp is a tuple (i, j) for which
i < j and A[i] <= A[j]. The width of such a ramp is j - i.
Find the maximum width of a ramp in A. If one doesn't exist, return 0.
Example 1:
Input: [6,0,8,2,1,5]
Output: ... | isudox/leetcode-solution | python-algorithm/leetcode/problem_962.py | Python | mit | 1,140 |
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # default
'guardian.backends.ObjectPermissionBackend',
)
# DJANGO GUARDIAN
ANONYMOUS_USER_ID = -1 | michailbrynard/django-skeleton | src/config/settings/extensions/guardian.py | Python | mit | 180 |
# must use python 2
from classy import Class
import matplotlib.pyplot as plt
import numpy as np
import math
max_l = 5000
max_scalars = '5000'
ell = np.array( range(1, max_l+1) )
def getDl( pii1=0.5e-10, pii2=1e-9, pri1=1e-13 ):
# Define your cosmology (what is not specified will be set to CLASS default para... | xzackli/isocurvature_2017 | analysis/plot_isocurvature_spectra_effects/deriv_iso.py | Python | mit | 3,825 |
#!/usr/bin/env python
# coding=utf-8
import pytest
import sacred.optional as opt
from sacred.config.config_scope import (
ConfigScope,
dedent_function_body,
dedent_line,
get_function_body,
is_empty_or_comment,
)
from sacred.config.custom_containers import DogmaticDict, DogmaticList
@pytest.fixtu... | IDSIA/sacred | tests/test_config/test_config_scope.py | Python | mit | 8,409 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import User
admin.site.register(User)
| ba1dr/tplgenerator | templates/django/__APPNAME__/apps/user_auth/admin.py | Python | mit | 110 |
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ impor... | shuang1330/tf-faster-rcnn | lib/model/test.py | Python | mit | 8,856 |
__author__ = 'minhtule'
from request import *
class Tracker(object):
"""
"""
def __init__(self, tracking_id, visitor):
self.__tracking_id = tracking_id
self.__visitor = visitor
self.__debug_enabled = False
@property
def tracking_id(self):
return self.__tracking_... | Labgoo/google-analytics-for-python | gap/tracker.py | Python | mit | 2,493 |
"""
Project main settings file. These settings are common to the project
if you need to override something do it in local.pt
"""
from sys import path
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
# PATHS
# Path containing the django project
BASE_DIR = os.path.dirname(os.path.dirna... | hamedtorky/django-starter-template | shaping_templeat/settings/base.py | Python | mit | 5,369 |
import sys
sys.path.insert(0, "../")
import unittest
from dip.typesystem import DNull, DBool, DInteger, DString, DList
from dip.compiler import BytecodeCompiler
from dip.interpreter import VirtualMachine
from dip.namespace import Namespace
class TestInterpreter(unittest.TestCase):
def _execute_simple(... | juddc/Dipper | dip/tests/test_interpreter.py | Python | mit | 5,801 |
# 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/v2016_09_01/operations/_virtual_network_peerings_operations.py | Python | mit | 22,805 |
import sys
if __name__ == "__main__":
# Parse command line arguments
if len(sys.argv) < 2:
sys.exit("python {} <datasetFilename> {{<maxPoints>}}".format(sys.argv[0]))
datasetFilename = sys.argv[1]
if len(sys.argv) >= 3:
maxPoints = int(sys.argv[2])
else:
maxPoints = None
# Perform initial pass through fil... | DonaldWhyte/multidimensional-search-fyp | scripts/read_multifield_dataset.py | Python | mit | 1,612 |
"""Wechatkit exception module."""
class WechatKitBaseException(Exception):
"""Wechatkit base Exception."""
def __init__(self, error_info):
"""Init."""
super(WechatKitBaseException, self).__init__(error_info)
self.error_info = error_info
class WechatKitException(WechatKitBaseExceptio... | istommao/wechatkit | wechatkit/exceptions.py | Python | mit | 437 |
# This module is part of the Divmod project and is Copyright 2003 Amir Bakhtiar:
# amir@divmod.org. This is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
from tkinter import *
import t... | samuelclay/NewsBlur | vendor/reverend/ui/trainer.py | Python | mit | 13,036 |
from django.urls import path, include
from django.contrib import admin
from rest_framework.routers import DefaultRouter
from tasks.views import TaskItemViewSet, MainAppView, TagViewSet, ProjectViewSet, TaskCommentViewSet
admin.autodiscover()
router = DefaultRouter()
router.register(r'task', TaskItemViewSet)
router.r... | andreiavram/organizer | organizer/urls.py | Python | mit | 637 |
#!/usr/bin/env python3
import pwd
for p in pwd.getpwall():
if p.pw_shell.endswith('/bin/bash'):
print(p[0])
| thunderoy/dgplug_training | assignments/assign4.py | Python | mit | 121 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient
try:
# Python 3
from urllib.parse import quote
except ImportError:
# Python 2
from urllib import quote
# Your Account Sid and Auth Token from twilio.com/console
account_sid = "A... | teoreteetik/api-snippets | lookups/lookup-international-basic/lookup-international-basic.5.x.py | Python | mit | 563 |
'''
Created on Oct 19, 2016
@author: jaime
'''
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
from products import views
urlpatterns = [
url(r'^categories/$', csrf_exempt(views.ProductCategoryView.as_view())),
url(r'^categories/(?P<uid>\w+)/$', csrf_exempt(views.ProductCa... | jroeland/teapot | project/web/app/products/urls.py | Python | mit | 489 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MicroPython documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 21 11:42:03 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
... | turbinenreiter/micropython | docs/conf.py | Python | mit | 10,766 |
"""Modify Group Entry Message."""
from enum import IntEnum
from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import (
FixedTypeList, Pad, UBInt8, UBInt16, UBInt32)
from pyof.v0x04.common.header import Header, Type
from pyof.v0x04.controller2switch.common import Bucket
__all__ = ('Gr... | cemsbr/python-openflow | pyof/v0x04/controller2switch/group_mod.py | Python | mit | 2,734 |
##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import UpdateHandler
from cspark.SQLiteContextEngine import SQLiteContextEngin... | Matvey-Kuk/cspark-python | examples/1_room_mentions_counter.py | Python | mit | 1,702 |
import phidl.geometry as pg
import gdsfactory as gf
from gdsfactory.component import Component
@gf.cell
def outline(elements, **kwargs) -> Component:
"""
Returns Component containing the outlined polygon(s).
wraps phidl.geometry.outline
Creates an outline around all the polygons passed in the `elem... | gdsfactory/gdsfactory | gdsfactory/geometry/outline.py | Python | mit | 2,655 |
# -*- coding: utf-8 -*-
"""
mchem.postgres
~~~~~~~~~~~~~~
Functions to build and benchmark PostgreSQL database for comparison.
:copyright: Copyright 2014 by Matt Swain.
:license: MIT, see LICENSE file for more details.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ ... | mcs07/mongodb-chemistry | mchem/postgres.py | Python | mit | 6,525 |
import _plotly_utils.basevalidators
class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="uirevision", parent_name="bar", **kwargs):
super(UirevisionValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/_uirevision.py | Python | mit | 398 |
import pyaudio
import wave
#CHUNK = 1024
CHUNK = 1
FORMAT = pyaudio.paInt16
#CHANNELS = 2
CHANNELS = 1
#RATE = 44100
RATE = 10025
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
i... | rzzzwilson/morse | morse/test.py | Python | mit | 682 |
def is_tl(data):
return isinstance(data, tuple) or isinstance(data, list)
def get_depth(data):
'''
:type data: list or tuple
get the depth of nested list
'x' is 0
['x', 'y'] is 1
['x', ['y', 'z'] is 2
'''
if is_tl(data):
depths = []
for i in data:... | Revolution1/ID_generator | generator.py | Python | mit | 1,559 |
import ctypes
import random
import math
import numpy
import stats
import constants
#energy = mesh.bandstructure.random_
ext = ctypes.cdll.LoadLibrary("c_optimized/driftscatter.so")
def randomElectronMovement(particle,electric_field,density_func,mesh,reaper):
# global avg_lifetime
# lifetime = .001#lifetime(cell)
p ... | cwgreene/Nanostructure-Simulator | driftscatter.py | Python | mit | 1,432 |
"""
Harshad Number implementation
See: http://en.wikipedia.org/wiki/Harshad_number
"""
def is_harshad(n):
result=0
while n:
result+=n%10
n//=10
return n%result == 0 # Return if the remainder of n/result is 0 else return False
def main():
# test contains a set of harshad numbers
... | kennyledet/Algorithm-Implementations | 10_Harshad_Number/Python/wasi0013/HarshadNumber.py | Python | mit | 856 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
extract FileInfo object for local files
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import multiprocessing as mp
from concurrent.futures import ProcessPoolExecutor
import os
from sync_app.util import get_md5, get_sha1
fro... | ddboline/sync_app | sync_app/file_info_local.py | Python | mit | 2,404 |
# -*- coding: utf-8 -*-
"""
rdd.exceptions
~~~~~~~~~~~~~~
This module contains the exceptions raised by rdd.
"""
from requests.exceptions import *
class ReadabilityException(RuntimeError):
"""Base class for Readability exceptions."""
class ShortenerError(ReadabilityException):
"""Failed to shorten URL."... | mlafeldt/rdd.py | rdd/exceptions.py | Python | mit | 407 |
from unittest import TestCase
from mangopi.site.mangapanda import MangaPanda
class TestMangaPanda(TestCase):
SERIES = MangaPanda.series('gantz')
CHAPTERS = SERIES.chapters
def test_chapter_count(self):
self.assertEqual(len(TestMangaPanda.SERIES.chapters), 383)
def test_chapter_title(self):
... | jiaweihli/mangopi | mangopi/tests/site/test_mangaPanda.py | Python | mit | 688 |
# coding=utf-8
# main codes, call functions at stokes_flow.py
# Zhang Ji, 20160410
import sys
import petsc4py
petsc4py.init(sys.argv)
# import warnings
# from memory_profiler import profile
import numpy as np
from src import stokes_flow as sf
# import stokes_flow as sf
from src.stokes_flow import problem_dic, obj_dic... | pcmagic/stokes_flow | sphere/sphere_rs.py | Python | mit | 20,947 |
# regression tree
# input is a dataframe of features
# the corresponding y value(called labels here) is the scores for each document
import pandas as pd
import numpy as np
from multiprocessing import Pool
from itertools import repeat
import scipy
import scipy.optimize
node_id = 0
def get_splitting_points(args):
#... | lezzago/LambdaMart | RegressionTree.py | Python | mit | 6,591 |
__version__ = "9.1.4"
| oslab-fr/lesspass | cli/lesspass/version.py | Python | mit | 22 |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="tickvals", parent_name="mesh3d.colorbar", **kwargs):
super(TickvalsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | plotly/python-api | packages/python/plotly/plotly/validators/mesh3d/colorbar/_tickvals.py | Python | mit | 460 |
from django.contrib import admin
from friends.apps.phonebook.models import Contact
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
list_display = ('id', 'first_name', 'last_name', 'phone_number')
list_filter = ('last_name', )
search_fields = ['first_name', 'last_name']
| alexdzul/friends | friends/apps/phonebook/admin.py | Python | mit | 299 |
# -*- coding: utf-8 -*-
import logging
import argparse
from .imdb import find_movies
logger = logging.getLogger('mrot')
def parse_args():
parser = argparse.ArgumentParser(prog='mrot', description='Show movie ratings over time.',
formatter_class=argparse.ArgumentDefaultsHelpF... | abrenaut/mrot | mrot/cli.py | Python | mit | 1,423 |
import bisect
from mahjong import bots, patterns, scoring
from mahjong.types import Tile
def can_win(context, player_idx=None, incoming_tile=None):
'''
Return if a player can win.
Unlike Hand.can_win(), this function does extra checking for special
winning patterns and winning restrictions (filters)... | eliangcs/mahjong | mahjong/algo.py | Python | mit | 9,066 |
import os
import sys
import errno
import itertools
import logging
import stat
import threading
from fuse import FuseOSError, Operations
from . import exceptions, utils
from .keys import Key
from .logs import Log
from .views import View
logger = logging.getLogger('basefs.fs')
class ViewToErrno():
def __enter__... | glic3rinu/basefs | basefs/fs.py | Python | mit | 8,050 |
# -*- coding: utf-8 -*-
from PIL import Image
import unittest
from pynayzr.cropper import crop, ttv, ftv, sets
class TestCropBase(unittest.TestCase):
def test_blank_base(self):
base = crop.CropBase('base')
self.assertEqual(base.name, 'base')
self.assertEqual(base.image, None)
self... | pynayzr/pynayzr | test/test_cropper.py | Python | mit | 1,540 |
import re, sys
import functools
import graphviz as gv
from graphviz import Source
bad_words = [ 'jns', 'js', 'jnz', 'jz', 'jno', 'jo', 'jbe', 'jb', 'jle', 'jl', 'jae', 'ja', 'jne loc', 'je', 'jmp', 'jge', 'jg', 'SLICE_EXTRA', 'SLICE_ADDRESSING', '[BUG]', 'SLICE_VERIFICATION', 'syscall', '#PARAMS_LOG']
instrEdges = []... | WesCoomber/dataFlowGraphProjecto | presentgetBothNodesEdges.py | Python | mit | 22,404 |
# coding: utf-8
# In[ ]:
import numpy as np
import numexpr as ne
def sym_decorrelation_ne(W):
""" Symmetric decorrelation """
K = np.dot(W, W.T)
s, u = np.linalg.eigh(K)
return (u @ np.diag(1.0/np.sqrt(s)) @ u.T) @ W
# logcosh
def g_logcosh_ne(wx,alpha):
"""derivatives of logcosh"""
return n... | 663project/fastica_lz | fastica_lz/fastica_lz.py | Python | mit | 2,082 |
from datetime import datetime, time, timedelta
from pandas.compat import range
import sys
import os
import nose
import numpy as np
from pandas import Index, DatetimeIndex, Timestamp, Series, date_range, period_range
import pandas.tseries.frequencies as frequencies
from pandas.tseries.tools import to_datetime
impor... | bdh1011/wau | venv/lib/python2.7/site-packages/pandas/tseries/tests/test_frequencies.py | Python | mit | 16,705 |
# -*- coding: utf-8 -*-
"""
Module that implements the questions types
"""
import json
from . import errors
def question_factory(kind, *args, **kwargs):
for clazz in (Text, Password, Confirm, List, Checkbox):
if clazz.kind == kind:
return clazz(*args, **kwargs)
raise errors.UnknownQuesti... | piton-package-manager/piton | piton/lib/inquirer/questions.py | Python | mit | 3,684 |
from os.path import abspath, dirname, join
from unittest.mock import MagicMock, Mock, call
from tests.common import NetflixTestFixture
from netflix.data.genre import NetflixGenre
from netflix.parsers.title import NetflixTitleParser
from netflix.utils import netflix_url
class TestNetflixTitleParser(NetflixTestFixtu... | dstenb/pylaunchr-netflix | tests/parsers/title_test.py | Python | mit | 1,822 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import cPickle as pickle
from uuid import UUID
class HNacExampleRuleLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HNacExampleRuleLHS.
"""
# Flag thi... | levilucio/SyVOLT | tests/TestModules/HNacExampleRuleLHS.py | Python | mit | 12,702 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... | HewlettPackard/python-hpOneView | examples/login_details.py | Python | mit | 1,720 |
#!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.log import setLogLevel, info, debug
from mininet.node import Host, RemoteController, OVSSwitch
# Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu)
QUAGGA_RUN_DIR = '/var/r... | TakeshiTseng/SDN-Work | mininet/bgp/topo.py | Python | mit | 3,549 |
# 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/peering/azure-mgmt-peering/azure/mgmt/peering/aio/_peering_management_client.py | Python | mit | 6,754 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-28 01:00
from __future__ import unicode_literals
import caching.base
from django.db import migrations, models
import django.db.models.deletion
import sorl.thumbnail.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
... | OpenNews/opennews-source | source/people/migrations/0001_initial.py | Python | mit | 5,559 |
#!/usr/bin/env python
from __future__ import print_function
################################################################################
#
#
# drmaa_wrapper.py
#
# Copyright (C) 2013 Leo Goodstadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associa... | magosil86/ruffus | ruffus/drmaa_wrapper.py | Python | mit | 18,668 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | tzpBingo/github-trending | codespace/python/tencentcloud/iottid/v20190411/models.py | Python | mit | 15,254 |
from django.db import models
from olc_webportalv2.users.models import User
from django.contrib.postgres.fields.jsonb import JSONField
import os
from django.core.exceptions import ValidationError
# Create your models here.
def validate_fastq(fieldfile):
filename = os.path.basename(fieldfile.name)
if filename.... | forestdussault/olc_webportalv2 | olc_webportalv2/new_multisample/models.py | Python | mit | 8,667 |
from django.test import TestCase
from django.urls import reverse
# Create your tests here.
from .models import Mineral
class MineralModelTests(TestCase):
def test_new_mineral_created(self):
mineral = Mineral.objects.create(
name = "Abelsonite",
image_filename = "240px-Abelsonite_-_Green_River_Formation%... | squadran2003/filtering-searching-mineral-catalogue | filtering-searching-mineral-catalogue/minerals/tests.py | Python | mit | 3,110 |
import logging
from flask import g
from flask_login import current_user
from app.globals import get_answer_store, get_answers, get_metadata, get_questionnaire_store
from app.questionnaire.path_finder import PathFinder
from app.schema.block import Block
from app.schema.exceptions import QuestionnaireException
logger ... | qateam123/eq | app/questionnaire/questionnaire_manager.py | Python | mit | 5,368 |
# -*- coding: utf-8 -*-
"""The top-level package for ``django-mysqlpool``."""
# These imports make 2 act like 3, making it easier on us to switch to PyPy or
# some other VM if we need to for performance reasons.
from __future__ import (absolute_import, print_function, unicode_literals,
division)... | smartfile/django-mysqlpool | django_mysqlpool/backends/mysqlpool/base.py | Python | mit | 3,693 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Converts A bunch of mac Screenshots to 24hour format
def to_24(string):
hour, minute, trail = string.split('.')
sec, period = trail.split(' ')
hour = int(hour)
minute = int(minute)
sec = int(sec)
is_pm = period.lower() == "pm"
if hour == ... | Saevon/Recipes | oneshots/screenshot.py | Python | mit | 1,143 |
# (c) 2009-2015 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Original PyFileServer (c) 2005 Ho Chun Wei.
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
WSGI container, that handles the HTTP requests. This object is passed to the
WSGI serve... | tracim/tracim-webdav | wsgidav/wsgidav_app.py | Python | mit | 18,592 |
#!/usr/bin/env python2.7
# -*- coding:utf-8 -*-
#
# Copyright (c) 2017 by Tsuyoshi Hamada. All rights reserved.
#
import os
import logging as LG
import random
import commands
import shelve
import pickle
import sys
import hashlib
import re as REGEXP
# -- set encode for your terminal --
config_term_encode = 'euc-jp'
# ... | thamada/tool-private | commi.py | Python | mit | 5,969 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/network_management_client.py | Python | mit | 20,421 |
import os
import pdb
import functools
import glob
from core import models
from core.ali.oss import BUCKET, oss2key, is_object_exists, is_size_differ_and_newer, is_source_newer, is_md5_differ
from core.misc import *
from colorMessage import dyeWARNING, dyeFAIL
from sqlalchemy import create_engine, UniqueConstraint
from ... | gahoo/SNAP | core/db.py | Python | mit | 14,857 |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Multiples of 3 and 5
#Problem level: 6 kyu
def solution(number):
return sum([x for x in range(3,number) if x%3==0 or x%5==0])
| Kunalpod/codewars | multiples_of_3_and_5.py | Python | mit | 182 |
DEBUG = False
TEMPLATE_DEBUG = DEBUG
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-US'
SITE_ID = 1
USE_L10N = True
USE_TZ = True
SECRET_KEY = 'local'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.s... | dmpayton/django-flanker | tests/settings.py | Python | mit | 609 |
# coding: utf-8
from __future__ import absolute_import
import unittest
from flask import json
from six import BytesIO
from openapi_server.models.computer_set import ComputerSet # noqa: E501
from openapi_server.models.free_style_build import FreeStyleBuild # noqa: E501
from openapi_server.models.free_style_project ... | cliffano/swaggy-jenkins | clients/python-flask/generated/openapi_server/test/test_remote_access_controller.py | Python | mit | 11,876 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from pprint import pprint
import re
from fileinput import input
import csv
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
articles = ['the', 'a']
prepositions = ['at', 'of']
hospital_words = ['hospital', 'medical', 'center']
word_exclusions = articles + pr... | pingortle/collate_hospitals_kludge | match_hospitals.py | Python | mit | 2,609 |
# -*- coding: utf8 -*-
"""
@todo: Update argument parser options
"""
# Imports. {{{1
import sys
# Try to load the required modules from Python's standard library.
try:
import os
import argparse
from time import time
import hashlib
except ImportError as e:
msg = "Error: Failed to load one of the r... | sergey-dryabzhinsky/dedupsqlfs | dedupsqlfs/app/mkfs.py | Python | mit | 11,069 |
import argparse
from goetia import libgoetia
from goetia.dbg import dBG
from goetia.hashing import StrandAware, FwdLemireShifter, CanLemireShifter
from goetia.parsing import iter_fastx_inputs, get_fastx_args
from goetia.storage import *
from goetia.timer import measure_time
parser = argparse.ArgumentParser()
group = ... | camillescott/boink | benchmarks/benchmark-dbg-insert.py | Python | mit | 1,086 |
#!/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.
"""
Image Grounded Conversations (IGC) Task.
See https://www.aclweb.org/anthology/I17-1047/ for more details. One must d... | facebookresearch/ParlAI | parlai/tasks/igc/agents.py | Python | mit | 11,014 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem303.py
#
# Multiples with small digits
# ===========================
# Published on Saturday, 25th September 2010, 10:00 pm
#
# For a positive integer n, define f(n) as the least positive multiple of n
# that, written in base 10, uses only digits 2. Thus f(2)=2... | olduvaihand/ProjectEuler | src/python/problem303.py | Python | mit | 475 |
# !/usr/bin/python
# -*- coding: utf-8 -*-
#
# Created on Nov 19, 2015
# @author: Bo Zhao
# @email: bo_zhao@hks.harvard.edu
# @website: http://yenching.org
# @organization: Harvard Kennedy School
import sys
from wbcrawler.sentiment import tencent_sentiment
reload(sys)
sys.setdefaultencoding('utf-8')
... | jakobzhao/wbcrawler3 | sentiment_by_tencent.py | Python | mit | 378 |
import unittest
from gis.protobuf.polygon_pb2 import Polygon2D, Polygon3D, MultiPolygon2D, MultiPolygon3D
from gis.protobuf.point_pb2 import Point2D, Point3D
class Polygon2DTestCase(unittest.TestCase):
def test_toGeoJSON(self):
polygon = Polygon2D(point=[Point2D(x=1.0, y=2.0),
... | tomi77/protobuf-gis | python/tests/test_polygon.py | Python | mit | 2,150 |
import logging
import os
from twilio.rest import Client
class TwilioClient(object):
def __init__(self):
self.logger = logging.getLogger("botosan.logger")
self.account_sid = os.environ["TWILIO_SID"]
self.account_token = os.environ["TWILIO_TOKEN"]
self.client = Client(self.account_si... | FredLoh/BotoSan | twilio-mnc-mcc-getter.py | Python | mit | 1,280 |
# datapath config
# data folder location
data_folder = '/home/data/jleeae/ML/e_learning/KnowledgeTracing/data/'
csv_original_folder = data_folder + 'csv_original/'
csv_rnn_data_folder = data_folder + 'csv_rnn_data/'
pkl_rnn_data_folder = data_folder + 'pkl_rnn_data/'
# csv_original
Assistments2009_csv_original = csv_o... | JSLBen/KnowledgeTracing | codes/AssistmentsProperties.py | Python | mit | 8,942 |
import pygame
class Animation:
def __init__(self, sheet, seq):
#Attributes
self.sheet = sheet
self.length = seq[0]
self.delay = seq[1]
self.x = seq[2]
self.y = seq[3]
self.w = seq[4]
self.h = seq[5]
self.step = 0
self.tick = 0
... | Ohjel/wood-process | jump/animation.py | Python | mit | 750 |
import busbus
from busbus.entity import BaseEntityJSONEncoder
from busbus.provider import ProviderBase
from busbus.queryable import Queryable
import cherrypy
import collections
import itertools
import types
def json_handler(*args, **kwargs):
value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
... | spaceboats/busbus | busbus/web.py | Python | mit | 6,218 |
from aiohttp import web
from dvhb_hybrid.export.xlsx import XLSXResponse
async def handler1(request):
async with XLSXResponse(request, filename='1.xlsx') as r:
r.append({'x': 2, 'y': 3})
r.append({'x': 'a', 'y': 'f'})
return r
async def handler2(request):
head = ['Column X', 'Column Y']
... | dvhbru/dvhb-hybrid | tests/test_export_xlsx.py | Python | mit | 917 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from .common import _ParserScraper
class ProjectFuture(_ParserScraper):
imageSearch = '//td[@class="tamid"]/img'
prevSearch = '//a[./img[@alt="Previous"]]'
def __init__(self, name, comic, fi... | webcomics/dosage | dosagelib/plugins/projectfuture.py | Python | mit | 2,118 |
"""
Initialize the application.
"""
import logging
logger = logging.getLogger(__name__)
import appdirs
import click
import datetime
import distutils.dir_util
import os
import putiopy
import sqlite3
APP_NAME = 'putio-automator'
APP_AUTHOR = 'datashaman'
DIRS = appdirs.AppDirs(APP_NAME, APP_AUTHOR)
from .db import cre... | datashaman/putio-automator | putio_automator/__init__.py | Python | mit | 1,262 |
#!/usr/bin/python
"""
Preferences Frame
Copyright (c) 2014, 2015 Andrew Hawkins
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 us... | achawkins/Forsteri | forsteri/gui/window/preferences.py | Python | mit | 5,406 |
# -*- coding: utf-8 -*-
"""
The project pages map for project
"""
import io
import os
from optimus.builder.pages import PageViewBase
from optimus.conf import settings
from project import __version__ as sveetoy_version
from project.sitemap import PageSitemap, tree_from_directory_structure
from py_css_styleguide.model... | sveetch/Sveetoy | project/pages.py | Python | mit | 1,627 |
import unittest
import time
import random
import os
os.environ['USE_CALIENDO'] = 'True'
from caliendo.db import flatfiles
from caliendo.facade import patch
from caliendo.patch import replay
from caliendo.util import recache
from caliendo import Ignore
import caliendo
from test.api import callback
from test.api.call... | buzzfeed/caliendo | test/test_replay.py | Python | mit | 2,701 |
import datetime
import httplib
import urllib
import os.path
import csv
import time
from datetime import timedelta
import pandas as pd
import numpy as np
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
def totimestamp(dt, epoch=datetime.date(1970,1,1)):... | kaija/tw-stock | stock.py | Python | mit | 11,215 |
import psycopg2
import urlparse
import os
def server_db():
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(database=url.path[1:], user=url.username, password=url.password, host=url.hostname, port=url.port)
cur = conn.cursor()
retu... | debasishbai/django_blog | blog/database_config.py | Python | mit | 454 |
__author__ = 'SM'
import sys
import
# from tkinter import *
# #create new window
# root = Tk()
# root.title("Hello world app")
# root.geometry('200x85')
#
# app = Frame()
# app.grid()
# lbl = Label(app, text = "Hello World!")
# lbl.grid()
#
# bttn1 = Button(app, text = "Press")
# bttn1.grid()
#
# root.mainloop()
... | sevmardi/University-of-Applied-Sciences-Leiden | Python/ifscp_Opdrachten/Opdracht1.py | Python | mit | 758 |
#!/usr/bin/env python3
# https://docs.python.org/3/library/modulefinder.html
from modulefinder import ModuleFinder
finder = ModuleFinder()
finder.run_script('graph1.py')
print('Loaded modules:')
for name, mod in finder.modules.items():
print('%s: ' % name, end='')
print(','.join(list(mod.globalnames.keys())... | jtraver/dev | python3/graphics/modulefinder1.py | Python | mit | 416 |
"""
SUPPRESS-GO-AHEAD
This supports suppressing or activating Evennia
the GO-AHEAD telnet operation after every server reply.
If the client sends no explicit DONT SUPRESS GO-AHEAD,
Evennia will default to supressing it since many clients
will fail to use it and has no knowledge of this standard.
It is set as the NOG... | whitehorse-io/encarnia | evennia/evennia/server/portal/suppress_ga.py | Python | mit | 1,804 |
from django.test import TestCase, Client
from jpspapp.models import Club, Activity,UserProfile
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
import datetime
# Create your tests here.
class ClubTestCase(TestCase):
def setUp(self):
User.objects.create_user(... | AlienStudio/jpsp_python | jpsp/jpspapp/tests.py | Python | mit | 3,241 |
from __future__ import print_function
import os
import json
import base64
import psycopg2
pg_host = os.getenv('PGHOST', "172.17.0.1")
pg_user = os.getenv('PGUSER', "postgres")
pg_password = os.getenv('PGPASSWORD', "root")
pg_database = os.getenv('PGDATABASE', "db_server")
pg_port = os.getenv('PGPORT', "5432")
print(... | mdmamunhasan/pgsync | lmdtest.py | Python | mit | 3,012 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="scattercarpet", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattercarpet/_hoverlabel.py | Python | mit | 2,062 |
"""Tests if it "compiles" (except that it doesn't).
Also: trivial usage example.
"""
from da import Node, Network
import topo
class MyNode(Node):
def run(self):
self.send(0, self.ID)
self.send(1, self.ID)
p, m = self.recv()
p, m = self.recv()
self.log('terminating', m, p)
... | AnotherKamila/distributed-algorithms-emulator | examples/test.py | Python | mit | 424 |
import os
from inspect import signature
from . import db
from . import settings
class Entry:
def __init__(self, id_=None, author=None, date=None, body=None, body_html=None, url=None,
plus=None, media_url=None, tags=None, is_nsfw=None, entry_id=None, type_=None):
self.id_ = id_
se... | kosior/taktyk | taktyk/entry.py | Python | mit | 2,324 |
class PluginBase(object):
name = ''
doc = 'doc about this class'
methods_subclass = {}
def __init__(self, **kwargs):
self.methods = {
'help': 'doc about help method',
'get_methods': 'doc about get_methods method'
}
self.methods.update(self.methods_subclas... | Bakterija/mmplayer | mmplayer/kivy_soil/terminal_widget/plugins/_base.py | Python | mit | 4,885 |
from flask import Flask
app = Flask(__name__)
app.config.from_object("configs.appconfig.DevelopmentConfig")
| oyang/testFalsk | app.py | Python | mit | 109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.