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 _plotly_utils.basevalidators class TokenValidator(_plotly_utils.basevalidators.StringValidator): def __init__(self, plotly_name="token", parent_name="histogram.stream", **kwargs): super(TokenValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/histogram/stream/_token.py
Python
mit
497
import cv2 import numpy as np import time image = cv2.imread('test.png') image = cv2.flip(image,2) rows, cols,_ = image.shape M = cv2.getRotationMatrix2D((cols/2,rows/2),40,1) image = cv2.warpAffine(image,M,(cols,rows)) mask=cv2.inRange(image, np.array([0, 180, 255],dtype='uint8'),np.array([0, 180, 255],dtype='uint8'...
RoboticsClubatUCF/RoboSub
ucf_sub_catkin_ros/src/sub_utils/src/linefinder.py
Python
mit
1,400
#!/usr/bin/env python3 # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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 withou...
fyookball/electrum
lib/daemon.py
Python
mit
14,615
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect import onenote import bitbucket # sample repo_uuid = 3d316876-a913-4b20-b183-d57e919f96dc BASE_URL = "https://afternoon-waters-2404.herokuapp.com" # DEV_URL = "https://classnotes-varunagrawal.c9.io" # Create your views h...
varunagrawal/ClassNotes
notes/views.py
Python
mit
4,070
from flask import current_app, url_for from cla_public.apps.base import base from cla_public.apps.base.utils import check_categories @base.app_template_global() def asset(filename, min_ext="min"): if not current_app.config["DEBUG"]: amended = filename.split(".") amended.insert(-1, min_ext) ...
ministryofjustice/cla_public
cla_public/apps/base/extensions.py
Python
mit
602
# -*- coding: utf-8 -*- # Copyright (C) 2008-2011, Luis Pedro Coelho <luis@luispedro.org> # vim: set ts=4 sts=4 sw=4 expandtab smartindent: # # License: MIT. See COPYING.MIT file in the milk distribution from __future__ import division from collections import defaultdict import numpy as np from .base import supervised...
arnaudsj/milk
milk/supervised/knn.py
Python
mit
1,620
# https://leetcode.com/problems/linked-list-cycle-ii/ from ListNode import ListNode class Solution(object): def detectCycle(self, head): slow,fast = head,head while True: if fast == None or fast.next == None : return None slow = slow.next fast = fast.next.next ...
menghanY/LeetCode-Python
LinkedList/LinkedListCycleII.py
Python
mit
474
# basic_source.py # Copyright (c) 2013-2016 Pablo Acosta-Serafini # See LICENSE for details # pylint: disable=C0103,C0111,E0611,R0201,R0204,W0212,W0232,W0612 # PyPI imports from numpy import array import pytest # Putil imports from putil.plot import BasicSource as FUT from putil.test import AE, AI, APROP, AROPROP ##...
pmacosta/putil
tests/plot/basic_source.py
Python
mit
9,026
#encoding:utf-8 subreddit = 'getmotivated' t_channel = '@r_getmotivated' def send_post(submission, r2t): return r2t.send_simple(submission)
Fillll/reddit2telegram
reddit2telegram/channels/~inactive/r_getmotivated/app.py
Python
mit
147
__all__ = ['ContextManager', 'WrapWithContextManager'] class ContextManager(object): name = 'ContextManager' def on_start(self, request): pass def on_success(self, request): pass def on_failure(self, request): pass def wrap_call(self, func): return func class...
mulonemartin/kaira
kaira/wrapper.py
Python
mit
1,431
import os, colorama, random_functions, module1, module2, module3, module4, module5, module6, module7 class Main1(random_functions.random_functions_class): def tool_menu_front(self): try: colorama.init(autoreset=True) self.seperator() self.logo() se...
deepak7mahto/ForensicsTool
ForensicsTool/ForensicsTool/Forensics_tool_redesigned_using_oops.py
Python
mit
14,272
import rdtest import renderdoc as rd class VK_CBuffer_Zoo(rdtest.TestCase): def get_capture(self): return rdtest.run_and_capture("demos_x64", "VK_CBuffer_Zoo", 5) def check_capture(self): draw = self.find_draw("Draw") self.check(draw is not None) self.controller.SetFrameEven...
googlestadia/renderdoc
util/test/tests/Vulkan/VK_CBuffer_Zoo.py
Python
mit
31,170
# helper.py # K. Ottoson # February 20, 2017 __author__ = "kjo9fq" def greeting(msg): print(msg)
kottoson/cs3240-labdemo
helper.py
Python
mit
103
class Solution: def splitArraySameAverage(self, A: List[int]) -> bool: total = sum(A) n = len(A) if all(total*i%n for i in range(n//2 + 1)): return False sums = [set() for _ in range(1 + n // 2)] sums[0].add(0) for num in A: for i in range(n//2...
jiadaizhao/LeetCode
0801-0900/0805-Split Array With Same Average/0805-Split Array With Same Average.py
Python
mit
507
import _plotly_utils.basevalidators class SymbolValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__(self, plotly_name="symbol", parent_name="box.marker", **kwargs): super(SymbolValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/box/marker/_symbol.py
Python
mit
14,526
__author__ = 'sam' import select import socket import sys import Queue # Create a TCP/IP socket server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setblocking(0) # Bind the socket to the port server_address = ('localhost', 12345) print >>sys.stderr, 'starting up on %s port %s' % server_address server....
bourneagain/pythonBytes
socketProgramming/socketSelect.py
Python
mit
410
import os import shutil import logging import tarfile import tempfile import subprocess from threading import Thread class TarToWebmCompressor(object): @staticmethod def compress(filename): thread = Thread(target=TarToWebmCompressor._compress, args=(filename,)) thread.start() @staticmetho...
thekot/cam_to_webm
modules/tar_to_webm_compressor.py
Python
mit
2,578
myList = ['hello', 'world'] myList * 2 # ['hello', 'world', 'hello', 'world'] 2 * myList # ['hello', 'world', 'hello', 'world']
schmit/intro-python-course
lectures/code/list_mult.py
Python
mit
131
import platform import socket import sys import os from mule_local.JobGeneration import * from mule.JobPlatformResources import * from . import JobPlatformAutodetect def _whoami(depth=1): """ String of function name to recycle code https://www.oreilly.com/library/view/python-cookbook/0596001673/ch14s08.h...
schreiberx/sweet
mule/platforms/50_cheyenne_intel/JobPlatform.py
Python
mit
8,312
import asyncio import logging import os import signal from collections import defaultdict import aiohttp.web from aiohttp_index import IndexMiddleware logger = logging.getLogger('rc-car.vechicle') class Vechicle: DEFAULT_CFG = {} def __init__(self, cfg=None, loop=None): self.loop = loop or asynci...
habibutsu/rc-car
rc_car/vechicle.py
Python
mit
3,174
from .build import build_loader
microsoft/Swin-Transformer
data/__init__.py
Python
mit
31
''' @author: Sergio Rojas @contact: rr.sergio@gmail.com -------------------------- Contenido bajo Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE) http://creativecommons.org/licenses/by-nc-sa/3.0/ve/ Creado en abril 18, 2016 ''' from sympy import * a, b, c, d, e, f, x, y = symbols ('a b c d...
rojassergio/Aprendiendo-a-programar-en-Python-con-mi-computador
Programas_Capitulo_01/Cap01_pagina_12.py
Python
mit
407
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py
Python
mit
25,178
""" Django settings for quizshowdown project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) INST...
thoreg/quiz
quizshowdown/quizshowdown/settings.py
Python
mit
1,757
import json import unittest import responses class PywikTestCase(unittest.TestCase): def add_fake_response(self, module, method, value, http_method='get', status=200): responses.add( getattr(responses, http_method.upper()), 'http://example.test/?' ...
Pythagorists/pypiwik
tests/__init__.py
Python
mit
676
#=========================================================================== # mjpegger.py # # Runs a MJPG stream on provided port. # # 2016-07-25 # Carter Nelson #=========================================================================== import threading import SimpleHTTPServer import SocketServer import io keepStre...
caternuson/rpi-laser
mjpegger.py
Python
mit
2,603
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def VirtualUSBXHCIControllerOption(vim, *args, **kwargs): '''The VirtualUSBXHCIController...
xuru/pyvisdk
pyvisdk/do/virtual_usbxhci_controller_option.py
Python
mit
1,380
from .botan import Botan __all__ = ['Botan']
rogerscristo/BotFWD
env/lib/python3.6/site-packages/telegram/contrib/__init__.py
Python
mit
49
from django.contrib.auth.forms import AuthenticationForm from django import forms from django.utils.translation import ugettext_lazy as _ class BigAuthenticationForm(AuthenticationForm): username = forms.CharField(label=_("Username"), max_length=70)
TwigWorld/Impostor
impostor/forms.py
Python
mit
252
# 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/v2018_07_01/operations/_network_watchers_operations.py
Python
mit
105,992
from lib.plugins import Inspector from lib.util import TimeSpan """ Description: Gets core system metrics Metrics: uptime - TimeSpan of time the system has been up idle - TimeSpan of the amount of CPU time idle (will be multipled by CPU) """ class System(Inspector): def __init__(self, driver): self._driver = dri...
zix99/sshsysmon
sshsysmon/inspectors/system.py
Python
mit
594
from .rest import RestClient class Rules(object): """Rules endpoint implementation. Args: domain (str): Your Auth0 domain, e.g: 'username.auth0.com' token (str): Management API v2 Token telemetry (bool, optional): Enable or disable Telemetry (defaults to True) t...
auth0/auth0-python
auth0/v3/management/rules.py
Python
mit
4,742
# -*- coding: utf-8 -*- # *********************************** # PiChi 0.0.1 # Author: Pedro Jorge De Los Santos # E-mail: delossantosmfq@gmail.com # Web: labdls.blogspot.mx # License: MIT License # ***********************************
JorgeDeLosSantos/PiChi
core/__ws.py
Python
mit
245
""" SublimeInfo Sublime Plugin. Show info about the system and the current Sublime Text instance. ``` ////////////////////////////////// // Info Commands ////////////////////////////////// { "caption": "Sublime Info", "command": "sublime_info" }, ``` Licensed under MIT Copyright (...
facelessuser/SublimeRandomCrap
sublime_info.py
Python
mit
2,894
#!/usr/bin/env python # encoding: utf-8 """A test module""" import datetime import tempfile import os import shutil import scores.common as common class TestCommon(object): """ A Test class""" def test_date_function(self): """Test""" a_date = datetime.datetime.now() a_date = a_date...
zesk06/scores
tests/common_test.py
Python
mit
524
#!/usr/bin/env python # coding=utf-8 import pprint import csv import click import requests import datetime as datetime from datetime import date from xml.etree import ElementTree as ET import os # from random import sample import random import json # import logging import subprocess import glob impor...
Fatman13/gta_swarm
ctripmultiplus.py
Python
mit
1,017
import numpy as np import pandas as pd import pytest from .const import RANDOM_SEED, TARGET_COL N_CATEGORY = 50 N_OBS = 10000 N_CAT_FEATURE = 10 N_NUM_FEATURE = 5 @pytest.fixture(scope="module") def generate_data(): generated = False def _generate_data(): if not generated: assert N_C...
jeongyoonlee/Kaggler
tests/conftest.py
Python
mit
1,121
"""Conversation objects.""" import asyncio import datetime import logging from hangups import (parsers, event, user, conversation_event, exceptions, hangouts_pb2) logger = logging.getLogger(__name__) CONVERSATIONS_PER_REQUEST = 100 MAX_CONVERSATION_PAGES = 100 async def build_user_conversatio...
ddboline/hangups
hangups/conversation.py
Python
mit
40,461
# -*- coding: utf-8 -*- """Reusable mixins for SQLAlchemy declarative models.""" from __future__ import unicode_literals import datetime import sqlalchemy as sa class Timestamps(object): created = sa.Column( sa.DateTime, default=datetime.datetime.utcnow, server_default=sa.func.now(), ...
tgbugs/hypush
hyputils/memex/db/mixins.py
Python
mit
548
# #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to ...
andresriancho/HTTPretty
tests/functional/test_requests.py
Python
mit
32,623
# 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. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py
Python
mit
5,908
import subprocess import os.path import traceback from radiopadre.file import FileBase from radiopadre.render import render_title, render_url, render_preamble, render_error from radiopadre import settings from radiopadre import imagefile class HTMLFile(FileBase): def __init__(self, *args, **kw): FileBase....
radio-astro/radiopadre
radiopadre/htmlfile.py
Python
mit
1,642
# -*- coding: utf-8 -*- """ This script contains the definition of the Metadata class. It can also be invoked in order to create a Metadata object and save it to a file in the data directory. """ import cPickle import config class Metadata(object): """ Class for storing metadata about a neural network and i...
attardi/nlpnet
nlpnet/metadata.py
Python
mit
4,429
import _plotly_utils.basevalidators class XpadValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="xpad", parent_name="scatter.marker.colorbar", **kwargs ): super(XpadValidator, self).__init__( plotly_name=plotly_name, parent_name=pa...
plotly/plotly.py
packages/python/plotly/plotly/validators/scatter/marker/colorbar/_xpad.py
Python
mit
460
""" Module contains helper functions """ def get_user(username, db): """ Usage: queries through and database and returns user object with passed username argument :return: User object or None if no such user """ for user in db: if user.username.lower() == username.l...
JoshuaOndieki/buckylist
bucky/helpers.py
Python
mit
710
from rest_framework import serializers from moto.moe import models from django.contrib.auth import get_user_model from django.core.urlresolvers import reverse from django.conf import settings from six.moves.urllib.parse import urlparse import os from django_comments_threaded.api.serializers import CommentSerializer as...
bung87/moto-moe
moto/moe/api/serializers.py
Python
mit
6,799
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
CUFCTL/DLBD
face-detection-code/object_detection/exporter_test.py
Python
mit
41,327
# -*- coding: utf-8 -*- ''' Unittest ''' import grs import unittest from datetime import datetime from types import BooleanType from types import NoneType class TestGrs(unittest.TestCase): def get_data(self): self.stock_no = '2618' self.data = grs.Stock(self.stock_no) def test_stock(self): ...
toomore/grs
test_unittest.py
Python
mit
5,685
import sys, os, shutil import markdown from pyquery import PyQuery as pq j = os.path.join md = markdown.Markdown(extensions=['toc', 'codehilite']) up = lambda p: j(*os.path.split(p)[:-1]) dirname = lambda p: os.path.basename(os.path.abspath(p)) extensions = ['md', 'mdown', 'markdown'] INDEX_PRE = u'''\ <!DOCTYPE htm...
sjl/d
d/base.py
Python
mit
6,812
from historia.enums.dict_enum import DictEnum class Biome(DictEnum): __exports__ = ['title', 'color', 'id'] arctic = { 'id': 1, 'title': 'Arctic', 'color': (224, 224, 224), 'fertility': 1, 'can_farm': False, 'has_forest': False, 'base_favorability': 10 ...
eranimo/historia
historia/world/biome.py
Python
mit
2,771
import unittest import os import numpy as np import math from tables import IsDescription, Int32Col, Float32Col from pymicro.core.samples import SampleData from BasicTools.Containers.ConstantRectilinearMesh import ConstantRectilinearMesh import BasicTools.Containers.UnstructuredMeshCreationTools as UMCT from config imp...
heprom/pymicro
pymicro/core/tests/test_samples.py
Python
mit
19,023
# coding=utf-8 """This module, code_section.py, is an abstraction for code sections. Needed for ordering code chunks.""" class CodeSection(object): """Represents a single code section of a source code file.""" def __init__(self, section_name): self._section_name = section_name self._code_chunks = [] def add...
utarsuno/quasar_source
deprecated/code_api/code_section.py
Python
mit
979
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Andrey Golovizin # # 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, ...
rybesh/pybtex
pybtex/database/output/bibtexml.py
Python
mit
3,696
from tkinter import * from tkinter import ttk from Parser import * from checker import * from Area import * #global Map_File def map_file_open(): global Map_File #Map_File = open('sydney250m.txt','r').read() Map_File = filedialog.askopenfile(mode='r').read() print("File Load: Done!") pass#return M...
iwancoppa/1730-PHMP
Main.py
Python
mit
1,720
__author__ = 'kevin' import re from attacksurfacemeter.loaders.base_line_parser import BaseLineParser class CflowLineParser(BaseLineParser): """""" _instance = None @staticmethod def get_instance(cflow_line=None): if CflowLineParser._instance is None: CflowLineParser._instance =...
andymeneely/attack-surface-metrics
attacksurfacemeter/loaders/cflow_line_parser.py
Python
mit
1,154
import pandas as pd from pandas import DataFrame import numpy as np import PIV import h5py import matplotlib.pyplot as plt import hotwire as hw ### PIV INNER PLOTS AND ANALYSIS ######## ######################################### def piv_inner(date, num_tests, utau, legend1): ##########################################...
Biles430/FPF_PIV
piv_inner.py
Python
mit
5,688
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # # This program is also distributed with certain s...
hawkeyexp/plugin.video.netflix
packages/mysql-connector-python/mysql/connector/protocol.py
Python
mit
29,453
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py
Python
mit
47,343
revision = '52ceb70dfec2' down_revision = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): op.create_table( 'message', sa.Column('id', postgresql.UUID(), nullable=False), sa.Column('sender', sa.String(), nullable=False), ...
mgax/zechat
migrations/versions/52ceb70dfec2_message.py
Python
mit
1,158
from __future__ import unicode_literals, print_function from jsontowidget import widget_from_json class Survey(object): def __init__(self, json_survey, **kwargs): super(Survey, self).__init__(**kwargs) self.survey_file = json_survey self.questionnaires = {} self.prev_questionnaires...
Kovak/KivySurvey
kivy_survey/survey.py
Python
mit
5,884
from __future__ import absolute_import, division, print_function, unicode_literals import struct import datetime from aspen import Response from aspen.http.request import Request from base64 import urlsafe_b64decode from cryptography.fernet import Fernet, InvalidToken from gratipay import security from gratipay.model...
gratipay/gratipay.com
tests/py/test_security.py
Python
mit
5,176
""" This module contains all api tests. """
tommartensen/arion-backend
arionBackend/tests/api/__init__.py
Python
mit
47
#!/usr/bin/env python3 from pathlib import Path import pprint pp = pprint.PrettyPrinter() import logging log = logging.getLogger(__name__) def main(): p = Path('particles.txt') if p.exists() and p.is_file(): parse(str(p)) def parse(filepath): raw = '' try: with open(filepath) as f: ...
klingtnet/dh-project-ws14
data/particle_parser.py
Python
mit
1,420
#!/usr/bin/env python3 import re import json from threading import Thread from rx import Observable import APIReaderTwitter as Twitter emoji_re = re.compile(u'[' u'\U0001F300-\U0001F64F' u'\U0001F680-\U0001F6FF' u'\u2600-\u26FF\u2700-\u27BF]+', re.UNICODE) # Util def process_stream(...
Pysellus/streaming-api-test
twitter-api-full-example/main_with_threads.py
Python
mit
2,615
r""" Network ======= This submodule contains models for calculating topological properties of networks """ from ._topology import * from ._health import *
PMEAL/OpenPNM
openpnm/models/network/__init__.py
Python
mit
158
import sys import os from netCDF4 import Dataset, MFDataset, num2date import numpy as np sys.path.append(os.path.join(os.path.dirname(__file__), "../")) import pyfesom as pf import joblib from joblib import Parallel, delayed import json from collections import OrderedDict import click from mpl_toolkits.basemap import m...
FESOM/pyfesom
tools/scalar2geo.py
Python
mit
12,219
# -*- coding: utf-8 -*- """ Created on Tue Jan 26 00:01:09 2021 @author: roman """ import zmq import time import sys #import random import os; sys.path.append(os.path.join('..', '..', '..')) # analysis:ignore #sys.path.append(r'C:\Github\xrt') # analysis:ignore import numpy as np #import matplotlib #matplotlib.use...
kklmn/xrt
tests/raycing/RemoteOpenCLCalculation/zmq_server.py
Python
mit
1,401
import arrow from django.db import models from common.models import Org, Profile from django.utils.translation import ugettext_lazy as _ class Teams(models.Model): name = models.CharField(max_length=100) description = models.TextField() users = models.ManyToManyField(Profile, related_name="user_teams") ...
MicroPyramid/Django-CRM
teams/models.py
Python
mit
1,068
from django.test import TestCase from app_forum.models import Forum, Comment from app_forum.forms import CommentForm, ThreadForm # test for forms class CommentFormTest(TestCase): def test_comment_forms(self): form_data = { 'comment_content' : 'comment' } form = CommentForm(dat...
django-id/website
app_forum/tests/test_forms.py
Python
mit
685
from django.utils import timezone from model_mommy import mommy from common.tests.test_models import BaseTestCase from ..models import MflUser class TestMflUserModel(BaseTestCase): def test_save_normal_user(self): data = { "email": "some@email.com", "username": "some", ...
urandu/mfl_api
users/tests/test_models.py
Python
mit
3,146
import tensorflow as tf import numpy as np import collections import time import util from .variational_inference import VariationalInference from inferences import proximity_statistics fw = tf.contrib.framework layers = tf.contrib.layers dist = tf.contrib.distributions class ProximityVariationalInference(Variatio...
altosaar/proximity_vi
inferences/proximity_variational_inference.py
Python
mit
5,782
# bibliography.py r''' Defines the BibItem() and Bibliography() classes (both sub-classed from Node) The Bibliography() object is initialized directly from a .bib file using the `bibtexparser` package. We use registry.ClassFactory for unlisted fields ''' import os import logging log = logging.getLogger(__name__) i...
dimbyd/latextree
latextree/parser/bibliography.py
Python
mit
6,260
import collections import typing from typing import TypeVar Key = TypeVar('Key') class Meta(collections.OrderedDict, typing.MutableMapping[Key, float]): def __init__(self, *args, **kwargs) -> None: self._smallest = float('inf') self._largest = 0 self._ordered = True super(Meta, self).__init__(*args...
PhilHarnish/forge
src/data/meta.py
Python
mit
1,361
class NameTable: def __init__(self, start, size): self.start = start self.size = size
Hexadorsimal/pynes
nes/processors/ppu/name_table.py
Python
mit
106
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from flask import request from indico.modules.admin.views import...
mic4ael/indico
indico/modules/users/views.py
Python
mit
1,654
#!/usr/bin/env python3 """ Compute the number of IBD pair at each position. @Author: wavefancy@gmail.com Usage: IBDPairByPos.py IBDPairByPos.py -h | --help | -v | --version | -f | --format Notes: 1. Read results from stdin(output from beagle3 fibd), and output results to stdo...
wavefancy/BIDMC-PYTHON
Exome/beagle/IBDPairByPos/IBDPairByPos.py
Python
mit
1,899
''' This module provides functions for generating nodes used for solving PDEs with the RBF and RBF-FD method. ''' from __future__ import division import logging import numpy as np from scipy.sparse import csc_matrix from scipy.sparse.csgraph import reverse_cuthill_mckee from rbf.utils import assert_shape, KDTree from...
treverhines/RBF
rbf/pde/nodes.py
Python
mit
22,858
# ============================================================ # modelparser.py # # (C) Tiago Almeida 2016 # # Still in early development stages. # # This module uses PLY (http://www.dabeaz.com/ply/ply.html) # and a set of grammar rules to parse a custom model # definition language. # =======================...
jumpifzero/morango
modelparser.py
Python
mit
5,062
import unittest from charlesbot.util.parse import parse_msg_with_prefix class TestMessageParser(unittest.TestCase): def test_prefix_uppercase(self): msg = "!ALL hi, there!" retval = parse_msg_with_prefix("!all", msg) self.assertEqual("hi, there!", retval) def test_prefix_mixed(self):...
marvinpinto/charlesbot
tests/util/parse/test_message_parser.py
Python
mit
1,817
import json import redis import uuid import subprocess from flask import Blueprint, request, session, g, redirect, url_for, abort, \ render_template, flash, current_app from flaskext.uploads import (UploadSet, configure_uploads, IMAGES, UploadNotAllowed) from wire.frontend import f...
radiosilence/wire
wire/frontend/views.py
Python
mit
20,501
def get_encrypted_char(k, ascii_val, ascii_list, limit): diff = k % 26 rotate_val = ascii_val + diff encrypted_char = '' if rotate_val not in ascii_list: rotate_val -= limit for i in ascii_list: rotate_val -= 1 if rotate_val == 0: encrypted_char +=...
spradeepv/dive-into-python
hackerrank/domain/algorithms/implementation/caesar_cipher/solution.py
Python
mit
1,399
# -*- coding: utf-8 -*- from shortuuidfield import ShortUUIDField from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import ( AbstractBaseUser, PermissionsMixin, BaseUserManager, ) from django_extensions.db.fields import ModificationDateTim...
locarise/locarise-drf-oauth2-support
locarise_drf_oauth2_support/users/models.py
Python
mit
2,474
class AnnotationMeta(type): def __call__(cls, *args, **kwargs): if cls._can_be_static and cls._is_static_call(*args, **kwargs): self = super(AnnotationMeta, cls).__call__() self(args[0]) return args[0] else: return super(AnnotationMeta, cls).__call__(*...
prkumar/uplink
uplink/interfaces.py
Python
mit
3,372
import os import unittest from txdbus import error, message class MessageTester(unittest.TestCase): def test_too_long(self): class E(message.ErrorMessage): _maxMsgLen = 1 def c(): E('foo.bar', 5) self.assertRaises(error.MarshallingError, c) def test_r...
Pyrrvs/txdbus
txdbus/test/test_message.py
Python
mit
815
""" Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: Input: s = "abcd" t = "abcde" Output: e Explanation: 'e' is the letter that was added. """ ...
franklingu/leetcode-solutions
questions/find-the-difference/Solution.py
Python
mit
760
# -*- coding: utf-8 -*- """ auto rule template ~~~~ :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ from utils.api import * class CVI_100...
LoRexxar/Cobra-W
rules/php/CVI_1004.py
Python
mit
1,469
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .base import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool...
seppi91/priceScheduler
config/settings/local.py
Python
mit
2,241
from threading import RLock from Model import C_Model class C_WebController: instance_WebController = None locker = RLock() @staticmethod def getInstance(): with C_WebController.locker: if C_WebController.instance_WebController is None: C_WebController.instance_W...
Mashdon/RaspAquaLight
WebServ/WebController.py
Python
mit
484
from xmediusmailrelayserver import *
xmedius/xmedius-mailrelayserver
xmediusmailrelayserver/__init__.py
Python
mit
38
import unittest """ Returns true if given number is prime. Introductory (school) method: Test if n is prime => check for all values from 2 through sqrt(n) to see if the value divides n. If no value divides n, then return True. With the exclusion of 2 and 3, all primes are of the form 6k+1 or 6k-1. So, a better way to t...
prathamtandon/g4gproblems
Math/is_prime.py
Python
mit
878
# -*- coding: utf-8 -*- """ Demonstrates a variety of uses for ROI. This class provides a user-adjustable region of interest marker. It is possible to customize the layout and function of the scale/rotate handles in very flexible ways. """ import initExample ## Add path to library (just for examples; you do not need...
ibressler/pyqtgraph
examples/ROIExamples.py
Python
mit
4,441
''' Classe utilitaria para realizacao dos testes ''' class StringUtils(object): def to_upper(self, string): return string.upper() def to_lower(self, string): return string.lower() def is_upper(self, string): return string.isupper() def join(self, list_object): return...
eduardomesquita/crud-flask
codigo-fonte/app/utils/string_utils.py
Python
mit
343
import time CALENDAR_URL = 'https://calendar.google.com/calendar' BUTTONS_CLASS = 'gcal-unlim-weeks-adjust-weeks' ADD_BUTTON_CLASS = 'gcal-unlim-weeks-add-week' REMOVE_BUTTON_CLASS = 'gcal-unlim-weeks-remove-week' def get_num_weeks(selenium): weeks = selenium.find_elements_by_class_name('month-row') return l...
tomviner/unlimited-weeks-in-google-calendar
tests/test_ext.py
Python
mit
2,010
#!/usr/bin/python import sys import csv import re import os def check_arguments(): if len(sys.argv) != 3: print "usage: ./unique_licenses.py <input file> <output file>" print " The input file should contain two fields: <dataset id> and <license>" print " This script will read in the input, fetch all lice...
Datafable/gbif-data-licenses
code/unique_licenses.py
Python
mit
2,877
import os with open("validation_classes.csv", "r") as f: rows = f.readlines() rows = rows[1:-1] rows = [x for x in rows if x != "\n"] path = "dataset/val/" for row in rows: rsplit = row.split(";") filename = rsplit[0] c = int(rsplit[1]) new_filename = format(c,'05d') + "_" + filename if o...
alessiamarcolini/deepstreet
utils/format_validation_filenames_util.py
Python
mit
408
import requests from urllib import urlencode VERSION='1.0' def _json_from_url(url): r = requests.get(url) if r.ok: return r.json() r.raise_for_status() def walkit(items=None,indent=0): if items is None: j = resources() items = j['result']['list']['items'] for i in items: ...
NUKnightLab/fao-explorer
app/fao-api.py
Python
mit
877
import numpy as np import json import scipy as sci def get_decimal_delta(data, index,decimals): ''' This function calculates the difference between the values of one column :param data: the data array :param time_index: the index of the column of interest :param decimals: Number of decimal places t...
IT-PM-OpenAdaptronik/Webapp
apps/calc/measurement/calculus.py
Python
mit
3,360
# what each page will look like from howmanyapp import app from flask import render_template, flash, redirect, request from howmany import * from random import choice from urlparse import urlparse @app.route('/') @app.route('/index.html') def index(): return render_template("index.html") @app.route('/fuck/<path...
phorust/howmanygiven
howmanyapp/views.py
Python
mit
982
"""setuptools.command.bdist_egg Build .egg distributions""" # This module should be kept compatible with Python 2.3 import sys import os import marshal import textwrap from setuptools import Command from distutils.dir_util import remove_tree, mkpath try: # Python 2.7 or >=3.2 from sysconfig import get_path, ...
ppyordanov/HCI_4_Future_Cities
Server/src/virtualenv/Lib/site-packages/setuptools/command/bdist_egg.py
Python
mit
17,632
#!/usr/bin/env python # # Setup script for Review Board. # # A big thanks to Django project for some of the fixes used in here for # MacOS X and data files installation. import os import shutil import sys from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from setuptools...
asutherland/opc-reviewboard
setup.py
Python
mit
4,082