repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
guoshijiang/we_guitar
common/testcase.py
<filename>common/testcase.py import logging from django.conf import settings from django.test import TestCase, TransactionTestCase class _BaseTestDatabaseDescriptor: def __get__(self, instance, cls=None): return set(settings.DATABASES.keys()) class BaseTestCase(TestCase): databases = _BaseTestDatab...
guoshijiang/we_guitar
blog/helper.py
import re def judge_pc_or_mobile(ua): factor = ua is_mobile = False _long_matches = r'googlebot-mobile|android|avantgo|blackberry|blazer|elaine|hiptop|ip(hone|od)|kindle|midp|mmp' \ r'|mobile|o2|opera mini|palm( os)?|pda|plucker|pocket|psp|smartphone|symbian|treo|up\.(browser|link)' \ ...
guoshijiang/we_guitar
common/models.py
<filename>common/models.py<gh_stars>1-10 import uuid from django.db import models class BaseModel(models.Model): uuid = models.CharField(max_length=100, blank=True, unique=True, null=True) created_at = models.DateTimeField( auto_now_add=True, db_index=True ) updated_at = models.DateTim...
guoshijiang/we_guitar
we_guitar/urls.py
<reponame>guoshijiang/we_guitar #encoding=utf-8 from django.contrib import admin from django.urls import path, re_path, include from django.conf import settings from django.conf.urls.static import static from django.views.static import serve urlpatterns = [ path('admin/', admin.site.urls), path('', include('...
peterwinter/boxcluster
test_mod.py
<filename>test_mod.py import pytest from .mod import Modules, BaseModules, SimpleModules @pytest.fixture() def basemod(): bm = BaseModules() bm.nodes bm.mods bm.fitness = 5.0 return # this was mainly copied from test_boxlist. not properly adjusted class aTestBaseModules: """ tests for basic p...
peterwinter/boxcluster
test_boxsort.py
<reponame>peterwinter/boxcluster import numpy as np from .boxsort import BoxSort from .fake_data import generate_nested_data import random def basic_block_array(shape=(10, 10)): a = np.ones(shape=shape) a[:5, :5] = 0 a[5:, 5:] = 0 return a # def test_SortingAlgorithmReorder(): # a = basic_block_...
peterwinter/boxcluster
affinity.py
<filename>affinity.py import numpy as np from itertools import count import pandas as pd class AffinityMatrix(object): def __init__(self): self.count_df = None self.order = None self.trials = 0 def initialize_counts(self, clust_series): order = clust_series.index N ...
peterwinter/boxcluster
__init__.py
<filename>__init__.py from .boxsort import BoxSort from .boxlist import BoxList from .boxcut import BoxCut from .nested_cutter import Nested
peterwinter/boxcluster
fake_data.py
import numpy as np # import pandas as pd # def symmetrize(a): # return a + a.T - numpy.diag(a.diagonal()) def generate_nested_data(size=64, noise=0.05): """generate some data for testing the algorithm""" tiny_size = int(size / 16) quad_size = int(size / 4) half_size = int(size / 2) a = np.zer...
peterwinter/boxcluster
nested_cutter.py
<gh_stars>1-10 import numpy as np from . import BoxCut from . import BoxList from collections import namedtuple, deque Branch = namedtuple('branch', ('begin', 'end', 'depth')) class Nested(BoxCut): def bic(self, unique_points, likelihood, dof): # k = n_parameters n_parameters = (2 * dof + 1) ...
peterwinter/boxcluster
test_boxlist.py
import pytest from .boxlist import BaseBoxList, BoxList boxtypes = [ BaseBoxList(boxes=[4, 8, 16], fitness=13.2), BoxList(boxes=[1, 4, 16], fitness=3.2) ] # add parameters later @pytest.fixture(scope='function', params=boxtypes, ids=['BaseBoxList', 'BoxList']) def baseboxl...
peterwinter/boxcluster
boxorder.py
<reponame>peterwinter/boxcluster from collections import namedtuple import numpy as np import random import math from .mixins import FitnessEqualitiesMixin class BaseFitMatrix(FitnessEqualitiesMixin): """ basic class functionality """ def __init__(self, matrix, fitness=np.inf, order=None, weights=None): ...
peterwinter/boxcluster
mixins.py
class FitnessEqualitiesMixin(object): """ Mixin used by data objects with a fitness attribute """ def __lt__(self, other): return self.fitness < other.fitness def __le__(self, other): return self.fitness <= other.fitness def __eq__(self, other): return self.fitness == other.fi...
peterwinter/boxcluster
mod.py
import networkx as nx import random import numpy as np import copy as cp from collections import abc from collections import OrderedDict from .mixins import FitnessEqualitiesMixin from collections import namedtuple SingleMove = namedtuple('SingleMove', ('node', 'from_mod', 'to_mod')) class BaseModules(abc.Iterable,...
peterwinter/boxcluster
modularity/NestedSA.py
import random import copy import math from .base import modularity from .base import BaseModularitySearch limit = 25 # specifically for finding split moves class ModularityNestedSA(BaseModularitySearch): # unlike ModularitySA, this also contains global_net def __init__(self, G, global_net, Ti=1.0, Tf=0.005,...
peterwinter/boxcluster
modularity/GirvanNewman.py
#! /usr/bin/env python """ Implementation of the GirvanNewman algorithm for finding the best modularity in a network """ import copy import random import networkx as nx from .base import modularity from .base import largest_connected def get_graph(filename): G = nx.Graph() f = open(filename) data = f.read...
peterwinter/boxcluster
test_boxorder.py
import numpy as np from .boxorder import OrderedArray from .fake_data import generate_nested_data test_soln = generate_nested_data(noise=0.05) blankmove = np.arange(len(test_soln)) def ordered_array_ok(oa): # all lengths must be same N = len(oa) assert len(oa) == len(oa.order) == len(oa.matrix) # or...
peterwinter/boxcluster
modularity/base.py
import networkx as nx import random import copy import math import numpy as np from collections import namedtuple SingleMove = namedtuple('SingleMove', ('node', 'from_mod', 'to_mod')) def largest_connected(G): return next(nx.connected_component_subgraphs(G)) def modularity(modules, G, L): """ calculate mo...
peterwinter/boxcluster
modmax.py
import numpy as np import networkx as nx from itertools import count from .mod import Modules from .anneal import Annealer def largest_connected(G): return next(nx.connected_component_subgraphs(G)) class BaseModMax(Annealer): def graph_check(self, G): if G.__class__ == nx.classes.graph.Graph: ...
peterwinter/boxcluster
modularity/ModularitySA.py
from .base import modularity from .base import BaseModularitySearch import random import copy import math from . import NestedSA as MNSA limit = 25 class ModularitySAProblem(BaseModularitySearch): def __init__(self, G, Ti=1.0, Tf=0.005, Ts=0.995, f=1, fac=0.10): '''Sets the initial state for the problem....
peterwinter/boxcluster
test_boxcut.py
<gh_stars>1-10 import pytest from . import BoxCut from . import fake_data def check_box_integrity(boxlist): """ values must be ordered integers. no duplicates.""" values = sorted(set(boxlist)) assert len(values) == len(boxlist) for i, j in zip(values, boxlist): assert i == j assert typ...
peterwinter/boxcluster
anneal.py
<filename>anneal.py<gh_stars>1-10 import numpy as np from itertools import count from collections import namedtuple # from collections import abc class BaseAnnealer(object): def _probability_to_accept(self, improvement): return np.exp(improvement / self.temp) def accept_move(self, cur_fit, new_fit):...
peterwinter/boxcluster
boxsort.py
<reponame>peterwinter/boxcluster<gh_stars>1-10 #!/usr/bin/env python """structures for performing a couple of different clustering algorithms. most notably, performs matrix sorting as described in marta's pnas, using simulated annealing""" from itertools import count from .anneal import Annealer from .boxorder import...
peterwinter/boxcluster
boxlist.py
<filename>boxlist.py from collections import abc from itertools import permutations from .mixins import FitnessEqualitiesMixin import random import numpy as np class BaseBoxList(abc.MutableSequence, FitnessEqualitiesMixin): """ basic class functionality """ def __init__(self, boxes=[], fitness=np.inf): ...
peterwinter/boxcluster
boxcut.py
<gh_stars>1-10 import numpy as np from itertools import count from .boxlist import BoxList from .anneal import Annealer class BoxCut(Annealer): maximize = False def __init__(self, matrix): self.matrix_size = len(matrix) self.matrix = matrix self._since_last_move = 0 self._move...
artrepreneur/Vodun
resource.py
<gh_stars>1-10 # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import os, sys def resource_path(relative_path): #dir = QDir.currentPath() if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative_path) retur...
artrepreneur/Vodun
peerinf.py
<reponame>artrepreneur/Vodun # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess import os, sys, json #from resource import * def resource_path(relative_path): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._M...
artrepreneur/Vodun
send.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path from rpcworker import progres...
artrepreneur/Vodun
pixMp.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import os, sys from PyQt5.QtGui import * #from resource import resource_path def resource_path(relative_path): #dir = QDir.currentPath() if hasattr(sys, '_MEIPASS'): return os.p...
artrepreneur/Vodun
createWallet.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json import time #from resource import resource_path def resource_path(relative_path): #dir = QDir.currentPath() if hasattr(sys, '_MEIPASS'): return ...
artrepreneur/Vodun
estimate.py
<gh_stars>1-10 # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path from rpcworker...
artrepreneur/Vodun
getSeed.py
<filename>getSeed.py # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path from rpc...
artrepreneur/Vodun
MainWindow.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainwindow.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): Mai...
artrepreneur/Vodun
signMultiSigTrans.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json #threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path _translate = QCoreApplicatio...
artrepreneur/Vodun
password.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path from rpcworker import progres...
artrepreneur/Vodun
genAddress.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, addresses from PyQt5.QtCore import * from PyQt5 import QtWidgets from rpcworker import progress_fn, thread_complete, Worker, Worke...
artrepreneur/Vodun
fold.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import QtWidgets from rpcworker import progress_fn, thre...
artrepreneur/Vodun
combineSigned.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. from electrum.util import bh2u from electrum.bitcoin import base_decode from electrum.transaction import Transaction from electrum.transaction import tx_from_str def combine_transactions(transa...
artrepreneur/Vodun
custombtn.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. from PyQt5 import QtWidgets from PyQt5.QtGui import * from PyQt5.QtCore import QSize from pixMp import * # Dynamic button class class BasicBtn (QtWidgets.QPushButton): def __init__(self, ob...
artrepreneur/Vodun
sendCombMultiSigTrans.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path _translate = QCoreApplication.translate MIN_CONF = '1' MAX_CONF = '99...
artrepreneur/Vodun
balances.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess import os, sys, rpcworker from PyQt5.QtCore import * from config import MIN_CONF, MAX_CONF from rpcworker import progress_fn, thread_complete _translate = QCoreApplication.tran...
artrepreneur/Vodun
config.py
<gh_stars>1-10 # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. MIN_CONF = '6' MAX_CONF = '9999999'
artrepreneur/Vodun
transactions.py
<reponame>artrepreneur/Vodun # Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import QtWidgets from dateti...
artrepreneur/Vodun
pubkey.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import subprocess, os, sys, json, threading, signal, traceback, rpcworker from PyQt5.QtCore import * from PyQt5 import QtWidgets #from resource import resource_path from rpcworker import progres...
artrepreneur/Vodun
cryptic.py
# Copyright (c) 2020 <NAME> # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. import base64 from Crypto.Cipher import AES from Crypto.Hash import SHA256 from Crypto import Random def encrypt_seed(password, seed, filename): encrypted_data = encrypt(password, seed) ...
glibin/binder-proxy
handler/__init__.py
<filename>handler/__init__.py from tornado.options import options from tortik.page import RequestHandler try: import urlparse # py2 except ImportError: import urllib.parse as urlparse # py3 class PageHandler(RequestHandler): """Base handler""" preprocessors = [] postprocessors = [] def mak...
glibin/binder-proxy
proxy.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import logging import logging.handlers import tornado.ioloop import tornado.web import tornado.options import tornado.locale import tornado.httpserver import tornado.httpclient import tornado.netutil import tornado.gen from tornado.options import options from to...
glibin/binder-proxy
config.py
<filename>config.py import logging from tornado.options import define define('port', default=9999, type=int, help='Port to run on') define('host', default='127.0.0.1', help='Host to run on') define('resolver', default='tornado.platform.caresresolver.CaresResolver', help='DNS resolver to use') define('proxy_url', def...
bjornaa/bib2html
bib2html.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """bib2html.py Convert bibtex files to html Usage: bib2html.py <bibtex-file> [<html-file>] bib2html.py (-h | --help) By default <html-file> = <bibtex-file>.replace('.bib', '.html') Options: -h --help Show this help text """ # -------------------------...
FusRoman/Alert-Association
src/graph/motloader.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 18:11:34 2021 @author: Roman """ from spektral.data.loaders import BatchLoader import numpy as np class MOTLoader(BatchLoader): def __init__(self, dataset, mask=False, batch_size=1, epochs=None, shuffle=True): self.mask = mask super().__init_...
FusRoman/Alert-Association
src/__init__.py
<reponame>FusRoman/Alert-Association<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Wed Aug 4 17:11:16 2021 @author: Roman """
FusRoman/Alert-Association
src/model/motmodel.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 18:09:51 2021 @author: Roman """ from tensorflow.keras.models import Model from spektral.models.general_gnn import MLP from src.model.motlayer import MOTLayer class MOTModel(Model): def __init__( self, node_inputs_channels, edge_inputs_cha...
FusRoman/Alert-Association
src/graph/__init__.py
<reponame>FusRoman/Alert-Association # -*- coding: utf-8 -*- """ Created on Wed Aug 4 17:18:34 2021 @author: Roman """
FusRoman/Alert-Association
src/model/__init__.py
<filename>src/model/__init__.py # -*- coding: utf-8 -*- """ Created on Wed Aug 4 17:18:03 2021 @author: Roman """
FusRoman/Alert-Association
src/script/training.py
<reponame>FusRoman/Alert-Association # -*- coding: utf-8 -*- """ Created on Wed Aug 4 19:20:32 2021 @author: Roman """ import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras import optimizers from keras import metrics from src.model.motmodel import MOTModel from src.graph.motloader i...
FusRoman/Alert-Association
src/model/motlayer.py
<reponame>FusRoman/Alert-Association # -*- coding: utf-8 -*- """ Created on Wed Aug 4 18:05:46 2021 @author: Roman """ from spektral.layers import MessagePassing from tensorflow.keras import backend as K import tensorflow as tf class MOTLayer(MessagePassing): def __init__(self, n_edges_feature...
FusRoman/Alert-Association
src/graph/motgraphdataset.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 16:13:47 2021 @author: Roman """ from spektral.transforms import AdjToSpTensor from spektral.data import Dataset from spektral.transforms.normalize_one import NormalizeOne import numpy as np import pandas as pd from scipy.sparse import coo_matrix from astropy.coordin...
FusRoman/Alert-Association
src/graph/motgraph.py
<reponame>FusRoman/Alert-Association # -*- coding: utf-8 -*- """ Created on Wed Aug 4 15:51:21 2021 @author: Roman """ from spektral.data.graph import Graph class MOTGraph(Graph): def __init__(self, x, a, e, y, edge_info, past_index, futur_index, **kwargs): """ Build a graph based on Spektral p...
FusRoman/Alert-Association
setup.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 17:20:14 2021 @author: Roman """ from distutils.core import setup setup(name='SSOTrajectoriesPrediction', version='0.1', description='A python package that use deep learning to associate solar system candidates alert produce by Fink and create trajectory'...
FusRoman/Alert-Association
src/model/trajectory.py
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Wed Aug 4 16:51:27 2021 @author: Roman """ import pandas as pd import numpy as np import time as t import src.graph.motgraphdataset as motdataset from spektral.transforms import AdjToSpTensor from spektral.transforms.normalize_one import NormalizeOne def mean_edge_...
Tank1334/Webscraper1.0
check.py
import requests from time import sleep from bs4 import BeautifulSoup as bs def check(URL): page = requests.get(URL) soup = bs(page.content, "html.parser") results = soup.find(id="pnlInventory") stock = results.find_all("span", class_="inventoryCnt") check = "" for job_elem in stock: ...
Tank1334/Webscraper1.0
bot.py
<gh_stars>0 from check import tof import discord from discord.ext import tasks from discord.ext.commands import Bot from time import sleep client = Bot(command_prefix = '!') #set the prefix of the bot to ! @tasks.loop(hours=1.0) async def timed_check(): channel = client.get_channel(790412745911828490) #await ch...
MAB-Lab/Protein_coverage_MS
peptide_coverage.py
<gh_stars>0 ########################## # written by <NAME> and <NAME> # under the supervision of <NAME> and <NAME>. The code is used in the OpenProt pipeline, see: Brunet MA et al, 2021 ########################## import os import sys import re import argparse import itertools as itt import numpy as np from...
pcchou/python-bpl
bahaplib.py
<reponame>pcchou/python-bpl #!/usr/bin/env python3 """ A 巴哈姆特(https://forum.gamer.com.tw/) post library for python. For more documentation, see README.md . """ import requests import urllib.parse as urlparse from bs4 import BeautifulSoup import re REQHEADERS = {"User-Agent": ("Mozilla/5.0 (X11; Linux x86_64) AppleWeb...
crawfordleeds/saleor
saleor/giftcard/tests/test_tasks.py
import datetime import pytest from .. import GiftCardEvents from ..models import GiftCard from ..tasks import deactivate_expired_cards_task def test_deactivate_expired_cards_task( gift_card, gift_card_used, gift_card_expiry_date, gift_card_created_by_staff ): # given gift_card.expiry_date = datetime.dat...
jeffreyyang3/Lines_Queueing
config.1.py
import random import math data = [[ { # Type 1: double, no communication, 8 players # "settings": { "duration": 100, "swap_method": "double", "pay_method": "gain", "k": 0.8, "service_distribution": 1, ...
jeffreyyang3/Lines_Queueing
config4.py
<reponame>jeffreyyang3/Lines_Queueing<filename>config4.py import random import math """ - Data holds the data for one session. - Each inner list represents a group. - Each inner inner dict represents a period. - Period dicts can have no more dictionaries than there are participants. - Each dict rep...
jeffreyyang3/Lines_Queueing
tests.py
from otree.api import Bot, Submission ''' <NAME> <<EMAIL>> ''' class PlayerBot(Bot): def play_round(self): pass
jeffreyyang3/Lines_Queueing
pages.py
<filename>pages.py<gh_stars>0 from ._builtin import Page, WaitPage from .models import Constants import json """ <NAME> <<EMAIL>> """ class Instructions(Page): form_model = "player" form_fields = ["time_Instructions"] def is_displayed(self): # return self.round_number == 1 return False ...
kumarnishu/BOOKS-LIBRARY
Library/app/migrations/0006_auto_20200202_1401.py
# Generated by Django 3.0.2 on 2020-02-02 08:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0005_auto_20200202_1302'), ] operations = [ migrations.AlterField( model_name='user', name='address', ...
kumarnishu/BOOKS-LIBRARY
Library/app/admin.py
from django.contrib import admin from app.models import * admin.site.register(User) admin.site.register(Book)
kumarnishu/BOOKS-LIBRARY
Library/app/views.py
<filename>Library/app/views.py # imports required from django.shortcuts import render,redirect from django.contrib.auth import authenticate,login,logout from django.contrib.auth.models import User from django.contrib import messages from app.models import * from datetime import datetime, timedelta from django.contrib...
kumarnishu/BOOKS-LIBRARY
Library/app/migrations/0007_auto_20200203_0958.py
# Generated by Django 3.0.2 on 2020-02-03 04:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0006_auto_20200202_1401'), ] operations = [ migrations.AlterField( model_name='user', name='picture', ...
kumarnishu/BOOKS-LIBRARY
Library/app/urls.py
from django.urls import path from app.views import * app_name="app" urlpatterns=[ path("",index,name="index"), path("login_page/",login_page,name="login_page"), path("login_view/",login_view,name="login_view"), path("signup_page/",signup_page,name="signup_page"), path('signup_view/',signup_view,na...
kumarnishu/BOOKS-LIBRARY
Library/app/migrations/0002_auto_20200201_1054.py
# Generated by Django 3.0.2 on 2020-02-01 05:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0001_initial'), ] operations = [ migrations.AlterField( model_name='book', name='due_date', field...
kumarnishu/BOOKS-LIBRARY
Library/app/models.py
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): phone=models.PositiveIntegerField(blank=True,null=True) email=models.EmailField(blank=True,null=True) picture=models.ImageField(upload_to="profile",default="none.jpg",blank=True,null=True) address...
kumarnishu/BOOKS-LIBRARY
Library/app/migrations/0003_user_slug.py
<reponame>kumarnishu/BOOKS-LIBRARY<filename>Library/app/migrations/0003_user_slug.py # Generated by Django 3.0.2 on 2020-02-02 05:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0002_auto_20200201_1054'), ] operations = [ migr...
kumarnishu/BOOKS-LIBRARY
Library/app/migrations/0005_auto_20200202_1302.py
# Generated by Django 3.0.2 on 2020-02-02 07:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0004_auto_20200202_1236'), ] operations = [ migrations.AddField( model_name='user', name='address', ...
KuaJnio/light-cep
light-cep/core/utils.py
<filename>light-cep/core/utils.py import logging import sys def signal_term_handler(signal, frame): logging.info('Catched signal SIGTERM') try: pass except Exception as e: logging.error('Error in signal_term_handler: ' + str(e)) logging.info('Done handling signal SIGTERM, exiting now!'...
KuaJnio/light-cep
light-cep/core/cep.py
<gh_stars>0 from time import time, sleep from re import search from threading import Thread, Lock from json import JSONEncoder, load, dump import logging class PayloadConsumer(Thread): def __init__(self, payload, rules_handler, regexs_handler, database_handler): Thread.__init__(self) self.payload ...
KuaJnio/light-cep
light-cep/core/mqtt_client.py
<filename>light-cep/core/mqtt_client.py import paho.mqtt.client as mqtt from threading import Thread from time import sleep import logging TOPICS = None def on_connect(client, userdata, flags, rc): try: if rc == 0: logging.info("Connection to broker OK") else: logging.warn...
KuaJnio/light-cep
light-cep/apis/regexs.py
<reponame>KuaJnio/light-cep from flask_restplus import Namespace, Resource, fields from flask import current_app api = Namespace('regexs', description='Regexs related operations') @api.route('/') class RegexList(Resource): @api.doc('list_regexs') def get(self): '''List all regexs''' return {'...
KuaJnio/light-cep
light-cep/apis/rules.py
<reponame>KuaJnio/light-cep from flask_restplus import Namespace, Resource, fields from flask import current_app api = Namespace('rules', description='Rules related operations') @api.route('/') class RuleList(Resource): @api.doc('list_rules') def get(self): '''List all rules''' return {'name'...
KuaJnio/light-cep
light-cep/core/database.py
import logging from threading import Lock import sqlite3 class DatabaseHandler(object): def __init__(self, name): try: self.lock = Lock() self.connection = sqlite3.connect(name, check_same_thread=False) self.create_table() except Exception as e: logg...
KuaJnio/light-cep
light-cep/apis/__init__.py
from flask_restplus import Api from .rules import api as ns_rules from .regexs import api as ns_regexs api = Api( title='light-cep', version='1.0', description='light complex event processing application written in python', # All API metadatas ) api.add_namespace(ns_rules, path='/rules') api.add_name...
KuaJnio/light-cep
light-cep/app.py
from core.utils import set_logger, signal_term_handler from core.database import DatabaseHandler from core.cep import RegexsHandler, create_rules_handler, ConfigHandler, PayloadConsumer, create_rule from core.mqtt_client import create_mqtt_client from threading import Thread import signal import json import logging fro...
RahulSundar/pysindy
pysindy/optimizers/base.py
""" Base class for SINDy optimizers. """ import abc import numpy as np from scipy import sparse from sklearn.linear_model import LinearRegression from sklearn.multioutput import MultiOutputRegressor from sklearn.utils.extmath import safe_sparse_dot from sklearn.utils.validation import check_X_y def _rescale_data(X, ...
codassassin/face_detection
face_authentication.py
# by @codassassin import cv2 import numpy as np import face_recognition import os import FaceMeshModule as fm path = 'Auth_face' images = [] classNames = [] myList = os.listdir(path) for cl in myList: curImg = cv2.imread(f'{path}/{cl}') images.append(curImg) classNames.append(os.path.spli...
deadlysnowman3308/upgraded-ARP-Poisoning
upgraded-ARP-Poisoning.py
#!/usr/bin/env python from scapy.all import * import os, sys from os import system from termcolor import colored, cprint os.system('cls' if os.name == 'nt' else 'clear') try: dest_random = RandIP() print("\n") cprint(colored("[+] Made by Aniket [+]", "yellow", attrs=["blink"])) print("\n") user = s...
biobai/LiBis
LiBis/test/analysis.py
<reponame>biobai/LiBis<filename>LiBis/test/analysis.py def mates(dic,file): #chr start front_del end_del result=[] for name in dic: if name[-2:]=='_0': _name = name[:-2] if _name[-1]=='1': continue if (_name[:-1]+'1'+'_0' in dic) or (_name[:-1]+'1'...
biobai/LiBis
LiBis/computeProcess.py
from .moabs import * from .fastqc import Fastqc from .trim import Trim from .utils import * from .NumExtractor import * from .bedtools import Bedtools from pandas import DataFrame from .bsplot import * import os from datetime import datetime def computeQC(name,fastqc,param={}): ''' Computing function for qc. R...
biobai/LiBis
LiBis/test/Comb_fastq.py
<reponame>biobai/LiBis from utils import overlap,Pshell import utils import sys import os def GetFastqList(joined_reads,Part_Fastq_Filename,step,length_bin,filter,outputname,originalfile): nameset={} contentset={} filenum = len(Part_Fastq_Filename) #Generate a dictionary which contains readsname, star...
biobai/LiBis
LiBis/utils.py
<reponame>biobai/LiBis<filename>LiBis/utils.py<gh_stars>0 import sys import multiprocessing import subprocess import os import time from datetime import datetime timer = str(int(time.time())) class Pshell(): def __init__(self,command): self.command = command self.out = "" def change(self,co...
biobai/LiBis
LiBis/moabs.py
<reponame>biobai/LiBis ''' Tested This is a wapper for MOABS in this pipeline. It contains commands for BSMAP, bam sort, bam deduplicate, methylation calling. ''' from .utils import * from .clipmode import clipmode import os class MCALL(): def check(self,nocheck=False): #return True,'' if not too...
biobai/LiBis
LiBis/clipmode.py
from datetime import datetime from .mapreduce import * import multiprocessing #from Comb_fastq import combine import pysam from .utils import * import sys import gzip import os from .pairend import * max_file_length = 500 # 24 _index = [] for i in range(max_file_length): _index.append(str(i)) reads_cut_buff = {}...
biobai/LiBis
LiBis/trim.py
''' Tested ''' from .utils import * import os class TRIM(): def check(self,nocheck=False): if not toolcheck('trim_galore -v'): return False,'trim_galore not found!' if os.path.exists('Trim'): if nocheck: print('"Trim" exist! But --nocheck enabled, so cont...
biobai/LiBis
LiBis/test/test.py
<filename>LiBis/test/test.py import os print(os.path.abspath(__file__))
biobai/LiBis
LiBis/test/bsmap_record_combine.py
import sys,os import re import pandas as pd def record_process(files): ans=[] title=['fastq_file_name','output_file','total_read_pairs','aligned_pairs','unique_pairs','non-unique_pairs','#1_unpaired_read','#1_unique_reads','#1_non-unique_reads','#2_unpaired_read','#2_unique_reads','#2_non-unique_reads'] fo...
biobai/LiBis
LiBis/test/main.py
import argparse import os import xml.dom.minidom from computeProcess import computeProcess from utils import * ''' fastq pairs k pairs sample label k labels clipmode True/False clipsetting window, step ref string processes ...
biobai/LiBis
LiBis/pairend.py
import gzip import pysam from .utils import Pshell import os def pair_valid(chr1,chr2,strand1,strand2,pos1,pos2): if chr1!=chr2: return False if strand1=='++' and strand2!='+-': return False if strand1=='-+' and strand2!='--': return False if strand1=='+-' and strand2!='++': ...