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 -*- """ A window with a unicode textfield where the user can edit. Useful for editing the contents of an article. """ from __future__ import unicode_literals # # (C) Rob W.W. Hooft, 2003 # (C) Daniel Herding, 2004 # Wikiwichtel # (C) Pywikibot team, 2008-2014 # # Distributed under the terms o...
hperala/kontuwikibot
pywikibot/userinterfaces/gui.py
Python
mit
21,830
# coding: UTF-8 from django.db import models from django.db.models import fields class Mensagem(models.Model): conteudo = models.TextField(null=False, blank=False) user_id = fields.CharField(null=False, max_length=64) class Config(models.Model): name = fields.CharField(null=False, max_length=64) va...
qmagico/sampleappqm
src/core/home/models.py
Python
mit
638
import os.path import pytest from awscatalyst import util class SomeException(Exception): pass def test_tempdir_instantiated(): td = util.tempdir(base_path="/tmp") assert td.base_path with pytest.raises(AttributeError): print(td.path) assert td.cleanup() or True, "Cleaning up unused t...
clifflu/awscatalyst
tests/test_util.py
Python
mit
1,288
#!/usr/bin/env python # -*- coding: utf-8 -*- from pip.req import parse_requirements from setuptools import setup __version__ = "1.2.0" __author__ = "Orcun Gumus <gumus@somed.io>, Gokce Muge Cil, <gokce@somed.io>" long_description = open('README.rst').read() install_reqs = parse_requirements("requirements.txt", sess...
somedanalytics/communicability
setup.py
Python
mit
809
# -*- coding: utf-8 -*- """Test fetching within tabix files """ import os from vcfpy import reader __author__ = "Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>" # Test fetch with chrom/begin/end --------------------------------------------- def test_fetch_no_records_values(): path = os.path.join(os.path.dir...
bihealth/vcfpy
tests/test_fetch.py
Python
mit
2,341
from numpy import * from scipy import * from pylab import * import collections as cll import csv import os import matplotlib.pyplot as plt ##################################################################################### ## Reading probes into the file folder = "../output" os.chdir(folder) filename='combined_colu...
erdc-cm/air-water-vv
2d/hydraulicStructures/sluice_gate/postprocess/dischargePlot_sluice.py
Python
mit
2,656
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import argparse import subprocess import sys import os import time import datetime import random import hashlib import tempfile from filelock import Timeout, FileLock import psutil DESCRIPTION = "A cron job wrapper to add some missing...
thefab/cronwrapper
cronwrapper/cronwrap.py
Python
mit
7,574
#!/usr/bin/env python # -*- coding: utf-8 -*- """Go through arXiv data. You can download arXiv data by s3cmd: 1. pip install s3cmd 2. s3cmd --configure 3. s3cmd get --recursive --skip-existing s3://arxiv/src/ --requester-pays """ import os from os import listdir from os.path import isfile, join import tarfile impor...
MartinThoma/write-math
tools/language_model/parse_arxiv.py
Python
mit
19,701
#Copyright (c) 2011, Peter Brunner (Lugoues) # #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, pub...
Lugoues/beets-lyrics
beetsplug/lyrics/utilites.py
Python
mit
1,322
__author__ = 'Neil Butcher' from PyQt4 import QtGui, QtCore def string(item): return str(item) class AddDelComboWidget(QtGui.QWidget): objectSelected = QtCore.pyqtSignal(QtCore.QObject) def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.layout = QtGui.QHBoxLayout(se...
ergoregion/Rota-Program
Rota_System/UI/widget_addDel_combo.py
Python
mit
3,473
#!/usr/bin/env python from influxdb import InfluxDBClient import os, time, PyNUT, argparse, socket WAIT_TIME = 60 # seconds def main(host='localhost', port=8086, ups='upsoem'): user = 'admin' password = 'admin' dbname = 'beastcraft' dbclient = InfluxDBClient(host, port, user, password, dbname) ...
ab77/beastcraft-telemetry
ups.py
Python
mit
2,221
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This tool will run scrapers, if it can. It also sets up a working area for them so that they don't all have to have their own data folder. This can optionally be cleaned up after each run. ''' import os import pkgutil import shutil import sys from publish.lib.manifes...
nhsengland/publish-o-matic
publish/tools/run_scraper.py
Python
mit
2,788
"""Test different accessory types: Lights.""" from datetime import timedelta from pyhap.const import HAP_REPR_AID, HAP_REPR_CHARS, HAP_REPR_IID, HAP_REPR_VALUE import pytest from homeassistant.components.homekit.const import ( ATTR_VALUE, PROP_MAX_VALUE, PROP_MIN_VALUE, ) from homeassistant.components.ho...
rohitranjan1991/home-assistant
tests/components/homekit/test_type_lights.py
Python
mit
43,714
import os, re, sys bindir = os.path.abspath(os.path.dirname(sys.argv[0])) libdir = bindir + "/../../lib" sys.path.append(libdir) import lacuna as lac glc = lac.clients.Member( config_file = bindir + "/../../etc/lacuna.cfg", config_section = 'sitter', ) my_planet = glc.get_body_byname( 'some_planet' ) trade...
tmtowtdi/MontyLacuna
t/bldgs/trade.py
Python
mit
4,579
try: from gevent.pool import Pool from gevent import monkey as curious_george except ImportError: raise RuntimeError('Gevent is required to run a WebhookApplication worker.') curious_george.patch_all(thread=False, select=False) import os import sys import time import logging import signal import argparse ...
closeio/sharq-webhooks
sharq_webhooks/__main__.py
Python
mit
1,586
class Test: def method1(self): pass
swiperthefox/python-source-browser
tests/fixtures/sample-dir/dir2/f2_1.py
Python
mit
48
# -*- coding: utf-8 -*- """ Created on Thu Aug 02 14:02:50 2012 @author: David """ import os, csv, glob, sys from datetime import datetime import sqlite3 as lite import tarfile csv.register_dialect('apsim', delimiter=' ', skipinitialspace=True) class ScrubError(Exception): '''Error for reporting a non-alphanumeri...
dhstack/apsimRegions
scripts/apsimRun/utils.py
Python
mit
12,043
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages setup(name='singletonmixin', version='2.0', license='MIT License', packages=find_packages(), )
nuwainfo/singletonmixin
setup.py
Python
mit
205
from flask_wtf import Form from wtforms import validators, FieldList from wtforms.fields.html5 import EmailField class EmailForm(Form): addresses = FieldList(EmailField('Email Address', [validators.DataRequired(), validators.Email()]))
jondye/blogger-email-sender
forms.py
Python
mit
242
#!/usr/bin/env python """ Scheduling tactician. """ import os import logging import numpy as np import ephem from collections import OrderedDict as odict from obztak import get_survey from obztak.utils.projector import angsep from obztak.utils import projector as proj from obztak.ctio import CTIO from obztak.utils i...
kadrlica/obztak
obztak/tactician.py
Python
mit
9,297
import math from typing import List, Union, Sequence from pyrep.backend import sim from pyrep.objects.object import Object, object_type_to_class import numpy as np from pyrep.const import ObjectType, PerspectiveMode, RenderMode class VisionSensor(Object): """A camera-type sensor, reacting to light, colors and ima...
stepjam/PyRep
pyrep/objects/vision_sensor.py
Python
mit
15,647
"""Contains classes and functions for modelling helical structure.""" from collections import OrderedDict import numpy from tools.geometry import ( Quaternion, dihedral, find_transformations, cylindrical_to_cartesian, Axis) from ampal.base_ampal import Atom from ampal.protein import Polypeptide, Residue from amp...
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
Python
mit
21,175
from django import forms import re city = ( ('KHARKOV', 'KHARKOV'), ('ODESSA', 'ODESSA'), ('DONETSK', 'DONETSK'), ('KIEV', 'KIEV'), ('DNEPR', 'DNEPR'), ('POLTAVA', 'POLTAVA'), ('MARIUPOL', 'MARIUPOL'), ) point = ( ('K0', 'K0'), ('K2', 'K2'), ('K01', 'K01'), ('K02', 'K02'),...
maxsocl/django-ssc
ssc/forms.py
Python
mit
2,430
"""Chat Messages.""" import json import logging from enum import Enum LOGGER = logging.getLogger(__name__) AGE_MARKERS = [ 'advanced to the', 'a progressé vers', '升级至', 'avanzó a la', 'đã phát triển lên', '시대로 발전했습니다', 'vorangeschritten', 'переход в', 'avançou para a Idade', 'wk...
happyleavesaoc/aoc-mgz
mgz/common/chat.py
Python
mit
6,245
# coding: utf-8 from __future__ import unicode_literals from collections import namedtuple SmokeTest = namedtuple('SmokeTest', 'func params name description') class Registry(object): def __init__(self): self._registry = [] @property def tests(self): """ List of all registered tests """ ...
djentlemen/django-smoked
smoked/registry.py
Python
mit
1,789
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-19 18:01 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('account', '0001_initial'), ] operations = [ migrations.AddField( ...
natotthomer/nattr
account/migrations/0002_auto_20170919_1801.py
Python
mit
595
import sys if len(sys.argv) >= 4 and sys.argv[1] == '--sub': sys.path[:] = eval(sys.argv[2]) # hacks for test_integration # XXX we don't invokve py.test machinery but try to make sure # pypy support code sees the test options from the invoking # process import rpython.conftest class opt: ...
jptomo/rpython-lang-scheme
rpython/jit/metainterp/test/test_memmgr.py
Python
mit
9,576
#!/usr/bin/python # (c) 2018 Jim Hawkins. MIT licensed, see https://opensource.org/licenses/MIT # Part of Blender Driver, see https://github.com/sjjhsjjh/blender-driver """Blender Driver Application with threads and synchronisation. This module is intended for use within Blender Driver and can only be used from within...
sjjhsjjh/blender-driver
blender_driver/application/thread.py
Python
mit
6,994
import numpy as np import math import heapq import tm # pip install scikit-learn from sklearn import tree from sklearn.naive_bayes import GaussianNB from sklearn import linear_model from sklearn.externals.six import StringIO from sklearn.metrics import precision_recall_curve from sklearn.metrics import accuracy_score ...
zollie/PASS
TextMining/Week2/cls.py
Python
mit
7,328
import firebase_admin from firebase_admin import credentials from firebase_admin import db from firebase_admin import firestore from firebase_admin import auth class FirebaseService(): def __init__(self, databaseURL, creds): if creds.get('private_key'): cred = credentials.Certificate(creds) fi...
WildflowerSchools/sensei
app/firebase_service.py
Python
mit
508
from rest_framework import status from rest_framework.response import Response def error_response(message): error_message = { 'errors': [ { 'status': status.HTTP_502_BAD_GATEWAY, 'humanMessage': 'A pagina da receita sofreu ' ...
gbazilio/nfebrasil
api/errors_helper.py
Python
mit
670
# -*- coding: utf-8 -*- """ """ from Chapter1.themes.great_common_divisor import gcd from Chapter2.themes.lisp_list_structured_data import car, cdr, cons from utils import let def make_rat(num, den): """The IF block comes from exercise 2.1""" with let(gcd(num, den)) as (g,): if num * den < 0: ...
aoyono/sicpy
Chapter2/themes/rational_number_system.py
Python
mit
1,843
# https://projecteuler.net/problem=54 # Adapted the solution that I've used elsewhere for project eulur, # hence the left, right and none. So left if player 1 and right # player 2 import urllib2 def main(): lines = urllib2.urlopen('https://projecteuler.net/project/resources/p054_poker.txt') p...
tdsymonds/project-euler
scripts/problem54.py
Python
mit
8,392
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-11-03 16:29 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('transcript', '0019_remove_transcriptphrasecorrection_not_an_error'), ] operations = [ ...
WGBH/FixIt
mla_game/apps/transcript/migrations/0020_auto_20171103_1629.py
Python
mit
473
import csv import os from tempfile import NamedTemporaryFile from django.conf import settings from django.core.files import File from django.core.management.base import BaseCommand, CommandError from refugeedata.models import RegistrationCardBatch class Command(BaseCommand): help = ("Exports the data from a ca...
ukch/refugeedata
refugeedata/management/commands/export_card_data.py
Python
mit
1,724
#!/usr/local/bin/python # -*- coding: utf-8 -*- #import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import scipy as sp import math as mt class DisplayWeights(object): def __init__(self): self.fig = None def make_graph_space(self): self.fig = plt....
WaterIsland/DLStudy
tensorflow/source/mine/mnist/DisplayWeights.py
Python
mit
3,423
from DTL.api import InternalError, Path from DTL.db import BaseData from DTL.db import StringProperty, FloatProperty, IntegerProperty, BooleanProperty, ListProperty, CustomDataProperty #------------------------------------------------------------ #------------------------------------------------------------ class Nod...
rocktavious/DevToolsLib
DTL/db/data.py
Python
mit
2,385
# 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-graphrbac/azure/graphrbac/operations/users_operations.py
Python
mit
18,223
# pylint: disable=too-many-arguments class CallRecord: def __init__(self, entity_name, method_name, input_parms_list, output, count): self.entity_name = entity_name self.count = count self.output = output self.input_parms_list = input_parms_list self.method...
qbahn/grortir
tests/framework/calls/calls_record.py
Python
mit
340
import psycopg2 def create_user(username, email, password): conn = psycopg2.connect(database="basketball", user="postgres", password="password") cur = conn.cursor() #cur.execute("INSERT INTO basket_user(user_id, user_email, user_password) VALUES ('" + username + "', '"+ email + "', '" + password+ "');") ...
weihengSu/basketApp
login_check.py
Python
mit
524
import os from slackclient import SlackClient BOT_NAME = 'startbot' slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN')) if __name__ == "__main__": api_call = slack_client.api_call("users.list") if api_call.get('ok'): # retrieve all users so we can find our bot users = api_call.get...
ChocolateCorp/MyBot
myBotId.py
Python
mit
579
import sys from PyQt5 import QtCore, QtGui, QtWidgets from calculator_design import Ui_MainWindow # pyuic5 -x calculator_design.ui -o calculator_design.py class Calculator(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) ...
ric2b/Qt-Calculator
calculator.py
Python
mit
2,556
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class involveEvent(scrapy.Item): # define the fields for your item here like: description = scrapy.Field() url = scrapy.Field() pass class events...
enirinth/free-food-calendar
foodscrape/items.py
Python
mit
468
""" This runs tests for brod's ZooKeeper Producer and Consumer. It actually starts an instance of ZooKeeper and multiple instances of Kafka. Since it's meant to run during development, it runs these servers on different ports and different locations from the application defaults, to avoid conflicts. Current assumptio...
DataDog/brod
brod/test/test_zk.py
Python
mit
23,047
import base64 import random from datetime import timedelta import json import re from django.utils.six import string_types, text_type as str from django.db import models from django.db.models import Q from django.db import transaction, IntegrityError from django.conf import settings from django.utils.translation impor...
okfse/froide
froide/foirequest/models.py
Python
mit
61,758
#!/usr/env/bin python # https://www.hackerrank.com/challenges/write-a-function # Python 2 def is_divisible_by(number, year): return year % number == 0 def is_leap(year): leap = False if is_divisible_by(4, year): leap = True if is_divisible_by(100, year): leap = False ...
arvinsim/hackerrank-solutions
hackerrank/all-domains/python/introduction/write-a-function/solution.py
Python
mit
399
#-*- coding: utf-8 -*- """ The authorization process utilizes two authorization server endpoints (HTTP resources): o Authorization endpoint - used by the client to obtain authorization from the resource owner via user-agent redirection. o Token endpoint - used by the client to exchange an authoriza...
uptown/django-town
django_town/oauth2/endpoint/__init__.py
Python
mit
848
import argparse import pandas from mypyli import plotmaster if __name__ == "__main__": parser = argparse.ArgumentParser(description="plots the average coverage over all contigs for each sample from the depth file metaBAT uses") parser.add_argument("-depth", help="the depth file", required=True) parser.ad...
hunter-cameron/Bioinformatics
job_scripts/plate_scrapes/contig_grouping/plot_metaBAT_depth_file.py
Python
mit
947
import unittest from microproxy.context.base import parse_version class TestBase(unittest.TestCase): def test_parse_release_version(self): self.assertEquals((0, 4, 0), parse_version("0.4.0")) def test_parse_minus_dev_version(self): self.assertEquals((0, 4, 0), parse_version("0.4.0-dev")) ...
mike820324/microProxy
microproxy/test/context/test_base.py
Python
mit
426
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Xinlei Chen # -------------------------------------------------------- from __future__ import absolute_import from __future__ import division from __future__ impor...
endernewton/tf-faster-rcnn
lib/nets/mobilenet_v1.py
Python
mit
11,704
#!/usr/bin/env python3 """ API server to run the JSON-RPC and REST API. Uses servers specified in protocol.xxx.json files Print the help and all possible arguments: ./api-server.py -h Run using TestNet with JSON-RPC API at port 10332 and REST API at port 8080: ./api-server.py --testnet --port-rpc 10332 --p...
hal0x2328/neo-python
neo/bin/api_server.py
Python
mit
11,953
import picamera import io import time import picamera from PIL import Image """ Tips mainly from http://picamera.readthedocs.org/en/release-1.2/recipes1.html """ # Create the in-memory stream stream = io.BytesIO() with picamera.PiCamera() as camera: # Turn the camera's LED off camera.led = False camera.s...
petrklus/airwellhvac
command_parsing/picamera.py
Python
mit
502
# Copyright © 2017 Ondrej Martinsky, All rights reserved # http://github.com/omartinsky/pybor # # 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 li...
omartinsky/PYBOR
instruments/crosscurrencyswap.py
Python
mit
3,939
from collections import namedtuple from datetime import datetime, date from io import StringIO from typing import Union, Tuple from unittest import TestCase import geopandas as gpd import numpy as np import pandas as pd import shapely.wkt import xarray as xr from shapely.geometry import Point, Polygon from cate.core....
CCI-Tools/cate-core
tests/core/test_types.py
Python
mit
29,150
from __future__ import with_statement from setuptools import setup # To install python-sansay-cdr-parser Module, open a Terminal shell, then run this # file by typing: # # python setup.py install # # You need to have the setuptools module installed. Try reading the setuptools # documentation: http://pypi.python.org/py...
kromulas/python-sansay-cdr-parser
setup.py
Python
mit
1,712
#!/usr/bin/env python import os import sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'tests.test_settings') def runtests(): import django from django.conf import settings from django.test.utils import get_runner if hasattr(django, 'setup'): django.setup() TestRunner = get_runner(...
uncovertruth/django-horizon
runtests.py
Python
mit
511
import _plotly_utils.basevalidators class StartlinecolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="startlinecolor", parent_name="carpet.aaxis", **kwargs ): super(StartlinecolorValidator, self).__init__( plotly_name=plotly_name, ...
plotly/python-api
packages/python/plotly/plotly/validators/carpet/aaxis/_startlinecolor.py
Python
mit
481
from dartcms.utils.config import DartCMSConfig from dartcms.utils.loading import get_model from .forms import FeedItemForm app_name = 'feeditems' FeedItem = get_model('feeds', 'FeedItem') config = DartCMSConfig({ 'model': FeedItem, 'parent_kwarg_name': 'feed', 'parent_model_fk': 'feed_id', 'grid': {...
astrikov-d/dartcms
dartcms/apps/feeds/items/urls.py
Python
mit
695
stmts = dict() stmts['get_token_by_cod'] = {'sql':"PREPARE get_token_by_cod (text) AS " \ "SELECT * FROM jwt.token WHERE cod_token LIKE $1"} stmts['create_token_by_type'] = {'sql':"PREPARE create_token_by_type (text) AS " \ "SELECT lib.create_token_byType($1) as cod_token"} stmts['verify_t...
francoricci/sapspid
modules/jwtoken/lib/statements.py
Python
mit
1,142
# encoding: utf-8 # Copyright 2013 maker # License import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Contact.related_user' db.alter_column('identities_contact', '...
alejo8591/maker
identities/migrations/0005_auto__chg_field_contact_related_user.py
Python
mit
12,852
#!/usr/bin/env python # -*- coding: utf-8 -*- # Triangle Project Code. # Triangle analyzes the lengths of the sides of a triangle # (represented by a, b and c) and returns the type of triangle. # # It returns: # 'equilateral' if all sides are equal # 'isosceles' if exactly 2 sides are equal # 'scalene' ...
erikld/Bobo
python3/koans/triangle.py
Python
mit
1,379
# Copyright (C) 2010-2011 Richard Lincoln # # 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, publish...
rwl/PyCIM
CIM15/IEC61970/LoadModel/LoadGroup.py
Python
mit
2,507
"""server 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...
placeB/translation-service
server/core/urls.py
Python
mit
948
from .request import Request
andreask/fortnox-python
fortnox/requests/__init__.py
Python
mit
28
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. """Syntax highlighting for IPython/Jupyter Notebooks.""" from .plugin import...
indico/indico-plugins
previewer_jupyter/indico_previewer_jupyter/__init__.py
Python
mit
384
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Feb 18 02:46:54 2017 @author: coskun 6.00.1x.W2T3.Simple.Algorithms.E3.Secret.Number.Game Your Secret Number Game :) The program works as follows: you (the user) thinks of an integer between 0 (inclusive) and 100 (not inclusive). The computer makes ...
coshkun/6.00.1x-MITx-Course-Training-Lab-Notes
anaconda/6.00.1x.W2T3.Simple.Algorithms.E3.Secret.Number.Game.py
Python
mit
1,297
import gtk import wnck from .geometry import Geometry class AzulejoScreen(object): """ Class to hold details of the current screen This is to encapsulate the gtk that actually communicates with the system. This will allow us to change libraries if needed and also allows the creation of a mock sc...
johnteslade/azulejo
azulejo/azulejo_screen.py
Python
mit
3,607
# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function import re import multiprocessing from six.moves.urllib.parse import urlspl...
blade2005/dosage
tests/test_comics.py
Python
mit
4,122
class Person: def __init__(self, firstName, lastName, idNumber): self.firstName = firstName self.lastName = lastName self.idNumber = idNumber def printPerson(self): print("Name:", self.lastName + ",", self.firstName) print("ID:", self.idNumber) class Student(Person): def __init__(self, firstName, lastN...
clemus90/competitive-programming
hackerRank/30DaysOfCode/day_12_inheritance.py
Python
mit
809
import numpy as np import scipy as sp from scipy import special import numpy.matlib as M W = 40 K = 5 I = 3 a_tm = 10 * np.ones([W,I]) b_tm = np.ones([W,I]) a_ve = np.ones([I,K]) b_ve = 100 * np.ones([I,K]) T = np.random.gamma(a_tm,b_tm) V = np.random.gamma(a_ve,b_ve) x = np.random.poisson(T.dot(V)) hoho = gnmf_vb...
wickedoto/Cmpe547_Final_Project
python_implementation/gnmf_vb_demo.py
Python
mit
658
# -*- coding: utf-8 -*- __author__ = 'CubexX' from app import db class Entity(db.Model): __table__ = 'entities' __timestamps__ = False __fillable__ = ['cid', 'type', 'title', 'count'] @staticmethod def generate_list(cid=None): # Generating entities entities = {'total': 0, ...
CubexX/confstat-web
app/models/entity.py
Python
mit
1,257
import mock from django.utils import timezone from bulbs.content.models import Content from bulbs.reading_list.popular import get_popular_ids, popular_content from bulbs.utils.test import make_content, BaseIndexableTestCase class PopularContentTestCase(BaseIndexableTestCase): def setUp(self): super(Pop...
theonion/django-bulbs
tests/reading_list/test_popular.py
Python
mit
2,559
import warnings from warnings import warn import astropy.units as u import numpy from astropy.coordinates.sky_coordinate import SkyCoord from lcc.entities.light_curve import LightCurve class Star(): """ Star is base object in astronomy. This class is responsible for keeping basic information about stella...
mavrix93/LightCurvesClassifier
lcc/entities/star.py
Python
mit
8,667
from gobject import timeout_add from scribes_helpers import weak_connect from .signals import Signals class Reseter(object): def __init__(self, signals, editor): editor.response() self.editor = editor self.signals = signals self.lines = () self.update = True weak_connect(editor, "reset-buffer", se...
baverman/scribes-goodies
plugins/examples/Bookmark2/MarkReseter.py
Python
mit
718
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Interrupt: code: int = 0 def __new__(cls, msg: str=None): print(cls.__name__ + (': ' + msg if msg else '')) exit(cls.code) class AlreadyHere(Interrupt): code = 0 class RevisionNotFound(Exception): pass class BranchingFound(Exc...
ALFminecraft/migro
migro/exceptions.py
Python
mit
476
from __future__ import division, print_function, absolute_import import warnings from numpy import finfo, sign, sqrt from . import _zeros _iter = 100 _xtol = 2e-12 _rtol = 4 * finfo(float).eps __all__ = ['newton', 'bisect', 'ridder', 'brentq', 'brenth'] CONVERGED = 'converged' SIGNERR = 'sign error' CONVERR = 'co...
DailyActie/Surrogate-Model
01-codes/scipy-master/scipy/optimize/zeros.py
Python
mit
19,943
""" Module: stat_computer ... """ class StatComputer(object): """ StatComputer is an interface for computing stats. This is intended to be implemented by SqNode. Its subclasses will utilize these generic protected methods. Note: StatComputer may become our Sport class, especially is Sport turns ...
scrbrd/scoreboard
model/api/stat_computer.py
Python
mit
1,353
#!/usr/bin/env python # -*- coding: utf-8 -*- import http.cookiejar import os import urllib.parse import urllib.request import urllib.error cookie_filename = "cookies" class SimpleScraper(): def __init__(self): self.cj = http.cookiejar.MozillaCookieJar(cookie_filename) if os.access(cookie_filena...
soodoku/get-journalist-data
scraper.py
Python
mit
1,485
#!/usr/bin/env python # -*- coding: utf-8 -*- from gensim import corpora, models, similarities, matutils, interfaces import numpy as np from time import time # from vectorizer import get_raw_corpus_file class Similarity_API: def __init__(self,_path,_count,_chunk_length): self.path=_path # TODO ...
clemsos/mitras
lib/api.py
Python
mit
8,483
"""Unit tests for IOs """ ################################################################## # Copyright 2016 OSGeo Foundation, # # represented by PyWPS Project Steering Committee, # # licensed under MIT, Please consult LICENSE.txt for details # ##########################...
ldesousa/PyWPS
tests/test_inout.py
Python
mit
14,737
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
xylsxyls/xueyelingshuang
src/ProcessClient/scripts/rebuild_dll_ProcessClient.py
Python
mit
13,977
#vars.vehicleSpawnAllowed false name = "Log weapons" author = "codesuela" import base, os class Bf3Mod(base.Bf3Mod): def playerOnKill(self, killer, killed, weapon, headshot): if os.path.exists("weapon.log"): weaps = open("weapon.log", "a+") allweaps = weaps.read() weap...
smowden/b3ef-Battlefield-3-RCON-autoadmin-framework
mods/logweapons.py
Python
mit
639
from numpy import * def computemeanwave(signal, events, fdist, lmin=0,lmax=0): # Output: Array with mean wave, standard deviation and distance to the mean wave # acordding to fdist if (lmin==0) & (lmax==0): lmax=mean(diff(events))/2 lmin=-lmax w=waves(signal, events, lmin, lma...
hgamboa/novainstrumentation
novainstrumentation/waves/computemeanwave.py
Python
mit
423
""" Functions dealing with parsing commands. """ from pkgutil import walk_packages from . import commands from .execute import execute_module_command from .invalid import print_invalid_command def parse_command_line(command_line=[], *args, **kwargs): """ Parses the given command line and returns a command ob...
robobrobro/coffer
coffer/command/parse.py
Python
mit
1,522
import time import math from functions import prime_sieve times = [] times.append(time.clock()) limit = 600851475143 primes = prime_sieve( int(math.sqrt(limit)) ) for p in reversed(primes): if limit % p == 0: print(p) break times.append(time.clock()) print(times[-1] - times[-2])
esosn/euler
3.py
Python
mit
305
import os from y2h.parser.base import BaseParser from y2h.parser.factory import ElemParserFactory ROOT_ELEMENT = 'html' DEFAULT_TEMPLATE = 'bootstrap3' class HtmlHelper(object): def __init__(self, jsonret): self.jsonret = jsonret self.template = self.jsonret.get('template', DEFAULT_T...
rfancn/y2h
y2h/parser/html.py
Python
mit
1,017
''' Created on May 7, 2014 @author: john ''' from Ship import Ship from Bullet import Bullet import pygame def serializeObject(obj): ans = {} for a in dir(obj): if not a.startswith('__') and not callable(getattr(obj, a)): ans[a] = getattr(obj, a) return ans def serializeShip(ship): ...
rayman42003/INF123-VVPilot
Serialize.py
Python
mit
1,568
class BaseStorageWorker(object): def __init__(self, flask_app): self.flask_app = flask_app def put(self, build, tmp_build_path, tmp_icon_path): pass def get(self, build): pass def get_build_link(self, build): pass def get_icon_link(self, app_key): pass ...
nrudenko/anarcho
anarchoApp/anarcho/storage_workers/base_worker.py
Python
mit
410
from typing import Optional, Callable from thinc.api import Model from .stop_words import STOP_WORDS from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_INFIXES from ...language import Language, BaseDefaults from .lemmatizer import ItalianLemmatizer from .synta...
explosion/spaCy
spacy/lang/it/__init__.py
Python
mit
1,229
from datetime import timedelta import re import time def longer_time_string(run_time_in_seconds): time_delta = timedelta(seconds=run_time_in_seconds) timedelta_string = str(time_delta) m = re.search('(\d* (days|day), )?(\d*):(\d*):(\d*)', timedelta_string) days_string = m.group(1) hours = int(m.g...
iddoberger/timingdecorator
timingdecorator/timeit.py
Python
mit
1,468
from __future__ import absolute_import from werkzeug.serving import run_simple from .views import ObjectSearch from .views import QuerySearch from .views import ClassicObjectSearch from flask_restful import Api from flask_discoverer import Discoverer from adsmutils import ADSFlask def create_app(): """ Create...
adsabs/object_service
object_service/app.py
Python
mit
875
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'plotBox.ui' # # Created: Tue Mar 24 19:08:35 2015 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except Attrib...
RP-Hall/harry-plotter
src/plotBox.py
Python
mit
28,464
import sys import datetime from pprint import pprint, pformat from django.core.management.base import BaseCommand, CommandError from fo2.connections import db_cursor, db_cursor_so import base.models from utils.functions.models import rows_to_dict_list_lower import lotes.models as models class Command(BaseCommand)...
anselmobd/fo2
src/utils/management/commands/hist_010.py
Python
mit
7,067
# -*- coding: utf-8 -*- from django.shortcuts import render def pageloader(request, templatename): return render(request, 'main2022/'+templatename+'.html', { 'event_id': 20, 'templatename': templatename, })
Instanssi/Instanssi.org
Instanssi/main2022/views.py
Python
mit
234
from django.shortcuts import render def index(request): return render(request, 'events/index.html')
JasonBristol/spor-ct
spor/events/views.py
Python
mit
106
""" Polynomial regression example """ from random import random import numpy as np degree = 4 coefficients = [0.5, 1.2, 2.4, 1.5, -0.2] def get_result(x): result = 0 num = 1 for c in coefficients: result += c * num num *= x return result def generate_sample_set(sample_size): in...
ocozalp/machine-learning
single_parameter/polynomial_regression.py
Python
mit
1,610
import gensim import pymongo from pymongo import MongoClient import time mongo_url = 'mongodb://localhost:27017/' db = 'CamSim' coll = 'CamAuthors' client = MongoClient(mongo_url) ca = client[db][coll] sim_name = 'SimEngine' model = gensim.models.Word2Vec.load(sim_name) y = time.time() ind = 0 cur2 = ca.find() huge_o...
patrick-s-h-lewis/CamSim
CamAuthorsSimGen.py
Python
mit
1,028
# 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/servicebus/azure-servicebus/azure/servicebus/management/_generated/operations/__init__.py
Python
mit
942
#!/bin/python from .japonicus import * from . import options from . import interface
Gab0/gekkoJaponicus
japonicus/__init__.py
Python
mit
86
from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.sites.shortcuts import get_current_site from django.core import mail from django.urls import reverse from django.http import HttpResponseRedirect from django.test import TransactionTestCase from caffeine_oauth2.models i...
coffeestats/coffeestats-django
coffeestats/caffeine_oauth2/tests/test_views.py
Python
mit
9,846