repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
JayramMardi/codeMania
codeMania-python-matplotlib/mymodule.py
''' TRICKS FOR CODING { 1. for press down arrow key when center to a word to avoid the time } ''' person1 = { "name": "j", "age": "23", "class": "standard" } class myclass(): agent1 = { "name": " india ", "age":"21", "standard":"A class ...
JayramMardi/codeMania
codeMania-python-AI-Machine-learning/tut9_practise.py
def testing(num): if (num>50): return (num-2) return testing(testing(num+10)) print(testing(30))
JayramMardi/codeMania
codeMania-python-begginer/01_pythonforbegginer.py
<filename>codeMania-python-begginer/01_pythonforbegginer.py # What Is Programming python is easy to use and less development time, high level language it means don't very about the memory allocated or crash your proggramer code portablity first class it installed on windows/man /linux and instllation is very quick . ...
JayramMardi/codeMania
codeMania-python-AI-Machine-learning/tut8_linear-polynomial.py
''' Machine Learning - Polynomial Regression Polynomial Regression If your data points clearly will not fit a linear regression (a straight line through all data points), it might be ideal for polynomial regression. Polynomial regression, like linear regression, uses the relationship between the variables x and...
JayramMardi/codeMania
codeMania-python-matplotlib/tut14_historigram.py
<filename>codeMania-python-matplotlib/tut14_historigram.py # Matplotlib Histograms ''' Histogram A histogram is a graph showing frequency distributions. It is a graph showing the number of observations within each given interval. Example: Say you ask for the height of 250 people, you might end up with a h...
JayramMardi/codeMania
codeMania-python-matplotlib/tut11_Matplot_Subplot.py
<gh_stars>0 import matplotlib.pyplot as plt import numpy as np # plot 1 x=np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y=np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) # plt.subplot(1,2,1) # plt.plot(x, y) # plt.title('income') # # plot 2 # x=np.array([80, 85, 90, 95, 100, 10...
JayramMardi/codeMania
codeMania-python-AI-Machine-learning/tut6_scatterplot.py
<reponame>JayramMardi/codeMania<gh_stars>0 ''' Machine Learning - Scatter Plot Scatter Plot A scatter plot is a diagram where each value in the data set is represented by a dot. The Matplotlib module has a method for drawing scatter plots, it needs two arrays of the same length, one for the values of the x-ax...
JayramMardi/codeMania
codeMania-python-matplotlib/tut3.py
<filename>codeMania-python-matplotlib/tut3.py # TYPECASTING CHAPTER a = "antman" print(bool(a)) x=48 y=898.889 u="duhdh" print(int(y)) print(float(x))
JayramMardi/codeMania
codeMania-python-matplotlib/tut9_LINE_plotting.py
''' Chapter Matplot lining .... Linestyle You can use the keyword argument linestyle, or shorter ls, to change the style of the plotted line: Example Use a dotted line: import matplotlib.pyplot as plt import numpy as np ypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, linestyle = 'dotted') plt.sh...
JayramMardi/codeMania
codeMania-python-AI-Machine-learning/tut3_percentiles.py
<reponame>JayramMardi/codeMania ''' Machine Learning - Percentiles What are Percentiles? Percentiles are used in statistics to give you a number that describes the value that a given percent of the values are lower than. Example: Let's say we have an array of the ages of all the people that lives in a street. ...
rsriram315/eds_covid-19
src/data/get_data.py
# -*- coding: utf-8 -*- """ Created on Fri Aug 21 13:02:59 2020 @author: Sriram """ import subprocess import os import pandas as pd import numpy as np from datetime import datetime # Check Working directory and set the path if os.path.split(os.getcwd())[-1]=='notebooks': os.chdir("../") # Function to pull lates...
rsriram315/eds_covid-19
src/visualization/visualize_SIR.py
<reponame>rsriram315/eds_covid-19 # -*- coding: utf-8 -*- """ Created on Thu Aug 27 22:59:56 2020 @author: Sriram """ import os import pandas as pd import numpy as np import plotly.graph_objects as go import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input...
rsriram315/eds_covid-19
src/data/process_JH_data.py
# -*- coding: utf-8 -*- """ Created on Fri Aug 21 18:59:53 2020 @author: Sriram """ import pandas as pd import numpy as np from datetime import datetime #defining a function to process raw JH data into a relational data structure def store_relational_JH_data(): "process raw JH data into a relational data structu...
rsriram315/eds_covid-19
src/features/build_features.py
# -*- coding: utf-8 -*- """ Created on Sat Aug 22 10:32:53 2020 @author: Sriram """ import numpy as np from sklearn import linear_model import pandas as pd from scipy import signal # we define the linear regression object reg=linear_model.LinearRegression(fit_intercept=True) def get_doubling_time_via_regression(in_...
rsriram315/eds_covid-19
src/visualization/visualize.py
# -*- coding: utf-8 -*- """ Created on Mon Aug 24 17:00:40 2020 @author: Sriram """ import os import pandas as pd import numpy as np import plotly.graph_objects as go import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input,Output df_input_large=pd.read_c...
rsriram315/eds_covid-19
src/data/process_SIR_JH_data.py
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sat Aug 29 12:22:53 2020 @author: Sriram """ import pandas as pd import requests import subprocess import os import numpy as np from datetime import datetime def store_flat_table_JH_data(): "process raw JH data into a flat table data structure" datapath='dat...
foxmask/baeuda
baeuda/datasource/joplin.py
<reponame>foxmask/baeuda<filename>baeuda/datasource/joplin.py from joplin_api import JoplinApi import pypandoc import settings class Joplin: def __init__(self): self.joplin = JoplinApi(settings.TOKEN) def subfolder(self, folder): """ :param folder: subfolder :return: line of...
foxmask/baeuda
baeuda/__init__.py
# coding: utf-8 """ This module allow us to manage anki card cards created from Joplin editor :P """ import baeuda.settings from baeuda.datasource.joplin import Joplin from baeuda.datasource.mdfile import MdFile __version__ = "0.3.0"
foxmask/baeuda
baeuda/datasource/mdfile.py
<gh_stars>10-100 from pathlib import Path import os import pypandoc import settings class MdFile: def __init__(self): pass async def my_folder(self): """ :return: return the folder name used by he filesystem where md files are """ return os.path.basename(os.path.norm...
foxmask/baeuda
baeuda/settings.py
JOPLIN_WEBCLIPPER = 41184 TOKEN = '' # provide the JOPLIN TOKEN you have on the webclipper configuration page FOLDER = 'Kimchi!' # from which folder does baeuda read the note to create into anki ? # FOLDER = '/home/foxmask/tmp/' # from which folder does baeuda read the note to create into anki ? PYPANDOC_MARKDOW...
imagetyperz-api/imagetyperz-api-python2
imagetyperzapi2/imagetyperzapi.py
# Imagetyperz captcha API # ----------------------- # requests lib try: from requests import session except: raise Exception('requests package not installed, try with: \'pip install requests\'') import os, json from base64 import b64encode from urllib import urlencode from json import loads as json_loads # en...
sdlouhy/TensorFlow-ENet
test_enet.py
<gh_stars>0 import tensorflow as tf from tensorflow.contrib.framework.python.ops.variables import get_or_create_global_step from tensorflow.python.platform import tf_logging as logging from enet import ENet, ENet_arg_scope from preprocessing import preprocess import os import time import numpy as np import matplotlib.p...
c3TNT/master
manager.py
<gh_stars>0 from flask_migrate import MigrateCommand from flask_script import Manager app =create_app('develop') manager =Manager() manager.add_command('db',MigrateCommand) if __name__ == '__main__': manager.run()
glqstrauss/oopsgenie
clean.py
import csv from utils import get_valid_colum_indices class Cleaner(): def clean(file, clean_columns, remove): print ("Cleaning {}".format(file)) print ("For columns {}".format(clean_columns)) new_file = file[0:-7] + "clean.csv" with open(file, 'r') as raw_file: reader...
glqstrauss/oopsgenie
utils.py
def get_valid_colum_indices(full_cols, specified_cols): indices = [] for column in specified_cols: # Validate columns to extract if column not in full_cols: return None indices.append(full_cols.index(column)) return indices
glqstrauss/oopsgenie
count.py
<gh_stars>1-10 import csv from datetime import datetime from utils import get_valid_colum_indices from fuzzywuzzy import fuzz class Counter(object): def count(self, file, column, limit, interval, match, update_minutes, outfile): with open(file, 'r') as f: reader = csv.reader(f, delimiter=',')...
glqstrauss/oopsgenie
oopsgenie.py
import argparse import os.path from clean import Cleaner from count import Counter, FuzzyCounter def is_valid_file(parser, arg): if not os.path.exists(arg): parser.error("The file {} does not exist!".format(arg)) return arg def main(): parser = argparse.ArgumentParser(description="OpsGenie Alert...
develmaycare/django-fixman
tests/test_library_files.py
from fixman.library.files import * # Tests class TestFixtureFile(object): def test_get_full_path(self): f = FixtureFile("testing") assert f.get_full_path() == "fixtures/testing/initial.json" def test_get_path(self): f = FixtureFile("testing") assert f.get_path() == "fixtures...
develmaycare/django-fixman
fixman/variables.py
<reponame>develmaycare/django-fixman import os FIXMAN_PATH = os.path.abspath(os.path.dirname(__file__)) """The current path to the fixman install directory.""" CURRENT_WORKING_DIRECTORY = os.getcwd() """The current working directory. Used as the default path for all commands."""
develmaycare/django-fixman
sandbox/fixman.py
<gh_stars>0 #! /usr/bin/env python import re import sys sys.path.insert(0, "../") from fixman.cli import main_command if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(main_command())
develmaycare/django-fixman
fixman/utils.py
<filename>fixman/utils.py<gh_stars>0 # Imports from configparser import ConfigParser import logging import os from commonkit import smart_cast from .constants import LOGGER_NAME log = logging.getLogger(LOGGER_NAME) # Exports __all__ = ( "filter_fixtures", "load_fixtures", "scan_fixtures", ) # Functions...
develmaycare/django-fixman
tests/test_utils.py
from fixman.utils import * import os def test_filter_fixtures(): path = os.path.join("tests", "example_project", "fixtures", "config.ini") fixtures = load_fixtures(path) assert len(filter_fixtures(fixtures, apps=["lookups"])) == 9 # BUG: Model filter will also fail if there is a fixture with no spec...
develmaycare/django-fixman
setup.py
<filename>setup.py # See https://packaging.python.org/en/latest/distributing.html # and https://docs.python.org/2/distutils/setupscript.html # and https://pypi.python.org/pypi?%3Aaction=list_classifiers from setuptools import setup, find_packages def read(path): with open(path, "r") as f: contents = f.re...
develmaycare/django-fixman
fixman/library/commands.py
<filename>fixman/library/commands.py # Imports import logging import os from subprocess import getstatusoutput from commonkit.shell import EXIT from ..constants import LOGGER_NAME log = logging.getLogger(LOGGER_NAME) # Classes class DumpData(object): """A command for dumping fixture data.""" def __init__(...
develmaycare/django-fixman
fixman/cli/initialize.py
# Imports # Exports # Functions def subcommands(subparsers): commands = SubCommands(subparsers) commands.dumpdata() commands.init() commands.inspect() commands.list() commands.loaddata() commands.scan() # Classes class SubCommands(object): """A utility class which keeps the ``cli....
develmaycare/django-fixman
fixman/library/files.py
<reponame>develmaycare/django-fixman # Imports import os # Exports __all__ = ( "FixtureFile", ) # Classes class FixtureFile(object): """Represents a fixture file.""" def __init__(self, app, comment=None, copy_to=None, database=None, file_name=None, group=None, model=None, natural_for...
develmaycare/django-fixman
fixman/constants.py
LOGGER_NAME = "fixman" """The internal name used for logging."""
develmaycare/django-fixman
fixman/cli/subcommands.py
<filename>fixman/cli/subcommands.py # Imports import logging import os from commonkit import highlight_code, read_file, truncate, write_file from commonkit.shell import EXIT, TABLE_FORMAT, Table from subprocess import getstatusoutput from ..library.commands import DumpData, LoadData from ..constants import LOGGER_NAME...
develmaycare/django-fixman
fixman/cli/__init__.py
# Imports from argparse import ArgumentParser, RawDescriptionHelpFormatter from commonkit.logging import LoggingHelper from commonkit.shell import EXIT from ..constants import LOGGER_NAME from ..variables import CURRENT_WORKING_DIRECTORY from ..version import DATE as VERSION_DATE, VERSION from . import initialize from...
develmaycare/django-fixman
tests/test_library_commands.py
<filename>tests/test_library_commands.py from fixman.library.commands import * # import subprocess def mock_bad_getstatusoutput(command): return 1, "fail" def mock_good_getstatusoutput(command): return 0, "ok" # Tests class TestDumpData(object): def test_get_command(self): dd = DumpData("tes...
develmaycare/django-fixman
fixman/version.py
DATE = "2021-05-01" VERSION = "1.0.0" MAJOR = 1 MINOR = 0 PATCH = 0
carlopires/tnetstring3
tools/shootout.py
<reponame>carlopires/tnetstring3 import sys import random import cjson import ujson import tnetstring import marshal from tnetstring.tests.test_format import FORMAT_EXAMPLES, get_random_object TESTS = [] def add_test(v): # These modules have a few round-tripping problems... try: assert cjson.decode...
carlopires/tnetstring3
tnetstring/__init__.py
<filename>tnetstring/__init__.py """ tnetstring: data serialization using typed netstrings ====================================================== This is a data serialization library. It's a lot like JSON but it uses a new syntax called "typed netstrings" that Zed has proposed for use in the Mongrel2 webserver. It's...
carlopires/tnetstring3
tests/__init__.py
import unittest def suite(): from . import test_format suite = unittest.TestSuite() suite.addTest(test_format.suite()) return suite if __name__ == '__main__': unittest.TextTestRunner(verbosity=2).run(suite())
carlopires/tnetstring3
setup.py
from setuptools import setup, Extension def get_info(): info = {} src = open("tnetstring/__init__.py") lines = [] ln = next(src) while "__version__" not in ln: lines.append(ln) ln = next(src) while "__version__" in ln: lines.append(ln) ln = next(src) exec(""....
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/ex2_create_table.py
import pymysql connection = pymysql.connect( host="localhost", database="css326_lab8" ) with connection: with connection.cursor() as cursor: sql1 = """CREATE TABLE user ( title varchar(100) DEFAULT NULL, first_name varchar(250) DEFAULT NULL, last_name varchar(250) DEFAULT NULL, email...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/ex4_select_join.py
<reponame>waterthatfrozen/Y3T1-CodeVault<filename>CSS326/Lab08/ex4_select_join.py import pymysql connection = pymysql.connect( host="localhost", database="css326_lab8", ) with connection: with connection.cursor() as cursor: sql = """SELECT u.email,u.first_name,u.last_name,c.title FROM user_cours...
waterthatfrozen/Y3T1-CodeVault
CSS324/Homework 1/main.py
<filename>CSS324/Homework 1/main.py # Ball Sort Puzzle Assignment # CSS324 Section 3 # 6222780379 <NAME>. # 6222780833 <NAME>. import BallSort as BS import UCGS import utils goal_node, _ = UCGS.uniform_cost_graph_search(BS) if goal_node: utils.print_solution(goal_node) else: print("No Solution")
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/create_m2m_link.py
import pymysql connection = pymysql.connect( host="localhost", database="css326_lab8" ) with connection: with connection.cursor() as cursor: # create m2m table sql = """CREATE TABLE IF NOT EXISTS user_course ( user_email varchar(250) NOT NULL, course_code varchar(250) NOT NULL, PRIMA...
waterthatfrozen/Y3T1-CodeVault
DES322/flaskBackend/01_helloworld.py
from flask import Flask import os app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World! 1234</p>" if __name__ == "__main__": """ The default port is 5000, to change port of your service in powershell use following command: $env:PORT = xxxx """ app.run(host="0.0.0.0...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/ex1_create_database.py
<reponame>waterthatfrozen/Y3T1-CodeVault import pymysql connection = pymysql.connect( host="localhost" ) with connection: with connection.cursor() as cursor: sql = "CREATE DATABASE css326_lab8" cursor.execute(sql)
waterthatfrozen/Y3T1-CodeVault
CSS324/Homework 1/UCGS.py
<filename>CSS324/Homework 1/UCGS.py<gh_stars>0 # Uniform Cost Graph Search # from lecture 3 from heapq import heappush, heappop, heapify from utils import create_node def index(f, s): return next((i for i, x in enumerate(f) if x[1][0] == s), -1) def uniform_cost_graph_search(problem): initial_node = create_n...
waterthatfrozen/Y3T1-CodeVault
CSS324/Homework 1/BallSort.py
<gh_stars>0 # Ball Sorting import copy def initial_state(): # "" as empty stack # return ["AAAA","BBBB","DCCC","CDDD","",""] S1 = S2 = S3 = S4 = "" for _ in range(4): a = input().split() S1+=a[0] S2+=a[1] S3+=a[2] S4+=a[3] init_state = [S1,S2,S3,S4,"",""] ...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab09/ex1_create_and_import.py
import pymysql from pymysql.constants import CLIENT connection = pymysql.connect( host="localhost", client_flag=CLIENT.MULTI_STATEMENTS ) with connection: # Create a connection (pipe) with connection.cursor() as cursor: # Create a cursor(pointer) sql = "DROP DATABASE IF EXISTS css326_lab9" cursor.exec...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/batch_insert_users.py
<reponame>waterthatfrozen/Y3T1-CodeVault import pymysql connection = pymysql.connect( host="localhost", database="css326_lab8", ) with connection: with connection.cursor() as cursor: sql = """INSERT INTO user(title, first_name, last_name, email) VALUES (%s, %s, %s, %s); """ values = [ ...
waterthatfrozen/Y3T1-CodeVault
DES322/flaskBackend/07_axios.py
import peewee from flask import Flask, jsonify, request from flask import render_template, send_from_directory, abort import os from product import * app = Flask(__name__) # This hook ensures that a connection is opened to handle any queries # generated by the request. @app.before_request def _db_connect(): db.c...
waterthatfrozen/Y3T1-CodeVault
DES322/flaskBackend/02_routing.py
from flask import Flask import os app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World!</p>" @app.route("/hi") def say_hi(): return "<p>Hi, there!</p>" @app.route("/hello/<name>") def hello(name): return f"<p>Hello, {name}!</p>" if __name__ == "__main__": """ The defau...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab08/ex3_insert_data.py
<filename>CSS326/Lab08/ex3_insert_data.py<gh_stars>0 import pymysql connection = pymysql.connect( host="localhost", database="css326_lab8", ) with connection: with connection.cursor() as cursor: sql2 = """INSERT INTO course(title, code, credit) VALUES (%s, %s, %s); """ values = [("How to...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab09/ex3_agent_performance.py
import pymysql connection = pymysql.connect( host="localhost", database="css326_lab9" ) with connection: with connection.cursor() as cursor: sql = """SELECT a.AGENT_NAME, SUM(c.OUTSTANDING_AMT) FROM customer c INNER JOIN agents a ON c.AGENT_CODE = a.AGENT_CODE GROUP BY c.AGENT_CODE;""" cursor.execute(...
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab09/ex4_monthly_sale.py
<reponame>waterthatfrozen/Y3T1-CodeVault import pymysql connection = pymysql.connect( host="localhost", database="css326_lab9" ) with connection: with connection.cursor() as cursor: sql = """SELECT MONTHNAME(ORD_DATE),SUM(ORD_AMOUNT) FROM orders GROUP BY MONTH(ORD_DATE) ORDER BY MONTH(ORD_DATE);""" cu...
waterthatfrozen/Y3T1-CodeVault
DES322/flaskBackend/03_template.py
<gh_stars>0 from flask import Flask from flask import render_template import os app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World!</p>" @app.route("/index") def index(): return render_template("index.html") @app.route("/hello/<name>") def hello(name): return render_templat...
waterthatfrozen/Y3T1-CodeVault
DES322/flaskBackend/product.py
from peewee import * import uuid db = SqliteDatabase('database/product.db') class Product(Model): id = UUIDField(primary_key=True) #Autogenerated key, required for Peewee productid = CharField(unique=True) name = CharField() desc = TextField() price = FloatField() image ...
waterthatfrozen/Y3T1-CodeVault
DES322/GitLecture/OnlineStore/main.py
<filename>DES322/GitLecture/OnlineStore/main.py<gh_stars>0 import os print(os.__version__)
waterthatfrozen/Y3T1-CodeVault
CSS326/Lab09/ex2_find_min_max.py
import pymysql connection = pymysql.connect( host="localhost", database="css326_lab9" ) with connection: with connection.cursor() as cursor: sql = """SELECT MAX(OUTSTANDING_AMT),MIN(OUTSTANDING_AMT),AVG(OUTSTANDING_AMT) FROM customer;""" cursor.execute(sql) for row in cursor: print(*row)
waterthatfrozen/Y3T1-CodeVault
CSS324/Homework 1/utils.py
<reponame>waterthatfrozen/Y3T1-CodeVault from collections import deque import copy def create_node(state, parent, action, path_cost, depth): return (state, parent, action, path_cost, depth) def print_solution(n): r = deque() while n is not None: r.appendleft(n[0]) n = n[1] step = 0 ...
Josue-Rodriguez-98/TwitterAPI
twitter.py
<gh_stars>0 # ----------------------------------------------------------- # Tarea: Análisis de Datos en Twitter # Sistemas Inteligentes # Desarrollado por <NAME> (11641196) # 2. Emplear expresiones regulares para limpiar el texto removiendo Tags, Caracteres Especiales, URLs, Imágenes (done) # 2.1 Emplear el algoritmo d...
MOBSkuchen/bodytracking
bodytracking/__init__.py
import cv2,mediapipe __title__ = "bodytracking" __version__ = "1.02" __author__ = "Suprime" class Hand: def __init__(self,n_hand:int,lm:list,handLms): self.hand_n = n_hand self.sol = mediapipe.solutions self.lm_list = lm self.hand_lms = handLms self.mpHands = self.s...
BitcoinNanoLabs/infinitum-wallet-server
ws_server.py
import asyncio import websockets from logging import getLogger, INFO, StreamHandler logger = getLogger('websockets') logger.setLevel(INFO) logger.addHandler(StreamHandler()) clients = set() async def handler(websocket, path): msg = await websocket.recv() print(f"Received: {msg}") global clients clien...
pranav083/puauto_login
pu_cam.py
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import webbrowser <<<<<<< HEAD browser = webdriver.Firefox() #install browser.get("http:\\bit.do/wifion") time.sleep(2) #based on processor increase the time for initiallizing the browser username = browser.find_element_b...
lizardsystem/django-stored-messages
stored_messages/tests/urls.py
<gh_stars>0 from django.contrib import admin from django.conf.urls import url, include from stored_messages.tests.views import message_view, message_create, message_create_mixed admin.autodiscover() urlpatterns = [ url(r'^consume$', message_view), url(r'^create$', message_create), url(r'^create_mixed$',...
lizardsystem/django-stored-messages
stored_messages/tests/base.py
from __future__ import unicode_literals from django.contrib.auth import get_user_model from django.test import TestCase, RequestFactory from importlib import reload import mock from stored_messages import storage from stored_messages import settings class BaseTest(TestCase): def setUp(self): # settings...
lizardsystem/django-stored-messages
stored_messages/urls.py
""" At the moment this module does something only when restframework is available """ from django.conf import settings if 'rest_framework' in settings.INSTALLED_APPS: from rest_framework.routers import DefaultRouter from django.conf.urls import url, include from . import views router = DefaultRouter()...
fastfists/project
tools.py
<gh_stars>1-10 import pandas as pd well_productions = pd.read_csv("well_productions/well productions.csv") """ Sets a proppant per stage as "ppf" defaults to the maximum weight method can be ["min, "max", "avg"] """ def propant_per_stage(dataframe: pd.DataFrame, method="avg"): if method == "min": val = mi...
machow/duckdb_engine
duckdb_engine/tests/test_basic.py
from hypothesis import assume, given from hypothesis.strategies import text from pytest import fixture, mark from sqlalchemy import ( Column, ForeignKey, Integer, MetaData, Sequence, String, Table, create_engine, inspect, ) from sqlalchemy.dialects.postgresql.base import PGInspector ...
aiorchestra/aiorchestra-persistency
aiorchestra_persistence/models.py
# Author: <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
aiorchestra/aiorchestra-persistency
migrations/versions/f1a1565a8dd4_aiorchestra_persistency.py
<reponame>aiorchestra/aiorchestra-persistency """AIOrchestra persistence Revision ID: f1a1565a8dd4 Revises: Create Date: 2016-08-19 11:04:20.567324 """ # revision identifiers, used by Alembic. import sqlalchemy as sa from alembic import op revision = 'f1a1565a8dd4' down_revision = None branch_labels = None depend...
abhishek62073/algorithm-paradise
entries/abhishek'sswap.py
a = int(input("Enter a number: ")) b = int(input("Enter another number: ")) a = a+b b = a-b a = a-b print(a) print(b)
Nazukixv/OpenNMT-py
onmt/decoders/ensemble.py
<filename>onmt/decoders/ensemble.py """ Ensemble decoding. Decodes using multiple models simultaneously, combining their prediction distributions by averaging. All models in the ensemble must share a target vocabulary. """ import torch import torch.nn as nn from onmt.encoders.encoder import EncoderBase from onmt.mod...
Nazukixv/OpenNMT-py
onmt/decoders/decoder.py
<reponame>Nazukixv/OpenNMT-py """ Base Class and function for Decoders """ import torch import torch.nn as nn import onmt.models.stacked_rnn from onmt.utils.misc import aeq from onmt.utils.rnn_factory import rnn_factory class RNNDecoderBase(nn.Module): """ Base recurrent attention-based decoder class. S...
regalk13/updated_discord-BOT.py
launcher.py
<reponame>regalk13/updated_discord-BOT.py from lib.bot import bot from discord.ext.commands import Cog VERSION = "0.0.32" bot.run(VERSION)
regalk13/updated_discord-BOT.py
lib/cogs/fun.py
<gh_stars>1-10 import random from random import choice, randint from typing import Optional from aiohttp import request from discord import Member, Embed from discord.errors import HTTPException from discord.ext.commands import Cog from discord.ext.commands import BucketType from discord.ext.commands import command, c...
regalk13/updated_discord-BOT.py
lib/cogs/mod.py
from asyncio import sleep from re import search import discord from discord.ext import commands from discord.ext.commands import Cog, Greedy from better_profanity import profanity from discord import Embed, Member from discord.ext.commands import CheckFailure from discord.ext.commands import command, has_permissions, ...
regalk13/updated_discord-BOT.py
lib/cogs/info.py
from datetime import datetime from typing import Optional from discord import Embed, Member from discord.ext.commands import Cog from discord.ext.commands import command, has_permissions class Info(Cog): def __init__(self, bot): self.bot = bot @command(name="userinfo", alisases=["ui"]) async def ...
regalk13/updated_discord-BOT.py
lib/cogs/welcome.py
<reponame>regalk13/updated_discord-BOT.py from discord import Forbidden from discord.ext.commands import Cog from discord.ext.commands import command from ..db import db class Welcome(Cog): def __init__(self, bot): self.bot = bot @Cog.listener() async def on_member_join(self, member): ...
regalk13/updated_discord-BOT.py
lib/cogs/log.py
<gh_stars>1-10 from datetime import datetime from discord import Embed from discord.ext.commands import Cog from discord.ext.commands import command class Log(Cog): def __init__(self, bot): self.bot = bot @Cog.listener() async def on_user_update(self, before, after): if before.name != af...
regalk13/updated_discord-BOT.py
lib/cogs/misc.py
<reponame>regalk13/updated_discord-BOT.py<filename>lib/cogs/misc.py from discord.ext.commands import Cog from discord.ext.commands import CheckFailure from discord.ext.commands import command, has_permissions from ..db import db class Misc(Cog): def __init__(self, bot): self.bot = bot @command(name="...
regalk13/updated_discord-BOT.py
lib/cogs/reactions.py
<gh_stars>1-10 from discord.ext.commands import Cog from discord.ext.commands import command, has_permissions from datetime import datetime, timedelta from discord import Embed from ..db import db #numbers #0⃣ 1️⃣ 2⃣ 3⃣ 4⃣ 5⃣ 6⃣ 7⃣ 8⃣ 9⃣ numbers = ("1️⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟") c...
regalk13/updated_discord-BOT.py
lib/cogs/exp.py
<filename>lib/cogs/exp.py from datetime import datetime, timedelta from random import randint from typing import Optional from discord import Member, Embed from discord.ext.menus import MenuPages, ListPageSource from discord.ext.commands import Cog from discord.ext.commands import CheckFailure from discord.ext.command...
regalk13/updated_discord-BOT.py
lib/bot/__init__.py
import discord from asyncio import sleep from datetime import datetime from glob import glob import sqlite3 from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.triggers.cron import CronTrigger from discord import Embed, File, DMChannel from discord.ext.commands import Bot as BotBase from disco...
regalk13/updated_discord-BOT.py
lib/cogs/meta.py
<filename>lib/cogs/meta.py from datetime import datetime, timedelta from discord import Embed from discord.ext.commands import Cog from discord.ext.commands import command, has_permissions from discord import Activity, ActivityType from apscheduler.triggers.cron import CronTrigger from time import time from psutil impo...
hzli-ucas/pytorch-retinanet
lib/nms/build.py
import os import torch from torch.utils.cpp_extension import BuildExtension, CppExtension from setuptools import setup sources = ['src/nms_binding.cpp'] defines = [] with_cuda = False if torch.cuda.is_available(): print('Including CUDA code.') defines += [('WITH_CUDA', None)] from torch.utils.cpp_extensi...
99Kies/ecdsa
demo.py
## 数字签名和验签 from ecdsa import PrivateKey, hash256 e = int.from_bytes(hash256(b'my secret'), 'big') # 私钥 z = int.from_bytes(hash256(b'my message'), 'big') # 加密的数据 print(e) print(z) pk = PrivateKey(e) sig = pk.sign(z) print(sig) res = pk.point.verify(z, sig) print(res)
99Kies/ecdsa
ecdsa.py
<filename>ecdsa.py import hashlib import hmac def hash256(s): '''two rounds of sha256''' return hashlib.sha256(hashlib.sha256(s).digest()).digest() class FieldElement: # 有限域 def __init__(self, num, prime): if num >= prime or num < 0: error = 'Num {} not in field range 0 to {}'.fo...
icbi-lab/miopy
miopy/__init__.py
<gh_stars>0 from .correlation import *
icbi-lab/miopy
miopy/classification.py
from sklearn.ensemble import BaggingClassifier, AdaBoostClassifier,GradientBoostingClassifier, RandomForestClassifier from sklearn.linear_model import LogisticRegression, RidgeClassifier from sklearn.svm import SVC # used for normalization from sklearn.preprocessing import StandardScaler from sklearn.preprocessing impo...
icbi-lab/miopy
setup.py
<filename>setup.py<gh_stars>0 #!/usr/bin/python3 from setuptools import setup setup( name='miopy', version='1.0.05', author='<NAME>', author_email='<EMAIL>', packages=['miopy', ], scripts=['bin/mio_correlation.py',], url='https://gitlab.i-med.ac.at/cbio/miopy', license='LICENSE.txt', descrip...
icbi-lab/miopy
miopy/survival.py
import pandas as pd from lifelines import KaplanMeierFitter, CoxPHFitter import numpy as np from sklearn.exceptions import ConvergenceWarning from multiprocessing import Pool import numpy as np import functools from .correlation import intersection, header_list import plotly import plotly.offline as opy from sklearn.pr...
icbi-lab/miopy
miopy/R_utils.py
import subprocess from os import path, remove import pandas as pd import uuid def read_count(file_path, sep = "\t"): """ Function to read dataset from the csv Args: file_path string path to the csv file Return: df dataframe DataFrame with the matrix count """ df = pd.read_csv...
icbi-lab/miopy
miopy/metrics.py
import numpy as np from scipy.stats import rankdata from scipy.signal import decimate import pandas as pd import math import time import matplotlib.pyplot as plt from sklearn.preprocessing import KBinsDiscretizer import warnings """ Implements the Randomized Dependence Coefficient <NAME>, <NAME>, <NAME> http://papers.n...
icbi-lab/miopy
miopy/process_data.py
import pandas as pd import numpy as np from os import path import io import numpy as np import re def _get_path_data(): return path.join(path.dirname(__file__), 'data') def get_target_query(method = "and", lTarget = []): #Build DB query: dbQ = "" lHeader = load_matrix_header() if method == "and":...