repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
Alqueraf/lms-app | foosball/adb_foos.py | import CHIP_IO.GPIO as GPIO
import time
import os
import urllib2
import socket
import logging
from subprocess import call
TIMESTR = time.strftime("%Y%m%d-%H%M%S")
logging.basicConfig(level=logging.DEBUG, filename='foos_' + TIMESTR + '.log')
TABLE_ID = "5FLOOR"
BTNRESET = "GPIO2"
BTN1 = "GPIO3"
BTN2 = "GPIO4"
LED1 =... |
PhoeniXuzoo/NU-Projects | EE475/Ch6P16.py | <filename>EE475/Ch6P16.py<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
return x, y
fot = lambda x : np.exp(-x) / (1 + np.exp(-x))
sot = lambda x : ( 1 / (1 + np.exp(x))) * (1 - ( 1 / (1... |
PhoeniXuzoo/NU-Projects | EE475/Ch6P13.py | import numpy as np
import matplotlib.pyplot as plt
## softmax: 0.1 600
## perceptron: 0.05 550
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
return x, y
def softmaxCostFunc(x, y, w):
cost = np.sum(np.log(1 + np.exp(-y*np.transpose(np.dot(np.t... |
PhoeniXuzoo/NU-Projects | EE475/9.2.py | <filename>EE475/9.2.py
import ssl
from sklearn.datasets import fetch_openml
import autograd.numpy as np
from autograd import grad
from autograd.misc.flatten import flatten_func
import matplotlib.pyplot as plt
import random
# import MNIST
x, y = fetch_openml('mnist_784', version=1, return_X_y=True)
# re-shape input/ou... |
PhoeniXuzoo/NU-Projects | EE475/edgebased_feature_extractor.py | <gh_stars>0
from autograd import numpy as np
class tensor_conv_layer:
# convolution function
def conv_function(self, tensor_window):
tensor_window = np.reshape(tensor_window, (
np.shape(tensor_window)[0], np.shape(tensor_window)[1] * np.shape(tensor_window)[2]))
t = np.dot(self.kernels... |
PhoeniXuzoo/NU-Projects | EE475/Ch7P3.py | <gh_stars>0
import autograd.numpy as np
import matplotlib.pyplot as plt
from autograd import grad
from autograd.misc.flatten import flatten_func
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
return x, y
def model(x, w):
a = w[0] + np.dot(x.T, w... |
PhoeniXuzoo/NU-Projects | EE475/Ch3P5.py | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def gradientDescentEveryStep(derivative, startPoint, stepLength):
return startPoint - stepLength * derivative(startPoint)
if __name__ == "__main__":
# g(w) = (1/50) * ( w^4 + w^2 + w)
with PdfPages('... |
PhoeniXuzoo/NU-Projects | EE475/Ch3P6.py | <reponame>PhoeniXuzoo/NU-Projects
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def gradientDescentEveryStep(derivative, startPoint, stepLength):
return startPoint - stepLength * derivative(startPoint)
if __name__ == "__main__":
# g(w) = |x|
wit... |
PhoeniXuzoo/NU-Projects | EE475/Ch4P5c.py | from autograd import grad
from autograd import hessian
import autograd.numpy as np
import matplotlib.pyplot as plt
def newtons_method(g, max_its, w):
gradient = grad(g)
hess = hessian(g)
epsilon = 10 ** (-7)
weight_history = [w]
cost_history = [g(w)]
for k in range(max_its):
grad_ev... |
PhoeniXuzoo/NU-Projects | EE475/Ch3P8.py | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def gradientDescentEveryStep(derivative, startPoint, stepLength):
return startPoint - stepLength * derivative(startPoint)
def constFunc(w):
total = 0
for i in w:
total += i*i
return total
... |
PhoeniXuzoo/NU-Projects | EE475/Ch9P2.py | <reponame>PhoeniXuzoo/NU-Projects
import ssl
from sklearn.datasets import fetch_openml
import autograd.numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
from autograd import grad
from autograd.misc.flatten import flatten_func
import copy
ssl._create_default_https_context = ssl._... |
PhoeniXuzoo/NU-Projects | EE475/Ch5P9b.py | <reponame>PhoeniXuzoo/NU-Projects<gh_stars>0
import numpy as np
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
for i in range(len(x)):
x[i] = (x[i] - np.mean(x[i])) / np.std(x[i])
return x, y
def gradientDescentEachStep(w, x, y):
w_T... |
PhoeniXuzoo/NU-Projects | EE475/Ch5P2.py | import csv
import numpy as np
import math
def readData():
rawData = csv.reader(open("kleibers_law_data.csv", 'r'))
xList = []
yList = []
i = 0
for raw in rawData:
if i == 0:
xList = raw
i += 1
else:
yList = raw
for i in range(len(xList)):
... |
PhoeniXuzoo/NU-Projects | EE475/data_transformer.py | from autograd import numpy as np
import edgebased_feature_extractor
# edge-based feature extraction
def edge_transformer(x):
# edge-based directions for kernel-based feature extraction
kernels = np.array([
[[-1, -1, -1],
[ 0, 0, 0],
[ 1, 1, 1]],
[[-1, -1, 0],... |
PhoeniXuzoo/NU-Projects | EE475/Ch7P2.py | <reponame>PhoeniXuzoo/NU-Projects
import numpy as np
import matplotlib.pyplot as plt
import copy
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
return x, y
def drawpoint(x, y):
position = x[[1,2]]
zeroXList = []
zeroYList = []
oneXLi... |
PhoeniXuzoo/NU-Projects | EE475/Ch6P15.py | <filename>EE475/Ch6P15.py
import numpy as np
import matplotlib.pyplot as plt
def readData(csvname):
data = np.loadtxt(csvname, delimiter=',')
x = data[:-1, :]
y = data[-1:, :]
for i in range(len(x)):
x[i] = (x[i] - np.mean(x[i])) / np.std(x[i])
return x, y
def perceptronCostFunc(x, y, w,... |
Mitrofanov/enhanced-rds-monitoring | tests/sample_input.py | # Sample RDSOS output from a MySQL instance
my_sql_dict = {
u"engine": u"MYSQL",
u"instanceID": u"ppr9b9oge80i99",
u"instanceResourceID": u"db-H4UK4SA7E62QPMAYTMPK5XWETQ",
u"timestamp": u"2017-09-19T00:21:07Z",
u"version": 1,
u"uptime": u"272 days, 1:28:18",
u"numVCPUs": 2,
u"cpuUtilizat... |
Mitrofanov/enhanced-rds-monitoring | enhanced_rds/metric_maps.py | <filename>enhanced_rds/metric_maps.py<gh_stars>0
"""
The default structure(s) of the metric payloads delivered to the Lambda.
Note that the Aurora section only contains the structures in which there is
meaningful difference from the standard version.
"""
# Standard set of metric info
METRICS = [
u'cpuU... |
Mitrofanov/enhanced-rds-monitoring | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = [line.strip() for line in f.readlines()]
setup(
name='enhanced_rds',
version='0.1.0',
description='AWS Lambda function wrapper to capture metrics from enhanced RDS monitoring logs',
... |
krava2020/pong | Ping_Pong.py | import pygame
pygame.init()
mw_w = 500
mw_h = 500
mw = pygame.display.set_mode((mw_w, mw_h))
mw.fill((0,255,0))
clock = pygame.time.Clock()
FPS = 60
class Sprite:
def __init__(self, image_name, x, y, width, hight, speed):
self.image = pygame.transform.scale(
pygame.image.load(im... |
mbeyers/NCI-DOE-Collab-Pilot1-Tumor_Classifier | Pilot1/TC1/tc1_infer.py | from __future__ import print_function
import pandas as pd
import numpy as np
import os
import sys
import gzip
import argparse
try:
import configparser
except ImportError:
import ConfigParser as configparser
from keras import backend as K
from keras.layers import Input, Dense, Dropout, Activation, Conv1D, Max... |
quantori/nsaph-platform-deployment | project/examples/test-workflow.py | #!/usr/bin/env python3
from cwl_airflow.extensions.cwldag import CWLDAG
args = {
"cwl": {
"debug": True,
"parallel": True
}
}
dag = CWLDAG(
workflow="/opt/airflow/project/examples/test-workflow.cwl",
dag_id="Test-Workflow",
default_args=args
) |
quantori/nsaph-platform-deployment | project/python_sample_project/setup.py | from setuptools import setup, find_packages
with open("README.md", "r") as readme:
long_description = readme.read()
setup(
name='pisample',
version="0.1",
url='',
license='Apache 2.0',
author='<NAME>',
author_email='<EMAIL>',
description='Sample Python project for CWL-Airflow',
lon... |
quantori/nsaph-platform-deployment | project/examples/medicaid.py | <gh_stars>0
#!/usr/bin/env python3
from cwl_airflow.extensions.cwldag import CWLDAG
args = {
"cwl": {
"debug": True,
"parallel": True
}
}
dag = CWLDAG(
workflow="/opt/airflow/project/cms/src/cwl/medicaid.cwl",
dag_id="medicaid",
default_args=args
) |
quantori/nsaph-platform-deployment | project/examples/1st-tool.py | #!/usr/bin/env python3
from cwl_airflow.extensions.cwldag import CWLDAG
args = {
"cwl": {
"debug": True,
"parallel": True
}
}
dag = CWLDAG(
workflow="/opt/airflow/project/examples/1st-tool.cwl",
dag_id="1st-tool",
default_args=args
) |
quantori/nsaph-platform-deployment | project/python_sample_project/pi.py | <reponame>quantori/nsaph-platform-deployment
import sys
def calculate(n:int) -> float:
k = 1
s = 0
for i in range(n):
if i % 2 == 0:
s += 4/k
else:
s -= 4/k
k += 2
return s
if __name__ == '__main__':
print(calculate(int(sys.argv[1])))
|
quantori/nsaph-platform-deployment | project/examples/airnow.py | <gh_stars>0
#!/usr/bin/env python3
from cwl_airflow.extensions.cwldag import CWLDAG
args = {
"cwl": {
"debug": True,
"parallel": True
}
}
dag = CWLDAG(
workflow="/opt/airflow/project/epa/src/cwl/airnow.cwl",
dag_id="AirNow",
default_args=args
) |
quantori/nsaph-platform-deployment | project/examples/rpi.py | #!/usr/bin/env python3
from cwl_airflow.extensions.cwldag import CWLDAG
args = {
"cwl": {
"debug": True,
"parallel": True
}
}
dag = CWLDAG(
workflow="/opt/airflow/project/examples/rpi.cwl",
dag_id="rpi",
default_args=args
) |
andrewschoen/cephci | tests/ceph_installer/test_ceph_deploy.py | <reponame>andrewschoen/cephci
import logging
import time
from ceph.utils import keep_alive, setup_deb_repos
from ceph.utils import setup_repos, create_ceph_conf
logger = logging.getLogger(__name__)
log = logger
def run(**kw):
log.info("Running test")
ceph_nodes = kw.get('ceph_nodes')
config = kw.get('co... |
andrewschoen/cephci | tests/ceph_ansible/shrink_mon.py | <reponame>andrewschoen/cephci<filename>tests/ceph_ansible/shrink_mon.py
import logging
import re
log = logging.getLogger(__name__)
def run(ceph_cluster, **kw):
"""
Remove monitor from cluster using shrink-mon.yml
Args:
ceph_cluster (ceph.ceph.Ceph): ceph cluster
Returns:
int: non-z... |
slimpotatoes/STEM_Moire_GPA | src/gpa.py | <reponame>slimpotatoes/STEM_Moire_GPA
# GPA Module
import mask as mask
import data as data
import numpy as np
from skimage.restoration import unwrap_phase
def gpa(mask_id, datastruct):
"""Pefrom GPA on the GUI id, mask_id using the data in datastructure:
1. Load elements of GUI (center, radius) to c... |
slimpotatoes/STEM_Moire_GPA | src/userinput.py | # Input Module
import dm3_lib as dm3_lib
import numpy as np
import data as data
def load_files(file_path_smh, file_path_ic, datastruct):
"""Load the files by asking the controller the filepaths smh and ic provided by the user and store the appropriate
data in the data structure object (dictionary). Before s... |
slimpotatoes/STEM_Moire_GPA | src/test_mask.py | import pytest
import mask as mask
import numpy as np
# Test cases
test_case_0 = dict()
test_case_0['center'] = (2, 3)
test_case_0['radius'] = 1
test_case_0['image_test'] = np.ones(shape=(6, 6))
test_case_0['image_to_assert'] = np.array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0],
... |
slimpotatoes/STEM_Moire_GPA | src/rotatecalc.py | import numpy as np
import math
import data
def angle_rotation(gui):
first_position = [gui.line_rot.LineCoords[0][1], gui.line_rot.LineCoords[0][0]]
second_position = [gui.line_rot.LineCoords[1][1], gui.line_rot.LineCoords[1][0]]
print('first position = ', first_position)
print('second position = ', s... |
slimpotatoes/STEM_Moire_GPA | src/test_conversion.py | <reponame>slimpotatoes/STEM_Moire_GPA
import pytest
import data
import numpy as np
import conversion
mask = 'Mask1'
# Create elements used by conversion in the data structure
# -------------------------------
# Test cases
# -------------------------------
# Test 24 in TestPlan.pdf
test_case_0 = dict()
datastruct_0 ... |
slimpotatoes/STEM_Moire_GPA | src/test_data.py | """ Tests of the SMGData class from data.py """
import pytest
import data
# Test setup
# SMGData instance
smgData = data.SMGData()
smgData.create_branch('Mask1')
smgData.create_branch('Mask2')
# This definition should have been provided by the SMGData interface
possibleKeys = [
"ICref",
"pref",
... |
slimpotatoes/STEM_Moire_GPA | src/conversion.py | # Conversion Module
import numpy as np
import data as data
import math as math
def conversion(mask_id, n_horizontal, m_vertical, datastruct):
"""Convert the Moire 3D array into the Crystal 2D array and store it in datastruct.
The Moire 3D array is loaded from the data structure (datastruct) using the keywor... |
slimpotatoes/STEM_Moire_GPA | src/main.py | <gh_stars>1-10
# ############################# #
# #
# STEM Moire GPA Software #
# #
# ############################# #
#
# #####################################################################################
#
# Python script calculating the 2D relative... |
slimpotatoes/STEM_Moire_GPA | src/data.py | <filename>src/data.py<gh_stars>1-10
# Data Structure Module
class SMGData(object):
"""Module storing and loading intermediate data used during the processing"""
def __init__(self):
self.SMGData = dict()
self.SMGData['ISMHexp'] = None
self.SMGData['p'] = None
self.SMGData['ICre... |
slimpotatoes/STEM_Moire_GPA | src/manual_test_gpa.py | <reponame>slimpotatoes/STEM_Moire_GPA
# Test of GPA Module
import numpy as np
import math as math
import data as data
import gpa as gpa
import matplotlib.pyplot as plt
import statistics
# #######################################
# Test #2 in TestPlan document
# #######################################
data_test_2 = da... |
slimpotatoes/STEM_Moire_GPA | src/smhsimulation.py | # STEM Moire hologram simulation module
import numpy as np
import data as data
import math as math
from scipy.ndimage.interpolation import shift
def smh_sim(datastruct):
"""Simulate the Fourier transform of the STEM Moire hologram based on the reference image"""
# Make the Fourier transform of the STEM Moi... |
slimpotatoes/STEM_Moire_GPA | src/mask.py | <reponame>slimpotatoes/STEM_Moire_GPA
# Mask Module
import numpy as np
def mask_classic(center, r, shape):
"""Return the mask function in the image space I defined by shape (see MIS). The classic mask takes the center of a
circle center = (xc,yc) and its radius r and put 1 if the image space is inside the c... |
slimpotatoes/STEM_Moire_GPA | src/gui.py | # STEM Moire GPA GUI Module
import matplotlib.pyplot as plt
import matplotlib.gridspec as grid
import matplotlib.cm as cm
import matplotlib.colors as colors
import matplotlib.artist as artist
import matplotlib.patches as patch
from tkinter import filedialog
from matplotlib.widgets import Button
from matplotlib.widget... |
slimpotatoes/STEM_Moire_GPA | src/guimaskmanager.py | # Module Mask Manager that is used by GUI
from matplotlib.patches import Circle
import matplotlib.artist as artist
import math
class MaskCreator(object):
def __init__(self, axis, image):
self.axis = axis
self.image = image
self.circle = None
self.colored = None
self.off_... |
slimpotatoes/STEM_Moire_GPA | src/test_straincalc.py | import pytest
import straincalc
import numpy as np
import data
# ----------------
# Test cases
# ---------------
# Test 27 from TestPlan.pdf
datastruct_0 = data.SMGData()
datastruct_0.create_branch('Mask1')
datastruct_0.create_branch('Mask2')
datastruct_0.store('p', 1)
g_c_uns_1 = np.transpose(np.array([[[1, 2]]]), a... |
slimpotatoes/STEM_Moire_GPA | src/guilinemanager.py | <filename>src/guilinemanager.py
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import numpy as np
class LineDraw(object):
epsilon = 20
def __init__(self, axis):
self.axis = axis
self.canvas = self.axis.figure.canvas
self.LineStartx = None
self.LineStarty = N... |
slimpotatoes/STEM_Moire_GPA | src/straincalc.py | # Strain calculation Module
import numpy as np
import data as data
import rotatecalc
def strain_calculation(mask_id_1, mask_id_2, datastruct):
p = data.SMGData.load(datastruct, 'p')
if p <= 0:
raise Exception('Pixel size negative or zero, strain calculation cannot be performed')
# Load the crys... |
victorwyee/great_expectations | great_expectations/expectations/metrics/map_metric.py | import uuid
from functools import wraps
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
import numpy as np
from great_expectations.core import ExpectationConfiguration
from great_expectations.core.util import convert_to_json_serializable
from great_expectations.exceptions.metric_exceptions ... |
hadi1976/python_project | codes/main.py | <reponame>hadi1976/python_project<filename>codes/main.py
from typing import TextIO
from pipes import TypeOfPipe
import flowrate_factors
import performances
import plots
from config import *
"""
Author: <NAME>
Author: <NAME>
The script "main.py" has the function of integrating the outputs from all
the cod... |
hadi1976/python_project | codes/plots.py | <filename>codes/plots.py
from config import *
import performances
import pumps_figure
"""
Author: <NAME>
The script "plots" as its name says, has the function of process the data input
by the user, as the outputs from files as: "flowrate_factors", "pumps_figure",
and "performances", in order to elaborate the g... |
hadi1976/python_project | codes/diameters.py | <reponame>hadi1976/python_project<gh_stars>0
from config import*
class DiameterReader:
"""
Author: <NAME>
The class 'DiameterReader' has the function to read the
'EconomicDiameter' csv file. Making it reusable for others
water distribution designing codes.
"""
def ... |
hadi1976/python_project | codes/pipes.py | <filename>codes/pipes.py
from config import *
from diameters import DiameterReader
class TypeOfPipe:
"""
Author: <NAME>
The class 'TypeOfPipe' has the function of dimensioning the pipes
parameters that are needed for supplying the demand in a sewer system.
"""
def __init__(self, fl... |
hadi1976/python_project | codes/performances.py | from flowrate_factors import max_daily_flow
from config import*
"""" Author: <NAME>
The script 'performances.py' has the function of evaluating the performances
of the two pump capacities for the model 2009 1760 RPM and the model 8013 1760
RPM. This evaluation is according to: elevation (m) and flow discharge... |
hadi1976/python_project | codes/flowrate_factors.py | from config import *
"""
Author: <NAME>
"""
# read the country name from text file
with open(country) as file:
country_name = file.read()
# read the number of inhabitants from text file
with open(inhabitants) as file:
number_inhabitants = int(file.read())
def get_flow_discharge():
"""
... |
hadi1976/python_project | codes/GUI.py | from config import *
"""
Author: <NAME>
in this file I made a stand alone GUI which takes all the inputs from the user,
save it in a text file, and show the results.
"""
class MyApp(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.Label018 = None
... |
hadi1976/python_project | codes/config.py | """
Author: <NAME>
The "config.py" file, is importing all the libraries and modules that are
required for the correct functionality of this code.As well as, the path
of the GUI inputs.
Also, in case one of the libraries or modules is not properly installed
or the path of the GUI cannot be found. The user will b... |
hadi1976/python_project | codes/pumps_figure.py | from config import *
class FlowRatePump:
"""
Author:<NAME>
This class "FlowRatePump" has 3 attributes;start, stop, name
The Method is called flow_rate which gets the attributes and
create a list of 500 numbers between stop and start.
"""
def __init__(self, start, stop, name):
... |
grim13b/testtone | sinewave.py | # -*- coding: utf-8 -*-
__author__ = 'grim3lt.org'
import numpy
import struct
class SineWaveCreator:
def offset_header(self, fp):
for i in range(44):
fp.write(b'0')
def write(self, fp, a, f0, fs, depth, sec):
"""
a = amplitude
f0 = frequency
fs = sampling ... |
taki0112/GDWCT-Tensorflow | GDWCT.py | <gh_stars>10-100
from ops import *
from utils import *
from glob import glob
import time
from tensorflow.contrib.data import prefetch_to_device, shuffle_and_repeat, map_and_batch
class GDWCT(object) :
def __init__(self, sess, args):
self.model_name = 'GDWCT'
self.sess = sess
self.checkpoint... |
taki0112/GDWCT-Tensorflow | ops.py | <gh_stars>10-100
import tensorflow as tf
import tensorflow.contrib as tf_contrib
import numpy as np
from utils import pytorch_xavier_weight_factor, pytorch_kaiming_weight_factor
factor, mode, uniform = pytorch_kaiming_weight_factor(a=0.0, uniform=False)
weight_init = tf_contrib.layers.variance_scaling_initializer(fact... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/models/__init__.py | <gh_stars>1-10
from .eksisozlukbot import Entry |
altuntasmuhammet/eksisozluk-scraper | altuntas/altuntas/celery.py | <gh_stars>1-10
from __future__ import absolute_import
from celery import Celery
from django.conf import settings
import os
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'altuntas.settings')
app = Celery('altuntas')
app.config_from_object('django.con... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/migrations/0001_initial.py | <filename>altuntas/scraper/migrations/0001_initial.py
# Generated by Django 3.2.5 on 2021-07-10 17:15
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Entry',
... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/migrations/0002_alter_entry_table.py | <filename>altuntas/scraper/migrations/0002_alter_entry_table.py
# Generated by Django 3.2.5 on 2021-07-10 17:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scraper', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/tasks/eksisozlukbot.py | <filename>altuntas/scraper/tasks/eksisozlukbot.py
from celery.decorators import task
from eksisozlukbot.eksisozlukbot.spiders.eksisozluk import EksisozlukSpider
from eksisozlukbot.eksisozlukbot import settings as eksisozlukbot_settings
from scrapy import signals
from scrapy.crawler import Crawler
from scrapy.settings i... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/models/eksisozlukbot.py | from django.conf import settings
from django.db import models
class Entry(models.Model):
title = models.TextField()
content = models.TextField()
favourite_count = models.IntegerField()
author = models.TextField()
created_date = models.DateTimeField()
edited_date = models.DateTimeField(blank=Tr... |
altuntasmuhammet/eksisozluk-scraper | altuntas/altuntas/settings.py | <reponame>altuntasmuhammet/eksisozluk-scraper<filename>altuntas/altuntas/settings.py<gh_stars>1-10
"""
Django settings for altuntas project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of ... |
altuntasmuhammet/eksisozluk-scraper | altuntas/eksisozlukbot/eksisozlukbot/spiders/eksisozluk.py | <gh_stars>1-10
import scrapy
import time
from datetime import datetime
import urllib.parse
EKSISOZLUK_BASEURL = "https://eksisozluk.com"
DATETIME_FORMAT = "%d.%m.%Y %H:%M"
START_DATE = ""
END_DATE = ""
# keywords = ["apache kafka"]
class EksisozlukSpider(scrapy.Spider):
name = 'eksisozluk'
allowed_domains = ... |
altuntasmuhammet/eksisozluk-scraper | altuntas/scraper/admin.py | from django.contrib import admin
from .models import Entry
# Register your models here.
class EntryAdmin(admin.ModelAdmin):
list_display = ("title", "content", "favourite_count", "author", "created_date", "edited_date")
admin.site.register(Entry, EntryAdmin) |
altuntasmuhammet/eksisozluk-scraper | altuntas/eksisozlukbot/__init__.py | from six import iteritems
from eksisozlukbot.eksisozlukbot import spiders
from eksisozlukbot.eksisozlukbot import items
from eksisozlukbot.eksisozlukbot import middlewares
from eksisozlukbot.eksisozlukbot import pipelines
from eksisozlukbot.eksisozlukbot import settings
_SUBMODULES = {
"spiders": spiders,
"... |
altuntasmuhammet/eksisozluk-scraper | altuntas/eksisozlukbot/eksisozlukbot/settings.py | <filename>altuntas/eksisozlukbot/eksisozlukbot/settings.py
# Scrapy settings for eksisozlukbot project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# ... |
altuntasmuhammet/eksisozluk-scraper | altuntas/eksisozlukbot/eksisozlukbot/pipelines.py | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
from scraper.models.eksisozlukbot import Entry... |
pawansingh126/yaml_editor | yaml_editor/editor.py | <filename>yaml_editor/editor.py<gh_stars>1-10
##############################################################################
#
# Author : <NAME>
# Email : <EMAIL>
# Date : Oct 2018
#
##############################################################################
import click
import json
import os
import socket
i... |
ankit-vaghela30/sign-language-recognition | sign-language-recognition/image_obj_detect.py | <filename>sign-language-recognition/image_obj_detect.py
#!flask/bin/python
from flask import Flask, render_template, request
from flask_cors import CORS, cross_origin
import base64
import json
# from datetime import datetime
import numpy as np
import sys
import tensorflow as tf
import os
from threading import Thread
f... |
ankit-vaghela30/sign-language-recognition | sign-language-recognition/gesturedetector.py | import skimage
from skimage.transform import resize
from keras.models import load_model
import numpy as np
import cv2
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
print('Loading model...')
model = load_model('vgg16model.h5')
print('model loaded')
map_characters = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', 5: 'F'... |
ankit-vaghela30/sign-language-recognition | web-service/analyze.py | <filename>web-service/analyze.py
#!flask/bin/python
from flask import Flask, render_template, request
from flask_cors import CORS, cross_origin
import base64
import json
#import time
from datetime import datetime
app = Flask(__name__)
CORS(app, support_credentials=True)
@app.route('/upload', methods=['POST'])
@cross_... |
ramonmeza/raycasting-py | tests/template/features/steps/template.py | @given('some state of an object') # type: ignore # noqa: F821
def step_impl(context) -> None: # noqa: F811
context.test_str = 'change me'
@when('we change that object') # type: ignore # noqa: F821
def step_impl(context) -> None: # noqa: F811
context.test_str = 'you\'ve changed'
@then('assert that the ch... |
LZP4GitHub/ssd.pytorch | data/dota.py | <reponame>LZP4GitHub/ssd.pytorch
"""dota dataset classes
original author: <NAME>
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
updated by: ellis brown, max degroot
for dota file list is:
|data/
|data/trainvalsplit/
|data/testsplit/
|data|trainvalsplit/images/
|data|trainvals... |
LZP4GitHub/ssd.pytorch | test.py | <reponame>LZP4GitHub/ssd.pytorch
from __future__ import print_function
import sys
import os
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
from torch.autograd import Variable
# from data import VOC_ROOT, VOC_CLASSES as labelmap
from PI... |
jancervenka/acf | acf/core/computation.py | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import logging
import functools
import multiprocessing as mp
from typing import Any, Callable, Iterable, List, Optional, Tuple
import numpy as np
import pandas as pd
from .preprocessing import create_user_item_matrix
from .utils import (
c... |
jancervenka/acf | acf/tests/test_utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import unittest
import numpy as np
import pandas as pd
from ..core import utils
class CheckColumnsInDataFrameTest(unittest.TestCase):
"""
Tests `utils.check_columns_in_data_frame`.
"""
def setUp(self) -> None:
"""
Sets up... |
jancervenka/acf | acf/__init__.py | <reponame>jancervenka/acf<filename>acf/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
from .core.computation import Engine
from .core import metrics
from .version import __version__
__doc__ = """
Lightweight recommender engine for implicit feedback datasets.
The package implements a collab... |
jancervenka/acf | acf/tests/test_metrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import unittest
from unittest import mock
import pandas as pd
from ..core.metrics import mean_rank
class MeanRankTest(unittest.TestCase):
"""
Tests `metrics.mean_rank`.
"""
def test_mean_rank_correct_value(self) -> None:
"""
... |
jancervenka/acf | acf/tests/test_preprocessing.py | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import unittest
import numpy as np
import pandas as pd
from ..core.preprocessing import create_user_item_matrix
class CreateUserItemMatrixTest(unittest.TestCase):
"""
Tests `preprocessing.create_user_item_matrix`.
"""
@static... |
jancervenka/acf | acf/core/preprocessing.py | <filename>acf/core/preprocessing.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import pandas as pd
def create_user_item_matrix(
interactions: pd.DataFrame, user_column: str, item_column: str, feedback_column: str
) -> pd.DataFrame:
"""
Creates `R` from `interactions` dataframe by pivoti... |
jancervenka/acf | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2021, <NAME>
import setuptools
import pathlib
VERSION = "0.2.3"
def run_setup():
"""
Runs the package setup.
"""
this_directory = pathlib.Path(__file__).parent
setup_params = {
"name": "acf",
"version": VERSION,
"descr... |
jancervenka/acf | acf/tests/test_computation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import multiprocessing as mp
import unittest
from typing import Iterable
import numpy as np
import pandas as pd
from ..core.computation import Engine
class EngineTest(unittest.TestCase):
"""
Tests `computation.Engine` class.
"""
def set... |
jancervenka/acf | acf/core/utils.py | <reponame>jancervenka/acf
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import warnings
from typing import Tuple, Any
import numpy as np
import pandas as pd
def check_columns_in_dataframe(df: pd.DataFrame, columns: Tuple[str]) -> None:
"""
Raises an exception if any column name in `columns` ... |
jancervenka/acf | acf/core/metrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, <NAME>
import numpy as np
import pandas as pd
from . import computation
from .preprocessing import create_user_item_matrix
def mean_rank(
interactions: pd.DataFrame,
user_column: str,
item_column: str,
feedback_column: str,
engine: computati... |
Andre-Vitorino/House-Predict | api/house/House.py | import pandas as pd
import inflection
import math
import datetime
import pickle
import numpy as np
class House(object):
def __init__(self):
self.year_built_scaler = pickle.load(open('/home/andre/repos/House-Prices/parameter/year_built_scaler.pkl', 'rb'))
self.ms_sub_class_scaler = pickle.load... |
Andre-Vitorino/House-Predict | api/handler.py | <gh_stars>0
import pandas as pd
from flask import Flask, request, Response
from house.House import House
import pickle
# carregando modelo
model = pickle.load(open('/home/andre/repos/House-Prices/model/house_model.pkl', 'rb'))
app = Flask(__name__)
@app.route('/house/predict', methods=['POST'])
def house_predict... |
lukemassa/socialmixingmatrix | socialmixing.py | #!/usr/bin/env python3
"""
Groups social mixing data into age ranges
"""
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
import csv
POP_ESTIMATE_COLUMN = "CENSUS2010POP" # Which column to use from the census data
class AgeMixing():
"""
Container for social mixing data, functions to manipulat... |
rezaeiii/VDSR | main.py | <reponame>rezaeiii/VDSR
import os, argparse
from vdsr import VDSR
# Arguments
parser = argparse.ArgumentParser(description='TensorFlow implementation of VDSR')
# Select GPU
parser.add_argument('--gpu-id', type=int, default=0)
parser.add_argument('--test', action='store_true', default=False)
parser.add_a... |
rezaeiii/VDSR | utils.py | <reponame>rezaeiii/VDSR<filename>utils.py
import tensorflow as tf
import numpy as np
import math
from PIL import Image
from tqdm import tqdm
import os
import h5py
# Read image
def imread(fname):
return Image.open(fname)
# Save image
def imsave(image, path, fname):
image = image * 255.
... |
rezaeiii/VDSR | dataset.py | <filename>dataset.py<gh_stars>1-10
import tensorflow as tf
import numpy as np
import threading, time
import h5py
class Dataset():
def __init__(self, data_path, batch_size):
self.data_path = data_path
# Patch size for training
self.input_size = 41
self.label_size = 41
... |
mikaelengstrom/django-react-templatetags | django_react_templatetags/tests/test_manager.py | # -*- coding: utf-8 -*-
from django.conf import global_settings
from django.template import Context, Template
from django.test import TestCase, modify_settings, override_settings
import responses
from django_react_templatetags.templatetags.react import _get_tag_manager, ReactTagManager
class TestReactTagManager(Rea... |
mikaelengstrom/django-react-templatetags | django_react_templatetags/tests/test_ssr.py | <reponame>mikaelengstrom/django-react-templatetags
import json
try:
from unittest import mock
except ImportError:
import mock
from django.urls import reverse
from django.template import Context, Template
from django.test import TestCase, override_settings
import responses
from django_react_templatetags.tests.... |
mikaelengstrom/django-react-templatetags | django_react_templatetags/templatetags/react.py | <filename>django_react_templatetags/templatetags/react.py
# -*- coding: utf-8 -*-
"""
This module contains tags for including react components into templates.
"""
import uuid
import importlib
import json
from django import template
from django.conf import settings
from django.template import Node
from django_react_t... |
dhruvyad/MultimodalGame | model_symmetric.py | import os
import sys
import json
import time
import numpy as np
import random
import h5py
import copy
import functools
import logging
import pickle
import torch
from torch.autograd import Variable as _Variable
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
from torch.nn.parameter imp... |
dls-controls/scanpointgenerator | scanpointgenerator/rois/__init__.py | <filename>scanpointgenerator/rois/__init__.py
###
# Copyright (c) 2016, 2017 Diamond Light Source Ltd.
#
# Contributors:
# <NAME> - initial API and implementation and/or initial documentation
# <NAME> - initial API and implementation and/or initial documentation
# <NAME> - initial API and implementation and/or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.