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
from simpleGossip.gossiping.gossip import RemoteGossipService if __name__ == "__main__": from rpyc.utils.server import ThreadedServer t = ThreadedServer( RemoteGossipService, port=18861 ) t.start()
streed/simpleGossip
run.py
Python
mit
211
import sys import numpy as np from sklearn.model_selection import StratifiedKFold from sklearn.neural_network import MLPClassifier from sklearn.metrics import f1_score,accuracy_score, recall_score, precision_score import scipy from random import shuffle def load_dataset(filename): f = open(filename) x = [] ...
marcostx/BatCNN
mlp/mlp.py
Python
mit
1,571
from django import forms from example.models import OneUrlModel, ManyUrlsModel def test_one_url(db): class F(forms.ModelForm): class Meta: model = OneUrlModel fields = '__all__' form = F({'url': 'ya.RU'}) instance = form.save() assert instance.url == 'http://ya.ru' ...
shantilabs/django-smarturlfield
tests/test_modelfield.py
Python
mit
1,155
"""pblite message schemas and related enums.""" # Stop pylint from complaining about enums: # pyline: disable=too-few-public-methods import enum from hangups.pblite import Message, Field, RepeatedField, EnumField ############################################################################## # Enums ###############...
hangoutsbot/hangups
hangups/schemas.py
Python
mit
12,831
import logging from datetime import datetime import math import numpy as np import pandas as pd from flask_sqlalchemy import SQLAlchemy from ..models import SchoolWithDescription2020 from ..utilities import init_flask, time_delta, chunks, ItmToWGS84 school_fields = { "school_id": "ืกืžืœ_ืžื•ืกื“", "school_name": "...
hasadna/anyway
anyway/parsers/schools_with_description_2020.py
Python
mit
6,488
# this function will print a welcome message to the user def welcome_message(): print("Hello! I'm going to ask you 10 maths questions.") print("Let's see how many you can get right!") # this function will ask a maths question and return the points awarded (1 or 0) def ask_question(first_number, second_number)...
martinpeck/broken-python
mathsquiz/mathsquiz-step2.py
Python
mit
1,660
""" Contains a base Site class for pastebin-like sites. Each child class only needs to specify a base url, the relative url to the public pastes archive, and a lambda function to get the paste links out of the page. """ import logging import re from urllib.parse import urljoin from bs4 import BeautifulSoup import requ...
ThaWeatherman/scrapers
pastes/paste/paste.py
Python
mit
4,341
# -*- coding: utf-8 -*- # # Dummy parameters for models created in unit tests # from datetime import datetime credentials = '''{ "invalid": false, "token_uri": "https://accounts.google.com/o/oauth2/token", "refresh_token": "", "client_id": "351298984682.apps.googleusercontent.com", "token_expiry": "2050-11-...
opendatapress/open_data_press
tests/dummy.py
Python
mit
2,439
# MIT License # # Copyright (C) IBM Corporation 2019 # # 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, modify, merge...
IBM/differential-privacy-library
diffprivlib/models/__init__.py
Python
mit
1,558
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import numpy.linalg def norm_along_column(a, ord=2): norm = lambda x: np.linalg.norm(x, ord=ord) return np.apply_along_axis(norm, 0, a) def eig_residul(a, b, x, v, rel=True): av = a @ v bv = b @ v rs = norm_along_column(av - x * b...
ibara1454/pyss
pyss/util/analysis.py
Python
mit
443
# 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-devtestlabs/azure/mgmt/devtestlabs/models/policy_set_result.py
Python
mit
1,252
""" (c) Copyright 2014. All Rights Reserved. qball module setup and package. """ from setuptools import setup setup( name='qball', author='Matt Ferrante', author_email='mferrante3@gmail.com', description='Python integration for qball', license='(c) Copyright 2014. All Rights Reserved.', packa...
ferrants/qball-python
setup.py
Python
mit
547
from django.conf.urls import url from .views import ZadanieCreateView, ZadanieDetailView, ZadanieUpdateView urlpatterns = [ url(r'^dodaj/(?P<dopuszczenie_id>[0-9]+)/$', ZadanieCreateView.as_view(), name='create'), url(r'(?P<pk>[0-9]+)/detail/$', ZadanieDetailView.as_view(), name='detail'), url(r'(?P<pk>[...
szymanskirafal/ab
zadania/urls.py
Python
mit
388
from qcrash._dialogs.review import DlgReview def test_review(qtbot): dlg = DlgReview('some content', 'log content', None, None) assert dlg.ui.edit_main.toPlainText() == 'some content' assert dlg.ui.edit_log.toPlainText() == 'log content' qtbot.keyPress(dlg.ui.edit_main, 'A') assert dlg.ui.edit_mai...
ColinDuquesnoy/QCrash
tests/test_dialogs/test_review.py
Python
mit
455
def hotel_cost(nights): return 140 * nights def plane_ride_cost(city): if city == "Charlotte": return 183 elif city == "Tampa": return 220 elif city == "Pittsburgh": return 222 elif city == "Los Angeles": return 475 def rental_car_cost(days): total_car = days * ...
GunnerJnr/_CodeInstitute
Stream-2/Back-End-Development/1.Installing-Python/3.Using-IDLE/challenge-solution/vacation.py
Python
mit
629
from defcuts import * from defflags import * from defclump import * import astropy.table as table indir='/Users/amandanewmark/repositories/galaxy_dark_matter/GAH/' outdir='/Users/amandanewmark/repositories/galaxy_dark_matter/lumprofplots/clumps/' datatab = table.Table.read(indir+ 'LOWZ_HSCGAMA15_apmgs.fits') band...
anewmark/galaxy_dark_matter
callmeanSB.py
Python
mit
1,365
"""This is a really rough implementation but demonstrates the core ideas.""" import os import unittest try: import maya ISMAYA = True except ImportError: maya, ISMAYA = None, False from mayaserver.client import start_process, create_client, sendrecv class MayaTestCase(unittest.TestCase): def _setUp(...
rgalanakis/practicalmayapython
src/chapter6/mayatestcase.py
Python
mit
1,966
from .exc import ParameterTypeError # noqa from .nest import nest # noqa from .unnest import unnest # noqa __version__ = '0.2.1'
fastmonkeys/qstring
qstring/__init__.py
Python
mit
133
__author__ = 'jdaniel' import argparse from distutils.core import setup, Command import shutil from setuptools import find_packages import os import sys __version__ = "1.0.0" GAIA_DIR = os.getenv("HOME") + "/Gaia_v" + __version__ #GAIA_DIR = "/my/custom/install/location" + "/Gaia_" + __version__ class Color(object)...
jldaniel/Gaia
setup.py
Python
mit
4,535
from braces.views import LoginRequiredMixin from django.contrib.auth.models import User, Group from django.shortcuts import render # Create your views here. from django.views.generic import ListView, DetailView, CreateView, UpdateView from rest_framework import viewsets from employee.forms import CoachingSessionForm f...
luiscberrocal/homeworkpal
homeworkpal_project/employee/views.py
Python
mit
3,567
# coding=utf-8 from __future__ import unicode_literals c_lang_config = { "name": "c", "compile": { "group_memory": True, "src_name": "main.c", "exe_name": "main", "max_cpu_time": 5.0, "max_real_time": 10.0, "max_memory": 512 * 1024, # 512M compile memory ...
joeyac/JudgeServer
client/languages.py
Python
mit
2,209
from google.oauth2 import service_account from ..config import config cred_file = config.get("GoogleCloud", "CredentialPath") credentials = service_account.Credentials.from_service_account_file(cred_file) scoped_credentials = credentials.with_scopes([ 'https://www.googleapis.com/auth/devstorage.read_write' ])
2syume/telegram-majyobot
bot/cloud/__init__.py
Python
mit
318
# -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text...
rennancockles/gigapy
View/VisualizarTransportadoraView.py
Python
mit
3,770
import os from rbm import RBM from au import AutoEncoder import tensorflow as tf import input_data from utilsnn import show_image, min_max_scale import matplotlib.pyplot as plt flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_string('data_dir', '/tmp/data/', 'Directory for storing data') flags.DEFINE_integer('epo...
Cospel/rbm-ae-tf
test-ae-rbm.py
Python
mit
4,382
#!/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. """ RPA Unlikelihood (128 model) """ from parlai.zoo.light_whoami.whoami_download import download_with_model_type def d...
facebookresearch/ParlAI
parlai/zoo/light_whoami/rpa_ul_128.py
Python
mit
400
import sys import os sys.path.append(os.path.abspath(os.curdir))
WoodNeck/tataru
test/__init__.py
Python
mit
64
import argparse import yaml from jubatus.classifier.client import classifier from jubatus.classifier.types import * from jubaweather.version import get_version def parse_options(): parser = argparse.ArgumentParser() parser.add_argument( '-a', required = True, help = 'analyze data file (YAML)', ...
kosugawala/jubatus-weather
python/jubaweather/main.py
Python
mit
2,275
# -*- coding: utf-8 -*- """ Created on Thu Aug 20 12:01:18 2015 @author: Eric Dodds Abstract dictionary learner. Includes gradient descent on MSE energy function as a default learning method. """ import numpy as np import pickle # the try/except block avoids an issue with the cluster try: import matp...
emdodds/DictLearner
DictLearner.py
Python
mit
16,189
from app import db, cache from model import UserInfo import pickle from random import seed, randint from heapq import nlargest seed() cache.clear() fr = open('dat/a.dat','rb') U = pickle.load(fr) # a user_num x 100 mat unorm = pickle.load(fr) fr.close() #for i in xrange(len(unorm)): # unorm[i]+=1 class DUser: ...
wattlebird/Chi
www/app/data.py
Python
mit
3,269
# modusite # Copyright (c) 2006-2010 Phil Christensen # http://modu.bubblehouse.org # # from modu.persist import storable class FAQ(storable.Storable): def __init__(self): super(FAQ, self).__init__('faq') def get_answerer(self): store = self.get_store() store.ensure_factory('user') user = store.load_one('...
philchristensen/modu
examples/modusite/modusite/model/faq.py
Python
mit
371
#!/usr/bin/env python3 def sum_digits(n): return sum(int(d) for d in str(n)) print(sum_digits(2**1000))
arekfu/project_euler
p0016/p0016.py
Python
mit
110
''' Created on Jan 11, 2016 @author: Lucas Lehnert (lucas.lehnert@mail.mcgill.ca) Control on the Acrobot domain. ''' import numpy as np import matplotlib.pyplot as plt from mdp import MDPContinuousState from basisfunction import getTiledStateActionBasisFunction from policy import BoltzmannPolicy from qlearning impo...
lucasgit/rl
TD/src/acrobot.py
Python
mit
13,546
# pylint: disable=no-else-return """Adapted from an exercise in "Coding the Matrix". This script ingests a text file, produces an index of the words in that text file, and allows a user to search that index for one of more words. Validation is minimal. """ from string import punctuation def make_inverse_index(strlist...
carawarner/grasp
python/scripts/brute_searcher.py
Python
mit
3,110
import requests """The available regions""" REGIONS = { 'US': 'https://us.api.battle.net/wow', 'EU': 'https://eu.api.battle.net/wow', 'KR': 'https://kr.api.battle.net/wow', 'TW': 'https://tw.api.battle.net/wow' } """The available fields for use to get more detailed information for a specific character...
GoblinLedger/wowapi
wowapi/__init__.py
Python
mit
9,460
class BaseRuntimeException(BaseException): def __init__(self, message): super().__init__(message) class MemoryError(BaseRuntimeException): pass class NameError(MemoryError): pass class TypeError(BaseRuntimeException): pass class ArithmeticError(BaseRuntimeException): pass class ZeroDi...
maxmalysh/tiny-py-interpreter
tinypy/runtime/Errors.py
Python
mit
685
from .menu import menu_handlers from .main import main_handlers from .toolbar import toolbar_handlers handlers = {} handlers.update(menu_handlers) handlers.update(main_handlers) handlers.update(toolbar_handlers) __all__ = ['handlers']
uvNikita/fsm_builder
fsm_builder/handlers/__init__.py
Python
mit
239
#!/usr/bin/env python ''' Copyright (c) 2012 Jeremy Parks ( xanthic.9478 ) 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...
xanthics/gw2crafting---retired
Crafting.py
Python
mit
21,884
import CursesTimer import Audio import Utils import database import datetime class Pomodoro: ''' pomodoro้–ข้€ฃ ''' def __init__(self): self.db = database.database() self.t = CursesTimer.CursesTimer() self.u = Utils.Utils() self.NofPomodoro = 4 #ไผ‘ๆ†ฉใพใงไฝ•ๅ›žใƒใƒขใƒ‰ใƒผใƒญใ™ใ‚‹ใ‹ ...
tortuepin/pomodoro-python
pomodoro.py
Python
mit
5,789
#!/usr/bin/env python import os from setuptools import setup, find_packages import skypipe setup( name='skypipe', version=skypipe.VERSION, author='Jeff Lindsay', author_email='progrium@gmail.com', description='Magic pipe in the sky', long_description=open(os.path.join(os.path.dirname(__file__)...
progrium/skypipe
setup.py
Python
mit
844
# -*- coding: utf-8 -*- """ test ~~~~ Sanic-CORS is a simple extension to Sanic allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2020 by Ashley Sommer (based on flask-cors by Cory Dolphin). :license: MIT, see LICENSE for more details. """ fr...
ashleysommer/sanic-cors
tests/decorator/test_exception_interception.py
Python
mit
9,339
"""Uploads apk to rollout track with user fraction.""" import sys import socket from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import subprocess import xml.etree.ElementTree as ET import os from pathlib import Path TRACK = 'beta' USER_FRACTION = 1 APK_FILE = '...
yunity/foodsaving-frontend
cordova/playstoreHelper/publish_to_beta.py
Python
mit
5,755
#!/usr/bin/env python # coding: utf-8 from xml.dom import minidom import re def atc_1_root_element(kml): """Verify that the root element of the document has [local name] = "kml" and [namespace name] = "http://www.opengis.net/kml/2.2""" root = kml.documentElement isKml = root.tagName ==...
heltonbiker/MapComplete
PyQt/kml/minidom/KmlDomConformanceTester.py
Python
mit
3,679
from django.conf import settings from django.conf.urls import url from django.conf.urls.static import static from vod import user_views from vod.alias_id_views import AliasIdListView, AliasIdCreateView, AliasIdUpdateView, AliasIdRetireView from vod.datatype_views import DataTypeListView, DataTypeCreateView, DataTypeUp...
hizni/vod-systems
vod_systems/vod/urls.py
Python
mit
6,067
# 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/bt_default_unit_info.py
Python
mit
4,695
import os from os.path import expanduser import sys import yaml def getSettings(): if not getSettings.settings: cwd = os.getcwd() path = cwd + '/.settings.yaml' if not os.path.isfile(path): path = cwd + '/.screeps_settings.yaml' if not os.path.isfile(path): ...
screepers/screeps-stats
screeps_etl/settings.py
Python
mit
743
from pyeda.inter import * ''' The Englishman lives in the red house. The Swede keeps dogs. The Dane drinks tea. The green house is just to the left of the white one. The owner of the green house drinks coffee. The Pall Mall smoker keeps birds. The owner of the yellow house smokes Dunhills. The man in the center house ...
liuyonggg/learning_python
riddle/einstein.py
Python
mit
4,632
# -*- coding: utf-8 -*- from checker.backends import BaseBackend from checker import logger log = logger.getLogger(__name__) class GnomeBackend(BaseBackend): """for projects hosted on gnome.org""" name = 'Gnome' domain = 'gnome.org' example = 'https://download.gnome.org/sources/gnome-control-center...
1dot75cm/repo-checker
checker/backends/gnome.py
Python
mit
803
# coding=utf-8 # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ from datetime import datetime from azure.core import credentials import pytest import six import time from azure.containerregistry import ( Repositor...
Azure/azure-sdk-for-python
sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py
Python
mit
23,434
#!/usr/bin/env python # -*- coding: utf-8 -*- """""" import tkinter as tk from tkinter import ttk # http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-LabelFrame.html __title__ = "ToggledLabelFrame" __version__ = "1.2.5" __author__ = "DeflatedPickle" class ToggledLabelFrame(ttk.LabelFrame): "...
DeflatedPickle/pkinter
pkinter/toggledlabelframe.py
Python
mit
3,471
#!/usr/bin/env python import os import time import logging import argparse from Queue import Queue from threading import Thread from salt.utils.event import LocalClientEvent LOGGER = logging.getLogger() MAX_TIMEOUT_VALUE=60*5 def __parse_record(event): payload = event.get('data', {}) return payload.get('rec...
rehmanz/salt-reactors-demo
salt/formulas/base/reactor/ui_reactor.py
Python
mit
2,365
KEYWORDS = ['resin', ] def rules(head='',context='',ip='',port='',productname={},keywords='',hackinfo=''): return False
nanshihui/PocCollect
middileware/resin/__init__.py
Python
mit
123
import numpy as np import time import math import cv2 from pylab import array, arange, uint8 from PIL import Image import eventlet from eventlet import Timeout import multiprocessing as mp # Change the path below to point to the directoy where you installed the AirSim PythonClient #sys.path.append('C:/Users/Kjell/Goog...
Kjell-K/AirGym
gym_airsim/envs/myAirSimClient.py
Python
mit
6,563
# 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/v2017_10_01/aio/operations/_security_rules_operations.py
Python
mit
22,275
from game.table import Table from mahjong.constants import EAST, NORTH, SOUTH, WEST from utils.decisions_logger import MeldPrint from utils.test_helpers import make_meld, string_to_136_array def test_can_call_riichi_and_tempai(): table = Table() player = table.player player.in_tempai = False player.i...
MahjongRepository/tenhou-python-bot
project/game/tests/test_player.py
Python
mit
3,093
# shading = { # 0: " ", # 1: "โ–‘", # 2: "โ–’", # 3: "โ–“", # 4: "โ–ˆ"} # intro_string = ''' __ __ _ _ _ # \ \ / /__| |__ ___ _ __ ___ | |_ ___(_) # \ \/\/ / -_) / _/ _ \ ' \/ -_) | _/ _ \_ # \_/\_/\___|_\__\___/_|_|_\___...
juanchodepisa/sbtk
SBTK_League_Helper/test3.py
Python
mit
3,732
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Outsidetextfont(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "bar" _path_str = "bar.outsidetextfont" _valid_props = {"color", "colorsrc", "family...
plotly/python-api
packages/python/plotly/plotly/graph_objs/bar/_outsidetextfont.py
Python
mit
11,250
from chainer import cuda from chainer import function_node from chainer.utils import type_check class FFT(function_node.FunctionNode): """Fast Fourier transform.""" def __init__(self, method): self._method = method def check_type_forward(self, in_types): type_check.argname(in_types, ('r...
rezoo/chainer
chainer/functions/math/fft.py
Python
mit
2,426
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-08-24 03:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('crowdsourcing', '0134_userprofile_purpose_of_use'), ] operations = [ migration...
shirishgoyal/crowdsource-platform
crowdsourcing/migrations/0135_auto_20160824_0348.py
Python
mit
649
from datetime import timedelta, datetime from django.contrib import messages from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.db import transaction from django.http import Http404 from django.http import HttpResponse from django.shortcuts import get_object_or_4...
ultmaster/eoj3
contest/views.py
Python
mit
11,433
#!/usr/bin/env python3 class Solution: def maxPower(self, s): p, cnt, ret = '', 1, 0 for c in s: if c == p: cnt += 1 else: ret, cnt = max(ret, cnt), 1 p = c return max(ret, cnt) str_list = [ 'cc', 'leetcode', '...
eroicaleo/LearningPython
interview/leet/1446_Consecutive_Characters.py
Python
mit
471
""" ์ผ๋ฐ˜๋งค๋„ """ import base64 import simplejson as json import hashlib import hmac import httplib2 import time ACCESS_KEY = '' SECRET_KEY = '' currency = 'btc-krw' def get_encoded_payload(payload): dumped_json = json.dumps(payload) encoded_json = base64.b64encode(dumped_json) return encoded_json def get_signature...
newsters/coinrail
sell.py
Python
mit
1,249
from setuptools import find_packages, setup import os name = 'presence_analyzer' version = '0.2.2' def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name=name, version=version, description='Presence analyzer', long_description=read('README.md'), ...
Pacu2/presence-analyzer-fkucharczyk
setup.py
Python
mit
943
# -*- coding: utf-8 -*- """ Module to handle word vectors and initializing embeddings. """ import numpy as np from gensim.models.keyedvectors import KeyedVectors from utils import constants as Constants from utils.timer import Timer from collections import Counter ###################################################...
stanfordnlp/coqa-baselines
rc/word_model.py
Python
mit
3,203
import asyncio class FakeProtocol(asyncio.Protocol): def __init__(self, name): self.name = name self.connections_made = 0 self.data = [] self.connection_errors = [] self.expected_received = 0 self.expected = 0 self.connected = asyncio.Future() self.c...
madedotcom/photon-pump
test/connection/fake_server.py
Python
mit
1,317
# -*- coding=utf-8 -*- import cPickle import numpy as np import os import sys """Common tools for this project. Utils are defined in this module for sharing. """ PROJ_DIR = os.path.split(os.path.realpath(__file__))[0] def draw_progress(iteration, total, pref='Progress:', suff='', decimals=1, barle...
kn45/RNNRegressor
rnn_regressor/mlfutil.py
Python
mit
3,971
from stst.features.features_sequence import * from stst.features.features_pos import * from stst.features.features_ngram import * from stst.features.features_bow import * from stst.features.features_dependency import * from stst.features.features_align import * from stst.features.features_embedding import * from stst....
rgtjf/Semantic-Texual-Similarity-Toolkits
stst/features/__init__.py
Python
mit
525
__author__ = 'teemu kanstren' import pypro.utils as utils import pypro.snmp.config as config class CSVFileLogger: files = {} def __init__(self): oids = config.SNMP_OIDS utils.check_dir() self.event_log = open(utils.event_log+".csv", "w", encoding="utf-8") event_header = "time...
mukatee/pypro
src/pypro/snmp/loggers/csv_logger.py
Python
mit
1,847
import unittest import pymq.tests.test_item
cripplet/pymq
pymq/tests/__init__.py
Python
mit
45
"""The decision module handles the three planning levels Currently, only pre-specified planning is implemented. The choices made in the three planning levels influence the set of interventions and assets available within a model run. The interventions available in a model run are stored in a dict keyed by name. """...
willu47/smif
src/smif/decision/decision.py
Python
mit
22,709
#!/usr/bin/env python import logging logger = logging.getLogger() import argparse import collections import sys import os from Bio import SeqIO if __name__ == "__main__": parser = argparse.ArgumentParser(description="Adds novel alleles to an existing MLST scheme.") parser.add_argument("-n", "--novel", type=...
WGS-TB/MentaLiST
scripts/create_new_scheme_with_novel.py
Python
mit
2,432
import signal as signals import messages from config import config from curio import SignalQueue, TaskGroup, run, spawn, tcp_server # Queue, CancelledError from feeds import ClientStreamFeed from logs import setup_logging from tasks import ControlTask, HeartbeatTask, StatusTask logger = setup_logging(__name__) # T...
SV-Seeker/pi-rov
rov/main.py
Python
mit
2,172
#!/usr/bin/env python3 """ Calculate the total cost of tile it would take to cover a floor plan of width and height, using a cost entered by the user. """ from __future__ import print_function import argparse import sys class App(object): """Application.""" def __init__(self, args): self._raw_args =...
micumatei/learning-goals
Probleme/Solutii/Find_Cost_of_Tile_to_Cover_WxH_Floor/mmicu/python/main.py
Python
mit
1,283
""" WARNING! this module is incomplete and may have rough edges. Use only if necessary """ import py from struct import unpack from rpython.rlib.rstruct.formatiterator import FormatIterator from rpython.rlib.rstruct.error import StructError class MasterReader(object): def __init__(self, s): self.input = ...
jptomo/rpython-lang-scheme
rpython/rlib/rstruct/runpack.py
Python
mit
3,506
from __future__ import unicode_literals import re import time from netmiko.cisco_base_connection import CiscoSSHConnection class RuckusFastironBase(CiscoSSHConnection): """Ruckus FastIron aka ICX support.""" def session_preparation(self): """FastIron requires to be enable mode to disable paging.""" ...
fooelisa/netmiko
netmiko/ruckus/ruckus_fastiron.py
Python
mit
2,254
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'ghost' import random import string import os import datetime import logging def allowed_file(file, allowed_extensions): """ :param file: file name :param allowed_extensions: file extension :return: bool: """ return '.' in file and f...
rsj217/flask--scaffold
avatar/utils.py
Python
mit
2,253
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class DkBygningDa(Monument): def set_adm_location(self): if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first...
Vesihiisi/COH-tools
importer/DkBygningDa.py
Python
mit
3,500
"""Tests for polynomial module. """ from __future__ import division, absolute_import, print_function import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import ( TestCase, assert_almost_equal, assert_raises, assert_equal, assert_, run_module_suite) def trim(x): return poly.p...
DailyActie/Surrogate-Model
01-codes/numpy-master/numpy/polynomial/tests/test_polynomial.py
Python
mit
19,204
#!/usr/bin/env python import unittest from pycoin.ecdsa import generator_secp256k1, sign, verify, public_pair_for_secret_exponent class ECDSATestCase(unittest.TestCase): def test_sign_verify(self): def do_test(secret_exponent, val_list): public_point = public_pair_for_secret_exponent(generat...
greenaddress/pycoin
pycoin/test/ecdsa_test.py
Python
mit
1,478
import subprocess # Hey this is embarrassing I'll remove it soon I promise. # I mean, maybe. Or I'll leave it malingering for years. def apply(params, state): subprocess.check_output(["cp", state['sqlite_file'], "/srv/git/datacommons_manitoba/production....
paulfitz/sheetsite
sheetsite/destination/install_local_soup.py
Python
mit
666
def __load(): import imp, os, sys try: dirname = os.path.dirname(__loader__.archive) except NameError: dirname = sys.prefix path = os.path.join(dirname, 'wx._gdi_.pyd') #print "py2exe extension module", __name__, "->", path mod = imp.load_dynamic(__name__, path) ## ...
hanipcode/norinproject
build/bdist.win-amd64/winexe/temp/wx._gdi_.py
Python
mit
358
"""Added columns for duel win/lose streaks in the tb_user_duel_stats table Revision ID: 514f4b9bc74 Revises: 1d6dbeb93c9 Create Date: 2015-12-22 00:17:51.509756 """ # revision identifiers, used by Alembic. revision = '514f4b9bc74' down_revision = '1d6dbeb93c9' branch_labels = None depends_on = None from alembic imp...
gigglearrows/anniesbot
alembic/versions/514f4b9bc74_added_columns_for_duel_win_lose_streaks_.py
Python
mit
1,069
#!/usr/bin/env python from setuptools import setup, find_packages with open('pypd/version.py') as version_file: exec(compile(version_file.read(), version_file.name, 'exec')) options = { 'name': 'pypd', 'version': __version__, 'packages': find_packages(), 'scripts': [], 'description': 'A python...
ryplo/helpme
setup.py
Python
mit
959
"""Constants for CLIFun.""" import click from .classes import Context CONTEXT_SETTINGS = dict(auto_envvar_prefix='PLAY') PASS_CONTEXT = click.make_pass_decorator(Context, ensure=True)
e4r7hbug/cli-fun
cli_fun/constants.py
Python
mit
186
import sys from csv_data import Data from csv_utilities import readIntegerCSV from csv_utilities import convertToZeroOne from statistics import mean from math import log def dotProduct( arr1, arr2 ): return sum( [ arr1[idx] * arr2[idx] for idx in range( len( arr1 ) ) ] ) # def dataSubsetWithY( data, y ): return [ r...
CKPalk/MachineLearning
Assignment3/Naive_Bayes/nb.py
Python
mit
2,586
import sys n, m = map(int, raw_input().strip().split()) v1, v2 = map(int, raw_input().strip().split()) x, y = map(int, raw_input().strip().split()) route_map = {} distance_map = {} def get_edge_name(x, y): if x > y: x, y = y, x return str(x) + '_' + str(y) def get_edge_distance(x,y): edge_name = get...
shams-sam/logic-lab
DfsShortestPath/dfs_solution.py
Python
mit
2,348
import climate import lmj.cubes import lmj.plot import numpy as np import pandas as pd import theanets logging = climate.get_logger('posture->jac') BATCH = 256 THRESHOLD = 100 def load_markers(fn): df = pd.read_csv(fn, index_col='time').dropna() cols = [c for c in df.columns if c.startswith('marker') and c[...
lmjohns3/cube-experiment
modeling/posture-to-jacobian-recurrent.py
Python
mit
3,374
''' Created on Jan 17, 2014 @author: oliwa ''' import sys as sys import numpy as np from prody.dynamics.anm import calcANM, ANM from prody.dynamics.editing import extendModel, sliceModel from prody.dynamics.functions import saveModel, loadModel, writeArray from prody.proteins.pdbfile import writePDB, parsePDB from pro...
Shen-Lab/cNMA
Software/ANMs.py
Python
mit
131,770
import os import shutil import unittest from flask import json class NewsView(unittest.TestCase): def setUp(self): import web reload(web) self.app = web.app.test_client() def tearDown(self): try: shutil.rmtree('urlshortner') except: pass def...
loogica/urlsh
test_views.py
Python
mit
2,651
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/ # Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http...
LockScreen/Backend
venv/lib/python2.7/site-packages/botocore/credentials.py
Python
mit
22,856
# 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/logz/azure-mgmt-logz/azure/mgmt/logz/operations/_monitors_operations.py
Python
mit
37,518
from models.basemodel import BaseModel class Campus(BaseModel): CAMPUS_CODES = ['BD', 'DN', 'CS'] LONG_NAMES = { 'BD': 'University of Colorado, Boulder', 'DN': 'University of Colorado, Denver', 'CS': 'University of Colorado, Colorado Springs' } def requiredFields(self): ...
SFII/cufcq-new
models/campus.py
Python
mit
1,334
import unittest import json import os from pywikibase import ItemPage, Claim try: unicode = unicode except NameError: basestring = (str, bytes) class TestItemPage(unittest.TestCase): def setUp(self): with open(os.path.join(os.path.split(__file__)[0], 'data', 'Q725...
wikimedia/pywikibot-wikibase
tests/test_itempage.py
Python
mit
1,946
from logbot.daemonizer import Daemonizer from logbot.irc_client import IrcClient from logbot.logger import Logger from logbot.parser import Parser
mlopes/LogBot
logbot/__init__.py
Python
mit
147
# Copyright (c) Matt Haggard. # See LICENSE for details. from distutils.core import setup import os, re def getVersion(): r_version = re.compile(r"__version__\s*=\s*'(.*?)'") base_init = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'norm/__init__.py') guts = open(base_init, 'r').read() m ...
iffy/norm
setup.py
Python
mit
737
dia=input("Digite seu dia de nascimento: ") mes=input("Digite seu mรชs de nascimento: ") ano=input("Digite seu ano de nascimento: ") print("Vocรช nasceu no dia", dia, "de", mes, "de", ano)
AlbertoAlfredo/exercicios-cursos
Curso-em-video/Python/aulas-python/Desafios/desafio002.py
Python
mit
188
class InMemoryRepository(list): pass
xfornesa/BDDByExample-python
src/MyTaste/in_memory_repository.py
Python
mit
41
from __future__ import division,print_function,unicode_literals,with_statement import logging from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend User=get_user_model() class EmailBackend(ModelBackend): def authenticate(self,username=None,password=None,**kwargs): ...
hikelee/launcher
launcher/utils/common/auth_backends.py
Python
mit
703
def app_logo_attr(): """ Return app logo LI attributes. """ attr = { '_class': 'navbar-brand', '_role': 'button'} if request.controller == 'studies': attr['_onclick'] = 'tocModal(event);' attr['_title'] = 'Chapter Studies' elif request.controller == 'poems' and request.fu...
tessercat/ddj
models/menu.py
Python
mit
3,603
import os from spinspy import local_data def isdim(dim): if os.path.isfile('{0:s}{1:s}grid'.format(local_data.path,dim)): return True else: return False
bastorer/SPINSpy
spinspy/isdim.py
Python
mit
178
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-19 16:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Crea...
djangophx/beer-tracker
tracker/migrations/0001_initial.py
Python
mit
2,278