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
import click import newsfeeds import random import sys from config import GlobalConfig def mixer(full_story_list, sample_number): """Selects a random sample of stories from the full list to display to the user. Number of stories is set in config.py Todo: Add argument support for number of stories to displ...
haaspt/whatsnew
main.py
Python
mit
2,815
#!/usr/bin/python3 from mymodule import * sayhi() # __version__ 不会导入 # print('Version: ', __version__)
louistin/thinkstation
a_byte_of_python/unit_9_module/mymodule_demo3.py
Python
mit
114
# The MIT License (MIT) # # Copyright (c) 2016 WUSTL ZPLAB # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
erikhvatum/RisWidget
ris_widget/examples/simple_point_picker.py
Python
mit
6,323
import serial import sys from time import sleep def move(dir): print dir ser.write(dir) # write a string ser.sendBreak(0.25) ser.flush() sleep(1) def ResetCoords(): dir = 'r' print dir ser.write(dir) # write a string ser.sendBreak(0.25) ser.flush() sleep(1) def DrawRect(d...
Zokol/ArduinoCNC
cnc.py
Python
mit
2,290
"""TreeNode operation to find next node.""" import threading from src.core import tree from src.ops import abstract class NextNodeOp(abstract.AbstractOp): """Finds next TreeNode instance in the tree in in-order traversal.""" def do(self, root, args): """Implements NextNodeOp. See http://www.geeksforg...
cripplet/treedoc-py
src/ops/next_node.py
Python
mit
1,836
""" homeassistant.components.media_player.chromecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provides functionality to interact with Cast devices on the network. WARNING: This platform is currently not working due to a changed Cast API """ import logging from homeassistant.const import ( STATE_PLAYING, ...
michaelarnauts/home-assistant
homeassistant/components/media_player/cast.py
Python
mit
8,631
"""Order a block storage replica volume.""" # :license: MIT, see LICENSE for more details. import click import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import exceptions CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()} @click.command(context_settings=CONTEXT_SETTINGS) @cli...
skraghu/softlayer-python
SoftLayer/CLI/block/replication/order.py
Python
mit
2,315
import time import rlp import trie import db import utils import processblock import transactions import logging import copy import sys from repoze.lru import lru_cache # logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() INITIAL_DIFFICULTY = 2 ** 17 GENESIS_PREVHASH = '\00' * 32 GENESIS_COINBASE =...
jnnk/pyethereum
pyethereum/blocks.py
Python
mit
32,057
from .stackapi import StackAPI from .stackapi import StackAPIError
AWegnerGitHub/stackapi
stackapi/__init__.py
Python
mit
66
from django.conf import settings from django.core import mail from django.test import RequestFactory from django.test import TestCase from django.contrib.sites.models import Site from contact_form.forms import ContactForm class ContactFormTests(TestCase): def test_request_required(self): """ Can...
nunataksoftware/anayluistango
contact_form/tests/forms.py
Python
mit
2,154
#!/usr/bin/env python # # Jetduino Example for using the Grove Sound Sensor and the Grove LED # # The Jetduino connects the Jetson and Grove sensors. You can learn more about the Jetduino here: http://www.NeuroRoboticTech.com/Projects/Jetduino # # Modules: # http://www.seeedstudio.com/wiki/Grove_-_Sound_Sensor # ht...
NeuroRoboticTech/Jetduino
Software/Python/grove_sound_sensor.py
Python
mit
2,624
"""Common profiles are defined here to be easily used within a project using --profile {name}""" from typing import Any, Dict black = { "multi_line_output": 3, "include_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "ensure_newline_before_comments": True, "line_length": 8...
TeamSPoon/logicmoo_workspace
packs_web/butterfly/lib/python3.7/site-packages/isort/profiles.py
Python
mit
1,601
from django.core.exceptions import ValidationError from amweekly.slack.tests.factories import SlashCommandFactory import pytest pytest.mark.unit def test_slash_command_raises_with_invalid_token(settings): settings.SLACK_TOKENS = '' with pytest.raises(ValidationError): SlashCommandFactory()
akrawchyk/amweekly
amweekly/slack/tests/test_models.py
Python
mit
313
#!/usr/bin/env python from collections import namedtuple Payload = namedtuple('Payload', ['iden', 'body', 'send_date', 'sender']) class Handler(object): @staticmethod def config(): return def __init__(self, logger): self.logger = logger def create_translator(): return de...
JimboMonkey1234/pushserver
handlers/Handler.py
Python
mit
725
__author__ = 'leif' import os import socket import logging import logging.config import logging.handlers from autocomplete_trie import AutocompleteTrie from ifind.search.engines.whooshtrec import Whooshtrec from experiment_setup import ExperimentSetup work_dir = os.getcwd() # when deployed this needs to match up with...
leifos/treconomics
treconomics_project/treconomics/experiment_configuration.py
Python
mit
8,405
import unittest from .context import json_stable_stringify_python as stringify class TestStringify(unittest.TestCase): def test_simple_object(self): node = {'c':6, 'b': [4,5], 'a': 3, 'z': None} actual = stringify.stringify(node) expected = '{"a":3,"b":[4,5],"c":6,"z":null}' self.as...
haochi/json-stable-stringify-python
tests/test_stringify.py
Python
mit
1,700
import datetime import os import uuid from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.urls import reverse from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from pinax.invitations.models import JoinI...
pinax/pinax-teams
pinax/teams/models.py
Python
mit
12,754
#!/usr/bin/env python import socket import random SERVERHOST = 'localhost' SERVERPORT = 4080 LOCALIP = '127.0.0.2' LOCALPORT = 4082 LOCALNAME = "30_PERCENT_SEE" def higher(dice_a, dice_b): ad1, ad2 = dice_a[0], dice_a[1] bd1, bd2 = dice_b[0], dice_b[1] if ad1 == bd1 and ad2 == bd2: return False if ad1 == "2...
SteffenBauer/mia_elixir
python/mia_client1.py
Python
mit
2,536
#!/usr/bin/python import os os.system('git add -A && git commit -m "Working on changes in my website (Amaia)" && git push origin master');
amaiagiralt/amaiagiralt
upload.py
Python
mit
140
"""Tests for hermite_e module. """ from __future__ import division, absolute_import, print_function import numpy as np import numpy.polynomial.hermite_e as herme from numpy.polynomial.polynomial import polyval from numpy.testing import ( TestCase, assert_almost_equal, assert_raises, assert_equal, assert_, run...
DailyActie/Surrogate-Model
01-codes/numpy-master/numpy/polynomial/tests/test_hermite_e.py
Python
mit
18,726
import floq.core.fixed_system as fs import floq.evolution as ev import floq.errors as er import floq.helpers.index as h class ParametricSystemBase(object): """ Base class to specify a physical system that still has open parameters, such as the control amplitudes, the control duration, or other arbitrary ...
sirmarcel/floq
benchmark/museum_of_evolution/uncompiled_floq/parametric_system.py
Python
mit
2,852
#!python # coding: utf-8 # edit by gistnu # reference from lejedi76 # https://gis.stackexchange.com/questions/173127/generating-equal-sized-polygons-along-line-with-pyqgis from qgis.core import QgsMapLayerRegistry, QgsGeometry, QgsField, QgsFeature, QgsPoint from PyQt4.QtCore import QVariant def getAllbbox(layer, widt...
chingchai/workshop
qgis-scripts/generate_stripmap_index.py
Python
mit
2,746
from django.conf import settings from django.conf.urls import url from plans.views import CreateOrderView, OrderListView, InvoiceDetailView, AccountActivationView, \ OrderPaymentReturnView, CurrentPlanView, UpgradePlanView, OrderView, BillingInfoRedirectView, \ BillingInfoCreateView, BillingInfoUpdateView, Bil...
cypreess/django-plans
plans/urls.py
Python
mit
2,070
from handlers import Handler from models import User # Login handler class Login(Handler): def get(self): self.render('login-form.html') def post(self): username = self.request.get('username') password = self.request.get('password') u = User.login(username, password) ...
YuhanLin1105/Multi-User-Blog
handlers/login.py
Python
mit
489
import unittest import json import sys try: from unittest.mock import Mock except ImportError: from mock import Mock import requests from tabpy_client.rest import * class TestRequestsNetworkWrapper(unittest.TestCase): def test_init(self): rnw = RequestsNetworkWrapper() def test_init_with...
slewt/TabPy
tabpy-server/tests/test_rest.py
Python
mit
5,180
# This module imports names for backwards compatibility and to ensure # that pickled objects in existing sessions can be unpickled. __all__ = ['DAObject', 'DAList', 'DADict', 'DAOrderedDict', 'DASet', 'DAFile', 'DAFileCollection', 'DAFileList', 'DAStaticFile', 'DAEmail', 'DAEmailRecipient', 'DAEmailRecipientList', 'DA...
jhpyle/docassemble
docassemble_base/docassemble/base/core.py
Python
mit
790
""" Basic utility functions """ import redislite from .server import RDB_FILE def header(message, width=80): header_message = '## ' + message + ' ' end_chars = width - (len(message) + 4) header_message += '#'*end_chars print(header_message) def connect_to_redis(): return redislite.Redis(dbfilenam...
dwighthubbard/micropython-cloudmanager
cloudmanager/utility.py
Python
mit
538
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "hector_imu_tools" PROJECT_SPACE_DIR =...
siketh/ASR
catkin_ws/build/hector_slam/hector_imu_tools/catkin_generated/pkg.develspace.context.pc.py
Python
mit
382
#!/usr/bin/python import unittest import os import random import numpy as np from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice from pymatgen.core.surface import Slab, SlabGenerator, generate_all_slabs, \ get_symmetrically_distinct_miller_indices from pymatgen.symmetry.group...
sonium0/pymatgen
pymatgen/core/tests/test_surface.py
Python
mit
13,101
# -*- coding: utf-8 -*- import unittest import datetime from cwr.parser.encoder.dictionary import ComponentDictionaryEncoder from cwr.work import ComponentRecord """ ComponentRecord to dictionary encoding tests. The following cases are tested: """ __author__ = 'Bernardo Martínez Garrido' __license__ = 'MIT' __stat...
weso/CWR-DataApi
tests/parser/dictionary/encoder/record/test_component.py
Python
mit
2,680
from django.db import models from django.utils.translation import ugettext_lazy as _ from cms.models.pluginmodel import CMSPlugin from djangocms_text_ckeditor.fields import HTMLField from easy_thumbnails.alias import aliases from easy_thumbnails.signals import saved_file from easy_thumbnails.signal_handlers import gen...
kfr2/cmsplugin-biography
cmsplugin_biography/models.py
Python
mit
2,213
import struct from common import * from objects import ObjectAppType from bcddevice import BCDDevice # element types: # X X ???? XX # class format subtype # class: # 1 = Library # 2 = Application # 3 = Device # format: # 0 = Unknown # 1 = Device # 2 = String # 3 = Object # 4 = Object List # 5 = Integer # 6 = ...
kupiakos/pybcd
elements.py
Python
mit
10,086
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # ---------------------------------------------------------------- # tests/test_filename.py # # Test thumbnail file name generation. # ---------------------------------------------------------------- # copyright (c) 2015 - Domen Ipavec # Distributed under The MIT License,...
matematik7/STM
tests/test_filename.py
Python
mit
4,121
import pymongo from pprint import pprint def mongo_conn(db, collection): conn = pymongo.MongoClient('localhost', 27017) db_conn = conn[db] coll_conn = db_conn[collection] print coll_conn return coll_conn def list_and_count(coll_field, coll_conn, display_limit=10): a = list(coll_conn.aggregat...
darth-dodo/Quotable
quotable_queries.py
Python
mit
2,932
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from base import Problem class Solution(Problem): def solve(self, input_): numberLargest = 0 for a in range(1, 100): if a % 10 != 0: for b in range(1, 100): num_pow = a**b number_su...
phapdv/project_euler
pe56.py
Python
mit
616
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import HTMLParser import smtplib, quopri from frappe import msgprint, throw, _ from frappe.email.smtp import SMTPServer, get_outgoing_email_account from frappe.email...
rohitwaghchaure/frappe
frappe/email/queue.py
Python
mit
16,756
# coding: utf-8 import os import click from chado import ChadoInstance from chakin.cli import pass_context from chakin import config from chakin.io import warn, info CONFIG_TEMPLATE = """## Chado's chakin: Global Configuration File. # Each stanza should contain a single chado server to control. # # You can set the k...
abretaud/python-chado
chakin/commands/cmd_init.py
Python
mit
2,442
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ** marun flavor: compoom ** usage: compoom=/path/to/append.script add parameter -XX:OnOutOfMemoryError= """ import util def apply(conf, currentflags, flavor_conf): compressor = flavor_conf.get('compressor', 'gzip,lz4 --rm') for cmd in compressor.s...
nishemon/marun
marun/flavor/compoom.py
Python
mit
483
from flask import Flask from flask.ext.bootstrap import Bootstrap from flask.ext.mail import Mail from flask.ext.moment import Moment from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager from flask.ext.pagedown import PageDown from config import config import os bootstrap = Bootstrap() ...
Summerotter/furryyellowpages
app/__init__.py
Python
mit
1,090
#!/usr/bin/env python3 # Copyright (c) 2015-2018 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 transaction signing using the signrawtransaction* RPCs.""" from test_framework.test_framework imp...
Bushstar/UFO-Project
test/functional/rpc_signrawtransaction.py
Python
mit
7,698
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2021, 2022 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA client validation utilities.""" import sys from typing import Dict, NoReturn, ...
reanahub/reana-client
reana_client/validation/utils.py
Python
mit
3,953
#!/usr/bin/env python from .util import Spec class Port(Spec): STATES = [ "listening", "closed", "open", "bound_to", "tcp", "tcp6", "udp" ] def __init__(self, portnumber): self.portnumber = portnumber self.get_state() self.state = { 'state': '...
daniellawrence/pyspeccheck
speccheck/port.py
Python
mit
2,928
__version__ = '0.3.0'
alexhayes/django-psi
psi/__init__.py
Python
mit
22
""" To create an Attribute Editor template using python, do the following: 1. create a subclass of `uitypes.AETemplate` 2. set its ``_nodeType`` class attribute to the name of the desired node type, or name the class using the convention ``AE<nodeType>Template`` 3. import the module AETemplates which do not meet o...
yaoyansi/mymagicbox
version_control/scripts/AETemplates/AEtestNodeATemplate.py
Python
mit
1,749
from rpython.rlib import jit import interpret import parse import kernel_type as kt def entry_point(argv): jit.set_param(None, "trace_limit", 20000) interpret.run(argv) return 0 def target(driver, args): return entry_point, None
euccastro/icbink
entry_point.py
Python
mit
248
import pytest from playlog.lib.json import Encoder def test_encoder(): encoder = Encoder() with pytest.raises(TypeError): encoder.default(object())
rossnomann/playlog
tests/src/tests/common/test_json.py
Python
mit
167
class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ if not needle: return 0 if len(haystack) < len(needle): return -1 for i in xrange(len(haystack)): if i + le...
comicxmz001/LeetCode
Python/28 Implement strStr.py
Python
mit
792
import os import json class FakeResponse(object): status_code = 200 text = None headers = [] def __init__(self, text): self.text = text def json(self): return json.loads(self.text) def response(name): content = open(os.path.join(os.path.dirname(__file__), 'responses', name)).read() return FakeResponse(...
VerosK/python-fakturoid
tests/mock.py
Python
mit
329
import numpy as np def gauss(win, sigma): x = np.arange(0, win, 1, float) y = x[:,np.newaxis] x0 = y0 = win // 2 g=1/(2*np.pi*sigma**2)*np.exp((((x-x0)**2+(y-y0)**2))/2*sigma**2) return g def gaussx(win, sigma): x = np.arange(0, win, 1, float) y = x[:,np.newaxis] ...
pranka02/image_processing_py
gaussian.py
Python
mit
652
#!/usr/bin/env python ''' 'roi_gcibs.py' compares two groups informed by an a priori bootstrap analysis. ''' import os import sys import argparse import tempfile, shutil import json import pprint import copy from collections import defaultdict from _common import systemMisc a...
FNNDSC/roi_tag
roi_gcibs.py
Python
mit
37,159
from collections import UserList from copy import copy from npc.util import print_err class Tag(UserList): """ Defines a mult-value tag object """ def __init__(self, name: str, *args, required: bool=False, hidden: bool=False, limit: int=-1): """ Create a new Tag object Args: ...
aurule/npc
npc/character/tags/tag.py
Python
mit
9,073
"""srt URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based ...
true7/srt
src/srt/urls.py
Python
mit
1,086
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-12-23 10:13 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('blog', '0006_auto_20160321_1527'), ] operations = ...
pinax/pinax-blog
pinax/blog/migrations/0007_auto_20161223_1013.py
Python
mit
752
from contextlib import contextmanager @contextmanager def failnow(): try: yield except Exception: import sys sys.excepthook(*sys.exc_info()) sys.exit(1)
ActiveState/code
recipes/Python/577863_Context_manager_prevent_calling_code_catching/recipe-577863.py
Python
mit
195
""" Qxf2 Services: A plug-n-play class for logging. This class wraps around Python's loguru module. """ import os, inspect import pytest,logging from loguru import logger from pytest_reportportal import RPLogger, RPLogHandler class Base_Logging(): "A plug-n-play class for logging" def __init__(self,log_file_na...
qxf2/qxf2-page-object-model
utils/Base_Logging.py
Python
mit
4,369
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maiziblog2.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
llinmeng/PythonStudy
maiziedu/3-Pycharm-Study/maiziblog2/manage.py
Python
mit
253
#!/usr/bin/python # ---------------------------------------------------------------------------- # cocos "jscompile" plugin # # Copyright 2013 (C) Intel # # License: MIT # ---------------------------------------------------------------------------- ''' "jscompile" plugin for cocos command line tool ''' __docformat__ =...
dios-game/dios-cocos
src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/plugin_jscompile/__init__.py
Python
mit
12,716
import socket import struct import sys from time import sleep import logging class SocketChannelFactory(): ''' Provides method to create channel connection. ''' def openChannel(self, host, port): try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port))...
PaulFlorea/Orbis2014
lib/tronclient/SocketChannel.py
Python
mit
2,095
#!/usr/bin/python # # Copyright (c) 2011 The VirtaCoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib impo...
virtacoin/VirtaCoinProject
contrib/pyminer/pyminer.py
Python
mit
6,441
from django.conf import settings from mock import Mock from cabot.cabotapp import defs from datetime import datetime def build_absolute_url(relative_url): """Prepend https?://host to a url, useful for links going into emails""" return '{}://{}{}'.format(settings.WWW_SCHEME, settings.WWW_HTTP_HOST, relative_ur...
Affirm/cabot
cabot/cabotapp/utils.py
Python
mit
2,425
''' alignment utility functions ''' import os import sys import subprocess import logging import mmap import gzip import multiprocessing from operator import itemgetter import numpy as np ## public functions ## def pair_alignment(paths, args): """ creates the alignment """ # validate parameters. assert ...
jim-bo/silp2
creation/align.py
Python
mit
10,726
from os import remove, mkdir, listdir, rmdir from os.path import join, expanduser, isdir from os.path import split as splitdir import codecs from shutil import copy2 indir = join(expanduser("~"),"Desktop") orgdir = "" bakdir = "" with codecs.open(join(indir,"_diff.txt"), 'r', encoding='utf8') as diff: # Read fir...
RagingRoosevelt/BackupMediaSyncer
_sync.py
Python
mit
3,135
from operator import itemgetter import gym from gym import spaces from gym.utils import seeding from .game import Game from .card import Card from .player import PlayerAction, PlayerTools from .agents.random import AgentRandom class LoveLetterEnv(gym.Env): """Love Letter Game Environment The goal of hotter...
user01/love-letter
loveletter/env.py
Python
mit
7,457
# coding: utf-8 # This file is a part of VK4XMPP transport # © simpleApps, 2013 — 2015. from datetime import datetime if not require("attachments"): raise AssertionError("'forwardMessages' requires 'attachments'") BASE_SPACER = chr(32) + unichr(183) + chr(32) def parseForwardedMessages(self, msg, depth=0): body =...
unclev/vk.unclev.ru
extensions/forwarded_messages.py
Python
mit
1,156
from .core import Report, ReportResponse __all__ = [ Report, ReportResponse, ]
smices/mWorkerService
src/3rd/jpush/report/__init__.py
Python
mit
87
from flask import Flask from os.path import expanduser def create_app(): app = Flask(__name__) app.config.from_pyfile(expanduser('~/.directory-tools.py')) from directory_tools.frontend import frontend app.register_blueprint(frontend) return app
FunTimeCoding/directory-tools
directory_tools/application.py
Python
mit
269
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aalto_fitness.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
jessenieminen/aalto-fitness-homepage
manage.py
Python
mit
256
__author__ = 'hujin' import sys from os import path from twisted.internet import reactor from twisted.web import server, resource from twisted.python import log from dockerman.storage import ServiceStore from dockerman.api import Root from dockerman.docker import Client from dockerman.manager import Manager from d...
bixuehujin/dockerman
dockerman/application.py
Python
mit
1,498
"""Unit tests for reviewboard.diffviewer.models.filediff.""" from itertools import chain from reviewboard.diffviewer.models import DiffSet, FileDiff from reviewboard.diffviewer.tests.test_diffutils import \ BaseFileDiffAncestorTests from reviewboard.testing import TestCase class FileDiffTests(TestCase): """...
reviewboard/reviewboard
reviewboard/diffviewer/tests/test_filediff.py
Python
mit
15,804
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv, sys, subprocess from lib_time import * # returns the given float number with only 2 decimals and a % appended def float_to_percentage(float_number): return("%0.2f" % float_number +"%") # normalize the dictionary with the word count to generate the wordcloud d...
ufeslabic/parse-facebook
lib_output.py
Python
mit
6,654
#!/usr/bin/env python # # Copyright (c) 2017 DevicePilot Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mo...
DevicePilot/synth
synth/watch_zeromq.py
Python
mit
1,364
from __future__ import unicode_literals from django.apps import AppConfig class SequencerConfig(AppConfig): name = 'sequencer'
CARPEM/GalaxyDocker
data-manager-hegp/analysisManager/analysismanager/sequencer/apps.py
Python
mit
134
import urllib.request import time def pega_preço(): pagina = urllib.request.urlopen('http://beans.itcarlow.ie/prices-loyalty.html') texto = pagina.read().decode('utf8') onde = texto.find('>$') inicio= onde + 2 fim = inicio + 4 return float(texto[inicio:fim]) opção = input("deseja comprar já? (S/...
andersonsilvade/python_C
Python32/aulas/hakeandositeprecodescontowhiletemposimounao.py
Python
mit
607
import logging import json import os import re #from pprint import pprint #from itertools import count from urlparse import urljoin from lxml import html from thready import threaded import requests from scrapekit.util import collapse_whitespace from connectedafrica.scrapers.util import MultiCSV from connectedafrica....
ANCIR/siyazana.co.za
connectedafrica/scrapers/npo.py
Python
mit
4,358
'''This module contains some glue code encapsulating a "main" process. The code here is aimed at wrapping the most common tasks involved in creating and, especially, training a neural network model. ''' import climate import datetime import downhill import os import warnings from . import graph from . import trainer...
masterkeywikz/seq2graph
src/theanets-0.6.1/theanets/main.py
Python
mit
9,363
import unittest import asyncio import io import multiprocessing import urllib.request import time import grole def simple_server(): app = grole.Grole() @app.route('/') def hello(env, req): return 'Hello, World!' app.run(host='127.0.0.1') class TestServe(unittest.TestCase): def test_sim...
witchard/grole
test/test_serve.py
Python
mit
1,174
# -*- coding: utf-8 -*- # a hack for pytest to allow imports if __package__ is None: import sys import os.path sys.path[0:0] = [ os.path.dirname( # project_root os.path.dirname( # tests os.path.abspath(__file__) # this file )...
9seconds/iblocklist2ipset
tests/test_networks.py
Python
mit
2,438
import django import time from uuid import uuid1 from datetime import timedelta from threading import Thread from django.template import Template from django.test import TestCase, TransactionTestCase from django.contrib.auth.models import User, Group from django.utils import timezone from django.core import managemen...
jiaaro/django-alert
test_project/alert_tests/tests.py
Python
mit
12,663
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- class HT...
Azure/azure-storage-python
azure-storage-common/azure/storage/common/_http/__init__.py
Python
mit
2,018
#import matplotlib.pyplot as plt import numpy as np from collections import deque import numbers """ Created on Jun 29, 2016 @author: hans-werner """ def convert_to_array(x, dim=None, return_is_singleton=False): """ Convert point or list of points to a numpy array. Inputs: x: (list of)...
hvanwyk/quadmesh
src/mesh.py
Python
mit
263,904
# Generated by Django 2.0.10 on 2019-05-12 17:44 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('userprofile', '0020_auto_20190507_0150'), ('news', '0019_auto_20190512_1608'), ] operations = [ mi...
hackerspace-ntnu/website
news/migrations/0020_auto_20190512_1744.py
Python
mit
780
# coding: utf-8 # # Simple Character-level Language Model using vanilla RNN # 2017-04-21 jkang # Python3.5 # TensorFlow1.0.1 # # - <p style="color:red">Different window sizes were applied</p> e.g. n_window = 3 (three-character window) # - input: &nbsp;&nbsp;'hello_world_good_morning_see_you_hello_grea' # ...
jaekookang/useful_bits
Machine_Learning/RNN_LSTM/predict_character/rnn_char_windowing.py
Python
mit
7,262
from mindfeed.mindfeed import main if __name__ == "__main__": main()
zeckalpha/mindfeed
mindfeed/__init__.py
Python
mit
75
import falcon import json class QuoteResource: def on_get(self, req, resp): """Handles GET requests""" quote = { 'quote': 'I\'ve always been more interested in the future than in the past.', 'author': 'Grace Hopper' } resp.body = json.dumps(quote) api = fal...
lotrekagency/heimdall
server/server.py
Python
mit
371
from __future__ import absolute_import from celery import shared_task import os.path import logging import csv from django.core.exceptions import ObjectDoesNotExist from .RandomAuthorSet import RandomAuthorSet from ..CitationFinder import CitationFinder, EmptyPublicationSetException from scholarly_citation_finder impo...
citationfinder/scholarly_citation_finder
scholarly_citation_finder/apps/citation/evaluation/tasks.py
Python
mit
5,022
""" helloworld.py Author: Nils Kingston Credit: none Assignment: Write and submit a Python program that prints the following: Hello, world! """ print("Hello, world!")
nilskingston/Hello-world
helloworld.py
Python
mit
170
#!/usr/bin/env python3 # Fortwrangler is a tool that attempts to resolve issues with fortran lines over standard length. # Global libraries import sys # Global variables # Strings inserted for continuation CONTINUATION_ENDLINE = "&\n" CONTINUATION_STARTLINE = " &" # Line length settings MIN_LENGTH = len(CONTI...
owainkenwayucl/utils
src/fortwrangler.py
Python
mit
6,251
import socket import pytest import mock from pygelf import GelfTcpHandler, GelfUdpHandler, GelfHttpHandler, GelfTlsHandler, GelfHttpsHandler from tests.helper import logger, get_unique_message, log_warning, log_exception SYSLOG_LEVEL_ERROR = 3 SYSLOG_LEVEL_WARNING = 4 @pytest.fixture(params=[ GelfTcpHandler(hos...
keeprocking/pygelf
tests/test_common_fields.py
Python
mit
2,884
#!/usr/bin/env python from setuptools import setup, find_packages try: from pyqt_distutils.build_ui import build_ui cmdclass = {'build_ui': build_ui} except ImportError: cmdclass = {} setup( name='foo', version='0.1', packages=find_packages(), license='MIT', author='Colin Duquesnoy', ...
ColinDuquesnoy/pyqt_distutils
example/PySide/setup.py
Python
mit
432
from __future__ import absolute_import, unicode_literals, division import hashlib import hmac import time from quadriga.exceptions import RequestError class RestClient(object): """REST client using HMAC SHA256 authentication. :param url: QuadrigaCX URL. :type url: str | unicode :param api_key: Quad...
joowani/quadriga
quadriga/rest.py
Python
mit
4,123
# This license covers everything within this project, except for a few pieces # of code that we either did not write ourselves or which we derived from code # that we did not write ourselves. These few pieces have their license specified # in a header, or by a file called LICENSE.txt, which will explain exactly what # ...
pwndbg/pwndbg
pwndbg/which.py
Python
mit
3,111
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import time #import struct from pycket import impersonators as imp from pycket import values, values_string from pycket.cont import continuation, loop_label, call_cont from pycket.arity import Arity from pycket import values_parameter from pycket impor...
pycket/pycket
pycket/prims/general.py
Python
mit
75,231
class Item(object): def __init__(self, path, name): self.path = path self.name = name
nickw444/MediaBrowser
Item.py
Python
mit
106
# 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/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py
Python
mit
31,820
from sys import platform as sys_plat import platform import os from ctypes import * if sys_plat == "win32": def find_win_dll(arch): """ Finds the highest versioned windows dll for the specified architecture. """ dlls = [] filename = 'VimbaC.dll' # look in local working directory...
morefigs/pymba
pymba/vimba_c.py
Python
mit
17,849
#!/usr/bin/env python2 import sys sys.path.append('../fml/') import os import numpy as np import fml import random t_width = np.pi / 4.0 # 0.7853981633974483 d_width = 0.2 cut_distance = 6.0 r_width = 1.0 c_width = 0.5 PTP = {\ 1 :[1,1] ,2: [1,8]#Row1 ,3 :[2,1] ,4: [2,2]#Row2\ ...
andersx/fml
tests/test_aras.py
Python
mit
6,751
""" This file implements a wrapper for facilitating domain randomization over robosuite environments. """ import numpy as np from robosuite.utils.mjmod import CameraModder, DynamicsModder, LightingModder, TextureModder from robosuite.wrappers import Wrapper DEFAULT_COLOR_ARGS = { "geom_names": None, # all geoms ...
ARISE-Initiative/robosuite
robosuite/wrappers/domain_randomization_wrapper.py
Python
mit
9,076
#!/usr/bin/env python3 from sfmutils.api_client import ApiClient import argparse import logging import sys log = logging.getLogger(__name__) def main(sys_argv): # Arguments parser = argparse.ArgumentParser(description="Return WARC filepaths for passing to other commandlines.") parser.add_argument("--har...
gwu-libraries/sfm-utils
sfmutils/find_warcs.py
Python
mit
3,455
NAME="Phone Alert Status"
brettchien/PyBLEWrapper
pyble/const/profile/phone_alert_status.py
Python
mit
26
import requests, urllib, httplib, base64 from flask import Flask, render_template, request, jsonify app = Flask(__name__) @app.route("/") def hello(): return render_template("index.html") @app.route("/search", methods=['POST', 'GET']) def callAPI(): error = None _url = 'https://api.projectoxford.ai/vision/v1.0/...
USCSoftwareEngineeringClub/pyceratOpsRecs
src/interface/hello.py
Python
mit
1,646