code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('order', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='message',
options={'or... | sorz/isi | store/order/migrations/0002_auto_20150120_2243.py | Python | mit | 494 |
import os
from six.moves.configparser import ConfigParser, NoSectionError
from six.moves import urllib
from conans.errors import ConanException
from conans.model.env_info import unquote
from conans.paths import conan_expand_user, DEFAULT_PROFILE_NAME
from conans.util.env_reader import get_env
from conans.util.files i... | tivek/conan | conans/client/conf/__init__.py | Python | mit | 14,958 |
#!/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.
"""
Run the python or pytorch profiler and prints the results.
## Examples
To make sure that bAbI task 1 (1k exs) loads... | facebookresearch/ParlAI | parlai/scripts/profile_train.py | Python | mit | 2,526 |
__author__ = '@abhinavbom a.k.a darkl0rd'
import urllib2
import urlparse
import re
import os
import time
from lib.feeds import *
from lib.parse import *
def gather():
if not os.path.exists('intel'):
os.mkdir('intel')
os.chdir('.\\intel')
#print os.getcwd()
print "Starting feed update process"
... | abhinavbom/Threat-Intelligence-Hunter | lib/updatefeed.py | Python | mit | 1,127 |
from lbutils import as_callable
from lbworkflow import settings
# wf_send_sms(users, mail_type, event, ext_ctx)
# wf_send_mail(users, mail_type, event, ext_ctx)
def wf_send_msg(users, msg_type, event=None, ext_ctx=None):
if not users:
return
users = set(users)
if event: # ignore operator
... | vicalloy/django-lb-workflow | lbworkflow/core/sendmsg.py | Python | mit | 624 |
# -*- coding: utf-8 -*-
# MIT Licensed, Copyright (c) 2016 Ryan Scott Brown <sb@ryansb.com>
import os
from placebo.utils import placebo_session
import serverless_helpers
def test_unset_environment():
os.environ.pop('SERVERLESS_PROJECT_NAME', None)
os.environ.pop('SERVERLESS_STAGE', None)
stack_name = ser... | serverless/serverless-helpers-py | tests/test_cfn.py | Python | mit | 1,544 |
class GreedySearch:
default_configuration = None
option_iterator = None
best_performances = None
best_configurations = None
current_option_key = None
def __init__(self, settings):
self.default_configuration = self.get_default_configuration(settings)
self.option_iterator = self.... | MichSchli/QuestionAnsweringGCN | old_version/experiment_construction/search/greedy.py | Python | mit | 3,307 |
# coding=utf-8
import re
from blackhole import ben
__all__ = ['cronwalk']
class Entry(object):
__slots__ = ('minute', 'hour', 'day', 'month', 'isoweekday')
def __getitem__(self, index):
return getattr(self, self.__slots__[index], None)
def __setitem__(self, index, value):
return setatt... | liuhao1024/black-hole | blackhole/cronwalk.py | Python | mit | 5,177 |
#!/usr/bin/env python
import os
import re
import struct
import socket
import select
import platform
"""
NAT-PMP client library
Provides functions to interact with NAT-PMP gateways implementing version 0
of the NAT-PMP draft specification.
This version does not completely implement the draft standard.
... | Storj/pyp2p | pyp2p/nat_pmp.py | Python | mit | 21,188 |
import timeit
import math
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from colour import Color
X, Y = 0, 1
class Resolutions:
VGA = (640 , 480)
SVGA = (800 , 600)
WSVGA = (1024, 600)
XGA = (1024, 768)
XGAP = (1152, 864)
WXGA = (1280, 720)
WXGA ... | vyscond/razr | razr.py | Python | mit | 7,788 |
__version__ = '0.16.1'
| python-poetry/poetry-core | src/poetry/core/_vendor/_pyrsistent_version.py | Python | mit | 23 |
# run_downscale -- CMIP5 / CRU TS323 / CRU TS40
# for variables: tas, pr, vap, hur, clt
# *tasmin/tasmax require tas to be run first so we
# perform the computation in a second run.
# # # # # # # # # # # # # # # # # # # # # # # # # # #
import os, subprocess
base_dir = '/workspace/Shared/Tech_Projects/DeltaDownscalin... | ua-snap/downscale | snap_scripts/downscaling_v2/OLD_downscaling_v2/run_downscale_wrappers_minmax.py | Python | mit | 1,072 |
#!/usr/bin/env python
import datetime
import os
import sys
import log
import logging
import argparse
import math
from optimization_weight import *
from san_att_twolayer_theano import *
from data_provision_att_vqa import *
from data_processing_vqa import *
##################
# initialization #
##################
opti... | codedecde/ImageQA | Src/TheanoModel/Code/san_att_conv_twolayer.py | Python | mit | 9,975 |
# VMeter Python demos
# VMeter.net
# ver 1. 1/26/13
import pypm
import array
import time
from collections import deque
INPUT=0
OUTPUT=1
def PrintDevices(InOrOut):
for loop in range(pypm.CountDevices()):
interf,name,inp,outp,opened = pypm.GetDeviceInfo(loop)
if ((InOrOut == INPUT) & (inp == 1) |
... | curiousinventor/VMeter | Software/python/VMeter_python_demos.py | Python | mit | 16,528 |
import pathlib
from .._exceptions import ReadError
from .._helpers import register_format
from . import _vtk_42, _vtk_51
def read(filename):
filename = pathlib.Path(filename)
with open(filename.as_posix(), "rb") as f:
mesh = read_buffer(f)
return mesh
def read_buffer(f):
# The first line sp... | nschloe/meshio | src/meshio/vtk/_main.py | Python | mit | 1,027 |
from sso import models
def test_user_get_username():
user = models.BusinessSSOUser(email='test@example.com')
assert user.get_username() == 'test@example.com'
def test_user_save():
user = models.BusinessSSOUser(email='test@example.com')
assert user.save() is None
| uktrade/navigator | app/sso/tests/test_models.py | Python | mit | 285 |
from synthetic.consts import (DEFAULT_SAMPLE_RATE, DEFAULT_NODES,
DEFAULT_EDGES, DEFAULT_GEN_TYPE)
from synthetic.generator import load_generator
from synthetic.commands.command import Command, arg_with_default
class EvalDistance(Command):
def __init__(self, cli_name):
Comma... | telmomenezes/synthetic | synthetic/commands/eval_distance.py | Python | mit | 1,380 |
from twisted.trial import unittest
from vertex import q2qclient
import sys
from StringIO import StringIO
class TimeoutTestCase(unittest.TestCase):
def testNoUsage(self):
"""
When the vertex Q2QClientProgram is run without any arguments, it
should print a usage error and exit.
"""
... | glyph/vertex | vertex/test/test_client.py | Python | mit | 980 |
import config
import directorymonitor
import rsync
# project = { 'name': 'nvbio-internal', 'root_path': '/Users/nsubtil/nvbio-internal',
# 'remotes': [ { 'ssh_connection': connobj,
# 'remote_root': '/home/nsubtil/nvbio-internal' }, ... ]
class SynchronizedProjectDB (config.Confi... | nsubtil/remoter | project.py | Python | mit | 2,456 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
#
# Objective of this small program is to report memory usage using
# useful memory metrics for Linux, by default for user postgres.
#
# It will group processes according to their URES (unique resident set size)
# and also do reports based on per-username, per-program n... | bricklen/pg-scripts | pg_meminfo.py | Python | mit | 21,999 |
import platform
import select
import socket
import ssl
from typing import TYPE_CHECKING, Callable, Optional, Tuple, Union, overload
from unittest import mock
import pytest
from dummyserver.server import DEFAULT_CA, DEFAULT_CERTS
from dummyserver.testcase import SocketDummyServerTestCase, consume_socket
from urllib3.u... | sigmavirus24/urllib3 | test/test_ssltransport.py | Python | mit | 20,253 |
# pylint:disable=too-many-branches,too-many-statements
from __future__ import absolute_import
from __future__ import unicode_literals
import collections
import os.path
import re
class Status(object):
ADDED = object()
DELETED = object()
ALREADY_EXISTING = object()
class SpecialFileType(object):
SUBM... | ucarion/git-code-debt | git_code_debt/file_diff_stat.py | Python | mit | 4,630 |
#!/usr/bin/env python
"""Frequency manager."""
from mic import Mic
import numpy as np
import pylab as pl
class FrequencyStream(object):
"""Frequency stream."""
def __init__(self):
"""Construct FrequencyStream object."""
self.mic = Mic('Blue Snowball')
def __enter__(self):
"""O... | anassinator/beethoven | src/web/frequency.py | Python | mit | 1,545 |
import _plotly_utils.basevalidators
class HoverinfoValidator(_plotly_utils.basevalidators.FlaglistValidator):
def __init__(self, plotly_name="hoverinfo", parent_name="table", **kwargs):
super(HoverinfoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/table/_hoverinfo.py | Python | mit | 636 |
from django.shortcuts import render
from django.views.generic import View
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
#
# Show all cluster results and running tasks
#
@method_decorator(login_required, name='dispatc... | mstrehse/geneclust-server | app/statistics/views.py | Python | mit | 484 |
import logging
from functools import total_ordering
from typing import Tuple, NamedTuple, Dict, Callable, Set, Any, List
import numpy
import itertools
from decimal import Decimal
from datetime import datetime
import json
import pandas
class QuoteEncoder(json.JSONEncoder):
def default(self, o):
if isinst... | chris-ch/coinarb | bf-arb-pylab/src/arbitrage/entities.py | Python | mit | 24,192 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/tag.py | Python | mit | 5,101 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-08 01:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('round', '0015_auto_20161105_2340'),
]
operations = [
migrations.AddField(
... | adminq80/Interactive_estimation | game/round/migrations/0016_auto_20161208_0154.py | Python | mit | 942 |
from abc import ABCMeta, abstractmethod
from data_store import JSONDataStore
import os
import os.path
import json
from datetime import datetime
class Link:
__metaclass__ = ABCMeta
def __init__(self, settings_file):
self.settings = JSONDataStore(settings_file)
self.settings.load()
self.... | linusluotsinen/RPiAntiTheft | util/link.py | Python | mit | 2,866 |
#!/usr/bin/env python
import binascii
import socket
import struct
import argparse
import sys
import logging
import os
import traceback
import socket
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import Ether, IP, IPv6, TCP, sendp, conf, sniff
from random import randint
from capability impo... | ecthros/pina-colada | capabilities/dos/tcpkiller.py | Python | mit | 11,912 |
"""Chapter 23 Practice Questions
Answers Chapter 23 Practice Questions via Python code.
"""
def main():
# 1. What is the difference between a symmetric cipher and an asymmetric
# cipher?
# Hint: Check page 336
message = ".noitpyrced dna noitpyrcne rof yek emas eht esu taht srehpiC :cirtemmyS"
... | JoseALermaIII/python-tutorials | pythontutorials/books/CrackingCodes/Ch23/PracticeQuestions.py | Python | mit | 2,535 |
# -*- coding: utf-8 -*-
# Copyright
DB_USER = 'kungsliljans'
| jimbao/johanochida | backend/__init__.py | Python | mit | 61 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/application_gateway_backend_health_py3.py | Python | mit | 1,134 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def SessionManagerLocalTicket(vim, *args, **kwargs):
'''This data object type contains th... | xuru/pyvisdk | pyvisdk/do/session_manager_local_ticket.py | Python | mit | 1,133 |
import re
import json
from csv import writer
from parsel import Selector
import os.path
import fnmatch
import glob2
from multiprocessing import Pool
from django.core.management.base import BaseCommand
def _parse_me(base_fname):
json_fname = "{}.json".format(base_fname)
html_fname = "{}.html".format(base_fnam... | dchaplinsky/declarations.com.ua | declarations_site/catalog/management/commands/find_missing.py | Python | mit | 2,935 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
"""
`Unit tests for cargo.builder.create_user`
--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--ยท--
2016 Jared Lunde ยฉ The MIT License (MIT)
http://github.com/jaredlunde
"""
import unittest
import random
from cargo import fields
from c... | jaredlunde/cargo-orm | unit_tests/builders/ColumnBuilder.py | Python | mit | 5,201 |
import global_data as g
from util import *
import sys
import time
import select
import socket
import Queue
import os
from input_handler import HandleUserInput
import random
import hashlib
import json
import threading
import atexit, signal
class Connection:
def __init__(self, g_data):
self.auth = False
... | jvictor0/TiaraBoom | tiara/server.py | Python | mit | 6,107 |
#!/home/pi/.venv/jns/bin/python
#
# last modified 2019/05/26
#
# Python helper script to download Julia 1.1.0 binaries
# not meant to be executed manually
# https://stackoverflow.com/questions/38511444/python-download-files-from-google-drive-using-url
#
FILE_ID = '1fj6pNAJgmUD7bsSXqh8ocC1wESx8jkRh'
DESTINATION = './j... | kleinee/jns | scripts/dnld_julia-1.1.0-arm32bit.py | Python | mit | 1,372 |
from test_fena.test_common import test_cmd
def test_simple_cmds():
test_cmd("tag @s + _lol", "tag @s add fena.lol")
test_cmd("tag @s - _lol", "tag @s remove fena.lol")
test_cmd(r"tag @s + _lol {Invulnerable:1b}", expect_error=True)
test_cmd(r"tag @s - _lol {Invulne... | Aquafina-water-bottle/Command-Compiler-Unlimited | test_fena/v1_13/test_simple_cmds.py | Python | mit | 890 |
import merger
class Analyzer():
def analyze(self, path):
print 'Analyzing ' + path + '...'
return merger.main(path, 10, 4)
| h2oloopan/easymerge | EasyMerge/merger/analyzer.py | Python | mit | 145 |
import six
from grab import Grab
from grab.spider import Spider, Task
from grab.spider.error import SpiderError, FatalError
from tests.util import BaseGrabTestCase, build_spider
class SimpleSpider(Spider):
def task_baz(self, grab, unused_task):
self.stat.collect('SAVED_ITEM', grab.doc.body)
class Basic... | istinspring/grab | tests/spider.py | Python | mit | 7,171 |
# Generated by Django 2.2.4 on 2019-10-06 23:28
from django.db import migrations, models
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('text_search', '0009_annotatedtoken_speech_cat'),
]
operations = [
migrations.CreateModel(
name='Searc... | kingsdigitallab/tvof-django | tvof/text_search/migrations/0010_searchfacet.py | Python | mit | 1,225 |
'''Write a function find_longest_word() that takes a list of words and returns the length of the longest one.'''
def maps(x):
k=[]
for i in x:
k.append(len(i))
print max(k)
maps(['apple','orange','cat']) | garg10may/Python-for-Beginners-Solve-50-Exercises-Live | 15.py | Python | mit | 238 |
from .settings import *
from .secrets_test import *
DATABASES['default']['NAME'] = ':memory:'
| tomchuk/meetup | meetup/meetup/settings_test.py | Python | mit | 95 |
#!/usr/bin/env python
import unittest
import random
import string
from vredis import VRedis
from mockredis import MockConnectionPool
class VRedisTest(unittest.TestCase):
def setUp(self):
# setup VRedis
self.vr = VRedis(
hosts=[
('1', 1, 85),
('2', 2, 170... | 50onRed/vredis | tests/vredistest.py | Python | mit | 3,062 |
import sys
import pytest
import numpy as np
import plotly.graph_objs as go
import plotly.io as pio
from plotly.io._utils import plotly_cdn_url
if sys.version_info >= (3, 3):
import unittest.mock as mock
from unittest.mock import MagicMock
else:
import mock
from mock import MagicMock
# fixtures
# -... | plotly/plotly.py | packages/python/plotly/plotly/tests/test_io/test_html.py | Python | mit | 965 |
# David Millar - July 17, 2016
# dave.millar@uwyo.edu
# NOTES: - ggplot code at the end is just used for evaluation and plotting, and can be omitted
# or commented out when integrating this module into TREES_Py_R
# - Non-linear least squares regression are currently used to determine empirical model
#... | mcook42/Py_R_Converters | r2py-testfile.py | Python | mit | 3,815 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-search-autosuggest/azure/cognitiveservices/search/autosuggest/_configuration.py | Python | mit | 1,750 |
# Display file for Gravity
from pylab import *
output = atleast_2d(loadtxt('sample.txt'))
num_particles = (output.shape[1] - 3)//6
print(num_particles)
figure(figsize=(13, 6))
ion()
hold(False)
for i in xrange(0, output.shape[0]):
model = output[i, 3:-1]
x, y = model[0:num_particles], model[num_particles:2*num_part... | eggplantbren/TwinPeaks3 | Code/C++/display_gravity.py | Python | mit | 574 |
'''
Translate a .strings file from one language to another.
'''
from __future__ import with_statement
import re, sys, time
import codecs, locale
import PyGlang
k_langPathRegEx = re.compile('.*/([^\.]+)\.lproj.+$')
k_valueRegEx = re.compile('"([^"]*)"(\s*=\s*)"([^"]*)";', re.UNICODE)
def DetectEncoding(filepath):
... | kgn/pyglang | PyGlang/TranslateDotStrings.py | Python | mit | 2,467 |
# -*- coding: utf-8 -*-
# Copyright ยฉ 2012-2019 Roberto Alsina and others.
# 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 t... | okin/nikola | nikola/plugins/compile/__init__.py | Python | mit | 1,170 |
N = int(input())
R = [int(x) for x in input().split()]
g = [R[0]]
i = 1
while i < N and g[0] == R[i]: i += 1
if i != N:
g.append(R[i])
i += 1
while i < N:
if g[-2] < g[-1] < R[i] or g[-2] > g[-1] > R[i]:
g[-1] = R[i]
elif g[-2] < g[-1] > R[i] or g[-2] > g[-1] < R[i]:
g.append(R[i])
i... | knuu/competitive-programming | atcoder/corp/codefes2014f_e.py | Python | mit | 364 |
#!/usr/bin/env python3
# Copyright (c) 2014-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 re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly)... | dankcoin/dankcoin | qa/rpc-tests/rawtransactions.py | Python | mit | 7,193 |
# -*- 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):
# Adding field 'Subscription.frequency_duration'
db.add_column('billing_subscription', 'frequency_duration',... | artminster/artminster | contrib/billing/migrations/0003_auto__add_field_subscription_frequency_duration.py | Python | mit | 5,697 |
# -*- 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):
# Deleting model 'QandaProfile'
db.delete_table('qanda_app_qandaprofile')
def backwards(self, orm):
... | alpsayin/django-qanda | qanda/qanda_app/migrations/0020_auto__del_qandaprofile.py | Python | mit | 16,080 |
#!/usr/bin/python
import sys, os, time, socket
import ConfigParser
from web_request.handlers import wsgi, mod_python, cgi
from web_request.response import Response
from FeatureFilter.Service.Service import Service
from FeatureFilter.Algorithms.Clustering.MarkerCluster import MarkerCluster
from lxml import etree
from... | iocast/featurefilter | FeatureFilter/Server.py | Python | mit | 5,950 |
# coding=utf-8
from django.core.context_processors import csrf
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import View
from reportlab.lib.styles import getSampleStyleSheet
from export import report_as_pdf, report_as_csv, get_filename
import datetime
import copy
im... | alexsilva/zendeskspent | contracts/views.py | Python | mit | 5,444 |
"""
QUESTION:
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
ANSWER:
idea similar to dp
"""
class Solution:
# @param {integer} numRows
# @return {integer[][]}
def generate(self, numRows):... | tktrungna/leetcode | Python/pascals-triangle.py | Python | mit | 698 |
"""Run occasionally via cron for maintenance tasks."""
from datetime import datetime, timedelta
import praw
from models import cfg_file, Log, session, Subreddit
def main():
r = praw.Reddit(user_agent=cfg_file.get('reddit', 'user_agent'))
r.login(cfg_file.get('reddit', 'username'),
cfg_file.get('r... | sfwpn/AutoModerator | maintenance.py | Python | mit | 1,181 |
"""mybook URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-base... | kyon-bll/django_mybook | mybook/mybook/urls.py | Python | mit | 828 |
import os
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("corpusdir", help = "Path to the directory containing corpus directories")
parser.add_argument("script", help = "name of the script to be run")
args = parser.parse_args()
## lists of corpora to skip
## and failed to run... | MontrealCorpusTools/SPADE | run_all_corpora.py | Python | mit | 1,538 |
import change_case
import csv
import datetime
import iso8601
import json
import os
import random
import sys
import tempfile
import warnings
class JSONSchemaToDatabase:
'''JSONSchemaToDatabase is the mother class for everything
:param schema: The JSON schema, as a native Python dict
:param database_flavor... | better/jsonschema2db | jsonschema2db.py | Python | mit | 23,995 |
import unittest
import json
import time
from constellations import node
from constellations import message
from constellations import peer_node
class TestPeerNode(unittest.TestCase):
# TODO Cleanup the server and ports properly in order to run multiple independent tests
def setUp(self):
... | pthomaid/constellations | tests/test_peer_node.py | Python | mit | 2,850 |
import aws_curioh
from setuptools import find_packages, setup
version = aws_curioh.__version__
setup(
name='aws-curioh',
version=version,
description=('Simple Amazon AWS requests.'),
url='https://github.com/w2srobinho/aws-curioh',
author='Willian de Souza',
author_email='willianstosouza@gmail... | w2srobinho/aws-curioh | setup.py | Python | mit | 448 |
#!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
f... | walkowiak/mips | fastText/python/setup.py | Python | mit | 4,116 |
from __future__ import annotations
from typing import Any, Callable, Dict, List, Optional
from typing_extensions import Literal, TypedDict
class CommandDefinition(TypedDict):
function: Callable
description: str
is_alias: bool
aliases: List[str]
MyfitnesspalUserId = str
class GoalDisplayDict(Type... | coddingtonbear/python-myfitnesspal | myfitnesspal/types.py | Python | mit | 3,628 |
from contentbase import upgrade_step
from .shared import ENCODE2_AWARDS, REFERENCES_UUID
from past.builtins import long
import re
from pyramid.traversal import find_root
def number(value):
if isinstance(value, (int, long, float, complex)):
return value
value = value.lower().replace(' ', '')
value =... | kidaa/encoded | src/encoded/upgrade/biosample.py | Python | mit | 5,471 |
#!/usr/bin/env python
"""
Script for predicting TF binding with a trained model.
Use `predict.py -h` to see an auto-generated description of advanced options.
"""
import numpy as np
import pylab
import matplotlib
import pandas
import utils
import pickle
# Standard library imports
import sys
import os
import errno
i... | uci-cbcl/FactorNet | predict.py | Python | mit | 3,431 |
#!/usr/bin/env python3
import argparse
import scipy
import matplotlib.pyplot as plot
import wells.publisher as publisher
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--interactive",
help="Interactive mode",
action="store_true")
parser.add_argument("-e", "--ex... | ioreshnikov/wells | stability_eigenvalue.py | Python | mit | 2,880 |
"""
All webhook types
:see https://developers.facebook.com/docs/messenger-platform/webhook-reference
"""
from __future__ import unicode_literals
MESSAGE_RECEIVED = 'message_received'
POSTBACK_RECEIVED = 'postback_received'
AUTHENTICATION = 'authentication'
ACCOUNT_LINKING = 'account_linking'
MESSAGE_DELIVERED = 'messa... | shananin/fb_messenger | fb_messenger/types/webhook_types.py | Python | mit | 559 |
"""
Django settings for ssbwp2 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | antorof/django-simple | ssbwp2/settings.py | Python | mit | 2,067 |
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from findyour3d.utils.views import add_months, check_full_discount_for_prem... | hqpr/findyour3d | findyour3d/users/models.py | Python | mit | 2,216 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/email_v30_rc1.py | Python | mit | 9,158 |
from compass.compass import get_bearing
| piecakes/compass | compass/__init__.py | Python | mit | 40 |
# -*- coding: utf-8 -*-
import os, sys
from django.conf import settings
from django.core.management import call_command
DIRNAME = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(DIRNAME, 'database.db'),
}
}
settings.configure(D... | rosscdh/django-sendgrid | runtests.py | Python | mit | 1,270 |
#!/usr/bin/env python
from mock import MagicMock
from importlib import import_module
class FixtureClient(object):
def __init__(self):
# Keep track of Service instances in order to do future assertions
self.loaded_services = {}
def __call__(self, *args, **kwargs):
return self
def... | softlayer/softlayer-cinder-driver | slos/test/mocks/SoftLayer/__init__.py | Python | mit | 1,697 |
#coding:utf-8
from scipy import stats
import numpy as np
from pandas import Series,DataFrame
from openpyxl import load_workbook
import math
import uuid
import os
def chart(data_ws,result_ws):
pass
def _produc_random_value(mean,stdrange):
b = np.random.uniform(*stdrange)
a = b/math.sqrt(2)
x1,x2 = mean... | ppmm/python-bits | yj_anova_test.py | Python | mit | 6,003 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-11 03:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0003_post'),
]
operations = [
migrations.DeleteModel(
n... | mijkal/DjStarter | apps/user/migrations/0004_auto_20161211_0309.py | Python | mit | 508 |
import sys
verbose = sys.argv[1] == "true"
for line in sys.stdin:
if line.startswith('c("'):
features = line.rstrip("\n").replace('c("', '').replace(")", "").split(", ")
features = [x.replace('"', '') for x in features]
print(",".join(features).rstrip(","))
# if verbose:
# ... | srp33/ShinyLearner | AlgorithmScripts/Helper/ReformatMlrFeatureSelectionOutput.py | Python | mit | 346 |
from nextgen4b.analyze.to_csv import get_pos_stats, write_all_pos_stats, \
write_all_simple_misinc, get_stats
from nextgen4b.analyze.analyze import analyze_all_experiments
import nextgen4b.analyze.likelihood
import nextgen4b.analyze.words
__all__ = ['get_pos_stats', 'write_all_pos_stats', 'write_all... | tcyb/nextgen4b | nextgen4b/analyze/__init__.py | Python | mit | 397 |
#
# This file is part of PySkiplist. PySkiplist is Copyright (c) 2012-2015 by
# the PySkiplist authors.
#
# PySkiplist is free software available under the MIT license. See the file
# named LICENSE distributed with this file for the exact licensing terms.
from __future__ import absolute_import, print_function
import ... | geertj/pyskiplist | tests/mem_dllist.py | Python | mit | 682 |
""" smashlib.plugins.prompt
"""
#from IPython.utils.traitlets import Bool, Unicode
from smashlib import get_smash
from smashlib.plugins import Plugin
from smashlib.config import SmashConfig
from smashlib.prompt.component import PromptComponent
from smashlib._logging import smash_log
DEFAULT_IN_TEMPLATE = u'In [\\#]:... | mattvonrocketstein/smash | smashlib/plugins/prompt.py | Python | mit | 2,411 |
# 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 ... | rjschwei/azure-sdk-for-python | unreleased/azure-mgmt-intune/azure/mgmt/intune/models/application.py | Python | mit | 2,147 |
# Weka Normalization
# Normalizes all numeric values in the given dataset
# (apart from the class attribute, if set).
# The resulting values are by default in [0,1] for the data used to compute
# the normalization intervals. But with the scale and translation parameters one can change that,
# e.g., with scale = 2.0 an... | muntisa/pyWeka | PyScripts/wNormaliz.py | Python | mit | 1,219 |
from django.core.management import call_command
from freezegun import freeze_time
import pytest
@pytest.mark.django_db
def test_postlinks_command_friday(share, mocker):
mocked = mocker.patch('amweekly.slack.jobs.process_incoming_webhook.delay')
with freeze_time("2017-06-23"):
call_command('postlinks'... | akrawchyk/amweekly | amweekly/tests/test_management.py | Python | mit | 605 |
import numpy as np
from scipy.special import *
import scipy.linalg as lin
import FE
from Tkinter import *
import triangle
import matplotlib as mpl
mpl.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import matplotlib.tri a... | necoleman/fepy | Applications/triangle_survey_gui.py | Python | mit | 1,353 |
# Generated by Django 2.2.10 on 2020-03-27 00:40
import autoslug.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("monitorings", "0014_auto_20180917_0846"),
]
operations = [
migrations.AlterField(
model_name="monitoring... | watchdogpolska/feder | feder/monitorings/migrations/0015_auto_20200327_0040.py | Python | mit | 774 |
#!/usr/bin/env python
import sys
sys.path.append('/usr/share/inkscape/extensions') # or another path, as necessary
sys.path.append('/Applications/Inkscape.app/Contents/Resources/extensions')
sys.path.append('C:\Program Files\Inkscape\share\extensions')
#import xml.etree.ElementTree as ET
#ET.register_namespace('figuref... | FlyRanch/figurefirst | inkscape_extensions/0.x/tag_figure.py | Python | mit | 2,810 |
# -*- encoding: utf-8 -*-
import logging
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import re
import time
from datetime import datetime
import requests
log = logging.getLogger('facebook')
log.setLevel(logging.WARN)
#MESSAGE_URL = 'https://m.facebook.com/messages/... | spartak1547/Facebot | facebot/message.py | Python | mit | 8,619 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/public_ip_address.py | Python | mit | 4,256 |
def climbing_stairs(n):
"""
Returns a list of each way to climb n steps, where we can take either 1 step
or 2 steps at a time.
Intuition:
The last leap can either be 1 step or 2 steps. This yields a recurrence
relation that yields the Fibonacci numbers.
"""
prev, curr = [[]], [[... | adriano-arce/Interview-Problems | Recursion-Problems/Climbing-Stairs/Climbing-Stairs.py | Python | mit | 985 |
####
# Figure S4
# needs:
# - varykernel*.npz produced by runvarykernel.py
# - fattailed*.npz produced by runfattailed.py
# - rdf_*.npz produced by calc-rdf.py
# - sq_*.npz produced by calc-rdf.py
####
import glob
import sys
sys.path.append('..')
from lib.mppaper import *
import lib.mpsetup as mpsetup
import lib.immu... | andim/optimmune | figS4/figS4.py | Python | mit | 4,120 |
import pandas as pd
import pandasql
def min_temperature_on_rainy_days(filename):
'''
This function should run a SQL query on a dataframe of
weather data. More specifically you want to find the average
minimum temperature on rainy days where the minimum temperature
is greater than 55 degrees.
... | davidbroadwater/nyc-subway-datascience-project | project_2/mean_temp_on_rainy_days/mean_temp_on_rainy_days.py | Python | mit | 1,511 |
import numpy as np
import math as math
import word2vec
from utilities import Sentence, Product, AspectPattern
class AspectPatterns(object):
def __init__(self, pattern_name_list):
#possible pattern_name: adj_nn, nn, adj, adv
self.aspectPatterns_list = []
for pattern_name in pattern_name_list:
if pattern_name ... | MachineLearningStudyGroup/Smart_Review_Summarization | srs/word2VecModel.py | Python | mit | 7,782 |
'''
Client.py module. This module defines the Client class, which defines a Client type object.
A client is an object that needs to be managed by the application. Each client has an unique id,
an alphanumeric string for a name, and a 13-digit long integer which is the CNP. (personal numeric code)
... | p0licat/university | FP - Fundamentals Of Programming/text-library/domain/Client.py | Python | mit | 4,918 |
''' Image module '''
from karmaserver.data.models import db
class Image(db.Model):
''' Image class '''
_id = db.Column(db.String(64), primary_key=True)
observations = db.relationship('Observation', backref=db.backref('image', lazy='joined'))
x_size = db.Column(db.Integer)
y_size = db.Column(db.Int... | mnunezdm/cazasteroides | karmaserver/data/models/image.py | Python | mit | 753 |
from .get import GetProductSchema # noqa
from .list import ProductListSchema # noqa
| fastmonkeys/netvisor.py | netvisor/schemas/products/__init__.py | Python | mit | 86 |
# coding: utf-8
from flask import Flask, render_template
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map, icons
app = Flask(__name__, template_folder="templates")
# you can set key as config
app.config['GOOGLEMAPS_KEY'] = "XXXXX"
# you can also pass key here
GoogleMaps(app, key="XXXX")
@a... | sharkwheels/Independet_study_2017 | week8-google_maps/flask-maps/example.py | Python | mit | 9,848 |
from django.contrib.messages import constants as messages
from .common import *
ALLOWED_HOSTS = SECRETS.get('allowed_hosts', ['localhost'])
DEBUG = True
MESSAGE_LEVEL = messages.DEBUG if DEBUG else messages.INFO
CSRF_COOKIE_SECURE = False
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_DOMA... | randomic/aniauth-tdd | aniauth/settings/dev.py | Python | mit | 573 |
# -*- coding: utf-8 -*-
RABBIT = '''
(\__/) ||
(โขใ
โข) ||
/ ใ ใฅ
'''
def rabbitsay(spacing, message):
"""
โโโโโโโโโโโโโ
| rabbitsay |
โโโโโโโโโโโโโ
(\__/) ||
(โขใ
โข) ||
/ ใ ใฅ
Function to generate rabbit and sign with custom content
"""
lines = message.split()
width = ... | Cbeck527/rabbitsay | rabbitsay/rabbitsay.py | Python | mit | 720 |