repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
streitho/spinmob | _pylab_colorslider_frame.py | <filename>_pylab_colorslider_frame.py
#Boa:Frame:ColorSliderFrame
import _pylab_colorslider as _pc
import wx
from spinmob import _app
def create(parent):
return ColorSliderFrame(parent)
[wxID_COLORSLIDERFRAME, wxID_COLORSLIDERFRAMEBUTTONCOLOR,
wxID_COLORSLIDERFRAMEBUTTONCOLOR2, wxID_COLORSLIDERFRAMEBU... |
streitho/spinmob | _pylab_tweaks.py | <filename>_pylab_tweaks.py
import pylab as _pylab
import numpy as _numpy
import matplotlib as _mpl
import wx as _wx
import time as _time
from matplotlib.font_manager import FontProperties as _FontProperties
import os as _os
import _dialogs
import _functions as _fun
import _pylab_colorslider as _pc
import _plot
line_... |
streitho/spinmob | _plot.py | <filename>_plot.py
import spinmob as _s
import numpy as _n
import _plot_complex as complex_plane; reload(complex_plane)
import _plot_magphase as mag_phase; reload(mag_phase)
import _plot_realimag as real_imag; reload(real_imag)
import _plot_image as image; reload(image)
imp... |
Ablesius/Codewars | list_filtering.py | #! /usr/bin/env python
# In this kata you will create a function that takes a list of non-negative
# integers and strings and returns a new list with the strings filtered out.
# Example
#
# filter_list([1,2,'a','b']) == [1,2]
# filter_list([1,'a','b',0,15]) == [1,0,15]
# filter_list([1,2,'aasf','1','123',123]) == [1,2,... |
Ablesius/Codewars | find_odd_int.py | <gh_stars>0
#! /usr/bin/env python
# Given an array, find the int that appears an odd number of times.
# There will always be only one integer that appears an odd number of times.
def find_odd(int_list):
"""return None if no odd int was found, the odd one otherwise"""
for k in int_list:
if int_list.co... |
Ablesius/Codewars | Title_Case.py | #! /usr/bin/env python
# A string is considered to be in title case if each word in the string is either (a) capitalised (that is, only the first letter of the word is in upper case) or (b) considered to be an exception and put entirely into lower case unless it is the first word, which is always capitalised.
#
# Write... |
Ablesius/Codewars | count_duplicates.py | <reponame>Ablesius/Codewars
#! /usr/bin/env python
# Count the number of Duplicates
#
# Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both upperc... |
Ablesius/Codewars | find_divisors.py | <filename>find_divisors.py
#! /usr/bin/env python
# Create a function named divisors/Divisors that takes an integer n > 1 and
# returns an array with all of the integer's divisors(except for 1 and the
# number itself), from smallest to largest. If the number is prime return the
# string '(integer) is prime' (null in C#... |
waripoornima/temeva_rest_client | setup.py | import os, sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def main():
setup(
name='py_temeva_rest_client',
version= '0.1',
author='PoornimaWari',
author_email='<EMAIL>',
url='https://github.com/waripoornima/temeva_rest_cli... |
waripoornima/temeva_rest_client | py_temeva_rest_client/SpirentTemeva.py | """
Temeva Rest client is front end for Spirent Temeva licensing server ReST API
Supports 2.7 + to python 3+
"""
__Version__ = '0.1'
__Author__ = '<NAME>'
from datetime import datetime # we need it to create log file based on current time and date
"""
Modification history
====================
0... |
waripoornima/temeva_rest_client | examples/sample_temeva_rest_client_example.py | <gh_stars>0
"""
This is sample example for temeva license checkouts
Using temeva rest client
"""
from py_temeva_rest_client.SpirentTemeva import SpirentTemeva
# user credentials
user = '<EMAIL>'
password = '****'
# creating temeva object
temeva_object = SpirentTemeva(user, password)
# get the license server... |
amrufathy/Secure-Chat | utils.py | <filename>utils.py
import curses
import os
import signal
def showDialog(screen, title, message, is_error):
(height, width) = screen.getmaxyx()
exit_message = "Press Ctrl^c to exit" if is_error else ""
dialog_width = max(len(title), len(message), len(exit_message)) + 2
dialog_height = 8 if message else... |
amrufathy/Secure-Chat | parallel.py | <filename>parallel.py<gh_stars>0
import curses
import curses.ascii
from threading import Thread, Lock
import utils
mutex = Lock()
class CursesSendThread(Thread):
def __init__(self, sock, screen, chat_window, text_box_window, textbox):
self.sock = sock
self.screen = screen
self.chat_windo... |
amrufathy/Secure-Chat | DES.py | import random
import string
from Crypto.Cipher import DES
class myDES:
def __init__(self, TYPE):
letters = string.ascii_letters + string.digits
letters = letters.replace('\\', '').replace('\'', '').replace('\"', '')
# self._key = '12345678'
if TYPE == 1:
self._key = '... |
amrufathy/Secure-Chat | server_driver.py | <gh_stars>0
import sys
from Server import Server
server = Server()
server.start(9000)
print('Server is running...')
client = server.accept()
print('Received connection from', client.get_host())
while True:
sys.stdout.write('>> ')
client.send(str(input()))
print('Client:', client.recv())
|
amrufathy/Secure-Chat | gui.py | #! /usr/bin/env python
import curses
import curses.ascii
import curses.textpad
import time
import parallel
from Client import Client
from Server import Server
SERVER = 0
CLIENT = 1
def main(screen):
set_colors(screen)
screen.clear()
screen.border(0)
chat_window = make_chat_window(screen)
text_... |
amrufathy/Secure-Chat | Client.py | import socket
from DES import myDES
class Client:
def __init__(self, addr, _socket=None, _type=0):
self.addr = addr
if _socket is not None:
self._socket = _socket
else:
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.encryption = myD... |
amrufathy/Secure-Chat | Server.py | import socket
from Client import Client
class Server:
def __init__(self):
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Allows port to be reused
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def start(self, port):
self._socket.bind(('... |
amrufathy/Secure-Chat | client_driver.py | <filename>client_driver.py
import sys
from Client import Client
_socket = Client(('127.0.0.1', 9000), _type=1)
_socket.connect()
print('Client connected to', _socket.get_host())
while True:
print('Server:', _socket.recv())
sys.stdout.write('>> ')
_socket.send(str(input()))
|
MAliHassnain/ExtractTextFromImage | Main/urls.py | <gh_stars>0
from django.urls import path
from Main import views
urlpatterns = [
path('', views.Index, name='Index'),
path('Main/ProceedImage', views.ProceedImage, name='ProceedImage'),
path('Main/ProceedImageUrl', views.ProceedImageUrl, name='ProceedImageUrl'),
]
|
MAliHassnain/ExtractTextFromImage | Main/views.py | <reponame>MAliHassnain/ExtractTextFromImage<gh_stars>0
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
import TextFromImage.settings as Settings
from PIL import Image
import pytesseract
from django.core.files.storage import FileSystemStorage
import os
import glob
import requests
f... |
FerreiraWalter/OBI-E-MARATONAS | OBI-2018-1/Xadrez.py | <filename>OBI-2018-1/Xadrez.py
#Xadrez
L = int(input())
C = int(input())
if (L % 2 == 0 and C % 2 == 0) or (L % 2 != 0 and C % 2 != 0):
print('1')
else:
print('0') |
FerreiraWalter/OBI-E-MARATONAS | OBI-2018-1/Escadinha.py | #Escadinha
N = int(input())
num = input().split()
for i in range(len(num)):
num[i] = int(num[i])
resp = 1
i = 2
while i < len(num):
if (num[i] - num[i-1]) != (num[i-1] - num[i-2]):
resp += 1
i += 1
print(resp) |
FerreiraWalter/OBI-E-MARATONAS | OBI-2018-JR/Basquete_de_Robôs.py | <reponame>FerreiraWalter/OBI-E-MARATONAS
#Basquete de Robôs
D = int(input())
if ( D <= 800 ):
print('1')
elif ( 800 < D <= 1400 ):
print('2')
elif ( 1400 < D <=2000 ):
print('3')
|
FerreiraWalter/OBI-E-MARATONAS | OBI-2017-2/Game-10.py | <filename>OBI-2017-2/Game-10.py
n = int(input())
d = int(input())
a = int(input())
if a == d:
print('0')
elif a < d:
print('{}'.format(d - a))
elif a > d:
print('{}'.format((n - a) + 1 + (d - 1))) |
FerreiraWalter/OBI-E-MARATONAS | OBI-2017-JR/Drone_de_Entrega.py | <gh_stars>1-10
#ENTRADA DE DASDOS:
A = int(input())
B = int(input())
C = int(input())
caixa = [A, B, C]
caixa.sort()
H = int(input())
L = int(input())
janela = [H, L]
janela.sort()
#PROCESSAMENTO:
if caixa[0] <= janela[0] and caixa[1] <= janela[1]:
print('S')
else:
print('N') |
FerreiraWalter/OBI-E-MARATONAS | OBI-2017-1/Teleférico.py | <filename>OBI-2017-1/Teleférico.py<gh_stars>1-10
C = int(input())
A = int(input())
if A % (C - 1) == 0:
print(A // (C - 1))
else:
print((A // (C - 1)) + 1) |
FerreiraWalter/OBI-E-MARATONAS | OBI-2018-JR/Álbum_da_Copa.py | #Álbum da Copa
N = int(input())
M = int(input())
album = []
for c in range(0, M):
x = int(input())
if x not in album:
album.append(x)
restante = len(album)
total = N - restante
print(total)
|
aleccunningham/streampy | messenger_with_files.py | #!/usr/bin/python
import sys
import socket
import getopt
def dial_socket(host='localhost', port):
"""
Create a socket and establish a perisistent
connection to it, listening for events
"""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO... |
aleccunningham/streampy | recv_messages.py | <filename>recv_messages.py
import threading
import os, sys
class RecvMessages(threading.Thread):
def __init__(self, client_socket):
threading.Thread.__init__(self)
self.client_socket = client_socket
def run(self):
while True:
try:
msg_bytes = self... |
aleccunningham/streampy | python_handler.py | #!/usr/bin/python
# Copyright 2017.
# Author: <NAME>
# Server usage:
# ./stream.py -s | --serve <port>
# Server is run in a daemonized thread, while clients
# spawn a new thread; the server will not close
# and exit until all client threads are closed
#
# Client usage:
# ./stream.py -c | --client -p | --port <port>... |
aleccunningham/streampy | tests/file_compare.py | #! python3
# FileCompare
"""Compares files as either text files or binary files"""
class FileCompare():
def textFiles( self, file1, file2, verbose ):
textfile1= open( file1 )
textfile2= open( file2 )
line_num= 1
more= True
differ= False
banner_printed= False
while( more ):
f1_line= textfile1.readlin... |
aleccunningham/streampy | tests/autograde-messenger-with-files-py.py | #! python3
"""
Automated testing
Assignment: Messenger with file transfers
1. Start the program with server command line args
2. Start the program with client command line args
3. Input data from standard input for the server and the client
4. Redirect standard output to files
5. Compare output files to input files
6... |
aleccunningham/streampy | tests/within_file.py | #! python3
# WithinFile
"""Test whether the content of the first file is found within the content
of the second file"""
class WithinFile():
def searchText( self, file1, file2 ):
textfile1= open( file1 )
textfile2= open( file2 )
linesfile1= textfile1.readlines()
linesfile2= textfile2.readlines()
textfile1.c... |
aleccunningham/streampy | retrieve_file.py | <gh_stars>0
import threading
import os, sys
class RetrieveFile(threading.Thread):
def __init__(self, client_socket, data):
threading.Thread.__init__(self)
self.client_socket= client_socket
self.data = data
def run(self):
data = self.client_socket.recv(1024)
i... |
aleccunningham/streampy | file_request_listener.py | import threading
import os, sys
class fileRequestListener(threading.Thread):
def __init__(self, client_socket):
threading.Thread.__init__(self)
self.client_socket= client_socket
def run(self):
filename = input('Which file do you want?')
self.client_socket.send(filenam... |
aleccunningham/streampy | tests/input-writer.py | # open a file
# read each line
# output the line to standard input
# pace the timing of output
import sys
import time
argc= len( sys.argv )
if argc != 4 :
print( 'Usage: py ' + sys.argv[0] + ' <initial delay> <pace> <input file>' )
sys.exit()
initial_delay= int(sys.argv[1])
pace= int(sys.argv[2])
input_file= ope... |
danicat/oxford-ai-gcp | 03_spark/als.py | <filename>03_spark/als.py
import logging
import sys
from pyspark.sql import SparkSession, SQLContext
from pyspark.mllib.recommendation import ALS
from pyspark.sql.types import StructType, StructField, StringType, FloatType
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
CLOUDSQL_INSTANCE_... |
danicat/oxford-ai-gcp | 04_cloud_function/main.py | from flask import jsonify
import sqlalchemy
def recommend(request):
db = sqlalchemy.create_engine(
sqlalchemy.engine.url.URL(
drivername="mysql+pymysql",
username='rec-db',
password='<PASSWORD>',
database='rec-db',
query={"unix_socket": "/cloudsq... |
danicat/oxford-ai-gcp | 02_dataflow/pageviews.py | #!/usr/bin/env python
from __future__ import absolute_import
import argparse
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.options.pipeline_options import StandardOptions
import json
def run(arg... |
amjadcp/bookingLine-grpA-miniProject | users/forms.py | <filename>users/forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import *
class SignupForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email', 'password1', '<PASSWORD>')
def __init__(self, *a... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/migrations/0004_book_message.py | # Generated by Django 4.0.2 on 2022-02-06 05:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('serviceprovider', '0003_book_book_email_book_book_name_book_book_number'),
]
operations = [
migrations.AddField(
model_name='boo... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/migrations/0006_remove_book_user.py | <reponame>amjadcp/bookingLine-grpA-miniProject<filename>serviceprovider/migrations/0006_remove_book_user.py<gh_stars>0
# Generated by Django 4.0.2 on 2022-02-06 05:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('serviceprovider', '0005_book_user'),
]
... |
amjadcp/bookingLine-grpA-miniProject | users/urls.py | <filename>users/urls.py
from django.urls import path
from .views import *
app_name='users'
urlpatterns = [
path('signup-client', signup_client, name='signup-client'),
path('signup-serviceprovider', signup_serviceprovider, name='signup-serviceprovider'),
path('profile', profile, name='profile'),
path('d... |
amjadcp/bookingLine-grpA-miniProject | users/models.py | <filename>users/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _
from .utils import *
class User(AbstractUser):
username = models.CharField(
max_length=50, blank=True, null=True, unique=True)
email = model... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/forms.py | from dataclasses import field
from pyexpat import model
from django import forms
from .models import *
class DateForm(forms.ModelForm):
class Meta:
model = Book
fields = (
'book_name',
'book_number',
'book_email',
'date',
'from_time',
... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/views.py | <gh_stars>0
from django.shortcuts import redirect, render
from django.contrib.auth.decorators import login_required
from .models import *
# Create your views here.
@login_required
def add_auditorium(request):
if request.method == 'POST':
user = request.user
email = ''
name = request.POST['... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/models.py | <reponame>amjadcp/bookingLine-grpA-miniProject
import re
from django.db import models
from users.models import *
from .utils import *
# Create your models here.
class Auditorium(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=30)
catelog = models.I... |
amjadcp/bookingLine-grpA-miniProject | users/views.py | <gh_stars>0
from django.http import HttpRequest
from django.shortcuts import render, redirect
# from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from datetime import date, datetime
from .forms import *
from .models import *
from serviceprovider.model... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/urls.py | from unicodedata import name
from django.urls import path
from .views import *
app_name='serviceprovider'
urlpatterns = [
path('add-auditorium', add_auditorium, name='add-auditorium'),
path('update-auditorium/<int:id>', update_auditorium, name='update-auditorium'),
path('auditorium-dashboard/<str:user>/<in... |
amjadcp/bookingLine-grpA-miniProject | home/models.py | <gh_stars>0
from operator import mod
from django.db import models
# Create your models here.
class Contact(models.Model):
name = models.CharField(max_length=20)
email = models.EmailField()
subject = models.CharField(max_length=25)
message = models.TextField(max_length=100)
def __str__(self) -> st... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/migrations/0001_initial.py | <reponame>amjadcp/bookingLine-grpA-miniProject<gh_stars>0
# Generated by Django 4.0.2 on 2022-02-05 07:20
from django.db import migrations, models
import django.db.models.deletion
import serviceprovider.utils
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/utils.py | <reponame>amjadcp/bookingLine-grpA-miniProject
def get_catelog_upload_to(instance, filename):
return "static/auditorium/{}/{}/catelog/{}".format(instance.user,instance.name, filename)
def get_preview_upload_to(instance, filename):
return "static/auditorium/{}/{}/preview/{}".format(instance.auditorium.user,inst... |
amjadcp/bookingLine-grpA-miniProject | home/views.py | <gh_stars>0
from django.http import JsonResponse
from django.core.mail import send_mail
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from serviceprovider.models import Book, Preview
from users.models import *
from users.views import *
from .models import Contac... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/admin.py | <reponame>amjadcp/bookingLine-grpA-miniProject
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Auditorium)
admin.site.register(Preview)
admin.site.register(Book) |
amjadcp/bookingLine-grpA-miniProject | users/utils.py | <filename>users/utils.py
def get_pic_upload_to(instance, filename):
return "static/profile/{}/pic/{}".format(instance.user, filename)
def get_aadhar_upload_to(instance, filename):
instance.filename = filename
return "static/profile/{}/aadhar/{}".format(instance.user, filename)
def get_passbook_upload_to(i... |
amjadcp/bookingLine-grpA-miniProject | serviceprovider/migrations/0003_book_book_email_book_book_name_book_book_number.py | # Generated by Django 4.0.2 on 2022-02-06 04:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('serviceprovider', '0002_initial'),
]
operations = [
migrations.AddField(
model_name='book',
name='book_email',
... |
amjadcp/bookingLine-grpA-miniProject | home/urls.py | <reponame>amjadcp/bookingLine-grpA-miniProject
from django.urls import path
from .views import *
app_name='home'
urlpatterns = [
path('', index, name='index'),
path('home', after_login, name='home'),
path('auditorium-info', auditorium_info, name='auditorium-info'),
path('auditoriums', auditoriums, nam... |
avsavras/FileLock | filelock/filelock.py | # -*- coding: utf-8 -*-
import errno
import logging
import os
import time
logger = logging.getLogger(__name__)
class FileLockException(Exception):
pass
class FileLock(object):
"""A file locking mechanism that has context-manager support so
you can use it in a with statement. This shoul... |
sidoh/webpack_with_platformio | .build_web.py | <gh_stars>1-10
from shutil import copyfile
from subprocess import check_output, CalledProcessError
import sys
import os
import platform
import subprocess
Import("env")
def is_tool(name):
cmd = "where" if platform.system() == "Windows" else "which"
try:
check_output([cmd, name])
return True
... |
jamiels/pysovryn | pysovryn/core.py | <filename>pysovryn/core.py
from web3 import Web3
import requests as requests
import matplotlib.pyplot as plt
from dateutil import parser
from prettytable import PrettyTable
class LiquidityPool:
def __init__(self,asset,contract_address='0x6E2fb26a60dA535732F8149b25018C9c0823a715'):
self.__asset=asset
... |
jamiels/pysovryn | pysovryn/__init__.py | <reponame>jamiels/pysovryn<filename>pysovryn/__init__.py
from .core import LiquidityPool, RSKNode
|
jamiels/pysovryn | setup.py | from setuptools import setup
setup(
name='pysovryn',
version='0.02',
author='<NAME>',
packages=['pysovryn'],
install_requires=[
'matplotlib',
'web3',
'pandas',
'datetime',
'requests',
'prettytable'
],
include_package_data=True,
) |
jamiels/pysovryn | app.py | <gh_stars>0
from pysovryn import RSKNode, LiquidityPool
n = RSKNode()
print(n.current_block())
# rbtc_lp = LiquidityPool(contract_address='0x6E2fb26a60dA535732F8149b25018C9c0823a715')
# rbtc_lp.print()
# rbtc_lp.chart()
sov_lp = LiquidityPool('SOV')
sov_lp.balances()
sov_lp.history()
sov_lp.chart_history()
'''fro... |
nfynt/Unity_ScriptingRef | Random/Python/module_test.py | import module
from module import GetVersion as gv
from module import *
print(module.GetNumSquared(3))
print(gv())
print(GetPow(10,2)) |
nfynt/Unity_ScriptingRef | Random/Python/python_refresh.py | ## This is a quick refresher for python functions and syntax ##
#print("Hello python!")
message = "This is a variable"
#print(message)
#print(message.title()) #This Is A Variable
#print(message.upper()) #THIS IS A VARIABLE
#print(message.lower()) #this is a variable
message2 = "This is a message"
#print(message + ... |
nfynt/Unity_ScriptingRef | Random/Python/class_test.py | import classes
m1 = classes.Math(8,2)
m2 = classes.Math(5,6)
m1.ShowVals()
m2.ShowVals()
print("")
print(m2.GetPow(m1.val1,m1.val2))
print(m1.GetPow(m2.val1,m2.val2))
eq = classes.Equations(2,4,9)
print(eq.GetSquaredRoot(eq.val3))
print(eq.ShowVals()) |
nfynt/Unity_ScriptingRef | Random/Python/classes.py | <filename>Random/Python/classes.py
import random
import math
class Math():
def __init__(self, val1, val2):
self.val1 = val1
self.val2 = val2
def GetVersion(self):
return "v0.1"
def GetNumSquared(self, num):
return num ** 2
def GetAuthorName(self):
return "Nfyn... |
nfynt/Unity_ScriptingRef | Random/Python/module.py | import random
def GetVersion():
return "v0.1"
def GetNumSquared(num):
return num ** 2
def GetAuthorName():
return "Nfynt"
def GetNumCubed(num):
return num ** 3
def GetRandomNum():
return random.randint(89,8989)
''' Get a raise to the power of b '''
def GetPow(a,b):
return a ** b |
iGEM-SBU/lab-signin | mainapp/admin.py | from django.contrib import admin
from django.urls import path
from django.shortcuts import HttpResponseRedirect
from .constants import MEMBER_NAMES
from .models import Member
from .models import Member
class MemberAdmin(admin.ModelAdmin):
change_list_template = 'mainapp/admin_member_changelist.html'
list_disp... |
iGEM-SBU/lab-signin | mainapp/migrations/0001_initial.py | <reponame>iGEM-SBU/lab-signin<gh_stars>0
# Generated by Django 2.0.5 on 2018-06-04 20:46
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='M... |
iGEM-SBU/lab-signin | mainapp/urls.py | from django.contrib import admin
from django.urls import path, re_path
from . import views
urlpatterns = [
re_path(r'^$', views.index, name="index"),
path('member/<member_name>', views.view_member_profile, name="member_profile"),
path('member/<member_name>/signin', views.member_signin, name="member_signin"... |
iGEM-SBU/lab-signin | mainapp/views.py | <reponame>iGEM-SBU/lab-signin
import threading
from django.shortcuts import render, get_object_or_404, reverse, HttpResponseRedirect
from django.utils import timezone
from .models import Member, TimelineBlock
from .forms import HoursForm, SignInTimeForm, BigTimeCorrectionForm, TimelineForm
from .constants import MEMBE... |
iGEM-SBU/lab-signin | mainapp/constants.py | <reponame>iGEM-SBU/lab-signin<gh_stars>0
import datetime as dt
# Member Names (('username', 'verbose name'), ('username2', 'verbose name2'))
MEMBER_NAMES = (
('paggarwal', '<NAME>'),
('sbudhan', '<NAME>'),
('wchiang', '<NAME>'),
('dkwasniak', '<NAME>'),
('kledalla', '<NAME>'),
('mlee', '<NAME>')... |
iGEM-SBU/lab-signin | mainapp/forms.py | <gh_stars>0
from django import forms
from django.forms import DecimalField, TimeField, DateField, CharField
class HoursForm(forms.Form):
hours = DecimalField(min_value=0, max_value=12, max_digits=4, decimal_places=2)
class SignInTimeForm(forms.Form):
time_signed_in = TimeField(widget=forms.TimeInput(format=... |
iGEM-SBU/lab-signin | mainapp/models.py | from django.db import models
from django.utils import timezone
from . import constants
# Create your models here.
class Member(models.Model):
name = models.CharField(max_length=9, choices=constants.MEMBER_NAMES, blank=False)
sign_in_time = models.DateTimeField(auto_now=False, default=timezone.now)
sign_ou... |
iGEM-SBU/lab-signin | labsignin/wsgi.py | <gh_stars>0
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "labsignin.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(application) |
iGEM-SBU/lab-signin | mainapp/migrations/0002_timelineblock.py | # Generated by Django 2.0.5 on 2018-06-07 16:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='TimelineBlock',
... |
MikeXydas/SiameseLSTM | SiameseLSTM/inference.py | import pickle
import pandas as pd
import numpy as np
from SiameseLSTM.SiamLSTM import create_malstm_model
from SiameseLSTM.utils import create_dict_datasets
def create_output_file(model, X_test, outfile, max_seq_length, embeddings, embedding_dims, from_path=False,
path_to_test='../storage/data... |
MikeXydas/SiameseLSTM | SiameseLSTM/SiamLSTMwithFeatures.py | <reponame>MikeXydas/SiameseLSTM
import tensorflow.keras.backend as K
from tensorflow.keras import layers
from tensorflow.keras.models import Model
from tensorflow_core.python.keras import regularizers
def create_malstm_features_model(max_seq_length, embedding_dims, embeddings, numb_engineered_features):
# Parame... |
MikeXydas/SiameseLSTM | SiameseLSTM/SiamLSTM.py | import tensorflow.keras.backend as K
from tensorflow.keras import layers
from tensorflow.keras.models import Model
from tensorflow_core.python.keras import regularizers
def exponent_neg_manhattan_distance(left, right):
return K.exp(-K.sum(K.abs(left-right), axis=1, keepdims=True))
def create_malstm_model(max_s... |
MikeXydas/SiameseLSTM | Trainer.py | import shutil
import time
import pickle
import pandas as pd
import numpy as np
from tqdm.keras import TqdmCallback
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from sklearn import preprocessing
from SiameseLSTM.SiamLSTM import create_malstm_model
from SiameseLSTM.SiamLSTMwithFeatures import ... |
MikeXydas/SiameseLSTM | SiameseLSTM/utils.py | <filename>SiameseLSTM/utils.py
import pandas as pd
import numpy as np
import itertools
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from tensorflow.keras.preprocessing.sequence import pad_sequences
def create_dict_datasets(clean_train_df, numb_represantation_train, ... |
MikeXydas/SiameseLSTM | SiameseLSTM/plot_creation.py | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
train_acc = pd.read_csv('../storage/datasets/q2b/plots/epochs500/run-train-tag-epoch_accuracy.csv')
val_acc = pd.read_csv('../storage/datasets/q2b/plots/epochs500/run-validation-tag-epoch_accuracy.csv')
train_loss = pd.read_csv('../storage/dataset... |
AbbVie-ComputationalGenomics/genetic-evidence-approval | src/ParseMeSH.py | <reponame>AbbVie-ComputationalGenomics/genetic-evidence-approval
from __future__ import print_function # for python2 compatibility
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 20 14:02:43 2018
@author: kingea
"""
# This script takes a zipped mesh xml file of the format available from the
# ... |
hoffmangroup/cla | claweb/claweb/controller/groups.py | """
Created on Oct 7, 2013
@author: mmendez
"""
import os
from jinja2 import Environment, FileSystemLoader
from ..model import groups as groups_model
def group(config_file, group_and_comparisons, group_id):
template_folder = os.path.join(os.path.dirname(__file__), '..', 'view')
env = Environment(loader=FileS... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/up_down_neither_count.py | <gh_stars>0
import os
import sys
import argparse
import pandas as pd
import json
from .. extra import GAC
from collections import defaultdict
def get_up_down_count(df):
# add up and down count
res = defaultdict(
lambda: {"up": 0, "down": 0})
for i, row in df.iterrows():
if row["t-test"]... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/ontoviewer.py | import argparse
import json
import sys
from abc import ABC, abstractmethod
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use(backend="Agg")
FONT_SIZE = 15
class NodePlotter(ABC):
@abstractmethod
def plot_node... |
hoffmangroup/cla | claweb/claweb/controller/genes.py | <filename>claweb/claweb/controller/genes.py
__author__ = 'mickael'
from jinja2 import Environment, FileSystemLoader
from ..model import genes as genes_model
# from ..model import gene_dist as gene_dist_model
import os
def gene_list(config_file, group_and_comparisons):
template_folder = os.path.join(os.path.dirn... |
hoffmangroup/cla | skrrf/bin/run_test.py | from skrrf._forest import RegularizedRandomForestClassifier
import numpy as np
X = np.array([
[0, 0, 0, 3, 3, 3] + [3] * 50,
[0, 0, 4, 3, 3, 2] + [10] * 50,
[0, 2, 4, 1, 3, 5] + [0] * 25 + [1] * 25,
]).transpose()
y = [0, 0, 0, 1, 1, 1] + [1] * 50
min_sample_count = np.bincount(y).min()
clf = Regularize... |
hoffmangroup/cla | claweb/claweb/model/genes.py | __author__ = 'mickael'
import pandas as pd
import os
def gene_list(config_file, group_and_comparisons):
datasets_genes = []
datasets_name = ','.join([dataset['name'] for dataset in config_file['datasets']])
for dataset in config_file['datasets']:
df = pd.read_csv(dataset['summary'], sep='\t')
... |
hoffmangroup/cla | claweb/claweb/extra.py | <gh_stars>0
__author__ = 'mickael'
import os
import yaml
def load_config(config_path):
assert isinstance(config_path, str) or isinstance(config_path, dict)
if isinstance(config_path, str):
with open(config_path) as yaml_file:
cfg = yaml.safe_load(yaml_file)
else:
cfg = config... |
hoffmangroup/cla | claweb/claweb/model/comparisons.py | __author__ = 'mickael'
import os
from collections import defaultdict
import pandas as pd
def comparison_url(cfg, comp_id):
return os.path.join(cfg['website']['url'], 'comparisons', str(comp_id) + '.html')
def gene_dist_url(cfg, dataset_name, gene):
return os.path.join(cfg['website']['url'], 'gene_distribu... |
hoffmangroup/cla | claweb/claweb/model/summary.py | import pandas as pd
def get_number_of_cell_types_with_results(cfg):
n_cell_types_list = []
for dataset in cfg['datasets']:
df = pd.read_csv(dataset['summary'], sep='\t')
n_cell_types = pd.concat([df.cl1, df.cl2]).unique().size
n_cell_types_list.append(n_cell_types)
return max(n_ce... |
hoffmangroup/cla | claweb/claweb/run_single_comp.py | <reponame>hoffmangroup/cla
__author__ = 'mickael'
import argparse
import os
import sys
from collections import defaultdict
from itertools import combinations
import numpy as np
import pandas as pd
import sklearn
from scipy import stats
from skrrf._forest import RegularizedRandomForestClassifier
from . import extra
... |
hoffmangroup/cla | claweb/claweb/model/gac.py | from claweb.extra import load_configs
def get_used_samples(cfg_filepath, gac_filepath):
cfg, gac = load_configs(cfg_filepath, gac_filepath)
comparisons = gac["comparisons"]
cl_ids_in_comparison = []
for comparison in comparisons:
cl_ids_in_comparison.append(comparison["group1"])
cl_id... |
hoffmangroup/cla | claweb/setup.py | <reponame>hoffmangroup/cla<filename>claweb/setup.py
from setuptools import find_packages
from setuptools import setup
def post_install_cleaning():
"""Remove dist, eggs, and build directory after install"""
import shutil
import glob
shutil.rmtree('dist')
shutil.rmtree('build')
shutil.rmtree(gl... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/cytoscape_utils.py | import xml.dom.minidom as minidom
def get_node_attr_from_cytoscape(xgmml_filename):
"""Get node attributes name, id, shared_name, x, y, w, id, and edges from
an xgmml file from cytoscape.
Return nodes and edges"""
assert "xgmml" in xgmml_filename
doc = minidom.parse(xgmml_filename)
nodes =... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/terms.py | <reponame>hoffmangroup/cla<filename>claweb/claweb/f5clonto_helper/terms.py
import operator
MERGE_SEPARATOR = ';;'
class TermMerger:
def __init__(self, terms, merge_separator=MERGE_SEPARATOR):
self.terms = sorted(terms, key=operator.attrgetter('name'))
self.term_ids = [term.term_id for term in sel... |
hoffmangroup/cla | claweb/claweb/controller/comparisons/comparisons.py | """
Created on Oct 7, 2013
@author: mmendez
"""
import os
from jinja2 import Environment, FileSystemLoader
from ...model import comparisons as comparison_model
def comparisons(cfg, group_and_comparisons, comp_id):
template_folder = os.path.join(os.path.dirname(__file__), '..', '..', 'view')
env = Environme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.