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 |
|---|---|---|---|---|---|
from mitra import db
class Entry(db.Model):
id = db.Column(db.Integer, primary_key=True)
category_name = db.Column(db.String(120), db.ForeignKey('category.name'))
userid = db.Column(db.Integer, db.ForeignKey('user.id'))
date = db.Column(db.Date)
name = db.Column(db.String(120))
amount = db.Colu... | Nukesor/mitra | mitra/models/entry.py | Python | mit | 545 |
try:
from urllib.parse import quote, urljoin
except ImportError:
from urllib import quote
from urlparse import urljoin
import requests
class BandsintownError(Exception):
def __init__(self, message, response=None):
self.message = message
self.response = response
def __str__(self):... | jolbyandfriends/python-bandsintown | bandsintown/client.py | Python | mit | 4,358 |
# Constant indices within mmap buffers.
_POS_VALUE_LEN = 8
_READ_POS_IDX = 0
_WRITE_POS_IDX = _POS_VALUE_LEN
_HEADER_LEN = _POS_VALUE_LEN * 2
# Item size constants.
_ITEM_SIZE_LEN = 4
# struct.[un]pack format string for length fields
_POS_VALUE_FORMAT = "q"
_ITEM_SIZE_FORMAT = "i"
| whiskerlabs/mmringbuffer | mmringbuffer/constants.py | Python | mit | 292 |
##
## this file autogenerated
## 8.0(3)6
##
jmp_esp_offset = "191.143.24.9"
saferet_offset = "28.158.161.8"
fix_ebp = "88"
pmcheck_bounds = "0.0.11.9"
pmcheck_offset = "224.1.11.9"
pmcheck_code = "85.49.192.137"
admauth_bounds = "0.96.6.8"
admauth_offset = "112.101.6.8"
admauth_code = "85.137.229.87"
# "8.0(3)6" = [... | RiskSense-Ops/CVE-2016-6366 | extrabacon-2.0/improved/shellcode_8_0(3)6.py | Python | mit | 437 |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
import os
import jasy.core.Console as Console
import jasy.core.Util as Util
import jasy.vcs.Git as Git
import jasy.vcs.Svn as Svn
def isUrl(url):
"""
Figures out whether the given string is a valid Git repository URL.
:param url: URL t... | sebastian-software/jasy | jasy/vcs/Repository.py | Python | mit | 3,416 |
from plone import api
from plone.app.controlpanel.security import ISecuritySchema
def setup_workspaces(portal):
mp = api.portal.get_tool(name='portal_membership')
# set type to custom member type
mp.setMemberAreaType('wigo.workspaces.workspace')
# set member folder name
mp.setMembersFolderById('sq... | ade25/wigo | src/wigo.statusapp/wigo/statusapp/setuphandlers.py | Python | mit | 802 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/recurring_transaction_frequency.py | Python | mit | 7,155 |
# -*- 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/tcss/v20201101/models.py | Python | mit | 529,829 |
from pathlib import Path
import cv2
import dlib
import numpy as np
import argparse
from contextlib import contextmanager
from omegaconf import OmegaConf
from tensorflow.keras.utils import get_file
from src.factory import get_model
pretrained_model = "https://github.com/yu4u/age-gender-estimation/releases/download/v0.... | yu4u/age-gender-estimation | demo.py | Python | mit | 4,936 |
#!/usr/local/bin/python
a=['red','orange','yellow','green','blue','purple']
odds=a[::2]
evens=a[1::2]
print odds
print evens
x=b'abcdefg'
y=x[::-1]
print y
c=['a','b','c','d','e','f']
d=c[::2]
e=d[1:-1]
print e
| Vayne-Lover/Effective | Python/Effective Python/item6.py | Python | mit | 211 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012 Kozea
#
# This library 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... | vineethguna/heroku-buildpack-libsandbox | vendor/pygal-0.13.0/pygal/config.py | Python | mit | 8,580 |
# __version__ = "1.0"
from . import data_processing
from . import plotly_usmap
from . import UI_setup
# from .data_processing import *
# from .plotly_usmap import *
# from .UI_setup import *
| UWSEDS-aut17/uwseds-group-city-fynders | cityfynders/__init__.py | Python | mit | 193 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""__init__.py"""
from utils.errors.Error import Error
from utils.errors.InfLoopError import InfLoopError
__author__ = "Pi-Yueh Chuang"
__version__ =... | piyueh/SEM-Toolbox | utils/errors/__init__.py | Python | mit | 330 |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2018 Weitian LI <weitian@aaronly.me>
# MIT License
#
# TODO:
# * allow to query by coordinates & radius range
# * filter queried results according to the type/other...
# * if not queried by name, then try query by coordinates
#
"""
Query NED with the provided name or... | liweitianux/atoolbox | astro/query_ned.py | Python | mit | 3,683 |
from setuptools import setup, find_packages
import gravatar
setup(
name='dj-gravatar',
version=gravatar.__version__,
packages=find_packages(),
long_description=open('README.md').read(),
install_requires=[
'Django',
]
)
| Sheeprider/dj-gravatar | setup.py | Python | mit | 252 |
#!/usr/bin/python
from commands.utilities import register
import asyncio
import re
class Voting():
def __init__(self, config=None):
# regex to match a number at the start of the message.
# Being a float is optional.
self.length_re = r'--((\d*)?(\.\d*)?)'
# regex to atch and capture... | ellipses/Yaksha | src/commands/voting.py | Python | mit | 7,274 |
import time
import requests
from .exceptions import HttpError
from .json import json_loads
def check_rep(rep):
if (rep.status_code // 100) != 2:
raise HttpError(rep.text, rep.status_code)
def rep_to_json(rep):
check_rep(rep)
# we use our json loads for date parsing
return json_loads(rep.tex... | openergy/openergy | ovbpclient/rest_client.py | Python | mit | 4,045 |
"""Queue implementation using Linked list."""
from __future__ import print_function
from linked_list import Linked_List, Node
class Queue(Linked_List):
def __init__(self):
Linked_List.__init__(self)
def enqueue(self, item):
node = Node(item)
self.insert_front(node)
def dequeue(... | dineshrajpurohit/ds_al | queue.py | Python | mit | 1,234 |
from key import Key
def _object_getattr(obj, field):
"""Attribute getter for the objects to operate on.
This function can be overridden in classes or instances of Query, Filter, and
Order. Thus, a custom function to extract values to attributes can be
specified, and the system can remain agnostic to ... | alexandonian/ptutils | ptutils/datastore/query.py | Python | mit | 17,240 |
#!/usr/bin/env python
"""Query and aggregate data from log files using SQL-like syntax"""
import sys
import argparse
import os
import re
import ast
import readline
import atexit
import time
import inspect
from multiprocessing import cpu_count
try:
from collections import OrderedDict
except ImportError:
# pyth... | spuriousdata/logrok | logrok/logrok.py | Python | mit | 8,948 |
from sqlalchemy import Column, String
from FooBaseH import FooBaseH
class FooBaseH2(FooBaseH):
name2 = Column(String)
__mapper_args__ = {
'polymorphic_identity': "2"
}
| aitgon/wopmars | wopmars/tests/resource/model/FooBaseH2.py | Python | mit | 192 |
class Card:
"""
Static class that handles cards. We represent cards as 32-bit integers, so
there is no object instantiation - they are just ints. Most of the bits are
used, and have a specific meaning. See below:
Card:
bitrank suit rank... | RIP95/kurisu-bot | addons/deuces/card.py | Python | mit | 5,195 |
import json
import os
from commonfunctions import commonfunctions as cf
dir = cf.working_directory
transcripts = []
for x in os.listdir(dir):
with open(os.path.join(dir, x)) as f:
transcripts.append(json.load(f))
with open('worldcitiesout.json', 'r') as f:
city_dicts = json.load(f)
city_dicts = [x... | keelanfh/electionary | analysis/city-mentions.py | Python | mit | 1,375 |
# 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/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py | Python | mit | 19,783 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py | Python | mit | 9,206 |
__all__ = [
'RedisError',
'ProtocolError',
'ReplyError',
'MaxClientsError',
'AuthError',
'PipelineError',
'MultiExecError',
'WatchVariableError',
'ChannelClosedError',
'ConnectionClosedError',
'ConnectionForcedCloseError',
'PoolClosedError',
'MasterNotFoundError',
... | ymap/aioredis | aioredis/errors.py | Python | mit | 2,627 |
"""Read in lightcurve files."""
import logging
import numpy as np
import astropy.io.ascii as at
def read_single_aperture(filename):
"""Read in one of AMC's K2 light curves,
inputs
------
filename: string
should look like EPIC_205030103_xy_ap1.5_fixbox_cleaned.dat
outputs
-------
... | stephtdouglas/k2spin | k2io.py | Python | mit | 2,475 |
from __future__ import print_function
import numpy
import time
import traceback
import colorsys
import random
class EffectLayer(object):
"""Abstract base class for one layer of an LED light effect. Layers operate on a shared framebuffer,
adding their own contribution to the buffer and possibly blending or o... | chillpop/RELAX-HARDER | effects/base.py | Python | mit | 10,042 |
import detectlanguage
def detect(data):
result = detectlanguage.client.post('detect', { 'q': data })
return result['data']['detections']
def simple_detect(data):
result = detect(data)
return result[0]['language']
def user_status():
return detectlanguage.client.get('user/status')
def languages():
return detect... | detectlanguage/detectlanguage-python | detectlanguage/api.py | Python | mit | 353 |
def solution(s):
i = 0
j = len(s) - 1
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
else:
t = s[i + 1:j + 1]
if t == t[::-1]:
return i
else:
return j
return -1
testCount = int(input())
... | lilsweetcaligula/Online-Judges | hackerrank/algorithms/strings/easy/palindrome_index/py/solution.py | Python | mit | 414 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PhotoLoader.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| SerSamgy/PhotoLoader | manage.py | Python | mit | 254 |
""" Converter using Pygments.
Registers Pygments for all lexer file types. Should
be registered first to allow overriding other converters
for specific extensions (markdown, etc). """
import codecs
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_for_f... | kevinbeaty/mvw | mvw/converters/pygmentsconvert.py | Python | mit | 1,084 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('postcode_api', '0010_auto_20150601_1513'),
]
operations = [
migrations.AlterIndexTogether(
name='address',
... | ministryofjustice/postcodeinfo | postcodeinfo/apps/postcode_api/migrations/0011_auto_20150702_1812.py | Python | mit | 394 |
import os
import os.path
import binascii
import tempfile
import shutil
import getpass
import time
from twisted.trial import unittest
from twisted.internet.protocol import Factory
from twisted.internet import reactor, defer, protocol, error
from txdbus import bus, endpoints, authentication
from txdbus.authentication ... | Pyrrvs/txdbus | txdbus/test/test_authentication.py | Python | mit | 17,765 |
from asyncio import AbstractEventLoop
import aiomysql.sa
import asyncpg
from asyncio_extras import async_contextmanager
from cetus.types import (ConnectionType,
MySQLConnectionType,
PostgresConnectionType)
from sqlalchemy.engine.url import URL
DEFAULT_MYSQL_PORT = 330... | lycantropos/cetus | cetus/data_access/connectors.py | Python | mit | 5,800 |
#!/usr/bin/env python3
"""
Created on 18 Sep 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
from scs_core.data.datetime import LocalizedDatetime
from scs_core.data.json import JSONify
from scs_core.particulate.pmx_datum import PMxDatum
# -------------------------------------------------------... | south-coast-science/scs_dfe_eng | tests/particulate/pmx_datum_test.py | Python | mit | 530 |
import hexchat
#Based on Weechat's Weestats: https://weechat.org/scripts/source/weestats.py.html/
#By Filip H.F. 'FiXato' Slagter <fixato [at] gmail [dot] com>
__module_name__ = 'HexStats'
__module_version__ = '0.0.1'
__module_description__ = 'Displays HexChat-wide User Statistics'
__module_author__ = 'Vlek'
de... | Vlek/plugins | HexChat/HexStats.py | Python | mit | 1,614 |
from django.contrib import admin
from .models import Post, Publisher
class PostInline(admin.StackedInline):
model = Post
class PublisherAdmin(admin.ModelAdmin):
inlines = [PostInline,]
admin.site.register(Publisher, PublisherAdmin)
admin.site.register(Post) | omerturner/manakinproducts | blog/admin.py | Python | mit | 286 |
import dijon
def test_compare_sequence_no_difference():
source_data = ['a', 'b', 'c']
target_data = ['a', 'b', 'c']
diff_graph = dijon.compare(source_data, target_data)
diff_nodes = [n for n in diff_graph.iter_nodes(differences=True)]
assert len(diff_nodes) == 0
def test_compare_sequence_append... | artPlusPlus/dijon | tests/test_sequence_compare.py | Python | mit | 5,916 |
{
"name": "website_sale_birthdate",
"author": "IT-Projects LLC, Ivan Yelizariev",
"license": "Other OSI approved licence", # MIT
"support": "apps@itpp.dev",
"website": "https://yelizariev.github.io",
"category": "eCommerce",
"vesion": "13.0.1.0",
"depends": ["website_sale", "partner_per... | it-projects-llc/website-addons | website_sale_birthdate/__manifest__.py | Python | mit | 382 |
import json
from math import ceil
from asyncpg import Connection
from qllr.common import MATCH_LIST_ITEM_COUNT
from qllr.db import cache
from qllr.settings import PLAYER_COUNT_PER_PAGE
KEEPING_TIME = 60 * 60 * 24 * 30
SQL_TOP_PLAYERS_BY_GAMETYPE = """
SELECT
p.steam_id,
p.name,
p.model,
... | em92/pickup-rating | qllr/blueprints/ratings/methods.py | Python | mit | 3,787 |
# Now make a simple example using the custom projection.
import pdb
import sys
import os
import pkg_resources
pkg_resources.require('matplotlib==1.4.0')
import datetime
from dateutil.relativedelta import relativedelta
import re
import math
from matplotlib.ticker import ScalarFormatter, MultipleLocator
from matplotlib... | peterwilletts24/Python-Scripts | Tephigram/Tephigrams_From_Radiosonde_Climatology_Onset.py | Python | mit | 11,003 |
# tree_generator was written with Python 2.7.4.
# The pickle files it produces should not be read with a version of
# Python less than 2.7.4, as they are not forwards compatible.
from piece_definitions import PIECES
import numpy as np
import sys
import collections
import itertools
import argparse
import multiprocessing... | atyndall/cits4211 | tools/tree_generator.py | Python | mit | 14,570 |
import urllib2,json
def almanac(zip):
url = "http://api.wunderground.com/api/4997e70515d4cbbd/almanac/q/%d.json"%(zip)
r = urllib2.urlopen(url)
data = json.loads(r.read())
almanac = {"record low":data['almanac']['temp_low']['record']['F'].encode("ascii"),
"record high":data['almanac']['... | aacoppa/inglorious-gangsters | weather.py | Python | mit | 601 |
from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound
form_page = Blueprint('form_page', __name__,
template_folder='templates')
@form_page.route('/<page>')
def show(page):
try:
form = AppForms.query.filter_by(name=page).first()
return rende... | elbow-jason/flask-meta | flask_meta/appmeta/controllers/form_page.py | Python | mit | 402 |
from behave import then, when
from bs4 import BeautifulSoup
from bs4.element import Tag
from pageobjects.pages import About, Welcome
@when(u'I instantiate the Welcome page object')
def new_pageobject(context):
context.page = Welcome(context)
@then(u'it provides a valid Beautiful Soup document')
def pageobject_w... | behave/behave-django | tests/acceptance/steps/using_pageobjects.py | Python | mit | 1,207 |
# Test quiver-time
import keras as ks
from quiver_engine import server
import sys
# Load model
if sys.version_info.major == 2:
model = ks.models.load_model('models/my_bestmodel.h5')
elif sys.version_info.major == 3:
model = ks.models.load_model('models/my_bestmodel_py3.h5')
# Names of classes of PAMAP2
classe... | wmkouw/quiver-time | test_signal.py | Python | mit | 511 |
# The MIT License (MIT)
# Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors
#
# 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 wi... | CCI-Tools/cate-core | cate/core/ds.py | Python | mit | 23,947 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-11 11:22
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 = [
migrations.swappable_dependen... | EricZaporzan/evention | evention/events/migrations/0010_ignoredevent.py | Python | mit | 1,007 |
import unittest
from openmdao.main.api import VariableTree, Component, Assembly
from openmdao.main.datatypes.api import Float, VarTree
class VT(VariableTree):
x = Float()
class C(Component):
x = Float(iotype='in')
out = Float(iotype='out')
def execute(self):
self.out = 2 * self.x
class A... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/test/test_aningvtree.py | Python | mit | 742 |
"""
Settings and configuration for Django.
Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global settings file for
a list of all possible variables.
"""
import importlib
import os
import time
from aiohttp.log import... | kreopt/aioweb | aioweb/conf/__init__.py | Python | mit | 4,182 |
# My files
from handlers import MainPage
from handlers import WelcomePage
from handlers import SignUpPage
from handlers import SignIn
from handlers import SignOut
from handlers import NewPost
from handlers import EditPost
from handlers import DeletePost
from handlers import SinglePost
from handlers import LikePost
from... | joepettigrew/multi-blog | main.py | Python | mit | 890 |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-8
@author: m00147039
'''
import sqlite3
#===============================================================================
# DB Data struct
#===============================================================================
ID = 0
PROCDUCTTYPE = 1
VERSION = 2
MODULENAME = 3
... | HuaweiSNC/OPS2 | src/python/dao/driver_mgmt.py | Python | mit | 5,150 |
import sys
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.PublicKey import RSA
from Crypto import Random
#AES key size
AES_KEY_SIZE = 32
# Uses null character as the padding character
PADDING_VALUE = '/0'
def padAES(message):
lacking_char_num = (AES.block_size - (len(message) % AES.block_size)) % AES.blo... | 74105/aspp | crypto.py | Python | mit | 1,451 |
import pandas as pd
df = pd.read_csv('data/src/titanic_train.csv', index_col=0).drop(['Name', 'Ticket', 'SibSp', 'Parch'], axis=1)
print(df.head())
# Survived Pclass Sex Age Fare Cabin Embarked
# PassengerId
# 1 0 ... | nkmk/python-snippets | notebook/pandas_crosstab.py | Python | mit | 6,511 |
phone = "315-555-2955"
print "Area Code: {0}".format(phone[0:3])
print "Local: {0}".format(phone[4:])
print "Different format: ({0}) {1}".format(phone[0:3], phone[4:])
| codelikeagirlcny/python-lessons-cny | code-exercises-etc/section_02_(strings)/z.ajm.str-format-phone-ex.20151024.py | Python | mit | 169 |
"""
Definition of the plugin.
"""
from django.utils.translation import ugettext_lazy as _
from fluent_contents.extensions import ContentPlugin, plugin_pool
from . import models
@plugin_pool.register
class LocationPlugin(ContentPlugin):
model = models.LocationItem
category = _('Assets')
render_template = ... | ic-labs/django-icekit | icekit/plugins/location/content_plugins.py | Python | mit | 391 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the ZMQ API."""
import configparser
import os
import struct
from test_framework.test_framework im... | Exgibichi/statusquo | test/functional/zmq_test.py | Python | mit | 4,305 |
# Derived from keras-rl
import opensim as osim
import numpy as np
import sys
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Input, concatenate
from keras.optimizers import Adam
import numpy as np
from rl.agents import DDPGAgent
from rl.memory import SequentialMemory
f... | stanfordnmbl/osim-rl | examples/legacy/example.py | Python | mit | 4,483 |
from abstract_importer import AbstractImporter
from slugify import slugify
class KosovoImporter(AbstractImporter):
def __init__(self):
pass
def get_csv_filename(self):
return "importer/data/kosovo/kosovo-budget-expenditures-2014.csv"
def get_region(self):
return 'Kosovo'
def... | opendatakosovo/relate-with-it | importer/kosovo_importer.py | Python | mit | 1,479 |
"""
SoftLayer.tests.managers.ordering_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import testing
from SoftLayer.testing import fixtures
class OrderingTests(testing.TestCase):
def set_up(self):
self.ordering = ... | cloudify-cosmo/softlayer-python | SoftLayer/tests/managers/ordering_tests.py | Python | mit | 5,044 |
"""
POZ Development Application.
"""
import numpy as np
# import cv2
import pozutil as pu
import test_util as tpu
def perspective_test(_y, _z, _ele, _azi):
print "--------------------------------------"
print "Perspective Transform tests"
print
cam = pu.CameraHelper()
# som... | mwgit00/poz | poz.py | Python | mit | 3,487 |
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE file
"""
"""
development script for pattern correlation analysis
"""
from pycmbs.diagnostic import PatternCorrelation
from pycmbs.data import Data
import numpy as np
import matplotlib.pyplot as plt
... | pygeo/pycmbs | scripts/pattern_correlation.py | Python | mit | 619 |
from frontend import app
from flask import render_template
from flask import send_from_directory
from flask import request
from flask import redirect
from flask import url_for
from flask import flash
from flask import abort
import os
import models
import forms
from wtfpeewee.orm import model_form
@app.r... | maltonx/workforce | views.py | Python | mit | 7,037 |
import sys
import re
def import_file(lines):
tags_label = "TAGS: "
separator = 60*"-"
idx = 0
while idx < len(lines):
assert lines[idx].startswith(tags_label)
tags = lines[idx][len(tags_label):].split(",")
tags = [t.strip() for t in tags if t.strip()]
idx += 1
... | inducer/synoptic | synoptic-to-org.py | Python | mit | 1,087 |
# http://www.pythonchallenge.com/pc/def/equality.html
import re
file_ob = open("3.dat", 'r')
ob_read = file_ob.read()
read_arr = list(ob_read)
word = []
def for_loop(): # Loops through array to find solution
for i in range(len(read_arr)):
if (i + 8) > len(read_arr): # To keep index in bounds
break
if not(... | yarabarla/python-challenge | 3.py | Python | mit | 812 |
"""
WSGI config for berth project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "berth.settings")
from django.core.wsgi ... | joealcorn/berth.cc | berth/wsgi.py | Python | mit | 385 |
from gitmostwanted.app import celery, db
from gitmostwanted.lib.github.api import user_starred, user_starred_star
from gitmostwanted.models.repo import Repo
from gitmostwanted.models.user import UserAttitude
@celery.task()
def repo_starred_star(user_id: int, access_token: str):
starred, code = user_starred(access... | kkamkou/gitmostwanted.com | gitmostwanted/tasks/github.py | Python | mit | 1,028 |
import demo
demo.main()
| jasset75/finengine | app.py | Python | mit | 25 |
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, current_user, logout_user, login_required
from . import auth
from ..models import User, AnonymousUser
from .forms import LoginForm, RegistrationForm, ChangePasswordForm, \
PasswordResetRequestForm, PasswordR... | AguNnamdi/flask_microblog | app/auth/views.py | Python | mit | 5,982 |
from rhino.test import TestClient
from examples.build_url import app
client = TestClient(app.wsgi)
def test_index():
res = client.get('/')
assert res.code == 302
assert res.headers['Location'] == 'http://localhost/u:1/p:1'
def test_url():
res = client.get('/u:1/p:1')
assert 'http://localhost/u:... | trendels/rhino | test/examples/test_build_url.py | Python | mit | 339 |
"""
Allow to trace called methods and package
"""
import frida
import re
syms = []
def on_message(message, data):
global syms
global index, filename
if message['type'] == 'send':
if "SYM" in message["payload"]:
c = message["payload"].split(":")[1]
print c
syms.a... | mseclab/AHE17 | YouCanHideButYouCannotRun/multithreads.py | Python | mit | 2,670 |
#!/usr/bin/env python3
"""Simple log converter for SOTA
It inputs a simplified text log and converts it to SOTA CSV format.
The input is a simplified version which allows most of the data field
to be guessed by previous input.
Example of input file:
# lines starting with # are comments
# first line contains informat... | kcs/SOTAnaplo | log2csv.py | Python | mit | 21,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/v2020_11_01/operations/_virtual_hub_route_table_v2_s_operations.py | Python | mit | 22,766 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(name='megacl',
version='0.4.6',
description='mega.co.nz command line client.',
author='Arthibus Gisséhel',
author_email='public-dev-megacl@gissehel.org',
url='https://github.com/gissehel/megac... | gissehel/megacl | setup.py | Python | mit | 1,210 |
"""
The set [1,2,3,...,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for n = 3:
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permutation sequence.
Note:
Given n will be between 1 and 9 inclusive.
Given k wi... | franklingu/leetcode-solutions | questions/permutation-sequence/Solution.py | Python | mit | 1,021 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rtstock documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | condereis/realtime-stock | docs/conf.py | Python | mit | 8,475 |
class Solution(object):
def solveNQueens(self, n):
"""
:type n: int
:rtype: List[List[str]]
"""
def search(cur):
if cur == n:
add_answer()
else:
for i in range(n):
ok = True
rows[... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/51_N-Queens.py | Python | mit | 1,340 |
__all__ = ['Constraint', 'ConstraintGroup', 'TotalSumValueConstraint', 'UniqueValueConstraint']
from .constraint import Constraint
from .constraintgroup import ConstraintGroup
from .totalsumvalueconstraint import TotalSumValueConstraint
from .uniquevalueconstraint import UniqueValueConstraint
| JoostvanPinxten/ConstraintPuzzler | constraints/__init__.py | Python | mit | 296 |
def on_square():
pass
def total_after():
pass
| rootulp/xpython | exercises/grains/grains.py | Python | mit | 56 |
"""
<Program Name>
ed25519_keys.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
September 24, 2013.
<Copyright>
See LICENSE for licensing information.
<Purpose>
The goal of this module is to support ed25519 signatures. ed25519 is an
elliptic-curve public key signature scheme, its main s... | team-ferret/pip-in-toto | pip/toto/ssl_crypto/ed25519_keys.py | Python | mit | 14,560 |
# Generated by Django 3.1 on 2020-08-13 19:23
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... | smokeyfeet/smokeyfeet-registration | src/smokeyfeet/registration/migrations/0001_initial.py | Python | mit | 4,391 |
import numpy as np
import matplotlib.pyplot as plt
import sys
fname = sys.argv[1]
exes = [0] * 101
wise = [0] * 101
f = open(fname, 'r')
for i in range(101):
split = f.readline().split(" ")
exes[i] = split[0]
wise[i] = split[1]
x = np.asarray(exes)
y = np.asarray(wise)
fig, ax = plt.subplots()
ax.set_xlabel("... | mtkwock/Genome-Matching | code/plot_chances.py | Python | mit | 690 |
#!/usr/bin/env python
# -*-coding:utf-8-*-
import time
from time import sleep
import random
depo, sus, tab, user_puntos, pc_puntos = ["piedra", "papel", "tijera", "lagarto", "spock"], "-" * 35, " " * 4, 0, 0
print """Hola! Bienvenido al juego Piedra Papel Tijera Lagarto Spock!\nEstas son las reglas:\n Las tijeras cort... | juandc/platzi-courses | Python-Django-2016/Python/Reto/Otros-Competidores/Juan-David-Castro/pptls.py | Python | mit | 4,317 |
import logging
import hashlib
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, etag_cache
from pylons.decorators import jsonify
from pylons.i18n.translation import _
from wurdig.lib.base import BaseController, render
log = logging.getLogger(__nam... | leveille/blog.v1 | wurdig/controllers/js.py | Python | mit | 1,892 |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import ... | fujicoin/electrum-fjc | electrum/gui/kivy/main_window.py | Python | mit | 44,226 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('customers', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='address',
name='re... | davogler/POSTv3 | customers/migrations/0002_auto_20150405_1041.py | Python | mit | 1,800 |
class StretchException(Exception):
"""Common base class for all exceptions raised explicitly by stretch.
Exceptions which are subclasses of this type will be handled nicely by
stretch and will not cause the program to exit. Any exceptions raised
which are not a subclass of this type will exit(1) and ... | paddycarey/stretch | stretch/exceptions.py | Python | mit | 710 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2016-12-06 09:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('maps', '0002_au... | rouxcode/django-cms-plugins | cmsplugins/maps/migrations/0003_googlemap_cms_page.py | Python | mit | 601 |
import random
import time
import datetime
from consts import *
__all__ = ['gen_valid_id', 'gen_list_page', 'log']
def gen_valid_id(collection):
def gen_id():
_id = ''
for i in range(4):
_id += random.choice('0123456789')
return _id
id = gen_id()
while collection.find_... | oyiadin/Songs-Distributor | utils.py | Python | mit | 1,548 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000489.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000489 | BIOMD0000000489/model.py | Python | cc0-1.0 | 427 |
print """
Version Info
============
To obtain version info::
from scan.version import __version__, version_history
print __version__
print version_history
"""
import sys
sys.path.append("..")
from scan.version import __version__, version_history
print "Version history::"
for line in version_history.spli... | PythonScanClient/PyScanClient | doc/make_version.py | Python | epl-1.0 | 355 |
import linecache
import os.path
import re
import sys
import traceback # @Reimport
from _pydev_bundle import pydev_log
from _pydevd_bundle import pydevd_dont_trace
from _pydevd_bundle import pydevd_vars
from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
from _pydevd_bundle.pydevd_comm import CMD_ST... | RandallDW/Aruba_plugin | plugins/org.python.pydev/pysrc/_pydevd_bundle/pydevd_frame.py | Python | epl-1.0 | 33,951 |
# module General Ui
# file ui_maya_dock.py
# Main Dock Window interface
from thlib.side.Qt import QtWidgets as QtGui
#from thlib.side.Qt import QtCore
from thlib.environment import env_inst, env_mode, env_read_config, env_write_config
import thlib.maya_functions as mf
import thlib.tactic_classes as tc
import thlib.glo... | listyque/TACTIC-Handler | thlib/ui_classes/ui_maya_dock.py | Python | epl-1.0 | 6,812 |
#!/usr/bin/env python
import os,sys,time
import numpy as np
import bitarray
import tables as tb
import logging
import yaml
import matplotlib.pyplot as plt
import monopix_daq.scan_base as scan_base
import monopix_daq.analysis.interpreter as interpreter
local_configuration={"exp_time": 1.0,
"cnt_t... | SiLab-Bonn/monopix_daq | monopix_daq/scans/en_tune.py | Python | gpl-2.0 | 7,608 |
#!/usr/bin/env python
#
# MountDirectories.py: this file is part of the GRS suite
# Copyright (C) 2015 Anthony G. Basile
#
# This program 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 ... | gentoo/grss | grs/MountDirectories.py | Python | gpl-2.0 | 6,242 |
import pytest
import subprocess
import tempfile
import shutil
import os
import config
import time
import pymongo
@pytest.fixture(scope='session')
def mongod(request):
subprocess.call(['pkill', '-f', 'mongod*tmp'])
server = MongoServer()
server.start()
def stop():
server.stop()
server.... | alexander-gridnev/mongstore | code/server/tests/conftest.py | Python | gpl-2.0 | 1,564 |
import Levenshtein
import re
from prisoners import db
from prisoners.models.original import Gedetineerde
#prisonersmatch = db.Table('PrisonersMatch',
# db.Column('master_id_ged', db.Integer, db.ForeignKey('PrisonersCompare.id_gedetineerde')),
# db.Column('slave_id_ged... | pieterdp/doctoraat-ewout | prisoners/models/compare.py | Python | gpl-2.0 | 4,206 |
# This file is part of pybliographer
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.org
#
# This program 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 2
# of t... | zkota/pyblio-1.3 | Legacy/Iterator.py | Python | gpl-2.0 | 2,270 |
# -*- coding: utf-8 -*-
from sqlalchemy import select, desc
import const
from ..sqlalchemy_table import SqlTable
class TmpAnimts(SqlTable):
def __init__(self, engine, table):
self.engine = engine
self.table = table
SqlTable.__init__(self, self.engine, self.table, (const.NAME_TAN,))
... | authurlan/amdfin | server/database/amdfin/tmp_animts.py | Python | gpl-2.0 | 686 |